summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 096d1efb1eb3807bac8b139ce41b9739337eb014 (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
# Maintainer: Pierre-Marie de Rodat <pmderodat on #ada at freenode.net>

pkgname=libadalang-git
pkgver=r4155.7ddad847
pkgrel=1

pkgdesc='High performance syntactic and semantic engine for the Ada programming language'
url='https://github.com/AdaCore/libadalang/'
arch=('any')
license=('GPL')

depends=('gcc-ada' 'gprbuild' 'gnatcoll-core' 'gnatcoll-iconv' 'gnatcoll-gmp'
         'langkit')
makedepends=('git')

provides=('libadalang')
conflicts=('libadalang')

source=('git+https://github.com/AdaCore/libadalang.git')
sha1sums=('SKIP')

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

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

    # In order to build the generated library, Langkit expects the QUEX_PATH to
    # be set.
    source /etc/profile.d/quex.sh

    # Clang has trouble compiling the Quex-generated lexer, so make sure
    # GPRbuild chooses GCC.
    gprconfig -o config.cgpr --batch --config=c,,,,GCC --config=ada,,,,

    python ada/manage.py --no-langkit-support generate

    # Build Libadalang both as a static library and as a shared one. Ask not to
    # use rpath (-R), but that only makes sense for the shared library, so
    # build in two steps: once for shared lib (+ mains), and once for static
    # lib.
    #
    # TODO: build & install static libraries. For now, this fails because
    # auto-initialized static libraries are built using partial linking (ld's
    # -r option), which conflicts with GCC's by default -pie option.
    python ada/manage.py \
        --library-types relocatable --no-langkit-support \
        build --build-mode=prod --gargs="-R --config=$PWD/config.cgpr"
}

package()
{
    cd "$srcdir/${pkgname%-git}"

    # Install the Ada library with its C binding
    python ada/manage.py \
        --library-types relocatable --no-langkit-support \
        install --build-mode=prod "$pkgdir/usr"

    # Install the Python binding
    cd build/python
    python setup.py install --root="$pkgdir"
}