From 0fd62365fc104d7e6d5f3ef67800df09225a4019 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Thu, 9 Mar 2023 12:02:14 +0000 Subject: gentoo auto-resync : 09:03:2023 - 12:02:14 --- dev-lang/Manifest.gz | Bin 19677 -> 19678 bytes dev-lang/zig-bin/Manifest | 1 + dev-lang/zig-bin/zig-bin-0.10.1-r1.ebuild | 62 +++++++++++ dev-lang/zig/Manifest | 3 +- dev-lang/zig/zig-0.10.1-r1.ebuild | 171 ++++++++++++++++++++++++++++++ dev-lang/zig/zig-9999.ebuild | 90 ++++++++++++++-- 6 files changed, 320 insertions(+), 7 deletions(-) create mode 100644 dev-lang/zig-bin/zig-bin-0.10.1-r1.ebuild create mode 100644 dev-lang/zig/zig-0.10.1-r1.ebuild (limited to 'dev-lang') diff --git a/dev-lang/Manifest.gz b/dev-lang/Manifest.gz index 85565c157327..5f118a9c0e56 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 577c09960112..cb11bad4c376 100644 --- a/dev-lang/zig-bin/Manifest +++ b/dev-lang/zig-bin/Manifest @@ -9,5 +9,6 @@ DIST zig-linux-riscv64-0.10.1.tar.xz 42196008 BLAKE2B a7ae37b1d1db1281b09bbd7e35 DIST zig-linux-x86_64-0.10.0.tar.xz 44142400 BLAKE2B 7ba72ce57e616c5ead2fb84dc7e1b0ff08e8dffab56ca30cd00bff1d9b80fd62034f3d78b903f37f911665239a4717a6e93230faa77b3f387b0dada835672fb7 SHA512 87037766e58a736d7e4f9fca1c21dce070f2de8cd08dae7951e67252327b72dd69f79831f5c8e406be7ecc6522184400eba3bd265d3c7020c8fa4d2efc9f8766 DIST zig-linux-x86_64-0.10.1.tar.xz 44085596 BLAKE2B d689a469dbbe790593a561dd4df01c506212754c48be7de03773c7e690cbab197af10d639e80148f3343204ddf9ecfe09a88a62fb6ef63a262bcc2dd79fecd34 SHA512 1cf88a492b1a47800e213b8801477f4ffabf269f960d27d1849c5aec805b5db3768c83d4daa4a738532b1b7367e8c6812e3eea47c205ea732d7a6269a47e16dc EBUILD zig-bin-0.10.0.ebuild 1999 BLAKE2B 5f58d0fb901f1ddcbdd5939687ea4c3d5f6211198efebb0e215999f4156af2a1e76df3bffd7781f57579c2a3026bb8805b2dcc53863141b299155c0f9be08743 SHA512 449e70f2ba79903e6aa97d96260fced9cf2efb76e4a4b111e37c83de735662a7b7ef31d07a2da8b39995e6ab3c55f69aa53b5076fc80e5d2960eee70b60ad61f +EBUILD zig-bin-0.10.1-r1.ebuild 2156 BLAKE2B fcb150895a2c080b332aed35b8b1edbb599fb2c0677c3d31c7f17721cd225feef773de671df1dc6ef85ba9acdccf7c0c2db4b3eebe3a5a2728342992369d5d43 SHA512 f1ed0b89fda56b2be26cd01c5066a8a8a315bc82d89ee1befd851d214d3c8b24b03d736206b2dcb8d58843452bc8d29b34762e0204d005affd60905dc579ab97 EBUILD zig-bin-0.10.1.ebuild 1978 BLAKE2B 88c315e88ebb5c3e4398709ed6c30f7ecc6e21d0975b99f3da59d362dd81690d509a08474ce19a07c76b37a94584c8e03d18cae9a395857ae8bfb50e1c8cad74 SHA512 e0d998899bb55576ad37b8d88c0a8e593a8361ffc43249d4f861f3546832d859ec61c203b914d49e8bce2a2a6c83f29836f459d1c191a9ce105714bfa904e0f4 MISC metadata.xml 541 BLAKE2B 6f5c7fbf759f0430f69073a17a0dae4b8bebf335b54c3b43da6b24104dc3de05a3b686cddbbd31e4dae1fc31695a2f08d000d22437ed6f1847de8fa95e3b1952 SHA512 d49cf0a8ad76ac9a6f6fb091effddbbcd812b56f91df6d3c782e15197cb4ff4423fb1076671a232aabcb9833af19ef8c820ad6df312a1e4d72e665680314c083 diff --git a/dev-lang/zig-bin/zig-bin-0.10.1-r1.ebuild b/dev-lang/zig-bin/zig-bin-0.10.1-r1.ebuild new file mode 100644 index 000000000000..30514b6b713a --- /dev/null +++ b/dev-lang/zig-bin/zig-bin-0.10.1-r1.ebuild @@ -0,0 +1,62 @@ +# 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 ) + riscv? ( https://ziglang.org/download/${PV}/zig-linux-riscv64-${PV}.tar.xz ) + x86? ( https://ziglang.org/download/${PV}/zig-linux-i386-${PV}.tar.xz )" + +LICENSE="MIT" +SLOT="$(ver_cut 1-2)" +KEYWORDS="-* ~amd64 ~arm ~arm64 ~riscv ~x86" +IUSE="doc" + +RDEPEND="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 + + 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/Manifest b/dev-lang/zig/Manifest index aa442bd46cb6..1ccbeb1ed7ec 100644 --- a/dev-lang/zig/Manifest +++ b/dev-lang/zig/Manifest @@ -3,6 +3,7 @@ AUX zig-0.10.0-build-dir-install-stage3.patch 1430 BLAKE2B cca909207cadfe1c9b31b DIST zig-0.10.0.tar.xz 14530912 BLAKE2B 5949a44ee039b7d5a163344a0fc26af8dd9cf311ed25c7092a665bb59ec7dec8dc3cd39918d81ef02c707aa8989b038fb21dfba3927fd31153a1404739b4ea3c SHA512 9d83ce51cc0ce404c06da820179c1cc47aa50e573fb1c831a96baa12c6b5226abe85b384110f2ffc4cbdc5f24eaba1f14a4e3249ffeaa248c0d73ba29859e682 DIST zig-0.10.1.tar.xz 15143112 BLAKE2B 4954d95ad763000eedf73a78e62bc0e99d65bba91c7127cdf1ea4503eb67817265daf572f645b7efbe9e24087e690b2768f0b2bc6c43b5fd76eab33143e964fe SHA512 d443adf61556bc95470537c6b0371a0ac99d19a06b15635cf1e5055ae7849039680c9006105e06e1bd6ba0fc12da14c54c1d28ac597c7dee17ee3a5cd9cf79f8 EBUILD zig-0.10.0-r1.ebuild 3295 BLAKE2B 0997f58541abc6687278dd7eec16944a16b90bd58dc5a4ededea12dbfe9006264fc087c937eb5d1a4579d016df222a5aa8ed721fe42124a0fc85984fe7b38ec3 SHA512 ea1dec43578750945a3401ca1a2cefce0be9bc8da06a65c0e6da2684be6be0ff41b315f110a9ec9f8af99298c16b7369a37c21027ee1f53e82ecaceee13dce56 +EBUILD zig-0.10.1-r1.ebuild 4997 BLAKE2B 8463babcd1f7f016a334860f4dfe92810f689572472b6028059d81e2612a0697ee855c6e2740d79467099f7cb6d815ebbc9a35c75878a1fb7ea70483e384cddf SHA512 3208402b00e8098932137c6399ca4a5a605f505b0666c0a7c9562fb1498b01e4d7fb0d7c71cc0bb767545e51c4c7f577f1da5d14995ec8aaa056c4a21db3a503 EBUILD zig-0.10.1.ebuild 3205 BLAKE2B 977a4dec97a9bb7708581758e8f99155c3d03b68723e2703f657c096d661555ba50549854c5c31d0ff8bdd412442dd223dd4323182999b8f1fed61dcfe4c06d4 SHA512 0e7861a183c917b9ed8452d302bcec688ca891cfe0a68b88ae59204e96fda138c4f1fc6e17a581708769ee1696aec28c6b25af1af16fe8c4c88a9eab6675ecce -EBUILD zig-9999.ebuild 1671 BLAKE2B b753bbd37c7f1f60bdb2bc8fe3914d21f5b30787768460b55bd9e1980dc4727eb4f71c63a03da17a8a98c681df5e33e311b48c9c42fde8ab1b43a3bc9b3f4f90 SHA512 2b4d5a8fdfe5eba60896915b81168d5eb0aa3bcf53d6df8326c593f275556cf8652c401f0780f977325e877d36aa9348a196168f3e2c3dc3af99a8f5a1b46301 +EBUILD zig-9999.ebuild 3707 BLAKE2B 5b84b89a318871d48e922f1fb0e95284c53c9557fb5bfccd0a8350bf6f374d6a110d89c5b38d2768a9503380e74f88e6825e9cc3ef809d6e21d17ad4327cccc5 SHA512 baf0c8049385e282c7f6ca3b0d54dcc151e0f6fb3e154fc44c77e00e517ce89e91c2933158d62abd09bd0f229a9bfc4a81328e701b06e6057f532aca515510fc MISC metadata.xml 541 BLAKE2B 6f5c7fbf759f0430f69073a17a0dae4b8bebf335b54c3b43da6b24104dc3de05a3b686cddbbd31e4dae1fc31695a2f08d000d22437ed6f1847de8fa95e3b1952 SHA512 d49cf0a8ad76ac9a6f6fb091effddbbcd812b56f91df6d3c782e15197cb4ff4423fb1076671a232aabcb9833af19ef8c820ad6df312a1e4d72e665680314c083 diff --git a/dev-lang/zig/zig-0.10.1-r1.ebuild b/dev-lang/zig/zig-0.10.1-r1.ebuild new file mode 100644 index 000000000000..d92a0e709dda --- /dev/null +++ b/dev-lang/zig/zig-0.10.1-r1.ebuild @@ -0,0 +1,171 @@ +# 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 + +LICENSE="MIT" +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} + 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/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" +) + +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-9999.ebuild b/dev-lang/zig/zig-9999.ebuild index 04794281b8d8..b3846db59b81 100644 --- a/dev-lang/zig/zig-9999.ebuild +++ b/dev-lang/zig/zig-9999.ebuild @@ -1,10 +1,10 @@ -# Copyright 2019-2022 Gentoo Authors +# Copyright 2019-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 LLVM_MAX_SLOT=15 -inherit cmake llvm check-reqs +inherit edo cmake llvm check-reqs toolchain-funcs DESCRIPTION="A robust, optimal, and maintainable programming language" HOMEPAGE="https://ziglang.org/" @@ -17,7 +17,8 @@ else fi LICENSE="MIT" -SLOT="0" +SLOT="$(ver_cut 1-2)" +IUSE="doc" BUILD_DIR="${S}/build" @@ -34,10 +35,11 @@ DEPEND=" RDEPEND=" ${DEPEND} - !dev-lang/zig-bin + 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/bin/zig" # Since commit https://github.com/ziglang/zig/commit/e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118 @@ -48,6 +50,46 @@ 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 @@ -57,13 +99,49 @@ src_configure() { local mycmakeargs=( -DZIG_USE_CCACHE=OFF -DZIG_SHARED_LLVM=ON - -DCMAKE_PREFIX_PATH=$(get_llvm_prefix ${LLVM_MAX_SLOT}) + -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 -- --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 - ./zig2 build test -Dstatic-llvm=false -Denable-llvm=true -Dskip-non-native=true || die + local ZIG_TEST_ARGS="-Dstatic-llvm=false -Denable-llvm -Dskip-non-native \ + -Drelease -Dtarget=$(get_zig_target) -Dcpu=$(get_zig_mcpu)" + # TBF zig2 -> stage3/bin/zig when (if) https://github.com/ziglang/zig/pull/14255 will be merged + edo ./zig2 build test ${ZIG_TEST_ARGS} +} + +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 +} + +pkg_postrm() { + eselect zig update ifunset } -- cgit v1.2.3