PKGBUILDs/community/fpc/PKGBUILD
2023-05-07 16:29:20 +00:00

65 lines
2.4 KiB
Bash

# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Maintainer: BlackIkeEagle <ike DOT devolder AT gmail DOT com>
# Contributor: Valeriy Lyasotskiy <onestep@ukr.net>
# Contributor: Jan Willemson <janwil@hot.ee>
# Contributor: Hugo Ideler <hugoideler@dse.nl>
# Original PKGBUILD: Andre Naumann <anaumann@SPARCed.org>
# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - link ppcarm/ppca64 to /usr/bin
# - build for armhf on v6/v7
# - comment adding lto to cflags
pkgname=fpc
pkgver=3.2.2
pkgrel=8
pkgdesc="Free Pascal Compiler, Turbo Pascal 7.0 and Delphi compatible."
arch=('x86_64')
url="http://www.freepascal.org/"
license=('GPL' 'LGPL' 'custom')
backup=("etc/fpc.cfg")
depends=('ncurses' 'zlib' 'expat' 'binutils' 'make')
makedepends=(fpc)
options=(zipman libtool staticlibs !lto)
validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3')
source=("https://downloads.sourceforge.net/project/freepascal/Source/${pkgver}/fpcbuild-${pkgver}.tar.gz")
sha512sums=('75889bb54adc70a6e2cbd291476b9b12d61c8f943a05b7d16d2024de3215c935465ff43b1400c412e128e260c7f49a9c66e35c21f86cb866e671b5b60a282d82')
build() {
cd "${srcdir}"/fpcbuild-${pkgver}
#export CFLAGS="$CFLAGS -ffat-lto-objects"
[[ $CARCH == "armv7h" ]] && EXTRA="OPT=-dFPC_ARMHF"
pushd fpcsrc/compiler
fpcmake -Tall
popd
make build ${EXTRA}
}
package() {
cd "${srcdir}"/fpcbuild-${pkgver}
export HOME="${srcdir}"
make -j1 PREFIX="${pkgdir}"/usr install
export PATH="${pkgdir}"/usr/bin:$PATH
install -Dm0644 fpcsrc/rtl/COPYING.FPC "${pkgdir}"/usr/share/licenses/${pkgname}/COPYING.FPC
[ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${pkgver}/ppcx64 "${pkgdir}"/usr/bin/
[ "$CARCH" = "arm" -o "$CARCH" = "armv6h" -o "$CARCH" = "armv7h" ] && ln -s /usr/lib/fpc/${pkgver}/ppcarm "${pkgdir}"/usr/bin/
[ "$CARCH" = "aarch64" ] && ln -s /usr/lib/fpc/${pkgver}/ppca64 "${pkgdir}"/usr/bin/
mkdir -p "${pkgdir}"/etc
"${pkgdir}"/usr/lib/fpc/${pkgver}/samplecfg "${pkgdir}"/usr/lib/fpc/${pkgver} "${pkgdir}"/etc
"${pkgdir}"/usr/lib/fpc/${pkgver}/samplecfg "/usr/lib/fpc/${pkgver}" "${pkgdir}"/etc
cp "${srcdir}/.fp/fp."{cfg,ini} "${pkgdir}/usr/lib/fpc/${pkgver}/ide/text/"
# use -fPIC by default
echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "${pkgdir}/etc/fpc.cfg"
mv "${pkgdir}"/usr/man "${pkgdir}"/usr/share/
find "${pkgdir}"/etc/ -type f -exec sed -i "s|"${pkgdir}"||g" {} \;
}