diff options
author | BratishkaErik <bratishkaerik@getgoogleoff.me> | 2022-04-19 19:44:23 +0600 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2022-04-30 11:13:20 +0300 |
commit | 2647a868c09f98a97fad19e0070a4abab851376c (patch) | |
tree | 4a5a38160205446451f2c48a8c247616bf22532a /dev-lang/zig | |
parent | dev-lang/zig: update SRC_URI (diff) | |
download | gentoo-2647a868c09f98a97fad19e0070a4abab851376c.tar.gz gentoo-2647a868c09f98a97fad19e0070a4abab851376c.tar.bz2 gentoo-2647a868c09f98a97fad19e0070a4abab851376c.zip |
dev-lang/zig: add stage2 support (on -9999)
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: BratishkaErik <bratishkaerik@getgoogleoff.me>
Closes: https://github.com/gentoo/gentoo/pull/25085
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-lang/zig')
-rw-r--r-- | dev-lang/zig/files/zig-9999-stage2-fix.patch | 12 | ||||
-rw-r--r-- | dev-lang/zig/metadata.xml | 3 | ||||
-rw-r--r-- | dev-lang/zig/zig-9999.ebuild | 28 |
3 files changed, 42 insertions, 1 deletions
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" +} |