summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3c5416bb563b2eab313df5bea81be2593e57869a (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
# Maintainer: Pierre-Marie de Rodat <pmderodat on #ada at freenode.net>
# Contributor: xiretza <xiretza+aur@gmail.com>
# Contributor: Rod Kay <charlie5 on #ada at freenode.net>
# Contributor: Earnestly <zibeon AT googlemail.com>
pkgbase=gprbuild-git
pkgname=(libgpr-git gprbuild-git)
pkgver=r3779.5e603a95
pkgrel=1
pkgdesc="Builder for multi-language systems"
arch=('i686' 'x86_64')
url="https://github.com/AdaCore/gprbuild/"
license=('GPL3')
makedepends=('git' 'gprbuild-bootstrap' 'xmlada')

source=('git+https://github.com/AdaCore/gprbuild.git'
        'git+https://github.com/AdaCore/gprconfig_kb.git'
        'relocatable-build.patch'
        'always-use-host-gprinstall.patch'
        'expose-cargs-and-largs-makefile.patch')
sha1sums=('SKIP'
          'SKIP'
          '91b20bde99cf02410cdb2b74aa1adb014458a9b3'
          '66792ebc73aff76a368bd902adc6a6f181d1d878'
          '85c3e5facda8ce8316955a501ef56086f1c41bc0')

pkgver() {
    cd "$srcdir/${pkgbase%-git}"
    printf "r%s.%s" \
        "$(git rev-list --count HEAD)" \
        "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "$srcdir/${pkgbase%-git}"
    patch -Np1 -i "$srcdir/expose-cargs-and-largs-makefile.patch"
    patch -Np1 -i "$srcdir/relocatable-build.patch"

    # By default, it tries to use the freshly-built gprinstall to install
    # gprbuild, but that requires libgpr, which can't be installed yet. Simply
    # fall back to gprinstall from gprbuild-bootstrap.
    patch -Np1 -i "$srcdir/always-use-host-gprinstall.patch"

    # GPRbuild hard-codes references to /usr/libexec, but ArchLinux packages
    # must use /usr/lib instead.
    sed -i 's/libexec/lib/g' doinstall gprbuild.gpr

    cd "$srcdir/gprconfig_kb"
    sed -i 's/libexec/lib/g' db/{compilers,gnat,linker}.xml
}

build() {
    cd "$srcdir/${pkgbase%-git}"

    export OS=UNIX
    GPRBUILD_OPTIONS="-R -cargs $CFLAGS -largs $LDFLAGS -gargs"
    make BUILD=production setup

    make GPRBUILD_OPTIONS="$GPRBUILD_OPTIONS" libgpr.build
    make GPRBUILD_OPTIONS="$GPRBUILD_OPTIONS" build

    # Copy the knowledge database so that gprinstall processes it
    rm -rf share/gprconfig
    cp -ar "$srcdir/gprconfig_kb/db" share/gprconfig
}

package_libgpr-git() {
    pkgdesc="Ada library to handle GPRbuild project files"
    provides=('libgpr')
    conflicts=('libgpr')
    depends=('xmlada')

    cd "$srcdir/${pkgbase%-git}"

    make prefix="$pkgdir/usr" libgpr.install
}

package_gprbuild-git() {
    provides=('gprbuild-bootstrap' 'gprbuild')
    conflicts=('gprbuild-bootstrap' 'gprbuild')
    depends=('libgpr' 'xmlada')

    cd "$srcdir/${pkgbase%-git}"

    make prefix="$pkgdir/usr" install

    # We don't need to distribute the installation script
    rm -f -- "$pkgdir/usr/doinstall"
}