public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Viorel Munteanu" <ceamac@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:master commit in: dev-zig/zls/
Date: Fri, 10 Mar 2023 05:48:18 +0000 (UTC)	[thread overview]
Message-ID: <1678371215.873168168d68c015588118828bde624f9a00f960.ceamac@gentoo> (raw)

commit:     873168168d68c015588118828bde624f9a00f960
Author:     Eric Joldasov <bratishkaerik <AT> getgoogleoff <DOT> me>
AuthorDate: Thu Mar  9 13:55:19 2023 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Thu Mar  9 14:13:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=87316816

dev-zig/zls: adjust ebuild (0.10.0) for slotted Zig

Signed-off-by: Eric Joldasov <bratishkaerik <AT> getgoogleoff.me>

 dev-zig/zls/zls-0.10.0-r1.ebuild | 141 +++++++++++++++++++++++++++++++++++++++
 dev-zig/zls/zls-0.10.0.ebuild    |  56 ----------------
 2 files changed, 141 insertions(+), 56 deletions(-)

diff --git a/dev-zig/zls/zls-0.10.0-r1.ebuild b/dev-zig/zls/zls-0.10.0-r1.ebuild
new file mode 100644
index 000000000..da659404c
--- /dev/null
+++ b/dev-zig/zls/zls-0.10.0-r1.ebuild
@@ -0,0 +1,141 @@
+# Copyright 2022-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit edo
+
+DESCRIPTION="The officially unofficial Ziglang language server"
+HOMEPAGE="https://github.com/zigtools/zls"
+
+KNOWN_FOLDERS_COMMIT="24845b0103e611c108d6bc334231c464e699742c"
+TRACY_COMMIT="f493d4aa8ba8141d9680473fad007d8a6348628e"
+SRC_URI="
+	https://github.com/ziglibs/known-folders/archive/${KNOWN_FOLDERS_COMMIT}.tar.gz -> known-folders-${KNOWN_FOLDERS_COMMIT}.tar.gz
+	https://github.com/wolfpld/tracy/archive/${TRACY_COMMIT}.tar.gz -> tracy-${TRACY_COMMIT}.tar.gz
+	https://github.com/zigtools/zls/archive/refs/tags/${PV}.tar.gz -> zls-${PV}.tar.gz
+"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64"
+
+EZIG_MIN="0.10"
+EZIG_MAX_EXCLUSIVE="0.11"
+
+DEPEND="|| ( dev-lang/zig:${EZIG_MIN} dev-lang/zig-bin:${EZIG_MIN} )"
+RDEPEND="${DEPEND}"
+
+# see https://github.com/ziglang/zig/issues/3382
+# For now, Zig Build System doesn't support CFLAGS/LDFLAGS/etc.
+QA_FLAGS_IGNORED="usr/bin/zls"
+
+PATCHES=(
+	"${FILESDIR}/zls-0.10.0-add-builtin-data-for-new-zig-versions.patch"
+)
+
+# : copied from sys-fs/ncdu :
+# Many thanks to Florian Schmaus (Flowdalic)!
+# Adapted from https://github.com/gentoo/gentoo/pull/28986
+# Set the EZIG environment variable.
+zig-set_EZIG() {
+	[[ -n ${EZIG} ]] && return
+
+	if [[ -n ${EZIG_OVERWRITE} ]]; then
+		export EZIG="${EZIG_OVERWRITE}"
+		return
+	fi
+
+	local candidates candidate selected selected_ver
+
+	candidates=$(compgen -c zig-)
+
+	for candidate in ${candidates}; do
+		if [[ ! ${candidate} =~ zig(-bin)?-([.0-9]+) ]]; then
+			continue
+		fi
+
+		local ver
+		if (( ${#BASH_REMATCH[@]} == 3 )); then
+			ver="${BASH_REMATCH[2]}"
+		else
+			ver="${BASH_REMATCH[1]}"
+		fi
+
+		if [[ -n ${EZIG_EXACT_VER} ]]; then
+			ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue
+
+			selected="${candidate}"
+			selected_ver="${ver}"
+			break
+		fi
+
+		if [[ -n ${EZIG_MIN} ]] \
+			   && ver_test "${ver}" -lt "${EZIG_MIN}"; then
+			# Candidate does not satisfy EZIG_MIN condition.
+			continue
+		fi
+
+		if [[ -n ${EZIG_MAX_EXCLUSIVE} ]] \
+			   && ver_test "${ver}" -ge "${EZIG_MAX_EXCLUSIVE}"; then
+			# Candidate does not satisfy EZIG_MAX_EXCLUSIVE condition.
+			continue
+		fi
+
+		if [[ -n ${selected_ver} ]] \
+			   && ver_test "${selected_ver}" -gt "${ver}"; then
+			# Candidate is older than the currently selected candidate.
+			continue
+		fi
+
+		selected="${candidate}"
+		selected_ver="${ver}"
+	done
+
+	if [[ -z ${selected} ]]; then
+		die "Could not find (suitable) zig installation in PATH"
+	fi
+
+	export EZIG="${selected}"
+	export EZIG_VER="${ver}"
+}
+
+# Invoke zig with the optionally provided arguments.
+ezig() {
+	zig-set_EZIG
+
+	# Unfortunately, we cannot add more args here, since syntax is different
+	# for every subcommands. Yes, even target/cpu :( f.i. :
+	# -target/-mcpu for zig build-exe vs -Dtarget/-Dcpu for zig build-
+	# -OReleaseSafe for zig build-exe vs -DReleaseSafe for zig build
+	# (or even none, if hardcoded by upstream so choice is -Drelease=true/false)
+	# Ofc we can patch this, but still...
+
+	edo "${EZIG}" "${@}"
+}
+
+src_prepare() {
+	rm -r src/known-folders || die
+	mv "../known-folders-${KNOWN_FOLDERS_COMMIT}" src/known-folders || die
+	rm -r src/tracy || die
+	mv "../tracy-${TRACY_COMMIT}" src/zinput || die
+
+	default
+}
+
+src_compile() {
+	ezig build -Drelease-safe -Ddata_version=0.10.0 --verbose || die
+}
+
+src_test() {
+	ezig build test -Drelease-safe -Ddata_version=0.10.0 --verbose || die
+}
+
+src_install() {
+	DESTDIR="${ED}" ezig build install --prefix /usr -Drelease-safe -Ddata_version=0.10.0 --verbose || die
+	dodoc README.md
+}
+
+pkg_postinst() {
+	elog "You can find more information about options here https://github.com/zigtools/zls#configuration-options"
+}

diff --git a/dev-zig/zls/zls-0.10.0.ebuild b/dev-zig/zls/zls-0.10.0.ebuild
deleted file mode 100644
index 3333f5a03..000000000
--- a/dev-zig/zls/zls-0.10.0.ebuild
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright 2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-HOMEPAGE="https://github.com/zigtools/zls"
-DESCRIPTION="The officially unofficial Ziglang language server"
-
-KNOWN_FOLDERS_COMMIT="24845b0103e611c108d6bc334231c464e699742c"
-TRACY_COMMIT="f493d4aa8ba8141d9680473fad007d8a6348628e"
-SRC_URI="
-	https://github.com/ziglibs/known-folders/archive/${KNOWN_FOLDERS_COMMIT}.tar.gz -> known-folders-${KNOWN_FOLDERS_COMMIT}.tar.gz
-	https://github.com/wolfpld/tracy/archive/${TRACY_COMMIT}.tar.gz -> tracy-${TRACY_COMMIT}.tar.gz
-	https://github.com/zigtools/zls/archive/refs/tags/${PV}.tar.gz -> zls-${PV}.tar.gz
-"
-KEYWORDS="~amd64"
-
-LICENSE="MIT"
-SLOT="0"
-
-DEPEND="|| ( ~dev-lang/zig-0.10.1 ~dev-lang/zig-bin-0.10.1 )"
-RDEPEND="${DEPEND}"
-
-# see https://github.com/ziglang/zig/issues/3382
-# For now, Zig Build System doesn't support CFLAGS/LDFLAGS/etc.
-QA_FLAGS_IGNORED="usr/bin/zls"
-
-PATCHES=(
-	"${FILESDIR}/zls-0.10.0-add-builtin-data-for-new-zig-versions.patch"
-)
-
-src_prepare() {
-	rm -r src/known-folders || die
-	mv "../known-folders-${KNOWN_FOLDERS_COMMIT}" src/known-folders || die
-	rm -r src/tracy || die
-	mv "../tracy-${TRACY_COMMIT}" src/zinput || die
-
-	default
-}
-
-src_compile() {
-	zig build -Drelease-safe -Ddata_version=0.10.0 --verbose || die
-}
-
-src_test() {
-	zig build test -Drelease-safe -Ddata_version=0.10.0 --verbose || die
-}
-
-src_install() {
-	DESTDIR="${ED}" zig build install --prefix /usr -Drelease-safe -Ddata_version=0.10.0 --verbose || die
-	dodoc README.md
-}
-
-pkg_postinst() {
-	elog "You can find more information about options here https://github.com/zigtools/zls#configuration-options"
-}


             reply	other threads:[~2023-03-10  5:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10  5:48 Viorel Munteanu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-24 20:56 [gentoo-commits] repo/proj/guru:master commit in: dev-zig/zls/ David Roman
2024-08-10 15:41 Lucio Sauer
2024-08-07 10:33 Lucio Sauer
2024-08-07 10:33 Lucio Sauer
2024-08-07 10:33 Lucio Sauer
2024-08-07 10:33 Lucio Sauer
2024-08-01 10:12 Lucio Sauer
2024-07-31 22:49 Lucio Sauer
2024-07-31 22:49 Lucio Sauer
2023-10-10  6:32 Rui Huang
2023-08-28 16:33 David Roman
2023-03-10  5:48 Viorel Munteanu
2023-02-06  8:21 Viorel Munteanu
2022-11-05 15:26 Arthur Zamarin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1678371215.873168168d68c015588118828bde624f9a00f960.ceamac@gentoo \
    --to=ceamac@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox