summaryrefslogtreecommitdiff
path: root/manualPorts/fpc-cross/Pkgfile
blob: 940e35b1a99ad482540c3d6c264b0b4ddb3bd610 (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.0.4
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,^\./,/,'

}