void-packages/srcpkgs/plan9port/template

59 lines
1.8 KiB
Bash

# Template file for 'plan9port'
pkgname=plan9port
version=20200222
revision=3
_githash=92aa0e13ad8cec37936998a66eb728bfca88d689
archs="i686* x86_64* ppc*"
wrksrc="${pkgname}-${_githash}"
hostmakedepends="perl which"
makedepends="libX11-devel libXt-devel libXext-devel freetype-devel fontconfig-devel"
short_desc="Port of many Plan 9 programs to Unix-like operating systems"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="LPL-1.02"
homepage="https://9fans.github.io/plan9port/"
distfiles="https://github.com/9fans/plan9port/archive/${_githash}.tar.gz"
checksum=606840c59de9a3a6c447f381df21eeba57d3a6c9799af83877d43541a372497c
nocross=yes
if [[ $XBPS_TARGET_MACHINE == *-musl ]]; then
makedepends+=" libucontext-devel"
fi
post_extract() {
# add missing LDFLAGS for some rules
vsed -e '/prereq$/s/$/ $LDFLAGS/' \
-i src/cmd/auth/factotum/mkfile \
-i src/cmd/auth/secstore/mkfile \
-i src/cmd/devdraw/mkfile \
-i src/cmd/faces/mkfile \
-i src/cmd/mkfile
vsed -e 's/-lX11$/& $LDFLAGS/g' -i src/cmd/rio/mkfile
sed -i "s,/usr/local/plan9,/usr/lib/plan9,g" \
$(grep -lr /usr/local/plan9)
}
do_build() {
CFLAGS+=' -D_DEFAULT_SOURCE'
echo "CFLAGS='$CFLAGS'" >LOCAL.config
echo "LDFLAGS='$LDFLAGS'" >>LOCAL.config
vsed -e 's/-O2/$CFLAGS/' -i bin/9c
if [[ $XBPS_TARGET_MACHINE == *-musl ]]; then
# add libucontext to extralibs under linux
vsed -e '/^\textralibs=.*-lpthread"$/s/"$/ -lucontext"/' -i bin/9l
fi
./INSTALL
}
do_install() {
xargs -a lib/moveplan9.files -d'\n' sed -i "s#$wrksrc#/usr/lib/plan9#"
vinstall $FILESDIR/plan9.sh 644 etc/profile.d
vlicense LICENSE
vmkdir usr/lib
cp -a $wrksrc $DESTDIR/usr/lib/plan9
cd $DESTDIR/usr/lib/plan9
rm -f install.{log,sum}
sed -i -e "s|\(-specs=.*hardened-ld\)||g" -e "s|\(-specs=.*hardened-cc1\)||g" $DESTDIR/usr/lib/plan9/config $DESTDIR/usr/lib/plan9/LOCAL.config
}