void-packages/srcpkgs/fpc/template
2019-03-02 16:55:54 -03:00

63 lines
2.1 KiB
Bash

# Template file for 'fpc'
pkgname=fpc
version=3.0.4
revision=2
create_wrksrc=yes
build_wrksrc="${pkgname}build-${version}"
conf_files="/etc/fpc.cfg /etc/fppkg.cfg"
hostmakedepends="rpmextract"
makedepends="ncurses-devel zlib-devel expat-devel"
short_desc="Free Pascal Compiler"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="GPL-2, LGPL-2.1, FPC-FPR"
homepage="http://freepascal.org/"
distfiles="${SOURCEFORGE_SITE}/freepascal/Source/${version}/${pkgname}build-${version}.tar.gz"
checksum=f66514e6f2c2e4e1bccccb4d554c24b77682ed61c87811ae5dd210f421855e76
case "$XBPS_TARGET_MACHINE" in
x86_64*)
distfiles+=" ${SOURCEFORGE_SITE}/freepascal/Linux/${version}/${pkgname}-${version}-1.x86_64.rpm"
checksum+=" c7b75f09174a502d8dd776fbfabcad3e4360494fd635445185159b21001d65f1"
;;
i686*)
distfiles+=" ${SOURCEFORGE_SITE}/freepascal/Linux/${version}/${pkgname}-${version}-1.i686.rpm"
checksum+=" a8f1ea31c63e8cd96dbdecf02af97311f14629babe58b4bd18ecfa094a13ad45"
;;
esac
# TODO: figure out cross-build and how to unwrap the ARM .tar.
nocross=yes
nopie=yes
archs="x86_64* i686*"
post_extract() {
# relative links needed
ln -sf ../lib64/fpc/${version}/ppcx64 usr/bin
ln -sf ../lib/fpc/${version}/ppc386 usr/bin
# tweak PT_INTERP for musl targets
case "$XBPS_TARGET_MACHINE" in
x86_64-musl)
sed -i s,/lib64/ld-linux-x86-64.so.2,/lib/ld-musl-x86_64.so.1, $build_wrksrc/fpcsrc/compiler/systems/t_linux.pas
cd $build_wrksrc && patch -p0 < ${FILESDIR}/musl-__libc_csu.patch
;;
i686-musl)
sed -i s,/lib/ld-linux.so.2,/lib/ld-musl-i386.so.1, $build_wrksrc/fpcsrc/compiler/systems/t_linux.pas
;;
esac
}
do_build() {
FPC=$wrksrc/usr/bin/fpc make ${makejobs} all NOGDB=1
}
do_install() {
FPC=$wrksrc/usr/bin/fpc make install NOGDB=1 \
PREFIX=$DESTDIR/usr INSTALL_MANDIR=$DESTDIR/usr/share/man
ln -srf $DESTDIR/usr/lib/fpc/${version}/ppc* $DESTDIR/usr/bin
vmkdir etc
PATH=$DESTDIR/usr/bin:$PATH \
$DESTDIR/usr/lib/fpc/${version}/samplecfg \
$DESTDIR/usr/lib/fpc/${version} $DESTDIR/etc
sed -i "s,${DESTDIR},,g" $DESTDIR/etc/*.cfg $DESTDIR/etc/fppkg/* $DESTDIR/usr/lib/fpc/${version}/ide/text/*
vlicense fpcsrc/rtl/COPYING.FPC
}