# Template file for 'libgccjit' # Revbump libtool when updating gcc, since it hardcodes some internal compiler paths # which use the version number. pkgname=libgccjit version=14.2.1+20250405 revision=1 hostmakedepends="tar texinfo perl flex" makedepends="zlib-devel libzstd-devel isl-devel libmpc-devel gmp-devel mpfr-devel" depends="gcc" checkdepends="dejagnu" short_desc="Just-In-Time Compilation library for GCC" maintainer="Lane Biocini " homepage="https://gcc.gnu.org" license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later" case "${version}" in *+*) distfiles="https://gcc.gnu.org/pub/gcc/snapshots/${version%%.*}-${version#*+}/gcc-${version%%.*}-${version#*+}.tar.xz" ;; *) distfiles="${GNU_SITE}/gcc/gcc-${version}.tar.xz" ;; esac checksum=9a84b0947d8fb18197eef3fce8e255e30a61f7f382cebb961b1705c1d99214a3 nopie=yes lib32disabled=yes # Snapshot tarballs get removed after over a year, we can archive the ones we need in distfiles. case "$XBPS_DISTFILES_FALLBACK" in *"repo-default.voidlinux.org/distfiles"*) ;; *) XBPS_DISTFILES_FALLBACK+=" https://repo-default.voidlinux.org/distfiles" ;; esac pre_configure() { if [ "$XBPS_TARGET_LIBC" = musl ]; then for p in ${FILESDIR}/*-musl.patch; do patch -p1 -i $p done fi } do_configure() { # Define triplet for gcc build target case "$XBPS_TARGET_MACHINE" in i686) _target_triplet="i686-pc-linux-gnu";; i686-musl) _target_triplet="i686-linux-musl";; x86_64) _target_triplet="x86_64-unknown-linux-gnu";; x86_64-musl) _target_triplet="x86_64-linux-musl";; armv5tel) _target_triplet="arm-linux-gnueabi";; armv5tel-musl) _target_triplet="arm-linux-musleabi";; armv6l) _target_triplet="arm-linux-gnueabihf";; armv7l) _target_triplet="armv7l-linux-gnueabihf";; armv6l-musl) _target_triplet="arm-linux-musleabihf";; armv7l-musl) _target_triplet="armv7l-linux-musleabihf";; aarch64) _target_triplet="aarch64-linux-gnu";; aarch64-musl) _target_triplet="aarch64-linux-musl";; ppc) _target_triplet="powerpc-linux-gnu";; ppc-musl) _target_triplet="powerpc-linux-musl";; ppcle) _target_triplet="powerpcle-linux-gnu";; ppcle-musl) _target_triplet="powerpcle-linux-musl";; ppc64le) _target_triplet="powerpc64le-linux-gnu";; ppc64le-musl) _target_triplet="powerpc64le-linux-musl";; ppc64) _target_triplet="powerpc64-linux-gnu";; ppc64-musl) _target_triplet="powerpc64-linux-musl";; mips-musl) _target_triplet="mips-linux-musl";; mipshf-musl) _target_triplet="mips-linux-muslhf";; mipsel-musl) _target_triplet="mipsel-linux-musl";; mipselhf-musl) _target_triplet="mipsel-linux-muslhf";; esac local _langs _args _hash _hash=gnu case "$XBPS_TARGET_MACHINE" in mipselhf-musl) _args+=" --with-arch=mips32r2 --with-float=hard"; _hash=sysv;; mipsel-musl) _args+=" --with-arch=mips32r2 --with-float=soft"; _hash=sysv;; mipshf-musl) _args+=" --with-arch=mips32r2 --with-float=hard";; mips-musl) _args+=" --with-arch=mips32r2 --with-float=soft";; armv5*) _args+=" --with-arch=armv5te --with-float=soft";; armv6l*) _args+=" --with-arch=armv6 --with-fpu=vfp --with-float=hard";; armv7l*) _args+=" --with-arch=armv7-a --with-fpu=vfpv3 --with-float=hard";; aarch64*) _args+=" --with-arch=armv8-a";; ppc64le*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpcle-linux";; ppc64*) _args+=" --with-abi=elfv2 --enable-secureplt --enable-targets=powerpc-linux";; ppc*) _args+=" --enable-secureplt";; esac # fix: unknown long double size, cannot define BFP_FMT case "$XBPS_TARGET_MACHINE" in ppc*-musl) _args+=" --disable-decimal-float";; esac if [ "$CROSS_BUILD" ]; then export CC_FOR_TARGET="$CC" export GCC_FOR_TARGET="$CC" export CXX_FOR_TARGET="$CXX" _args+=" --host=$XBPS_CROSS_TRIPLET" _args+=" --with-build-sysroot=${XBPS_CROSS_BASE}" elif [ -z "$CHROOT_READY" ]; then export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}" _args+=" --build=${_target_triplet}" else _args+=" --build=${_target_triplet}" fi if [ "$XBPS_TARGET_LIBC" = "musl" ]; then _args+=" --disable-gnu-unique-object" _args+=" --disable-symvers" _args+=" libat_cv_have_ifunc=no" else _args+=" --enable-gnu-unique-object" fi case "$XBPS_TARGET_MACHINE" in ppc*) _args+=" --disable-vtable-verify";; *) _args+=" --enable-vtable-verify";; esac export CFLAGS="${CFLAGS/-D_FORTIFY_SOURCE=2/}" export CXXFLAGS="${CXXFLAGS/-D_FORTIFY_SOURCE=2/}" # Disable explicit -fno-PIE, gcc will figure this out itself. export CFLAGS="${CFLAGS//-fno-PIE/}" export CXXFLAGS="${CXXFLAGS//-fno-PIE/}" export LDFLAGS="${LDFLAGS//-no-pie/}" # Needs explicit -fPIC export CFLAGS+=" -fPIC" export CXXFLAGS+=" -fPIC" _args+=" --prefix=/usr" _args+=" --mandir=/usr/share/man" _args+=" --infodir=/usr/share/info" _args+=" --libexecdir=/usr/lib${XBPS_TARGET_WORDSIZE}" _args+=" --libdir=/usr/lib${XBPS_TARGET_WORDSIZE}" _args+=" --enable-threads=posix" _args+=" --enable-__cxa_atexit" _args+=" --disable-multilib" _args+=" --with-system-zlib" _args+=" --enable-shared" _args+=" --enable-lto" _args+=" --enable-plugins" _args+=" --enable-linker-build-id" _args+=" --disable-werror" _args+=" --disable-nls" _args+=" --enable-default-pie" _args+=" --enable-default-ssp" _args+=" --enable-checking=release" _args+=" --disable-libstdcxx-pch" _args+=" --with-isl" _args+=" --with-linker-hash-style=$_hash" _args+=" --disable-sjlj-exceptions" _args+=" --disable-target-libiberty" # libgccjit compilation specific _args+=" --enable-host-shared" _args+=" --disable-bootstrap" _args+=" --disable-libquadmath" _args+=" --disable-libquadmath-support" _args+=" --disable-libgomp" _args+=" --disable-liboffloadmic" _args+=" --disable-libada" _args+=" --disable-libvtv" _args+=" --disable-libsanitizer" _args+=" --with-bugurl='https://github.com/void-linux/void-packages/issues'" mkdir -p build cd build # If we are checking packages, we need to have c++ compiled [ -z "$XBPS_CHECK_PKGS" ] && _langs="jit" || _langs="jit,c++" _args+=" --enable-languages=${_langs}" CONFIG_SHELL=/bin/bash \ ${wrksrc}/configure ${_args} } do_build() { make -C build ${makejobs} } do_check() { make -C build/gcc check-jit RUNTESTFLAGS="-v -v -v" } do_install() { make -C build/gcc DESTDIR=${DESTDIR} jit.install-common jit.install-info } post_install() { vlicense COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION } libgccjit-devel_package() { short_desc+=" - development files" depends="${sourcepkg}>=${version}_${revision}" pkg_install() { vmove usr/include vmove usr/lib/*.so vmove usr/share/info } }