public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Joonas Niilola" <juippis@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/zig/files/, dev-lang/zig/
Date: Sat, 30 Apr 2022 08:13:23 +0000 (UTC)	[thread overview]
Message-ID: <1651306400.2647a868c09f98a97fad19e0070a4abab851376c.juippis@gentoo> (raw)

commit:     2647a868c09f98a97fad19e0070a4abab851376c
Author:     BratishkaErik <bratishkaerik <AT> getgoogleoff <DOT> me>
AuthorDate: Tue Apr 19 13:44:23 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Sat Apr 30 08:13:20 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2647a868

dev-lang/zig: add stage2 support (on -9999)

Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: BratishkaErik <bratishkaerik <AT> getgoogleoff.me>
Closes: https://github.com/gentoo/gentoo/pull/25085
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-lang/zig/files/zig-9999-stage2-fix.patch | 12 ++++++++++++
 dev-lang/zig/metadata.xml                    |  3 +++
 dev-lang/zig/zig-9999.ebuild                 | 28 +++++++++++++++++++++++++++-
 3 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/dev-lang/zig/files/zig-9999-stage2-fix.patch b/dev-lang/zig/files/zig-9999-stage2-fix.patch
new file mode 100644
index 000000000000..520be382c562
--- /dev/null
+++ b/dev-lang/zig/files/zig-9999-stage2-fix.patch
@@ -0,0 +1,12 @@
+diff --git a/build.zig b/build.zig
+index 4d3cf49..4601935 100644
+--- a/build.zig
++++ b/build.zig
+@@ -550,6 +550,7 @@ fn addCmakeCfgOptionsToExe(
+                 else => |e| return e,
+             };
+             exe.linkSystemLibrary("unwind");
++            exe.linkSystemLibrary("c_nonshared");
+         } else if (exe.target.isFreeBSD()) {
+             try addCxxKnownPath(b, cfg, exe, "libc++.a", null, need_cpp_includes);
+             exe.linkSystemLibrary("pthread");

diff --git a/dev-lang/zig/metadata.xml b/dev-lang/zig/metadata.xml
index 9a74b67c8634..6555f4c1c940 100644
--- a/dev-lang/zig/metadata.xml
+++ b/dev-lang/zig/metadata.xml
@@ -2,6 +2,9 @@
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
 	<!-- maintainer-needed -->
+	<use>
+		<flag name="stage2">Install stage2 alongside stage1</flag>
+	</use>
 	<upstream>
 		<remote-id type="github">ziglang/zig</remote-id>
 	</upstream>

diff --git a/dev-lang/zig/zig-9999.ebuild b/dev-lang/zig/zig-9999.ebuild
index a0e3522a22a0..cdac1427ee7e 100644
--- a/dev-lang/zig/zig-9999.ebuild
+++ b/dev-lang/zig/zig-9999.ebuild
@@ -18,7 +18,7 @@ fi
 
 LICENSE="MIT"
 SLOT="0"
-IUSE="test"
+IUSE="test +stage2"
 RESTRICT="!test? ( test )"
 
 BUILD_DIR="${S}/build"
@@ -47,6 +47,9 @@ llvm_check_deps() {
 # see https://github.com/ziglang/zig/wiki/Troubleshooting-Build-Issues#high-memory-requirements
 CHECKREQS_MEMORY="10G"
 
+# see https://github.com/ziglang/zig/issues/11137
+PATCHES=( "${FILESDIR}/${P}-stage2-fix.patch" )
+
 pkg_setup() {
 	llvm_pkg_setup
 	check-reqs_pkg_setup
@@ -61,7 +64,30 @@ src_configure() {
 	cmake_src_configure
 }
 
+src_compile() {
+	cmake_src_compile
+
+	if use stage2 ; then
+		cd "${BUILD_DIR}" || die
+		./zig build -p stage2 -Dstatic-llvm=false -Denable-llvm=true || die
+	fi
+}
+
 src_test() {
 	cd "${BUILD_DIR}" || die
 	./zig build test || die
 }
+
+src_install() {
+	cmake_src_install
+
+	if use stage2 ; then
+		cd "${BUILD_DIR}" || die
+		mv ./stage2/bin/zig zig-stage2 || die
+		dobin zig-stage2
+	fi
+}
+
+pkg_postinst() {
+	use stage2 && elog "You enabled stage2 USE flag, Zig stage1 was installed as /usr/bin/zig, Zig stage2 was installed as /usr/bin/zig-stage2"
+}


             reply	other threads:[~2022-04-30  8:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-30  8:13 Joonas Niilola [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-08-23  2:08 [gentoo-commits] repo/gentoo:master commit in: dev-lang/zig/files/, dev-lang/zig/ Eli Schwartz
2023-07-09  2:02 Sam James
2023-01-14 19:17 Sam James
2022-10-18 15:00 Michał Górny
2020-07-30 22:11 Michał Górny
2019-08-07 18:28 Joonas Niilola

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=1651306400.2647a868c09f98a97fad19e0070a4abab851376c.juippis@gentoo \
    --to=juippis@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