3d700f908b
Upstreams's build scripts set compilation flags based on whether or not gcc is detected. However, the detection scheme relies are path parsing and breaks when using ccache. Somehow this slipped passed CI. In particular see the broken build log: https://build.voidlinux.org/builders/x86_64_builder/builds/22852/steps/shell_3/logs/stdio The build phase stops when make exits with an error; however, this failed to kill the build for some reason. Thus we end up with a package containing none of the binaries that were supposed to build. In particular, `do_make` failed because the upstream build scripts *fallback* to assuming clang when gcc is not detected. Notice, especially, the following lines in the build log: entering /builddir/jsource-j901-release-e/make2 CC=cc compiler=/usr/bin/ccache When using ccache, `cc` points to /usr/bin/ccache, which the build scripts notice as not of the form `*gcc*`, thus assuming clang and eventually leading to a broken package.
134 lines
3.8 KiB
Bash
134 lines
3.8 KiB
Bash
# Template file for 'j'
|
|
pkgname=j
|
|
_vmaj=901
|
|
_vmin=e
|
|
_vrel=${_vmaj}-release${_vmin:+-}${_vmin}
|
|
version=${_vmaj}.${_vmin}
|
|
revision=3
|
|
archs="aarch64* x86_64*"
|
|
wrksrc="jsource-j${_vrel}"
|
|
makedepends="libedit-devel libgomp-devel libomp-devel"
|
|
short_desc="Modern, high-performance, ASCII-based successor to APL"
|
|
maintainer="B. Wilson <x@wilsonb.com>"
|
|
license="GPL-3.0-or-later"
|
|
homepage="https://jsoftware.com/"
|
|
distfiles="https://github.com/jsoftware/jsource/archive/j${_vrel}.tar.gz"
|
|
checksum=23d1cac75ae8426d4e301b178fac1f29e85d7a0c80cefe4740c104d9c1eeab7a
|
|
|
|
_jsz="j${XBPS_TARGET_WORDSIZE}"
|
|
_jtype="release"
|
|
_jbuilder="voidlinux.org"
|
|
_jlib="/usr/lib/j"
|
|
_jshare="/usr/share/j"
|
|
_jetc="/etc/j"
|
|
_juser=".j"
|
|
|
|
case "${XBPS_TARGET_MACHINE}" in
|
|
aarch64*) _jpl="raspberry";;
|
|
*) _jpl="linux";;
|
|
esac
|
|
|
|
case "${XBPS_TARGET_MACHINE}" in
|
|
*-musl) makedepends+=" musl-fts-devel";;
|
|
esac
|
|
|
|
|
|
do_configure() {
|
|
cp jsrc/jversion-x.h jsrc/jversion.h
|
|
vsed -i "/jversion/s@${_vmaj}@${_vrel}@;
|
|
/jplatform/s@unknown@${_jpl}@;
|
|
/jtype/s@beta@${_jtype}@;
|
|
/jbuilder/s@unknown@${_jbuilder}@" \
|
|
jsrc/jversion.h
|
|
|
|
# Remove version directory component from "~install" and "~user" paths
|
|
cp jlibrary/bin/profile.ijs jlibrary/bin/profile.ijs.new
|
|
vsed -i "/^install=./s@/usr/share/j/[0-9.]\+@${_jshare}@;
|
|
/^user=./s@home,userx@home,'/${_juser}'@" \
|
|
jlibrary/bin/profile.ijs.new
|
|
|
|
# The build scripts set compiler flags based on what they detect as the
|
|
# compiler (gcc vs clang). However, their detection scheme is fragile
|
|
# and breaks when using ccache. Thus we directly tell them that we are
|
|
# using gcc.
|
|
vsed -i '/^compiler/s/=.*/=gcc/' make2/build_jconsole.sh
|
|
vsed -i '/^compiler/s/=.*/=gcc/' make2/build_libj.sh
|
|
}
|
|
|
|
##
|
|
# Crossbuilds do not distinguish between AVX- and non-AVX targets, so instead
|
|
# we build all applicable binaries and install a wrapper script that executes
|
|
# the correct one on the target machine.
|
|
do_build() {
|
|
jplatform=${_jpl} j64x=${_jsz} make2/build_jconsole.sh
|
|
jplatform=${_jpl} j64x=${_jsz} make2/build_libj.sh
|
|
|
|
if [ "${_jsz}" = 'j64' ]; then
|
|
jplatform=${_jpl} j64x=${_jsz}avx make2/build_jconsole.sh
|
|
jplatform=${_jpl} j64x=${_jsz}avx make2/build_libj.sh
|
|
|
|
jplatform=${_jpl} j64x=${_jsz}avx2 make2/build_jconsole.sh
|
|
jplatform=${_jpl} j64x=${_jsz}avx2 make2/build_libj.sh
|
|
fi
|
|
}
|
|
|
|
do_check() {
|
|
if [ -d "${_jlib}/j64avx2" ] \
|
|
&& sed -n '/^flags/{s/\<avx2\>//;t;q1}' /proc/cpuinfo; then
|
|
javx='avx2'
|
|
elif [ -d "${_jlib}/j64avx" ] \
|
|
&& sed -n '/^flags/{s/\<avx\>//;t;q1}' /proc/cpuinfo; then
|
|
javx='avx'
|
|
else
|
|
javx=''
|
|
fi
|
|
|
|
mkdir -p test/bin
|
|
cp -r jlibrary/addons test/bin
|
|
cp -r jlibrary/system test/bin
|
|
cp -r jlibrary/tools test/bin
|
|
cp -r "bin/${_jpl}/${_jsz}${javx}" test/bin
|
|
cp jlibrary/bin/profile.ijs "test/bin/${_jsz}${javx}"
|
|
|
|
echo 'RECHO ddall' | "test/bin/${_jsz}${javx}/jconsole" test/tsu.ijs
|
|
}
|
|
|
|
##
|
|
# Script to detect AVX/AVX2 support and launch appropriate jconsole binary
|
|
_jconsole_wrapper_script() {
|
|
cat <<JC
|
|
#!/usr/bin/env sh
|
|
|
|
cpu_has_avx() { sed -n '/^flags/{s/\<avx\>//;t;q1}' /proc/cpuinfo; }
|
|
cpu_has_avx2() { sed -n '/^flags/{s/\<avx2\>//;t;q1}' /proc/cpuinfo; }
|
|
|
|
if [ -d "${_jlib}/j64avx2" ] && cpu_has_avx2; then
|
|
javx='avx2'
|
|
elif [ -d "${_jlib}/j64avx" ] && cpu_has_avx; then
|
|
javx='avx'
|
|
elif [ -d "${_jlib}/j64" ]; then
|
|
javx=''
|
|
else
|
|
>&2 echo "\${0}: Cannot find jconsole executable"
|
|
exit 1
|
|
fi
|
|
|
|
exec ${_jlib}/${_jsz}\${javx}/jconsole -jprofile "${_jetc}/profile.ijs" "\${@}"
|
|
JC
|
|
}
|
|
|
|
do_install() {
|
|
vmkdir "${_jshare}" 0755
|
|
vcopy jlibrary/system "${_jshare}"
|
|
vcopy jlibrary/tools "${_jshare}"
|
|
|
|
vmkdir "${_jlib}" 0755
|
|
vcopy "bin/${_jpl}/*" "${_jlib}"
|
|
|
|
vmkdir "${_jetc}" 0755
|
|
vinstall "${FILESDIR}/profilex_template.ijs" 644 "${_jetc}"
|
|
vinstall "jlibrary/bin/profile.ijs.new" 644 "${_jetc}" profile.ijs
|
|
|
|
_jconsole_wrapper_script >bin/jc.sh
|
|
vbin "bin/jc.sh" jc
|
|
}
|