void-packages/srcpkgs/plan9port/template

59 lines
1.8 KiB
Bash

# Template file for 'plan9port'
pkgname=plan9port
version=20200927
revision=2
_githash=291f7411783bf6871b253f3b15ce691eea7a257e
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=4db90ed7859066d26a424ebde38b318bb6030ad9209cdbfb4f5fb32fb486a659
nocross=yes
if [[ $XBPS_TARGET_MACHINE == *-musl ]]; then
makedepends+=" libucontext-devel"
fi
CFLAGS="-fcommon"
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
}