summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6e38eb5ffd7fe9cb7d1440088e8eac0c9797c567 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Maintainer: L <alaviss 0 at gmail dot com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Valeriy Lyasotskiy <onestep@ukr.net>
# Contributor: Jan Willemson <janwil@hot.ee>
# Contributor: Hugo Ideler <hugoideler@dse.nl>
# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com>
# Original PKGBUILD: Andre Naumann <anaumann@SPARCed.org>
# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc

# Build docs
_build_docs=true

pkgbase=fpc-svn
pkgname=(fpc-svn fpc-src-svn)
[[ $_build_docs ]] && pkgname+=(fpc-docs-svn)
pkgver=3.1.1.r35178
_pkgver=${pkgver/${pkgver:5}}
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.freepascal.org/"
license=('GPL' 'LGPL' 'custom')
depends=('ncurses' 'zlib' 'expat')
# Trunk can only be built with stable version of FPC
makedepends=('fpc<9999' 'svn')
[[ $_build_docs ]] && makedepends+=('texlive-core' 'texlive-htmlxml'
                                    'texlive-latexextra' 'ghostscript')
source=(fpcbuild::svn+http://svn.freepascal.org/svn/fpcbuild/trunk)
sha1sums=('SKIP')

pkgver() {
  cd "$srcdir/fpcbuild/fpcsrc"
  printf "%s.r%s" \
    $(grep -m1 version Makefile.fpc |sed 's/version=//') \
    $(svnversion | tr -d [A-z])
}

prepare() {
  cd "${srcdir}/fpcbuild"

  # Needed to fix documentation building on my machine
  # FIXME: check if it's required to build docs
  ln -sf /usr/share/texmf-dist/tex/latex/mdwtools/syntax.sty fpcdocs/syntax.sty
}

build() {
  cd "${srcdir}/fpcbuild"
  pushd fpcsrc/compiler
  fpcmake -Tall
  popd
  make ${MAKEFLAGS} NOGDB=1 OPT=" -dRelease" build

  cd fpcdocs
  [[ $_build_docs ]] && make ${MAKEFLAGS} FPCSRCDIR="${srcdir}/fpcbuild/fpcsrc" html
}

package_fpc-svn() {
  pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible \
    Pascal Compiler. It comes with fully TP 7.0 compatible run-time library."
  backup=("etc/fpc.cfg")
  options=('zipman' 'staticlibs')
  conflicts=('fpc')
  provides=('fpc=9999')

  cd "${srcdir}/fpcbuild"

  export HOME="$srcdir"

  make -j1 PREFIX="${pkgdir}"/usr install NOGDB=1 OPT=" -dRelease"

  export PATH="$pkgdir/usr/bin:$PATH"

  install -Dm0644 fpcsrc/rtl/COPYING.FPC "${pkgdir}/usr/share/licenses/${pkgname}/COPYING.FPC"

  [ "$CARCH" = "i686" ] && ln -s /usr/lib/fpc/${_pkgver}/ppc386 "${pkgdir}/usr/bin/"
  [ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${_pkgver}/ppcx64 "${pkgdir}/usr/bin/"

  mkdir -p "${pkgdir}/etc"
  "${pkgdir}/usr/lib/fpc/${_pkgver}/samplecfg" "$pkgdir/usr/lib/fpc/${_pkgver}" "${pkgdir}/etc"

  # 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" {} \;
}

package_fpc-src-svn() {
  pkgdesc="Sources for the FreePascal compiler (required by the Lazarus IDE)"
  options=("!strip")
  conflicts=("fpc-src")
  provides=("fpc-src")

  install -dm755 "$pkgdir"/usr/lib/fpc

  svn export -r HEAD "$srcdir"/fpcbuild/fpcsrc "$pkgdir/usr/lib/fpc/src"
}

package_fpc-docs-svn() {
  pkgdesc="Documentation for the Free Pascal compiler"
  options=("!strip")

  cd "$srcdir/fpcbuild/fpcdocs"
  make PREFIX="$pkgdir/usr" htmlinstall
}