diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-10-27 08:42:41 +0100 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-10-27 08:42:41 +0100 |
commit | 0fcaac21e786bd7911b1e8f436cd885c5e2f6437 (patch) | |
tree | ba392915815492b0ce486fc0e3ad5afb4a849b6f /dev-lang/zig-bin | |
parent | e30edd47e1804bf3ed1ea7be2eac67f4b8cd9f38 (diff) |
gentoo auto-resync : 27:10:2023 - 08:42:41
Diffstat (limited to 'dev-lang/zig-bin')
-rw-r--r-- | dev-lang/zig-bin/Manifest | 3 | ||||
-rw-r--r-- | dev-lang/zig-bin/files/zig-0.11.0-first-try-getconf.patch | 109 | ||||
-rw-r--r-- | dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild (renamed from dev-lang/zig-bin/zig-bin-0.11.0.ebuild) | 4 |
3 files changed, 114 insertions, 2 deletions
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 <bratishkaerik@getgoogleoff.me> + +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.ebuild b/dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild index 2ff67d9e16aa..92775c190670 100644 --- a/dev-lang/zig-bin/zig-bin-0.11.0.ebuild +++ b/dev-lang/zig-bin/zig-bin-0.11.0-r1.ebuild @@ -36,7 +36,9 @@ IDEPEND="app-eselect/eselect-zig" # 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=() +PATCHES=( + "${FILESDIR}/zig-0.11.0-first-try-getconf.patch" +) QA_PREBUILT="opt/${P}/zig" |