void-packages/srcpkgs/pcc/template

82 lines
2.0 KiB
Bash

# Template file for 'pcc'
pkgname=pcc
version=1.1.0.20190420
revision=4
_distver="${version%.*}"
_snapshot="${version##*.}"
archs="i686* x86_64*"
create_wrksrc=yes
configure_args="--enable-tls --enable-native"
hostmakedepends="flex bison"
depends="binutils pcc-libs>=${version}"
short_desc="Portable C Compiler"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-2-Clause, BSD-3-Clause, MIT, BSD-4-Clause"
homepage="http://pcc.ludd.ltu.se/"
distfiles="
http://pcc.ludd.ltu.se/ftp/pub/pcc-beta/pcc-${_distver}.BETA-${_snapshot}.tgz
http://pcc.ludd.ltu.se/ftp/pub/pcc-beta/pcc-libs-${_distver}.BETA-${_snapshot}.tgz"
checksum="a114dfca04b8b0559ea5d67b87d2d0fcb2bae2b4d9b9ba16ebc27960b921c812
e810aa4d6683e769f490f734b13a296b33c2511ddba646bc526eb85532f1a23a"
nocross=yes
CFLAGS="-fcommon"
case "$XBPS_TARGET_LIBC" in
musl) depends+=" musl-devel";;
*) depends+=" glibc-devel";;
esac
post_extract() {
mv pcc-${_distver}.BETA pcc
mv pcc-libs-${_distver}.BETA pcc-libs
}
post_patch() {
vsed -i '/GNUC_MINOR/s,3,1,g' pcc/cc/cc/cc.c pcc/cc/driver/platform.c
}
do_configure() {
cd $wrksrc/pcc
./configure ${configure_args} --libexecdir=/usr/libexec/pcc
cd $wrksrc/pcc-libs
./configure ${configure_args} CC=pcc
}
do_build() {
local _tmp=$wrksrc/tmp
mkdir -p $_tmp/usr/bin
PATH=$_tmp/usr/bin:$_tmp/usr/libexec/pcc:$PATH
cd $wrksrc/pcc
cp common/*.[ch] mip
make ${makejobs}
make DESTDIR=$_tmp install
cd $wrksrc/pcc-libs
make ${makejobs}
}
do_install() {
cd $wrksrc/pcc
make DESTDIR=$DESTDIR install
sed -n '3,27p' arch/amd64/code.c > LICENSE.3BSD
sed -n '3,25p' arch/amd64/local.c > LICENSE.2BSD
sed -n '3,25p' arch/arm/table.c > LICENSE.MIT
sed -n '3,33p' arch/i386/flocal.c > LICENSE.Caldera
cd $wrksrc/pcc-libs
make DESTDIR=$DESTDIR install
# Rename conflicting cpp.1 manpage.
mv ${DESTDIR}/usr/share/man/man1/{cpp,pcc-cpp}.1
}
pcc-libs_package() {
short_desc+=" - libraries"
nodebug=yes
pkg_install() {
vmove usr/lib/pcc
vlicense pcc/LICENSE.3BSD
vlicense pcc/LICENSE.2BSD
vlicense pcc/LICENSE.MIT
vlicense pcc/LICENSE.Caldera
}
}