summaryrefslogtreecommitdiff
path: root/manualPorts/fpc-cross/Pkgfile
blob: f178d8dfe6f3c3c9092cc935b334116af2936ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Description: A Free Pascal compiler.
# URL: http://www.freepascal.org/
# Packager: Danny Rawlins, crux at romster dot me
# Maintainer: Erich Eckner, crux at eckner dot net
# Depends on: fpc

name=fpc-cross
version=3.2.2
release=1
source=(ftp://ftp.freepascal.org/pub/fpc/dist/$version/source/fpcbuild-$version.tar.gz)

build() {

  readlink -e "$(which ppcx64)" | grep -qF "/$version/"

  cp -a "$SRC/fpcbuild-$version" "$SRC/fpcbuild-$version-win64"
  mv "$SRC/fpcbuild-$version" "$SRC/fpcbuild-$version-win32"

  for architecture in win32:i386 win64:x86_64; do

    cd "$SRC/fpcbuild-$version-${architecture%:*}"
    pushd fpcsrc/compiler
    export OS_TARGET="${architecture%:*}"
    export CPU_TARGET="${architecture#*:}"
    fpcmake -Tall
    popd
    make build NOGDB=1
  
    export HOME="$SRC"
  
    make -j1 PREFIX="$PKG/usr" crossinstall NOGDB=1

  done

  find "$PKG" -name '*.exe' -delete
  sed 's,^-\S\+\s\+\S\+\s\+,'"$PKG"'/,;t;d' $(prt-get path fpc)/.footprint \
    | xargs -rn1 rm -f
  ln -s "/usr/lib/fpc/${version}/ppcrossx64" "$PKG/usr/bin/"
  ln -s "/usr/lib/fpc/${version}/ppcross386" "$PKG/usr/bin/"
  find "$PKG" -type f \
    | sed 's,^\./,/,'

}