From 0fcaac21e786bd7911b1e8f436cd885c5e2f6437 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 27 Oct 2023 08:42:41 +0100 Subject: gentoo auto-resync : 27:10:2023 - 08:42:41 --- dev-lang/Manifest.gz | Bin 21002 -> 20998 bytes dev-lang/zig-bin/Manifest | 3 +- .../files/zig-0.11.0-first-try-getconf.patch | 109 ++++++++++ dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild | 69 +++++++ dev-lang/zig-bin/zig-bin-0.11.0.ebuild | 67 ------- dev-lang/zig/Manifest | 9 +- .../zig-0.10.0-build-dir-install-stage3.patch | 42 ---- .../zig/files/zig-0.10.1-musl-1.2.4-lfs64.patch | 220 --------------------- .../zig/files/zig-0.11.0-first-try-getconf.patch | 109 ++++++++++ dev-lang/zig/zig-0.10.1-r3.ebuild | 184 ----------------- dev-lang/zig/zig-0.11.0-r1.ebuild | 177 +++++++++++++++++ dev-lang/zig/zig-0.11.0.ebuild | 167 ---------------- dev-lang/zig/zig-9999.ebuild | 6 + 13 files changed, 475 insertions(+), 687 deletions(-) create mode 100644 dev-lang/zig-bin/files/zig-0.11.0-first-try-getconf.patch create mode 100644 dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild delete mode 100644 dev-lang/zig-bin/zig-bin-0.11.0.ebuild delete mode 100644 dev-lang/zig/files/zig-0.10.0-build-dir-install-stage3.patch delete mode 100644 dev-lang/zig/files/zig-0.10.1-musl-1.2.4-lfs64.patch create mode 100644 dev-lang/zig/files/zig-0.11.0-first-try-getconf.patch delete mode 100644 dev-lang/zig/zig-0.10.1-r3.ebuild create mode 100644 dev-lang/zig/zig-0.11.0-r1.ebuild delete mode 100644 dev-lang/zig/zig-0.11.0.ebuild (limited to 'dev-lang') diff --git a/dev-lang/Manifest.gz b/dev-lang/Manifest.gz index 20973e8d83e3..d829e6cd853e 100644 Binary files a/dev-lang/Manifest.gz and b/dev-lang/Manifest.gz differ diff --git a/dev-lang/zig-bin/Manifest b/dev-lang/zig-bin/Manifest index 74cbeadd695a..4644a78434e2 100644 --- a/dev-lang/zig-bin/Manifest +++ b/dev-lang/zig-bin/Manifest @@ -1,4 +1,5 @@ AUX zig-0.10.1-musl-1.2.4-lfs64.patch 8866 BLAKE2B 5faf4a70f2f388f24105948c56940123b51bb5da389f5008b565008a96df1f4033ebe6fbd764b1105870d2f2e7b018e0f8bb09947937bc53d542ef359fe94b70 SHA512 169f0b6412e8ebe11a20d23c0e639f98778ae077dd36ea44b423fd565b54adb70bcdcf1af085521e8a0ca9a08e095d6f82e40347d315ae1ec5566c8c205cfddb +AUX zig-0.11.0-first-try-getconf.patch 5214 BLAKE2B 8129d084fc36a2a8f32c21d13698a4c589ce35da640c4a5e3f95c100266240ba9f0ff9f9146ca5f9c2523257af20ad4cd0557f64228d77c2daadfb3c48e019a0 SHA512 b5ed25905da463c9ba34b82f118fdb0251bb460e8f47a3a37f52857ffc806e9078dc41f8c3aa82abd5f09a37f8fdda7e12c5c245fd181b6b7c54048b9f6662ef DIST zig-linux-aarch64-0.10.1.tar.xz 40321280 BLAKE2B 39abefb80d540d52333ec76203893630ac5df2a784684397033e9ac766f67c4512be71513ebb80faac6c5ebaa2a737859b7bc27b82797232cf97d87d91e8492e SHA512 44dd15b1b2d7bc85a4f8e8171ae5c51122be352249273091b499de5a392c72e262585f981908afd1718a41fa7e67b36f1b65c6cacbf8e9f226a687bd85b7edc6 DIST zig-linux-aarch64-0.11.0.tar.xz 41492432 BLAKE2B fd4e1f242475bfdc94f418817d2f1b256ebdc7e29b94e7629f54c241b7a1df273a2c776ab29dad645af041b5cfb0e7d1b0a922bb04a82553604076d36e957580 SHA512 07a026958cac0f1674496f8a1fd3a3dfcd79274d1a25c87e4123b74a437f332bbea4097320da7f83d67626fb9d6e9fe1d78e917522debb8873f7c40938031e63 DIST zig-linux-armv7a-0.10.1.tar.xz 50718132 BLAKE2B 76ef431ef8957272b992f6b861913a961d348120106a7f4b77d1f6b2a042dd8904a1ac744ab6b02b78681eef68af4143372e5315cd113d40711bd26fc78e6632 SHA512 4ec3ccd7ac980bfd9fc7a2f6b2301051d3df43b00143914d869389fc44b48916820d996e27cb922dac152228c4b04a0cce51f7b125317de85440a5479fe8ff7d @@ -12,5 +13,5 @@ DIST zig-linux-x86-0.11.0.tar.xz 49824456 BLAKE2B 4a9b4c9551ffe555d1283c9d5aab66 DIST zig-linux-x86_64-0.10.1.tar.xz 44085596 BLAKE2B d689a469dbbe790593a561dd4df01c506212754c48be7de03773c7e690cbab197af10d639e80148f3343204ddf9ecfe09a88a62fb6ef63a262bcc2dd79fecd34 SHA512 1cf88a492b1a47800e213b8801477f4ffabf269f960d27d1849c5aec805b5db3768c83d4daa4a738532b1b7367e8c6812e3eea47c205ea732d7a6269a47e16dc DIST zig-linux-x86_64-0.11.0.tar.xz 44961892 BLAKE2B b0780573dbd372c7a9efec32e6860050b15603a80e00e64757a6c09a02757febc14d3df32ff089f418996fb55bf6fb50774393037f86cbecd49f06c250e5bbe3 SHA512 992e49a28edc9bed44c124a887c4700e707c2eef6a6f3adb551c568103242c3a5304af00d95994a511670c2099f476aa5068eef538f6065afe9bc149c88887b9 EBUILD zig-bin-0.10.1-r3.ebuild 3049 BLAKE2B f00c12c02cade6f0af32239b268b7c7f41fa8ebef0d385e8502ab9b56e0394e9e9214ecf164c9a0c039d0a6d4cf51d83f8fe095c7f008b018a41168c09cd10c3 SHA512 4ae061b9601fbd04adb9ca577230e9f292f94629d4dc781cfbe35bca9fb3d67daa08f55951ce31be1452e28bfef6804ff8fcc62566e0de24fd70cf7488cebc12 -EBUILD zig-bin-0.11.0.ebuild 2577 BLAKE2B dbe08045acb6dc0bf6f154fb3ad959389ea5b2eeefd8a45b26f7d7fd3e7d2a20a832a3a511c975bdfbb38c4d186bff7f944b4baaaf51f91a949b486f18a2248f SHA512 c74eaa976cdbefbab9840d2ad0db020b14a4248483cba8ac631a96b3c8a28935b51713e7f094da56d048b5133e05c970ea8bf84f768d425079f9c6fa9926f5ef +EBUILD zig-bin-0.11.0-r1.ebuild 2627 BLAKE2B 6c31342832105db26843cde2e2a9453d91c1254a08a2b98e3faa223c4bbca67c5df7a256b6f3316d75500efbbbbb0f6dce9cb08d67d9f62076220ca885619bec SHA512 1cb751236c65e9ac2eab68208950f4b7ed488dbd1efeec141dba1da2c5daca2c1acef994d776d4e364545ea1df153bb91e95fe1a7652fd207fb1c66ac9f217b7 MISC metadata.xml 541 BLAKE2B 6f5c7fbf759f0430f69073a17a0dae4b8bebf335b54c3b43da6b24104dc3de05a3b686cddbbd31e4dae1fc31695a2f08d000d22437ed6f1847de8fa95e3b1952 SHA512 d49cf0a8ad76ac9a6f6fb091effddbbcd812b56f91df6d3c782e15197cb4ff4423fb1076671a232aabcb9833af19ef8c820ad6df312a1e4d72e665680314c083 diff --git a/dev-lang/zig-bin/files/zig-0.11.0-first-try-getconf.patch b/dev-lang/zig-bin/files/zig-0.11.0-first-try-getconf.patch new file mode 100644 index 000000000000..6d1b3ca7e5b7 --- /dev/null +++ b/dev-lang/zig-bin/files/zig-0.11.0-first-try-getconf.patch @@ -0,0 +1,109 @@ +From: Eric Joldasov + +Based on https://github.com/ziglang/zig/pull/12567 and https://github.com/ziglang/zig/pull/17671 +with small fixes, all ported to 0.11.0. + +First try `getconf GNU_LIBC_VERSION` to detect glibc version, +If there are any errors, skip to the upstream logic. + +Also fix glibc version parsing: if version string does not contain third (patch) component, "std.SemanticVersion.parse" returns parsing error. +For example, this currently happens with "GLIBC_2.37" or "glibc 2.37" inputs. +To fix this, we use copy-pasted "std.zig.CrossTarget.parse" function here, that sets omitted patch component to 0. + +After applying this patch, both `zig build-exe --show-builtin` and `zig env` show correct version on my default/linux/amd64/17.1/desktop/plasma : +glibc 2.37. + +Bug: https://bugs.gentoo.org/914731 +Bug: https://bugs.gentoo.org/914101 + +diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig +index 99a1a8f2e..d1032a716 100644 +--- a/lib/std/zig/system/NativeTargetInfo.zig ++++ b/lib/std/zig/system/NativeTargetInfo.zig +@@ -19,6 +19,32 @@ dynamic_linker: DynamicLinker = DynamicLinker{}, + + pub const DynamicLinker = Target.DynamicLinker; + ++// Copy-pasted from `std.zig.CrossTarget.parse` to avoid changing visibility of mentioned function. ++/// Parses a version with an omitted patch component, such as "1.0", ++/// which SemanticVersion.parse is not capable of. ++fn parseWithOptionalPatchField(ver: []const u8) error{ InvalidVersion, Overflow }!std.SemanticVersion { ++ const parseVersionComponent = struct { ++ fn parseVersionComponent(component: []const u8) !usize { ++ return std.fmt.parseUnsigned(usize, component, 10) catch |err| { ++ switch (err) { ++ error.InvalidCharacter => return error.InvalidVersion, ++ error.Overflow => return error.Overflow, ++ } ++ }; ++ } ++ }.parseVersionComponent; ++ var version_components = mem.split(u8, ver, "."); ++ const major = version_components.first(); ++ const minor = version_components.next() orelse return error.InvalidVersion; ++ const patch = version_components.next() orelse "0"; ++ if (version_components.next() != null) return error.InvalidVersion; ++ return .{ ++ .major = try parseVersionComponent(major), ++ .minor = try parseVersionComponent(minor), ++ .patch = try parseVersionComponent(patch), ++ }; ++} ++ + pub const DetectError = error{ + FileSystem, + SystemResources, +@@ -307,6 +333,35 @@ fn detectAbiAndDynamicLinker( + } + const ld_info_list = ld_info_list_buffer[0..ld_info_list_len]; + ++ if (is_linux and !os_is_non_native and cross_target.glibc_version == null) try_getconf: { ++ var buf: [4096]u8 = undefined; ++ var fba = std.heap.FixedBufferAllocator.init(&buf); ++ const allocator = fba.allocator(); ++ ++ const getconf = std.process.Child.exec(.{ ++ .allocator = allocator, ++ .argv = &.{ "getconf", "GNU_LIBC_VERSION" }, ++ .max_output_bytes = 1024, ++ }) catch break :try_getconf; ++ if (!std.mem.startsWith(u8, getconf.stdout, "glibc ")) break :try_getconf; ++ const version_string = getconf.stdout["glibc ".len..]; ++ const glibc_version = parseWithOptionalPatchField(version_string) catch break :try_getconf; ++ ++ var os_with_glibc = os; ++ os_with_glibc.version_range.linux.glibc = glibc_version; ++ ++ const result: NativeTargetInfo = .{ ++ .target = .{ ++ .cpu = cpu, ++ .os = os_with_glibc, ++ .abi = cross_target.abi orelse Target.Abi.default(cpu.arch, os_with_glibc), ++ .ofmt = cross_target.ofmt orelse Target.ObjectFormat.default(os_with_glibc.tag, cpu.arch), ++ }, ++ .dynamic_linker = cross_target.dynamic_linker, ++ }; ++ return result; ++ } ++ + // Best case scenario: the executable is dynamically linked, and we can iterate + // over our own shared objects and find a dynamic linker. + const elf_file = blk: { +@@ -563,7 +618,7 @@ fn glibcVerFromSoFile(file: fs.File) !std.SemanticVersion { + while (it.next()) |s| { + if (mem.startsWith(u8, s, "GLIBC_2.")) { + const chopped = s["GLIBC_".len..]; +- const ver = std.SemanticVersion.parse(chopped) catch |err| switch (err) { ++ const ver = parseWithOptionalPatchField(chopped) catch |err| switch (err) { + error.Overflow => return error.InvalidGnuLibCVersion, + error.InvalidVersion => return error.InvalidGnuLibCVersion, + }; +@@ -586,7 +641,7 @@ fn glibcVerFromLinkName(link_name: []const u8, prefix: []const u8) !std.Semantic + } + // chop off "libc-" and ".so" + const link_name_chopped = link_name[prefix.len .. link_name.len - suffix.len]; +- return std.SemanticVersion.parse(link_name_chopped) catch |err| switch (err) { ++ return parseWithOptionalPatchField(link_name_chopped) catch |err| switch (err) { + error.Overflow => return error.InvalidGnuLibCVersion, + error.InvalidVersion => return error.InvalidGnuLibCVersion, + }; diff --git a/dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild b/dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild new file mode 100644 index 000000000000..92775c190670 --- /dev/null +++ b/dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="A robust, optimal, and maintainable programming language" +HOMEPAGE="https://ziglang.org/" +SRC_URI=" + amd64? ( https://ziglang.org/download/${PV}/zig-linux-x86_64-${PV}.tar.xz ) + arm? ( https://ziglang.org/download/${PV}/zig-linux-armv7a-${PV}.tar.xz ) + arm64? ( https://ziglang.org/download/${PV}/zig-linux-aarch64-${PV}.tar.xz ) + ppc? ( https://ziglang.org/download/${PV}/zig-linux-powerpc-${PV}.tar.xz ) + ppc64? ( https://ziglang.org/download/${PV}/zig-linux-powerpc64le-${PV}.tar.xz ) + riscv? ( https://ziglang.org/download/${PV}/zig-linux-riscv64-${PV}.tar.xz ) + x86? ( https://ziglang.org/download/${PV}/zig-linux-x86-${PV}.tar.xz )" + +# project itself: MIT +# There are bunch of projects under "lib/" folder that are needed for cross-compilation. +# Files that are unnecessary for cross-compilation are removed by upstream +# and therefore their licenses (if any special) are not included. +# lib/libunwind: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libcxxabi: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libcxx: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libc/wasi: || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain +# lib/libc/musl: MIT BSD-2 +# lib/libc/mingw: ZPL public-domain BSD-2 ISC HPND +# lib/libc/glibc: BSD HPND ISC inner-net LGPL-2.1+ +LICENSE="MIT Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain BSD-2 ZPL ISC HPND BSD inner-net LGPL-2.1+" +SLOT="$(ver_cut 1-2)" +KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" +IUSE="doc" + +IDEPEND="app-eselect/eselect-zig" +# Zig provides its standard library in source form "/opt/zig-bin-{PV}/lib/", +# and all other Zig libraries are meant to be consumed in source form, +# because they can use compile-time mechanics (and it is easier for distributions to patch them) +# Here we use this feature for fixing programs that use standard library +# Note: Zig build system is also part of standard library, so we can fix it too +PATCHES=( + "${FILESDIR}/zig-0.11.0-first-try-getconf.patch" +) + +QA_PREBUILT="opt/${P}/zig" + +src_unpack() { + unpack ${A} + + mv "${WORKDIR}/"* "${S}" || die +} + +src_install() { + insinto /opt/ + + use doc && local HTML_DOCS=( "doc/langref.html" "doc/std/" ) + einstalldocs + rm -r ./doc/ || die + + doins -r "${S}" + fperms 0755 "/opt/${P}/zig" + dosym -r "/opt/${P}/zig" "/usr/bin/zig-bin-${PV}" +} + +pkg_postinst() { + eselect zig update ifunset +} + +pkg_postrm() { + eselect zig update ifunset +} diff --git a/dev-lang/zig-bin/zig-bin-0.11.0.ebuild b/dev-lang/zig-bin/zig-bin-0.11.0.ebuild deleted file mode 100644 index 2ff67d9e16aa..000000000000 --- a/dev-lang/zig-bin/zig-bin-0.11.0.ebuild +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright 2022-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DESCRIPTION="A robust, optimal, and maintainable programming language" -HOMEPAGE="https://ziglang.org/" -SRC_URI=" - amd64? ( https://ziglang.org/download/${PV}/zig-linux-x86_64-${PV}.tar.xz ) - arm? ( https://ziglang.org/download/${PV}/zig-linux-armv7a-${PV}.tar.xz ) - arm64? ( https://ziglang.org/download/${PV}/zig-linux-aarch64-${PV}.tar.xz ) - ppc? ( https://ziglang.org/download/${PV}/zig-linux-powerpc-${PV}.tar.xz ) - ppc64? ( https://ziglang.org/download/${PV}/zig-linux-powerpc64le-${PV}.tar.xz ) - riscv? ( https://ziglang.org/download/${PV}/zig-linux-riscv64-${PV}.tar.xz ) - x86? ( https://ziglang.org/download/${PV}/zig-linux-x86-${PV}.tar.xz )" - -# project itself: MIT -# There are bunch of projects under "lib/" folder that are needed for cross-compilation. -# Files that are unnecessary for cross-compilation are removed by upstream -# and therefore their licenses (if any special) are not included. -# lib/libunwind: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxxabi: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxx: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libc/wasi: || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain -# lib/libc/musl: MIT BSD-2 -# lib/libc/mingw: ZPL public-domain BSD-2 ISC HPND -# lib/libc/glibc: BSD HPND ISC inner-net LGPL-2.1+ -LICENSE="MIT Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain BSD-2 ZPL ISC HPND BSD inner-net LGPL-2.1+" -SLOT="$(ver_cut 1-2)" -KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86" -IUSE="doc" - -IDEPEND="app-eselect/eselect-zig" -# Zig provides its standard library in source form "/opt/zig-bin-{PV}/lib/", -# and all other Zig libraries are meant to be consumed in source form, -# because they can use compile-time mechanics (and it is easier for distributions to patch them) -# Here we use this feature for fixing programs that use standard library -# Note: Zig build system is also part of standard library, so we can fix it too -#PATCHES=() - -QA_PREBUILT="opt/${P}/zig" - -src_unpack() { - unpack ${A} - - mv "${WORKDIR}/"* "${S}" || die -} - -src_install() { - insinto /opt/ - - use doc && local HTML_DOCS=( "doc/langref.html" "doc/std/" ) - einstalldocs - rm -r ./doc/ || die - - doins -r "${S}" - fperms 0755 "/opt/${P}/zig" - dosym -r "/opt/${P}/zig" "/usr/bin/zig-bin-${PV}" -} - -pkg_postinst() { - eselect zig update ifunset -} - -pkg_postrm() { - eselect zig update ifunset -} diff --git a/dev-lang/zig/Manifest b/dev-lang/zig/Manifest index db2816773fe1..6f93464870f0 100644 --- a/dev-lang/zig/Manifest +++ b/dev-lang/zig/Manifest @@ -1,8 +1,5 @@ -AUX zig-0.10.0-build-dir-install-stage3.patch 1430 BLAKE2B cca909207cadfe1c9b31b9481a705882506363aaf41db7672f42cc66937f85f7b2f2b53346d29a4d748d1aef05e77efcc6e668ac498a7d172a6d8654034d5c4a SHA512 6704adb1f146ed78c8030aad2c739e30d0ec7ffda40273b5520914b16cc67d497afd9b1b59a1acfbb0097d7f5b0a5517973c45ef43ccbc35d8af051500577117 -AUX zig-0.10.1-musl-1.2.4-lfs64.patch 8866 BLAKE2B 5faf4a70f2f388f24105948c56940123b51bb5da389f5008b565008a96df1f4033ebe6fbd764b1105870d2f2e7b018e0f8bb09947937bc53d542ef359fe94b70 SHA512 169f0b6412e8ebe11a20d23c0e639f98778ae077dd36ea44b423fd565b54adb70bcdcf1af085521e8a0ca9a08e095d6f82e40347d315ae1ec5566c8c205cfddb -DIST zig-0.10.1.tar.xz 15143112 BLAKE2B 4954d95ad763000eedf73a78e62bc0e99d65bba91c7127cdf1ea4503eb67817265daf572f645b7efbe9e24087e690b2768f0b2bc6c43b5fd76eab33143e964fe SHA512 d443adf61556bc95470537c6b0371a0ac99d19a06b15635cf1e5055ae7849039680c9006105e06e1bd6ba0fc12da14c54c1d28ac597c7dee17ee3a5cd9cf79f8 +AUX zig-0.11.0-first-try-getconf.patch 5214 BLAKE2B 8129d084fc36a2a8f32c21d13698a4c589ce35da640c4a5e3f95c100266240ba9f0ff9f9146ca5f9c2523257af20ad4cd0557f64228d77c2daadfb3c48e019a0 SHA512 b5ed25905da463c9ba34b82f118fdb0251bb460e8f47a3a37f52857ffc806e9078dc41f8c3aa82abd5f09a37f8fdda7e12c5c245fd181b6b7c54048b9f6662ef DIST zig-0.11.0.tar.xz 15275316 BLAKE2B 603e4995a36d214ba71cf05b719a04732c8927995c8207ab8fdd574dca3410cdc5ccc8f6aa9964807afc04a5cbce1a3910a6cde4cf12e585cdf7684833217eb2 SHA512 c19a8ae6d440a16dd5e77941fc77c036d1f284f1784376625e63b65f30b4acad62f9f4217bc818c401f88c2c33f8722f26fc467c3e23c29a89178c4b1882d1c4 -EBUILD zig-0.10.1-r3.ebuild 5914 BLAKE2B 7281e035750656c1eb9e01e3b0f44eaf895b7376cccb56dc76e47e728ec39e906d4bbd7b5f02c65c95275c566dd0fd65bc5110c2f73cdbb14da45f38f29ccc3f SHA512 4b3b1f96304c3ac117680cadb752c0d1ff35c10a25459bbd746bfc7fc2409d138a6a100d6ae0351ca380fac824d8063f22a7c307d1021cc98f155730ee132693 -EBUILD zig-0.11.0.ebuild 4772 BLAKE2B 19a94428eb1e1e465e2b72e6f502082744bc0a874ba4dcda6158134079ed93010150fd3685578831ee1e5475c2da2b7d840eb2dd63f11deee97656d0256efb72 SHA512 135566da29886ccfbf1294ac4e53ef36ce71e191e2d60f22f4e3dfa117d1ad56cae9eea6a6c45b0a4e9deb78464c88fd3a616373704893670ece6604f8d48be5 -EBUILD zig-9999.ebuild 4772 BLAKE2B 0de890a8ede0488164eef30d26020af5ee1e52d1aae095507975216fc2e1179108f5e727244d1ebac36c92ab4e2fe84ffda9785b1d3f6fcf7b85c96ea364b101 SHA512 25cab78257cca1d6d81011e54c6f7f06cdb049d6d7c3159066a45904f76e670362caf84ff845e3ec37e5eefb473003442512f0d1572a00ac11f4c286446bbaad +EBUILD zig-0.11.0-r1.ebuild 5069 BLAKE2B 7b8fa2a72d67c7c211cf228fac00ead39dbc070ab5757d7245e507d2f5006f939a763fafac70e39b56fd82d16d11cc9d2df9c209a8950de28c87d9be6503a6c5 SHA512 275589b2ac7bcc71b2a65042a3473fe41c33e9729c12450dbf9d3559ed622db73958e5ae9bf9c5d704235d9ed7642b58a81ec4bb6e65b15939b3c5922e5fd233 +EBUILD zig-9999.ebuild 5006 BLAKE2B f5cf38fa29d81a493816477db31a721b2c8cf36c555ecddde177a432c143e1299b9365f0bafac64c5fa5a415ce8ee8218c5806320162e362beae69a84bd84b7d SHA512 16591b69fc074cff217a36bc0c0c05cd7871d107ff7b8bddd0a4699d43b5eb0ced46b1a51f5eb92bb75fa66560655253184b4fe634ae29560224242d55a4a0ef MISC metadata.xml 541 BLAKE2B 6f5c7fbf759f0430f69073a17a0dae4b8bebf335b54c3b43da6b24104dc3de05a3b686cddbbd31e4dae1fc31695a2f08d000d22437ed6f1847de8fa95e3b1952 SHA512 d49cf0a8ad76ac9a6f6fb091effddbbcd812b56f91df6d3c782e15197cb4ff4423fb1076671a232aabcb9833af19ef8c820ad6df312a1e4d72e665680314c083 diff --git a/dev-lang/zig/files/zig-0.10.0-build-dir-install-stage3.patch b/dev-lang/zig/files/zig-0.10.0-build-dir-install-stage3.patch deleted file mode 100644 index 5704e4ba7921..000000000000 --- a/dev-lang/zig/files/zig-0.10.0-build-dir-install-stage3.patch +++ /dev/null @@ -1,42 +0,0 @@ -From: Eric Joldasov - -Install 'zig' binary in 'build_dir/stage3' directory so that we can find it and use for testing. -Also split "add_custom_target(stage3 ALL" and command that it invokes, so that it won't retry it during installation, -as target will be considered not out-of-date. (Bug https://bugs.gentoo.org/890457 and https://bugs.gentoo.org/890459). -Upstream PR https://github.com/ziglang/zig/pull/14255. - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1094,10 +1094,14 @@ set(ZIG_BUILD_ARGS - ) - - add_custom_target(stage3 ALL -- COMMAND zig2 build compile ${ZIG_BUILD_ARGS} -- DEPENDS zig2 -- COMMENT STATUS "Building stage3" -- WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" -+ DEPENDS "${CMAKE_BINARY_DIR}/stage3/bin/zig" -+) -+ -+add_custom_command( -+ OUTPUT "${CMAKE_BINARY_DIR}/stage3/bin/zig" -+ COMMAND zig2 build --prefix "${CMAKE_BINARY_DIR}/stage3" ${ZIG_BUILD_ARGS} -+ COMMENT STATUS "Building stage3" -+ WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" - ) - - install(CODE "set(ZIG_EXECUTABLE \"${ZIG_EXECUTABLE}\")") - ---- a/build.zig -+++ b/build.zig -@@ -148,10 +148,6 @@ pub fn build(b: *Builder) !void { - }; - - const exe = b.addExecutable("zig", main_file); -- -- const compile_step = b.step("compile", "Build the self-hosted compiler"); -- compile_step.dependOn(&exe.step); -- - exe.stack_size = stack_size; - exe.strip = strip; - exe.sanitize_thread = sanitize_thread; diff --git a/dev-lang/zig/files/zig-0.10.1-musl-1.2.4-lfs64.patch b/dev-lang/zig/files/zig-0.10.1-musl-1.2.4-lfs64.patch deleted file mode 100644 index 05a550a7920e..000000000000 --- a/dev-lang/zig/files/zig-0.10.1-musl-1.2.4-lfs64.patch +++ /dev/null @@ -1,220 +0,0 @@ -From https://github.com/ziglang/zig/commit/b20ccff515364cdb8f3e733cc950e53ab77656db Mon Sep 17 00:00:00 2001 -From: Andrew Kelley -Date: Mon, 19 Jun 2023 15:17:01 -0700 -Subject: [PATCH] std.os: update logic for 64-bit symbol choice - -musl v1.2.4 dropped the "64"-suffixed aliases for legacy "LFS64" ("large -file support") interfaces, so this commit changes the corresponding Zig -logic to call the correct names. ---- a/lib/std/os.zig -+++ b/lib/std/os.zig -@@ -890,10 +890,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { - }; - const adjusted_len = @min(max_count, buf.len); - -- const pread_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.pread64 -- else -- system.pread; -+ const pread_sym = if (lfs64_abi) system.pread64 else system.pread; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - while (true) { -@@ -966,10 +963,7 @@ pub fn ftruncate(fd: fd_t, length: u64) TruncateError!void { - } - - while (true) { -- const ftruncate_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.ftruncate64 -- else -- system.ftruncate; -+ const ftruncate_sym = if (lfs64_abi) system.ftruncate64 else system.ftruncate; - - const ilen = @bitCast(i64, length); // the OS treats this as unsigned - switch (errno(ftruncate_sym(fd, ilen))) { -@@ -1034,10 +1028,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { - - const iov_count = math.cast(u31, iov.len) orelse math.maxInt(u31); - -- const preadv_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.preadv64 -- else -- system.preadv; -+ const preadv_sym = if (lfs64_abi) system.preadv64 else system.preadv; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - while (true) { -@@ -1311,10 +1302,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { - }; - const adjusted_len = @min(max_count, bytes.len); - -- const pwrite_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.pwrite64 -- else -- system.pwrite; -+ const pwrite_sym = if (lfs64_abi) system.pwrite64 else system.pwrite; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - while (true) { -@@ -1400,10 +1388,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz - } - } - -- const pwritev_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.pwritev64 -- else -- system.pwritev; -+ const pwritev_sym = if (lfs64_abi) system.pwritev64 else system.pwritev; - - const iov_count = if (iov.len > IOV_MAX) IOV_MAX else @intCast(u31, iov.len); - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned -@@ -1514,10 +1499,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: u32, perm: mode_t) OpenError!fd_t - return open(mem.sliceTo(file_path, 0), flags, perm); - } - -- const open_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.open64 -- else -- system.open; -+ const open_sym = if (lfs64_abi) system.open64 else system.open; - - while (true) { - const rc = open_sym(file_path, flags, perm); -@@ -1730,10 +1712,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: u32, mode: mode_t) - return openat(dir_fd, mem.sliceTo(file_path, 0), flags, mode); - } - -- const openat_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.openat64 -- else -- system.openat; -+ const openat_sym = if (lfs64_abi) system.openat64 else system.openat; - - while (true) { - const rc = openat_sym(dir_fd, file_path, flags, mode); -@@ -4117,10 +4096,7 @@ pub fn fstat(fd: fd_t) FStatError!Stat { - @compileError("fstat is not yet implemented on Windows"); - } - -- const fstat_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.fstat64 -- else -- system.fstat; -+ const fstat_sym = if (lfs64_abi) system.fstat64 else system.fstat; - - var stat = mem.zeroes(Stat); - switch (errno(fstat_sym(fd, &stat))) { -@@ -4176,10 +4152,7 @@ pub fn fstatatZ(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!S - return fstatatWasi(dirfd, mem.sliceTo(pathname), flags); - } - -- const fstatat_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.fstatat64 -- else -- system.fstatat; -+ const fstatat_sym = if (lfs64_abi) system.fstatat64 else system.fstatat; - - var stat = mem.zeroes(Stat); - switch (errno(fstatat_sym(dirfd, pathname, &stat, flags))) { -@@ -4416,10 +4389,7 @@ pub fn mmap( - fd: fd_t, - offset: u64, - ) MMapError![]align(mem.page_size) u8 { -- const mmap_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.mmap64 -- else -- system.mmap; -+ const mmap_sym = if (lfs64_abi) system.mmap64 else system.mmap; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset); -@@ -4823,10 +4793,7 @@ pub fn lseek_SET(fd: fd_t, offset: u64) SeekError!void { - } - } - -- const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.lseek64 -- else -- system.lseek; -+ const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - switch (errno(lseek_sym(fd, ioffset, SEEK.SET))) { -@@ -4870,10 +4837,7 @@ pub fn lseek_CUR(fd: fd_t, offset: i64) SeekError!void { - else => |err| return unexpectedErrno(err), - } - } -- const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.lseek64 -- else -- system.lseek; -+ const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - switch (errno(lseek_sym(fd, ioffset, SEEK.CUR))) { -@@ -4917,10 +4881,7 @@ pub fn lseek_END(fd: fd_t, offset: i64) SeekError!void { - else => |err| return unexpectedErrno(err), - } - } -- const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.lseek64 -- else -- system.lseek; -+ const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek; - - const ioffset = @bitCast(i64, offset); // the OS treats this as unsigned - switch (errno(lseek_sym(fd, ioffset, SEEK.END))) { -@@ -4964,10 +4925,7 @@ pub fn lseek_CUR_get(fd: fd_t) SeekError!u64 { - else => |err| return unexpectedErrno(err), - } - } -- const lseek_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.lseek64 -- else -- system.lseek; -+ const lseek_sym = if (lfs64_abi) system.lseek64 else system.lseek; - - const rc = lseek_sym(fd, 0, SEEK.CUR); - switch (errno(rc)) { -@@ -6169,10 +6127,7 @@ pub fn sendfile( - // TODO we should not need this cast; improve return type of @min - const adjusted_count = @intCast(usize, adjusted_count_tmp); - -- const sendfile_sym = if (builtin.link_libc) -- system.sendfile64 -- else -- system.sendfile; -+ const sendfile_sym = if (lfs64_abi) system.sendfile64 else system.sendfile; - - while (true) { - var offset: off_t = @bitCast(off_t, in_offset); -@@ -7050,10 +7005,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 { - pub const GetrlimitError = UnexpectedError; - - pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit { -- const getrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.getrlimit64 -- else -- system.getrlimit; -+ const getrlimit_sym = if (lfs64_abi) system.getrlimit64 else system.getrlimit; - - var limits: rlimit = undefined; - switch (errno(getrlimit_sym(resource, &limits))) { -@@ -7067,10 +7019,7 @@ pub fn getrlimit(resource: rlimit_resource) GetrlimitError!rlimit { - pub const SetrlimitError = error{ PermissionDenied, LimitTooBig } || UnexpectedError; - - pub fn setrlimit(resource: rlimit_resource, limits: rlimit) SetrlimitError!void { -- const setrlimit_sym = if (builtin.os.tag == .linux and builtin.link_libc) -- system.setrlimit64 -- else -- system.setrlimit; -+ const setrlimit_sym = if (lfs64_abi) system.setrlimit64 else system.setrlimit; - - switch (errno(setrlimit_sym(resource, &limits))) { - .SUCCESS => return, -@@ -7339,3 +7288,5 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError! - }, - }; - } -+ -+const lfs64_abi = builtin.os.tag == .linux and builtin.link_libc and builtin.abi.isGnu(); diff --git a/dev-lang/zig/files/zig-0.11.0-first-try-getconf.patch b/dev-lang/zig/files/zig-0.11.0-first-try-getconf.patch new file mode 100644 index 000000000000..6d1b3ca7e5b7 --- /dev/null +++ b/dev-lang/zig/files/zig-0.11.0-first-try-getconf.patch @@ -0,0 +1,109 @@ +From: Eric Joldasov + +Based on https://github.com/ziglang/zig/pull/12567 and https://github.com/ziglang/zig/pull/17671 +with small fixes, all ported to 0.11.0. + +First try `getconf GNU_LIBC_VERSION` to detect glibc version, +If there are any errors, skip to the upstream logic. + +Also fix glibc version parsing: if version string does not contain third (patch) component, "std.SemanticVersion.parse" returns parsing error. +For example, this currently happens with "GLIBC_2.37" or "glibc 2.37" inputs. +To fix this, we use copy-pasted "std.zig.CrossTarget.parse" function here, that sets omitted patch component to 0. + +After applying this patch, both `zig build-exe --show-builtin` and `zig env` show correct version on my default/linux/amd64/17.1/desktop/plasma : +glibc 2.37. + +Bug: https://bugs.gentoo.org/914731 +Bug: https://bugs.gentoo.org/914101 + +diff --git a/lib/std/zig/system/NativeTargetInfo.zig b/lib/std/zig/system/NativeTargetInfo.zig +index 99a1a8f2e..d1032a716 100644 +--- a/lib/std/zig/system/NativeTargetInfo.zig ++++ b/lib/std/zig/system/NativeTargetInfo.zig +@@ -19,6 +19,32 @@ dynamic_linker: DynamicLinker = DynamicLinker{}, + + pub const DynamicLinker = Target.DynamicLinker; + ++// Copy-pasted from `std.zig.CrossTarget.parse` to avoid changing visibility of mentioned function. ++/// Parses a version with an omitted patch component, such as "1.0", ++/// which SemanticVersion.parse is not capable of. ++fn parseWithOptionalPatchField(ver: []const u8) error{ InvalidVersion, Overflow }!std.SemanticVersion { ++ const parseVersionComponent = struct { ++ fn parseVersionComponent(component: []const u8) !usize { ++ return std.fmt.parseUnsigned(usize, component, 10) catch |err| { ++ switch (err) { ++ error.InvalidCharacter => return error.InvalidVersion, ++ error.Overflow => return error.Overflow, ++ } ++ }; ++ } ++ }.parseVersionComponent; ++ var version_components = mem.split(u8, ver, "."); ++ const major = version_components.first(); ++ const minor = version_components.next() orelse return error.InvalidVersion; ++ const patch = version_components.next() orelse "0"; ++ if (version_components.next() != null) return error.InvalidVersion; ++ return .{ ++ .major = try parseVersionComponent(major), ++ .minor = try parseVersionComponent(minor), ++ .patch = try parseVersionComponent(patch), ++ }; ++} ++ + pub const DetectError = error{ + FileSystem, + SystemResources, +@@ -307,6 +333,35 @@ fn detectAbiAndDynamicLinker( + } + const ld_info_list = ld_info_list_buffer[0..ld_info_list_len]; + ++ if (is_linux and !os_is_non_native and cross_target.glibc_version == null) try_getconf: { ++ var buf: [4096]u8 = undefined; ++ var fba = std.heap.FixedBufferAllocator.init(&buf); ++ const allocator = fba.allocator(); ++ ++ const getconf = std.process.Child.exec(.{ ++ .allocator = allocator, ++ .argv = &.{ "getconf", "GNU_LIBC_VERSION" }, ++ .max_output_bytes = 1024, ++ }) catch break :try_getconf; ++ if (!std.mem.startsWith(u8, getconf.stdout, "glibc ")) break :try_getconf; ++ const version_string = getconf.stdout["glibc ".len..]; ++ const glibc_version = parseWithOptionalPatchField(version_string) catch break :try_getconf; ++ ++ var os_with_glibc = os; ++ os_with_glibc.version_range.linux.glibc = glibc_version; ++ ++ const result: NativeTargetInfo = .{ ++ .target = .{ ++ .cpu = cpu, ++ .os = os_with_glibc, ++ .abi = cross_target.abi orelse Target.Abi.default(cpu.arch, os_with_glibc), ++ .ofmt = cross_target.ofmt orelse Target.ObjectFormat.default(os_with_glibc.tag, cpu.arch), ++ }, ++ .dynamic_linker = cross_target.dynamic_linker, ++ }; ++ return result; ++ } ++ + // Best case scenario: the executable is dynamically linked, and we can iterate + // over our own shared objects and find a dynamic linker. + const elf_file = blk: { +@@ -563,7 +618,7 @@ fn glibcVerFromSoFile(file: fs.File) !std.SemanticVersion { + while (it.next()) |s| { + if (mem.startsWith(u8, s, "GLIBC_2.")) { + const chopped = s["GLIBC_".len..]; +- const ver = std.SemanticVersion.parse(chopped) catch |err| switch (err) { ++ const ver = parseWithOptionalPatchField(chopped) catch |err| switch (err) { + error.Overflow => return error.InvalidGnuLibCVersion, + error.InvalidVersion => return error.InvalidGnuLibCVersion, + }; +@@ -586,7 +641,7 @@ fn glibcVerFromLinkName(link_name: []const u8, prefix: []const u8) !std.Semantic + } + // chop off "libc-" and ".so" + const link_name_chopped = link_name[prefix.len .. link_name.len - suffix.len]; +- return std.SemanticVersion.parse(link_name_chopped) catch |err| switch (err) { ++ return parseWithOptionalPatchField(link_name_chopped) catch |err| switch (err) { + error.Overflow => return error.InvalidGnuLibCVersion, + error.InvalidVersion => return error.InvalidGnuLibCVersion, + }; diff --git a/dev-lang/zig/zig-0.10.1-r3.ebuild b/dev-lang/zig/zig-0.10.1-r3.ebuild deleted file mode 100644 index b85fc3c95232..000000000000 --- a/dev-lang/zig/zig-0.10.1-r3.ebuild +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright 2019-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -LLVM_MAX_SLOT=15 -inherit edo cmake llvm check-reqs toolchain-funcs - -DESCRIPTION="A robust, optimal, and maintainable programming language" -HOMEPAGE="https://ziglang.org/" -if [[ ${PV} == 9999 ]]; then - EGIT_REPO_URI="https://github.com/ziglang/zig.git" - inherit git-r3 -else - SRC_URI="https://ziglang.org/download/${PV}/${P}.tar.xz" - KEYWORDS="~amd64 ~arm ~arm64" -fi - -# project itself: MIT -# There are bunch of projects under "lib/" folder that are needed for cross-compilation. -# Files that are unnecessary for cross-compilation are removed by upstream -# and therefore their licenses (if any special) are not included. -# lib/libunwind: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxxabi: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxx: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libc/wasi: || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain -# lib/libc/musl: MIT BSD-2 -# lib/libc/mingw: ZPL public-domain BSD-2 ISC HPND -# lib/libc/glibc: BSD HPND ISC inner-net LGPL-2.1+ -LICENSE="MIT Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain BSD-2 ZPL ISC HPND BSD inner-net LGPL-2.1+" -SLOT="$(ver_cut 1-2)" -IUSE="doc" - -BUILD_DIR="${S}/build" -# Zig requires zstd and zlib compression support in LLVM, if using LLVM backend. -# (non-LLVM backends don't require these) -# They are not required "on their own", so please don't add them here. -# You can check https://github.com/ziglang/zig-bootstrap in future, to see -# options that are passed to LLVM CMake building (excluding "static" ofc). -DEPEND=" - sys-devel/clang:${LLVM_MAX_SLOT}= - sys-devel/lld:${LLVM_MAX_SLOT}= - sys-devel/llvm:${LLVM_MAX_SLOT}=[zstd] -" - -RDEPEND=" - ${DEPEND} -" - -IDEPEND="app-eselect/eselect-zig" - -# see https://github.com/ziglang/zig/issues/3382 -# For now, Zig Build System doesn't support enviromental CFLAGS/LDFLAGS/etc. -QA_FLAGS_IGNORED="usr/.*/zig/${PV}/bin/zig" - -# see https://ziglang.org/download/0.10.0/release-notes.html#Self-Hosted-Compiler -# 0.10.0 release - ~9.6 GiB, since we use compiler written in C++ for bootstrapping -# 0.11.0 release - ~2.8 GiB, since we will (at least according to roadmap) use self-hosted compiler -# (transpiled to C via C backend) for bootstrapping -CHECKREQS_MEMORY="10G" - -PATCHES=( - "${FILESDIR}/zig-0.10.0-build-dir-install-stage3.patch" - "${FILESDIR}/zig-0.10.1-musl-1.2.4-lfs64.patch" -) - -llvm_check_deps() { - has_version "sys-devel/clang:${LLVM_SLOT}" -} - -ctarget_to_zigtarget() { - # Zig's Target Format: arch-os-abi - local CTARGET="${CTARGET:-${CHOST}}" - - local ZIG_ARCH - case "${CTARGET%%-*}" in - i?86) ZIG_ARCH=x86;; - sparcv9) ZIG_ARCH=sparc64;; - *) ZIG_ARCH="${CTARGET%%-*}";; # Same as in CHOST - esac - - local ZIG_OS - case "${CTARGET}" in - *linux*) ZIG_OS=linux;; - *apple*) ZIG_OS=macos;; - esac - - local ZIG_ABI - case "${CTARGET##*-}" in - gnu) ZIG_ABI=gnu;; - solaris*) ZIG_OS=solaris ZIG_ABI=none;; - darwin*) ZIG_ABI=none;; - *) ZIG_ABI="${CTARGET##*-}";; # Same as in CHOST - esac - - echo "${ZIG_ARCH}-${ZIG_OS}-${ZIG_ABI}" -} - -get_zig_mcpu() { - local ZIG_DEFAULT_MCPU=native - tc-is-cross-compiler && ZIG_DEFAULT_MCPU=baseline - echo "${ZIG_MCPU:-${ZIG_DEFAULT_MCPU}}" -} - -get_zig_target() { - local ZIG_DEFAULT_TARGET=native - tc-is-cross-compiler && ZIG_DEFAULT_TARGET="$(ctarget_to_zigtarget)" - echo "${ZIG_TARGET:-${ZIG_DEFAULT_TARGET}}" -} - -pkg_setup() { - llvm_pkg_setup - elog "This version requires 10G of memory for building compiler." - elog "If you don't have enough memory, you can wait until 0.11.0 release" - elog "or (if you are risky) use 9999 version (currently requires only 4GB)" - check-reqs_pkg_setup -} - -src_configure() { - local mycmakeargs=( - -DZIG_USE_CCACHE=OFF - -DZIG_SHARED_LLVM=ON - -DZIG_TARGET_TRIPLE="$(get_zig_target)" - -DZIG_TARGET_MCPU="$(get_zig_mcpu)" - -DZIG_USE_LLVM_CONFIG=ON - -DCMAKE_PREFIX_PATH="$(get_llvm_prefix ${LLVM_MAX_SLOT})" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/$(get_libdir)/zig/${PV}" - ) - - cmake_src_configure -} - -src_compile() { - cmake_src_compile - - if use doc; then - cd "${BUILD_DIR}" || die - edo ./zig2 run ../doc/docgen.zig -- ./zig2 ../doc/langref.html.in "${S}/langref.html" - edo ./zig2 test ../lib/std/std.zig --zig-lib-dir ../lib -fno-emit-bin -femit-docs="${S}/std" - fi -} - -src_test() { - cd "${BUILD_DIR}" || die - local ZIG_TEST_ARGS="-Dstatic-llvm=false -Denable-llvm -Dskip-non-native \ - -Drelease -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)" - local ZIG_TEST_STEPS=( - test-cases test-fmt test-behavior test-compiler-rt test-universal-libc test-compare-output - test-standalone test-c-abi test-link test-stack-traces test-cli test-asm-link test-translate-c - test-run-translated-c test-std - ) - - local step - for step in "${ZIG_TEST_STEPS[@]}" ; do - edob ./stage3/bin/zig build ${step} ${ZIG_TEST_ARGS} - done -} - -src_install() { - use doc && local HTML_DOCS=( "langref.html" "std" ) - cmake_src_install - cd "${ED}/usr/$(get_libdir)/zig/${PV}/" || die - mv lib/zig/ lib2/ || die - rm -rf lib/ || die - mv lib2/ lib/ || die - - dosym -r "/usr/$(get_libdir)/zig/${PV}/bin/zig" "/usr/bin/zig-${PV}" -} - -pkg_postinst() { - eselect zig update ifunset - - elog "0.10.1 release uses self-hosted compiler by default and fixes some bugs from 0.10.0" - elog "But your code still can be un-compilable since some features still not implemented or bugs not fixed" - elog "Upstream recommends:" - elog " * Using old compiler if experiencing such breakage (flag '-fstage1')" - elog " * Waiting for release 0.11.0 with old compiler removed (these changes are already merged in 9999)" - elog "Also see: https://ziglang.org/download/0.10.0/release-notes.html#Self-Hosted-Compiler" - elog "and https://ziglang.org/download/0.10.0/release-notes.html#How-to-Upgrade" -} - -pkg_postrm() { - eselect zig update ifunset -} diff --git a/dev-lang/zig/zig-0.11.0-r1.ebuild b/dev-lang/zig/zig-0.11.0-r1.ebuild new file mode 100644 index 000000000000..633b6e1c6399 --- /dev/null +++ b/dev-lang/zig/zig-0.11.0-r1.ebuild @@ -0,0 +1,177 @@ +# Copyright 2019-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_MAX_SLOT=16 +inherit edo cmake llvm check-reqs toolchain-funcs + +DESCRIPTION="A robust, optimal, and maintainable programming language" +HOMEPAGE="https://ziglang.org/" +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://github.com/ziglang/zig.git" + inherit git-r3 +else + SRC_URI="https://ziglang.org/download/${PV}/${P}.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64" +fi + +# project itself: MIT +# There are bunch of projects under "lib/" folder that are needed for cross-compilation. +# Files that are unnecessary for cross-compilation are removed by upstream +# and therefore their licenses (if any special) are not included. +# lib/libunwind: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libcxxabi: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libcxx: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) +# lib/libc/wasi: || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain +# lib/libc/musl: MIT BSD-2 +# lib/libc/mingw: ZPL public-domain BSD-2 ISC HPND +# lib/libc/glibc: BSD HPND ISC inner-net LGPL-2.1+ +LICENSE="MIT Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain BSD-2 ZPL ISC HPND BSD inner-net LGPL-2.1+" +SLOT="$(ver_cut 1-2)" +IUSE="doc" + +BUILD_DIR="${S}/build" + +# Zig requires zstd and zlib compression support in LLVM, if using LLVM backend. +# (non-LLVM backends don't require these) +# They are not required "on their own", so please don't add them here. +# You can check https://github.com/ziglang/zig-bootstrap in future, to see +# options that are passed to LLVM CMake building (excluding "static" ofc). +DEPEND=" + sys-devel/clang:${LLVM_MAX_SLOT}= + sys-devel/lld:${LLVM_MAX_SLOT}= + sys-devel/llvm:${LLVM_MAX_SLOT}=[zstd] +" + +RDEPEND=" + ${DEPEND} +" + +IDEPEND="app-eselect/eselect-zig" + +# see https://github.com/ziglang/zig/issues/3382 +# For now, Zig Build System doesn't support enviromental CFLAGS/LDFLAGS/etc. +QA_FLAGS_IGNORED="usr/.*/zig/${PV}/bin/zig" + +# Since commit https://github.com/ziglang/zig/commit/e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 +# Zig uses self-hosted compiler only +CHECKREQS_MEMORY="4G" + +PATCHES=( + "${FILESDIR}/zig-0.11.0-first-try-getconf.patch" +) + +llvm_check_deps() { + has_version "sys-devel/clang:${LLVM_SLOT}" +} + +ctarget_to_zigtarget() { + # Zig's Target Format: arch-os-abi + local CTARGET="${CTARGET:-${CHOST}}" + + local ZIG_ARCH + case "${CTARGET%%-*}" in + i?86) ZIG_ARCH=x86;; + sparcv9) ZIG_ARCH=sparc64;; + *) ZIG_ARCH="${CTARGET%%-*}";; # Same as in CHOST + esac + + local ZIG_OS + case "${CTARGET}" in + *linux*) ZIG_OS=linux;; + *apple*) ZIG_OS=macos;; + esac + + local ZIG_ABI + case "${CTARGET##*-}" in + gnu) ZIG_ABI=gnu;; + solaris*) ZIG_OS=solaris ZIG_ABI=none;; + darwin*) ZIG_ABI=none;; + *) ZIG_ABI="${CTARGET##*-}";; # Same as in CHOST + esac + + echo "${ZIG_ARCH}-${ZIG_OS}-${ZIG_ABI}" +} + +get_zig_mcpu() { + local ZIG_DEFAULT_MCPU=native + tc-is-cross-compiler && ZIG_DEFAULT_MCPU=baseline + echo "${ZIG_MCPU:-${ZIG_DEFAULT_MCPU}}" +} + +get_zig_target() { + local ZIG_DEFAULT_TARGET=native + tc-is-cross-compiler && ZIG_DEFAULT_TARGET="$(ctarget_to_zigtarget)" + echo "${ZIG_TARGET:-${ZIG_DEFAULT_TARGET}}" +} + +pkg_setup() { + llvm_pkg_setup + check-reqs_pkg_setup +} + +src_configure() { + # Useful for debugging and a little bit more deterministic. + export ZIG_LOCAL_CACHE_DIR="${T}/zig-local-cache" + export ZIG_GLOBAL_CACHE_DIR="${T}/zig-global-cache" + + local mycmakeargs=( + -DZIG_USE_CCACHE=OFF + -DZIG_SHARED_LLVM=ON + -DZIG_TARGET_TRIPLE="$(get_zig_target)" + -DZIG_TARGET_MCPU="$(get_zig_mcpu)" + -DZIG_USE_LLVM_CONFIG=ON + -DCMAKE_PREFIX_PATH="$(get_llvm_prefix ${LLVM_MAX_SLOT})" + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/$(get_libdir)/zig/${PV}" + ) + + cmake_src_configure +} + +src_compile() { + cmake_src_compile + + "${BUILD_DIR}/stage3/bin/zig" env || die "Zig compilation failed" + + if use doc; then + cd "${BUILD_DIR}" || die + edo ./stage3/bin/zig build std-docs --prefix "${S}/docgen/" + edo ./stage3/bin/zig build langref --prefix "${S}/docgen/" + fi +} + +src_test() { + cd "${BUILD_DIR}" || die + local ZIG_TEST_ARGS="-Dstatic-llvm=false -Denable-llvm -Dskip-non-native \ + -Doptimize=ReleaseSafe -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)" + local ZIG_TEST_STEPS=( + test-cases test-fmt test-behavior test-compiler-rt test-universal-libc test-compare-output + test-standalone test-c-abi test-link test-stack-traces test-cli test-asm-link test-translate-c + test-run-translated-c test-std + ) + + local step + for step in "${ZIG_TEST_STEPS[@]}" ; do + edob ./stage3/bin/zig build ${step} ${ZIG_TEST_ARGS} + done +} + +src_install() { + use doc && local HTML_DOCS=( "docgen/doc/langref.html" "docgen/doc/std" ) + cmake_src_install + + cd "${ED}/usr/$(get_libdir)/zig/${PV}/" || die + mv lib/zig/ lib2/ || die + rm -rf lib/ || die + mv lib2/ lib/ || die + dosym -r "/usr/$(get_libdir)/zig/${PV}/bin/zig" "/usr/bin/zig-${PV}" +} + +pkg_postinst() { + eselect zig update ifunset +} + +pkg_postrm() { + eselect zig update ifunset +} diff --git a/dev-lang/zig/zig-0.11.0.ebuild b/dev-lang/zig/zig-0.11.0.ebuild deleted file mode 100644 index 1644ef100c5c..000000000000 --- a/dev-lang/zig/zig-0.11.0.ebuild +++ /dev/null @@ -1,167 +0,0 @@ -# Copyright 2019-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -LLVM_MAX_SLOT=16 -inherit edo cmake llvm check-reqs toolchain-funcs - -DESCRIPTION="A robust, optimal, and maintainable programming language" -HOMEPAGE="https://ziglang.org/" -if [[ ${PV} == 9999 ]]; then - EGIT_REPO_URI="https://github.com/ziglang/zig.git" - inherit git-r3 -else - SRC_URI="https://ziglang.org/download/${PV}/${P}.tar.xz" - KEYWORDS="~amd64 ~arm ~arm64" -fi - -# project itself: MIT -# There are bunch of projects under "lib/" folder that are needed for cross-compilation. -# Files that are unnecessary for cross-compilation are removed by upstream -# and therefore their licenses (if any special) are not included. -# lib/libunwind: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxxabi: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libcxx: Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) -# lib/libc/wasi: || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain -# lib/libc/musl: MIT BSD-2 -# lib/libc/mingw: ZPL public-domain BSD-2 ISC HPND -# lib/libc/glibc: BSD HPND ISC inner-net LGPL-2.1+ -LICENSE="MIT Apache-2.0-with-LLVM-exceptions || ( UoI-NCSA MIT ) || ( Apache-2.0-with-LLVM-exceptions Apache-2.0 MIT BSD-2 ) public-domain BSD-2 ZPL ISC HPND BSD inner-net LGPL-2.1+" -SLOT="$(ver_cut 1-2)" -IUSE="doc" - -BUILD_DIR="${S}/build" - -# Zig requires zstd and zlib compression support in LLVM, if using LLVM backend. -# (non-LLVM backends don't require these) -# They are not required "on their own", so please don't add them here. -# You can check https://github.com/ziglang/zig-bootstrap in future, to see -# options that are passed to LLVM CMake building (excluding "static" ofc). -DEPEND=" - sys-devel/clang:${LLVM_MAX_SLOT}= - sys-devel/lld:${LLVM_MAX_SLOT}= - sys-devel/llvm:${LLVM_MAX_SLOT}=[zstd] -" - -RDEPEND=" - ${DEPEND} -" - -IDEPEND="app-eselect/eselect-zig" - -# see https://github.com/ziglang/zig/issues/3382 -# For now, Zig Build System doesn't support enviromental CFLAGS/LDFLAGS/etc. -QA_FLAGS_IGNORED="usr/.*/zig/${PV}/bin/zig" - -# Since commit https://github.com/ziglang/zig/commit/e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 -# Zig uses self-hosted compiler only -CHECKREQS_MEMORY="4G" - -llvm_check_deps() { - has_version "sys-devel/clang:${LLVM_SLOT}" -} - -ctarget_to_zigtarget() { - # Zig's Target Format: arch-os-abi - local CTARGET="${CTARGET:-${CHOST}}" - - local ZIG_ARCH - case "${CTARGET%%-*}" in - i?86) ZIG_ARCH=x86;; - sparcv9) ZIG_ARCH=sparc64;; - *) ZIG_ARCH="${CTARGET%%-*}";; # Same as in CHOST - esac - - local ZIG_OS - case "${CTARGET}" in - *linux*) ZIG_OS=linux;; - *apple*) ZIG_OS=macos;; - esac - - local ZIG_ABI - case "${CTARGET##*-}" in - gnu) ZIG_ABI=gnu;; - solaris*) ZIG_OS=solaris ZIG_ABI=none;; - darwin*) ZIG_ABI=none;; - *) ZIG_ABI="${CTARGET##*-}";; # Same as in CHOST - esac - - echo "${ZIG_ARCH}-${ZIG_OS}-${ZIG_ABI}" -} - -get_zig_mcpu() { - local ZIG_DEFAULT_MCPU=native - tc-is-cross-compiler && ZIG_DEFAULT_MCPU=baseline - echo "${ZIG_MCPU:-${ZIG_DEFAULT_MCPU}}" -} - -get_zig_target() { - local ZIG_DEFAULT_TARGET=native - tc-is-cross-compiler && ZIG_DEFAULT_TARGET="$(ctarget_to_zigtarget)" - echo "${ZIG_TARGET:-${ZIG_DEFAULT_TARGET}}" -} - -pkg_setup() { - llvm_pkg_setup - check-reqs_pkg_setup -} - -src_configure() { - local mycmakeargs=( - -DZIG_USE_CCACHE=OFF - -DZIG_SHARED_LLVM=ON - -DZIG_TARGET_TRIPLE="$(get_zig_target)" - -DZIG_TARGET_MCPU="$(get_zig_mcpu)" - -DZIG_USE_LLVM_CONFIG=ON - -DCMAKE_PREFIX_PATH="$(get_llvm_prefix ${LLVM_MAX_SLOT})" - -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/$(get_libdir)/zig/${PV}" - ) - - cmake_src_configure -} - -src_compile() { - cmake_src_compile - - if use doc; then - cd "${BUILD_DIR}" || die - edo ./stage3/bin/zig build std-docs --prefix "${S}/docgen/" - edo ./stage3/bin/zig build langref --prefix "${S}/docgen/" - fi -} - -src_test() { - cd "${BUILD_DIR}" || die - local ZIG_TEST_ARGS="-Dstatic-llvm=false -Denable-llvm -Dskip-non-native \ - -Doptimize=ReleaseSafe -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)" - local ZIG_TEST_STEPS=( - test-cases test-fmt test-behavior test-compiler-rt test-universal-libc test-compare-output - test-standalone test-c-abi test-link test-stack-traces test-cli test-asm-link test-translate-c - test-run-translated-c test-std - ) - - local step - for step in "${ZIG_TEST_STEPS[@]}" ; do - edob ./stage3/bin/zig build ${step} ${ZIG_TEST_ARGS} - done -} - -src_install() { - use doc && local HTML_DOCS=( "docgen/doc/langref.html" "docgen/doc/std" ) - cmake_src_install - - cd "${ED}/usr/$(get_libdir)/zig/${PV}/" || die - mv lib/zig/ lib2/ || die - rm -rf lib/ || die - mv lib2/ lib/ || die - dosym -r "/usr/$(get_libdir)/zig/${PV}/bin/zig" "/usr/bin/zig-${PV}" -} - -pkg_postinst() { - eselect zig update ifunset -} - -pkg_postrm() { - eselect zig update ifunset -} diff --git a/dev-lang/zig/zig-9999.ebuild b/dev-lang/zig/zig-9999.ebuild index e6ab3dbeeb61..9605234cfc43 100644 --- a/dev-lang/zig/zig-9999.ebuild +++ b/dev-lang/zig/zig-9999.ebuild @@ -108,6 +108,10 @@ pkg_setup() { } src_configure() { + # Useful for debugging and a little bit more deterministic. + export ZIG_LOCAL_CACHE_DIR="${T}/zig-local-cache" + export ZIG_GLOBAL_CACHE_DIR="${T}/zig-global-cache" + local mycmakeargs=( -DZIG_USE_CCACHE=OFF -DZIG_SHARED_LLVM=ON @@ -124,6 +128,8 @@ src_configure() { src_compile() { cmake_src_compile + "${BUILD_DIR}/stage3/bin/zig" env || die "Zig compilation failed" + if use doc; then cd "${BUILD_DIR}" || die edo ./stage3/bin/zig build std-docs --prefix "${S}/docgen/" -- cgit v1.2.3