void-packages/srcpkgs/LuaJIT/template
q66 da1f946705 LuaJIT: don't apply ppc64 patchset for ppc (breaks JIT)
There is something in the ppc64 patch that breaks 32-bit ppc in
some scenarios (it appears to work but segfaults e.g. when
building neovim). So until that is investigated and fixed,
conditionalize this.
2019-10-12 10:51:13 +02:00

99 lines
2.4 KiB
Bash

# Template file for 'LuaJIT'
pkgname=LuaJIT
version=2.1.0beta3
revision=1
_so_version=2.1.0
_dist_version=${_so_version}-beta3
wrksrc="${pkgname}-${_dist_version}"
hostmakedepends="lua52-BitOp"
short_desc="Just-In-Time Compiler for Lua"
maintainer="q66 <daniel@octaforge.org>"
license="MIT"
homepage="http://www.luajit.org"
distfiles="http://luajit.org/download/${pkgname}-${_dist_version}.tar.gz"
checksum=1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3
if [ "$CROSS_BUILD" -a "$XBPS_MACHINE" = "x86_64" ]; then
hostmakedepends+=" gcc-multilib"
fi
_cross_cc="cc"
if [ "$CROSS_BUILD" ]; then
# cross toolchains are only for x86_64, ppc64 and i686 hosts
# luajit needs matching bitness for host and target
# on x86_64 we can multilib, on others we can't
case "$XBPS_MACHINE" in
x86_64)
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|i686*|mips*|ppc*) _cross_cc="cc -m32";;
esac
;;
ppc64*|x86_64-musl)
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
arm*|i686*|mips*|ppc*)
broken="Mismatched bitness on non-multilib host"
;;
esac
;;
i686*)
case "$XBPS_TARGET_MACHINE" in
x86_64*|ppc64*|aarch64*)
broken="Mismatched bitness on non-multilib host"
;;
esac
;;
esac
fi
# the ppc64 patchset subtly breaks ppc, needs investigation; for
# now apply patches conditionally, separately for ppc64 and ppc
post_patch() {
local patchdir
case "$XBPS_TARGET_MACHINE" in
ppc64*) patchdir="ppc64";;
ppc*) patchdir="ppc";;
*) return;;
esac
for i in ${FILESDIR}/patches/${patchdir}/*.patch; do
msg_normal "patching: $i\n"
patch -sNp0 -i ${i}
done
}
do_build() {
local _cflags=$CFLAGS
local _ldflags=$LDFLAGS
if [ "$CROSS_BUILD" ]; then
local cross="CROSS=${XBPS_CROSS_TRIPLET}-"
fi
unset CFLAGS LDFLAGS
make ${makejobs} PREFIX=/usr HOST_LUA=lua5.2 HOST_CC="${_cross_cc}" \
HOST_CFLAGS="$XBPS_CFLAGS" HOST_LDFLAGS="$XBPS_LDFLAGS" \
TARGET_CFLAGS="${_cflags}" TARGET_LDFLAGS="${_ldflags}" ${cross}
}
do_install() {
make DPREFIX=${DESTDIR}/usr DESTDIR=${DESTDIR} \
INSTALL_SHARE=${DESTDIR}/usr/share PREFIX=/usr install
mv ${DESTDIR}/usr/bin/luajit-* ${DESTDIR}/usr/bin/luajit
ln -fs libluajit-5.1.so.${_so_version} ${DESTDIR}/usr/lib/libluajit-5.1.so.2
vlicense COPYRIGHT
}
LuaJIT-devel_package() {
depends="${sourcepkg}>=${version}_${revision}"
short_desc+=" - development files"
pkg_install() {
vmove usr/include
vmove usr/lib/pkgconfig
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
}
}