diff options
Diffstat (limited to 'dev-lang')
| -rw-r--r-- | dev-lang/hare/Manifest | 3 | ||||
| -rw-r--r-- | dev-lang/hare/hare-0.25.2-r2.ebuild | 60 | ||||
| -rw-r--r-- | dev-lang/hare/hare-0.26.0.1.ebuild (renamed from dev-lang/hare/hare-0.26.0-r1.ebuild) | 5 | ||||
| -rw-r--r-- | dev-lang/jerryscript/jerryscript-3.0.0.ebuild | 2 | ||||
| -rw-r--r-- | dev-lang/quickjs/Manifest | 1 | ||||
| -rw-r--r-- | dev-lang/quickjs/quickjs-2024.01.13-r1.ebuild | 54 | ||||
| -rw-r--r-- | dev-lang/scrapscript/scrapscript-0.1.1-r1.ebuild (renamed from dev-lang/scrapscript/scrapscript-0.1.1.ebuild) | 6 | ||||
| -rw-r--r-- | dev-lang/scrapscript/scrapscript-9999.ebuild | 6 | ||||
| -rw-r--r-- | dev-lang/souffle/souffle-2.5-r1.ebuild (renamed from dev-lang/souffle/souffle-2.5.ebuild) | 6 | ||||
| -rw-r--r-- | dev-lang/typescript/typescript-6.0.2.ebuild | 2 | ||||
| -rw-r--r-- | dev-lang/zig/Manifest | 2 | ||||
| -rw-r--r-- | dev-lang/zig/zig-0.16.0.ebuild | 356 | ||||
| -rw-r--r-- | dev-lang/zig/zig-9999.ebuild | 2 |
13 files changed, 370 insertions, 135 deletions
diff --git a/dev-lang/hare/Manifest b/dev-lang/hare/Manifest index 94eb0359f17f..7fee333a7af8 100644 --- a/dev-lang/hare/Manifest +++ b/dev-lang/hare/Manifest @@ -1,2 +1 @@ -DIST hare-0.25.2.tar.gz 940391 BLAKE2B 626b098a4a65c1a8760dc75317dd856f03915d564800beaa6c8708726bfd602c291d5e449139922293a3af087fa7ed2e9076e76e2e2731cab5908256d00894b5 SHA512 a72bda105c3bb40c0d43382f10030883d84d2b3511197890a4641eacfc84cbcf8f5aa15391d31e5b04b2e3154f5db0d7d855d08d213f9cd089ad536cbabdcec5 -DIST hare-0.26.0.tar.gz 976164 BLAKE2B fbcafe4d9efd3e69127b26d0128d2ff179edf72fa671e0d96157f410bc746b9596bb8b69350a4ee2ecd363f668c00efabc7585fbc329200658e2aaa68a9f0564 SHA512 3b3e4625f63b3ea5650bbb4c6e690b874292cae85a749cc602a120fa07437a491a0c4fba414565141e7de9b3736fde8d3ba7597b91f7f0d3fa4e95938a11ae77 +DIST hare-0.26.0.1.tar.gz 976995 BLAKE2B 1dec85ea7aeb3f124014817e912d300a116f784f0bf78b20e8d72587936c48786d2f83f7a73146ed6485e3e0cf454c92cb0b074abe9be79e8de7fe91156f2fd8 SHA512 61959ce95814f81e04d62eb783aa4dfd807b96c3bd1ee0ee31667d042c630be1406fb0b944f1b35776f5ce529eb55227fac1d37c30218020edb40c6b66ea6771 diff --git a/dev-lang/hare/hare-0.25.2-r2.ebuild b/dev-lang/hare/hare-0.25.2-r2.ebuild deleted file mode 100644 index ea2e67a9fa68..000000000000 --- a/dev-lang/hare/hare-0.25.2-r2.ebuild +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright 2021-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -if [[ "${PV}" = 9999 ]]; then - inherit git-r3 - EGIT_REPO_URI="https://git.sr.ht/~sircmpwn/hare" - SLOT="0" -else - MY_PV="$(ver_rs 3 -)" - MY_P="${PN}-${MY_PV}" - SRC_URI="https://git.sr.ht/~sircmpwn/hare/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz" - S="${WORKDIR}/${MY_P}" - SLOT="0/${PV}" - KEYWORDS="~amd64 ~arm64 ~riscv" -fi - -DESCRIPTION="The Hare systems programming language" -HOMEPAGE="https://harelang.org/" -LICENSE="MPL-2.0 GPL-3" - -# release policy: https://git.sr.ht/~sircmpwn/hare/tree/master/item/docs/release.md -DEPEND=" - ~dev-lang/harec-0.25.2 - >=sys-devel/qbe-1.2 -" -BDEPEND="app-text/scdoc" -RDEPEND="${DEPEND}" - -# hare and haredoc are built by hare -QA_FLAGS_IGNORED="usr/bin/hare usr/bin/haredoc" - -PATCHES=( - "${FILESDIR}/hare-0.25.2-os_exec-fix-clearenv.patch" -) - -src_configure() { - local target_arch - case ${ARCH} in - amd64 ) target_arch=x86_64 ;; - arm64 ) target_arch=aarch64 ;; - riscv ) target_arch=riscv64 ;; - * ) die "unsupported architecture: ${ARCH}" ;; - esac - - # Note: PREFIX needs to be set early as it is used for HAREPATH - cp configs/linux.mk config.mk || die - sed -i \ - -e "s;^ARCH =.*;ARCH = ${target_arch};" \ - -e "s;^PREFIX =.*;PREFIX = ${EPREFIX}/usr;" \ - -e 's;^AS =;AS ?=;' \ - -e 's;^LD =;LD ?=;' \ - -e 's;^AR =;AR ?=;' \ - config.mk || die -} - -src_install() { - emake DESTDIR="${D}" install -} diff --git a/dev-lang/hare/hare-0.26.0-r1.ebuild b/dev-lang/hare/hare-0.26.0.1.ebuild index 39c835c7cbe8..c3303acc6f74 100644 --- a/dev-lang/hare/hare-0.26.0-r1.ebuild +++ b/dev-lang/hare/hare-0.26.0.1.ebuild @@ -10,9 +10,8 @@ if [[ "${PV}" = 9999 ]]; then EGIT_REPO_URI="https://git.sr.ht/~sircmpwn/hare" SLOT="0" else - MY_PV="$(ver_rs 3 -)" - MY_P="${PN}-${MY_PV}" - SRC_URI="https://git.sr.ht/~sircmpwn/hare/archive/${MY_PV}.tar.gz -> ${MY_P}.tar.gz" + MY_P="${PN}-${PV}" + SRC_URI="https://git.sr.ht/~sircmpwn/hare/archive/${PV}.tar.gz -> ${MY_P}.tar.gz" S="${WORKDIR}/${MY_P}" SLOT="0/${PV}" KEYWORDS="~amd64 ~arm64 ~riscv" diff --git a/dev-lang/jerryscript/jerryscript-3.0.0.ebuild b/dev-lang/jerryscript/jerryscript-3.0.0.ebuild index c07879e90ca4..69741de9d869 100644 --- a/dev-lang/jerryscript/jerryscript-3.0.0.ebuild +++ b/dev-lang/jerryscript/jerryscript-3.0.0.ebuild @@ -1,4 +1,4 @@ -# Copyright 2021-2025 Gentoo Authors +# Copyright 2021-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 diff --git a/dev-lang/quickjs/Manifest b/dev-lang/quickjs/Manifest index 2636097c6f7d..8f7454b88bdc 100644 --- a/dev-lang/quickjs/Manifest +++ b/dev-lang/quickjs/Manifest @@ -1,2 +1 @@ -DIST quickjs-2024-01-13.tar.xz 765800 BLAKE2B 6d65d9ae19ef816a7e4784821d138d2be9965bbbea42c11f13adc0560dc6d67db9cd75c367680a5caec34182a320819127fc0d0c95c10fcf441161ca7880d5aa SHA512 9f426404e4dc1e2a41fcc235b72e58708041aed24eadd5fb9e82f62435501003d3a6b04831f307b04852551d2fd265b94cd400b3293ec0810465f52de8a6c057 DIST quickjs-2025-09-13-2.tar.xz 596244 BLAKE2B da4bdb04e87a3f6086287e352e878e9f5b78034feda5687f7e191a549a4e2e7a0aa54ce89dd25b99eb685ff83db5898021a314f05ca20830c99f59379c413c3e SHA512 ea20d9ce8b6e09e58f1c3dc51086cd23c1ca18de7b5711bbd88e86dbbba2589b950acd22003e33fbed94dd4ec3e1828e6af5342ea9c62024cce7ca11eca1029c diff --git a/dev-lang/quickjs/quickjs-2024.01.13-r1.ebuild b/dev-lang/quickjs/quickjs-2024.01.13-r1.ebuild deleted file mode 100644 index 3e5e8bd02a1d..000000000000 --- a/dev-lang/quickjs/quickjs-2024.01.13-r1.ebuild +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2021-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit toolchain-funcs - -MY_P="${PN}-${PV//./-}" - -DESCRIPTION="Small embeddable Javascript engine" -HOMEPAGE="https://bellard.org/quickjs/" -SRC_URI="https://bellard.org/quickjs/${MY_P}.tar.xz" -S="${WORKDIR}/${MY_P}" -LICENSE="MIT" -SLOT="0" -KEYWORDS="~amd64" -IUSE="lto static-libs" - -PATCHES=( - "${FILESDIR}/quickjs-2020.11.08_Remove-TTY-check-in-test.patch" - "${FILESDIR}/quickjs-2024-01-13-sharedlib.patch" - "${FILESDIR}/quickjs-2024-01-13-respect-env.patch" -) - -src_prepare() { - # Changed in master - sed -i '/^CONFIG_LTO=/s;^;#;' Makefile || die - - default - - sed -i '/$(STRIP) .*/d' Makefile || die "Failed removing STRIP call" - - sed -Ei '/^\s*(CC|AR)=/d' Makefile \ - || die "Failed to remove hard-coded tools." - - sed -i 's;$(PREFIX)/lib;$(LIBDIR);' Makefile || die "Failed fixing libdir" - - if ! use static-libs; then - sed -i '/install -m644 libquickjs.a "$(DESTDIR)$(LIBDIR)\/quickjs"/d' Makefile || die "Failed fixing static-libs" - fi -} - -src_configure() { - export CC="$(tc-getCC)" - export AR="$(tc-getAR)" - - export PREFIX=/usr - export LIBDIR="/usr/$(get_libdir)" - - export CONFIG_LTO=$(use lto) - if ! use static-libs; then - export CONFIG_SHARED=y - fi -} diff --git a/dev-lang/scrapscript/scrapscript-0.1.1.ebuild b/dev-lang/scrapscript/scrapscript-0.1.1-r1.ebuild index 30ecd15769ce..af5fc443fd2d 100644 --- a/dev-lang/scrapscript/scrapscript-0.1.1.ebuild +++ b/dev-lang/scrapscript/scrapscript-0.1.1-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -16,7 +16,7 @@ if [[ "${PV}" == *9999* ]] ; then inherit git-r3 EGIT_BRANCH="trunk" - EGIT_REPO_URI="https://github.com/tekknolagi/${PN}.git" + EGIT_REPO_URI="https://github.com/tekknolagi/${PN}" else inherit pypi @@ -25,8 +25,6 @@ fi LICENSE="MIT" SLOT="0" -IUSE="test" -RESTRICT="!test? ( test )" python_test() { edo "${EPYTHON}" ./scrapscript.py test diff --git a/dev-lang/scrapscript/scrapscript-9999.ebuild b/dev-lang/scrapscript/scrapscript-9999.ebuild index 30ecd15769ce..af5fc443fd2d 100644 --- a/dev-lang/scrapscript/scrapscript-9999.ebuild +++ b/dev-lang/scrapscript/scrapscript-9999.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2024 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -16,7 +16,7 @@ if [[ "${PV}" == *9999* ]] ; then inherit git-r3 EGIT_BRANCH="trunk" - EGIT_REPO_URI="https://github.com/tekknolagi/${PN}.git" + EGIT_REPO_URI="https://github.com/tekknolagi/${PN}" else inherit pypi @@ -25,8 +25,6 @@ fi LICENSE="MIT" SLOT="0" -IUSE="test" -RESTRICT="!test? ( test )" python_test() { edo "${EPYTHON}" ./scrapscript.py test diff --git a/dev-lang/souffle/souffle-2.5.ebuild b/dev-lang/souffle/souffle-2.5-r1.ebuild index 0acac3b49293..da680f76ed8c 100644 --- a/dev-lang/souffle/souffle-2.5.ebuild +++ b/dev-lang/souffle/souffle-2.5-r1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -14,7 +14,7 @@ HOMEPAGE="http://souffle-lang.github.io/ if [[ "${PV}" == *9999* ]] ; then inherit git-r3 - EGIT_REPO_URI="https://github.com/souffle-lang/${PN}.git" + EGIT_REPO_URI="https://github.com/souffle-lang/${PN}" else SRC_URI="https://github.com/souffle-lang/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" @@ -75,7 +75,6 @@ pkg_setup() { src_prepare() { unset LEX - cmake_src_prepare java-pkg-opt-2_src_prepare } @@ -118,6 +117,5 @@ src_configure() { src_install() { cmake_src_install - doman man/*.1 } diff --git a/dev-lang/typescript/typescript-6.0.2.ebuild b/dev-lang/typescript/typescript-6.0.2.ebuild index fc0ccd05b192..763ed060293a 100644 --- a/dev-lang/typescript/typescript-6.0.2.ebuild +++ b/dev-lang/typescript/typescript-6.0.2.ebuild @@ -12,7 +12,7 @@ S="${WORKDIR}/package" LICENSE="Apache-2.0" SLOT="0" -KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv" +KEYWORDS="amd64 ~arm64 ~ppc64 ~riscv" RDEPEND=" net-libs/nodejs diff --git a/dev-lang/zig/Manifest b/dev-lang/zig/Manifest index 5cce10557c88..6885d21b3eb4 100644 --- a/dev-lang/zig/Manifest +++ b/dev-lang/zig/Manifest @@ -7,3 +7,5 @@ DIST zig-0.15.1.tar.xz 21359884 BLAKE2B 3768435b8e34af819dca80aea2aae881bbbf8aa9 DIST zig-0.15.1.tar.xz.minisig 312 BLAKE2B ca09f8883bb7f822ad028554b9bef93b9a33d937970daff4b3d7a49a569440fd9dce927aff2d16743fd05ddb3505b468954fbed14aec5f4fbf560b6e91911dc5 SHA512 478f4b428db3e20312cc8c217d3b6ee2f94653bedd4c83c9605a82f8bda27635c849167a60fa76749e471d2222e3ea4469c4932b569dd7e5d48d68012bcae463 DIST zig-0.15.2.tar.xz 21366268 BLAKE2B 73e3c4df290b2b39f7202ab13ae10b2aef066c5dc65dc9f5e0935af8025902aedb548e02979a4e2c4225d31bc76538b21d6740ab7732ff3a6f3da09cfa221184 SHA512 56b0f2b14da8603bf86ab672fd1fe38c2b04d8d90512839104e85b0fbda94aaf07fecf76b238d7b17715f9fee24be46c1830a96a0b5993cff6adef91b83f3201 DIST zig-0.15.2.tar.xz.minisig 312 BLAKE2B 6a5615f00a590a21f99700d4bfaea42f9c0469a80b0fef2f9fdae5256d591cac03d15c31772ccdac32db1c8fdc858c526c23d10bed756eace5c79bacd1269fc6 SHA512 d951c167561599a11ac1881c0c12d17be5d8ea3d214b96403acaa5b40f62a6bee48602dcbf963046897481525b801023fe419daca6d6811b495c44a242777a13 +DIST zig-0.16.0.tar.xz 22503260 BLAKE2B 415ccb32f694ca2f6e461e4d8ae375e3c423b223b5cd64188129b6550e4830f667fb653c2ee112a696a15cd78546a8228fd07b07a4e1267b41720456ae5423c3 SHA512 1404a939c6f233d5f328a4833543d7a2b2d9f0f5081babe6e3ad43daed25bbb0844b28c01c900f64b5bb63ac62b5586457c05380b10494dfefb56f49b58d4a0a +DIST zig-0.16.0.tar.xz.minisig 312 BLAKE2B 5d7624c60ca19b7cf78a6fb80664f87edcdb53eb96505cf7e7c3b0df6142981e7f2055c3578923bdb5dbb6f7266448232684a815aa9e5213dc56a2c058a590c9 SHA512 44a2d57061cbe8bd4e9ad587c247883e2e9abefa148ab375617665fe51500a106f488ceaaeaf038c0ff5ce1a70f4eb3b519a44f3211769ea1ebae5ad49b2f1b9 diff --git a/dev-lang/zig/zig-0.16.0.ebuild b/dev-lang/zig/zig-0.16.0.ebuild new file mode 100644 index 000000000000..5f9f4082a755 --- /dev/null +++ b/dev-lang/zig/zig-0.16.0.ebuild @@ -0,0 +1,356 @@ +# Copyright 2019-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# https://codeberg.org/ziglang/zig/src/tag/${PV}#building-from-source +LLVM_COMPAT=( 21 ) +LLVM_OPTIONAL=1 + +ZIG_SLOT="$(ver_cut 1-2)" +ZIG_OPTIONAL=1 + +inherit check-reqs cmake flag-o-matic edo llvm-r2 toolchain-funcs zig + +DESCRIPTION="A robust, optimal, and maintainable programming language" +HOMEPAGE="https://ziglang.org/ https://codeberg.org/ziglang/zig/" +if [[ ${PV} == 9999 ]]; then + EGIT_REPO_URI="https://codeberg.org/ziglang/zig.git" + inherit git-r3 +else + VERIFY_SIG_METHOD=minisig + VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/minisig-keys/zig-software-foundation.pub + inherit verify-sig + + SRC_URI=" + https://ziglang.org/download/${PV}/${P}.tar.xz + verify-sig? ( https://ziglang.org/download/${PV}/${P}.tar.xz.minisig ) + " + KEYWORDS="~amd64 ~arm ~arm64" + + BDEPEND="verify-sig? ( sec-keys/minisig-keys-zig-software-foundation )" +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="${ZIG_SLOT}" +IUSE="debug doc +llvm" +REQUIRED_USE=" + !llvm? ( !doc ) + llvm? ( ${LLVM_REQUIRED_USE} ) +" +RESTRICT="!llvm? ( test )" + +# Used by both "cmake" and "zig" eclasses. +BUILD_DIR="${WORKDIR}/${P}_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://codeberg.org/ziglang/zig-bootstrap in future, to see +# options that are passed to LLVM CMake building (excluding "static" ofc). +LLVM_DEPEND="$(llvm_gen_dep ' + llvm-core/clang:${LLVM_SLOT} + llvm-core/lld:${LLVM_SLOT}[zstd] + llvm-core/llvm:${LLVM_SLOT}[zstd] +')" + +BDEPEND+=" llvm? ( ${LLVM_DEPEND} )" +DEPEND="llvm? ( ${LLVM_DEPEND} )" +RDEPEND="${DEPEND}" +IDEPEND="app-eselect/eselect-zig" + +DOCS=( "README.md" "doc/build.zig.zon.md" ) + +# zig.eclass does not set this for us since we use ZIG_OPTIONAL=1 +QA_FLAGS_IGNORED="usr/.*/zig/${PV}/bin/zig" + +# https://codeberg.org/ziglang/zig/src/tag/0.16.0/build.zig#L775-L778 +CHECKREQS_MEMORY="8G" + +pkg_setup() { + # Skip detecting zig executable. + declare -r -g ZIG_VER="${PV}" + ZIG_EXE="not-applicable" zig_pkg_setup + + declare -r -g ZIG_SYS_INSTALL_DEST="/usr/$(get_libdir)/zig/${PV}" + + if use llvm; then + [[ ${MERGE_TYPE} != binary ]] && llvm_cbuild_setup + fi + + # Requires running stage3 which is built for cross-target. + if use doc && tc-is-cross-compiler; then + die "USE=doc is not yet supported when cross-compiling" + fi + + check-reqs_pkg_setup +} + +src_unpack() { + if [[ ${PV} == 9999 ]]; then + git-r3_src_unpack + else + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.minisig} + fi + fi + zig_src_unpack +} + +src_prepare() { + if use llvm; then + cmake_src_prepare + else + # Sync with zig_src_prepare + default_src_prepare + mkdir -p "${BUILD_DIR}" || die + einfo "BUILD_DIR: \"${BUILD_DIR}\"" + # "--system" mode is not used during bootstrap. + fi + + sed -i '/exe\.allow_so_scripts = true;/d' build.zig || die +} + +src_configure() { + # Has no effect on final binary and only causes failures during bootstrapping. + filter-lto + + # Used during bootstrapping. stage1/stage2 have limited functionality + # and can't resolve native target, so we pass target in exact form. + declare -r -g ZIG_HOST_AS_TARGET="$(zig-utils_c_env_to_zig_target "${CBUILD:-${CHOST}}" "${CFLAGS}"})" + + # Note that if we are building with CMake, "my_zbs_args" + # are used only after compiling zig2. + local my_zbs_args=( + --zig-lib-dir "${S}/lib/" + + --prefix "${EPREFIX}/${ZIG_SYS_INSTALL_DEST}/" + --prefix-lib-dir lib/ + + # These are built separately + -Dno-langref=true + -Dstd-docs=false + + # More commands and options if "debug" is enabled. + -Ddebug-extensions=$(usex debug true false) + # More asserts and so on by default if "debug" is enabled. + --release=$(usex debug safe fast) + ) + + # Scenarios of compilation: + + # With LLVM, native: + # CMake: + # * generate "config.h" for LLVM libraries and build "zigcpp" + # * build "zig2" using common "config.h" and "zigcpp" + # build.zig: + # * build "stage3" using common "config.h" and "zigcpp" + + # With LLVM, cross-compiled: + # CMake: + # * generate cross-target "config.h" for LLVM libraries from ESYSROOT + # and build cross-target "zigcpp", and stash them away + # * generate native "config.h" for LLVM libraries from BROOT and + # build native "zigcpp" + # * build native "zig2" using native "config.h" and "zigcpp" + # build.zig: + # * build cross-target "stage3" using stashed "config.h" and "zigcpp" + + # Without LLVM: + # bootstrap.c: + # * build native "zig2" + # build.zig: + # * build (cross-)target "stage3" + + if use llvm; then + my_zbs_args+=( + -Denable-llvm=true + -Dstatic-llvm=false + -Dconfig_h="${BUILD_DIR}/config.h" + ) + else + my_zbs_args+=( + -Denable-llvm=false + ) + fi + zig_src_configure + + if use llvm; then + local mycmakeargs=( + -DZIG_SHARED_LLVM=ON + -DZIG_USE_LLVM_CONFIG=ON + -DZIG_HOST_TARGET_TRIPLE="${ZIG_HOST_AS_TARGET}" + # Don't set ZIG_TARGET_TRIPLE, ZIG_TARGET_MCPU and + # CMAKE_INSTALL_PREFIX because we build up to zig2 max, + # after that "zig build" is used to compile stage3. + + # Don't set CMAKE_PREFIX_PATH because "llvm_chost_setup" + # and "llvm_cbuild_setup" already set PATH in such way + # that suitable llvm-config is found and used in + # "cmake/Findllvm.cmake", and "cmake.eclass" help with + # cross-compilation pathes for "Findclang" and "Findlld". + + # CMP0144, Zig has own packages with these names, so ignore + # LLVM_ROOT, Clang_ROOT, LLD_ROOT from "llvm_chost_setup". + -DCMAKE_FIND_USE_PACKAGE_ROOT_PATH=OFF + ) + if tc-is-cross-compiler; then + # Enable cross-compilation for CMake when filling "config.h" + # and building "zigcpp". They would be used for stage3 build. + # Here we are using LLVM from ESYSROOT/DEPEND. + # Uses script llvm-config. + + # Isolate PATH changes in subshell so that it would not + # affect next `cmake_src_configure` with BROOT/BDEPEND. + ( + llvm_chost_setup + cmake_src_configure + cmake_build zigcpp + ) + + mv "${BUILD_DIR}/config.h" "${T}/target_config.h" || die + mv "${BUILD_DIR}/zigcpp/" "${T}/target_zigcpp/" || die + rm -rf "${BUILD_DIR}" || die + fi + + # Force disable cross-compilation for CMake when building "zig2". + # Here we are using LLVM from BROOT/BDEPEND. + # Uses native llvm-config. + + # Isolate environment changes in subshell so that it would not + # affect next phases. + ( + export BUILD_CFLAGS="${CFLAGS}" + export BUILD_CXXFLAGS="${CXXFLAGS}" + export BUILD_CPPFLAGS="${CPPFLAGS}" + export BUILD_LDFLAGS="${LDFLAGS}" + tc-env_build + + unset SYSROOT + export CHOST="${CBUILD:-${CHOST}}" + strip-unsupported-flags + cmake_src_configure + ) + fi +} + +src_compile() { + if use llvm; then + cmake_build zig2 + + if tc-is-cross-compiler; then + rm -rf "${BUILD_DIR}/zigcpp/" || die + rm -f "${BUILD_DIR}/config.h" || die + + mv "${T}/target_zigcpp/" "${BUILD_DIR}/zigcpp/" || die + mv "${T}/target_config.h" "${BUILD_DIR}/config.h" || die + fi + else + cd "${BUILD_DIR}" || die + ln -s "${S}/stage1/" . || die + ln -s "${S}/src/" . || die + ln -s "${S}/lib/" . || die + + local native_cc="$(tc-getBUILD_CC)" + "${native_cc}" -o bootstrap "${S}/bootstrap.c" || die "Zig's bootstrap.c compilation failed" + ZIG_HOST_TARGET_TRIPLE="${ZIG_HOST_AS_TARGET}" CC="${native_cc}" edo ./bootstrap + fi + + cd "${BUILD_DIR}" || die + ZIG_EXE="./zig2" zig_src_compile --prefix stage3/ + + # Requires running stage3 which is built for cross-target. + if ! tc-is-cross-compiler; then + ./stage3/bin/zig env || die "Zig compilation failed" + + if use doc; then + ZIG_EXE="./stage3/bin/zig" zig_src_compile langref --prefix docgen/ + fi + fi +} + +src_test() { + if has_version -b app-emulation/qemu; then + ewarn "QEMU executable was found on your building system." + ewarn "If you have qemu-binfmt (binfmt_misc) hooks enabled for" + ewarn "foreign architectures, Zig tests might fail." + ewarn "In this case, please disable qemu-binfmt and try again." + fi + + cd "${BUILD_DIR}" || die + + # XXX: When we pass a libc installation to Zig, it will fail to find + # the bundled libraries for targets like aarch64-macos and + # *-linux-musl. Zig doesn't run binaries for these targets when + # -Dskip-non-native is passed, but they are still compiled, so + # the test will fail. There's no way to disable --libc once passed, + # so we need to strip it from ZBS_ARGS. + # See: https://github.com/ziglang/zig/issues/22383 + + # XXX: Also strip --release=* flags to run tests with Debug mode, + # like upstream runs in CI. Full test suite with other modes is + # in a sad state right now... + ( + local -a filtered_args=() + local i=0 + + local arg + while (( i < ${#ZBS_ARGS[@]} )); do + arg="${ZBS_ARGS[i]}" + case "$arg" in + --libc) + (( i += 2 )) + ;; + --release=*) + (( i += 1 )) + ;; + *) + filtered_args+=("$arg") + (( i += 1 )) + ;; + esac + done + + ZBS_ARGS=("${filtered_args[@]}") + + ZIG_EXE="./stage3/bin/zig" zig_src_test -Dskip-non-native + ) +} + +src_install() { + use doc && local HTML_DOCS=( "${BUILD_DIR}/docgen/doc/langref.html" ) + + ZIG_EXE="./zig2" zig_src_install + + cd "${ED}/${ZIG_SYS_INSTALL_DEST}" || die + mv lib/zig/ lib2/ || die + rm -rf lib/ || die + mv lib2/ lib/ || die + dosym -r "${ZIG_SYS_INSTALL_DEST}/bin/zig" /usr/bin/zig-${PV} +} + +pkg_postinst() { + eselect zig update ifunset || die + + if ! use llvm; then + elog "Currently, Zig built without LLVM support lacks some" + elog "features such as optimizations, linker features, etc." + elog "They are listed under \"Building from Source without LLVM\"" + elog "section of the README file from \"/usr/share/doc/${PF}\" ." + fi +} + +pkg_postrm() { + eselect zig update ifunset +} diff --git a/dev-lang/zig/zig-9999.ebuild b/dev-lang/zig/zig-9999.ebuild index 5f9f4082a755..b223efdedbfe 100644 --- a/dev-lang/zig/zig-9999.ebuild +++ b/dev-lang/zig/zig-9999.ebuild @@ -4,7 +4,7 @@ EAPI=8 # https://codeberg.org/ziglang/zig/src/tag/${PV}#building-from-source -LLVM_COMPAT=( 21 ) +LLVM_COMPAT=( 22 ) LLVM_OPTIONAL=1 ZIG_SLOT="$(ver_cut 1-2)" |
