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

pkgname=libadalang-git
pkgver=r2849.99e95476
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')
makedepends=('git' 'langkit')

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,,,,

    python2 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.
    python2 ada/manage.py \
        --disable-static --enable-shared --no-langkit-support \
        build --build-mode=prod --gargs="-R --config=$PWD/config.cgpr"

    # 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.
    true || python2 ada/manage.py -vdebug \
        --enable-static --disable-shared \
        build --build-mode=prod --disable-all-mains
}

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

    # Install the Ada library with its C binding
    python2 ada/manage.py \
        --disable-static --enable-shared --no-langkit-support \
        install "$pkgdir/usr"

    # Install the Python binding
    site_packages="$pkgdir/usr/lib/python2.7/site-packages"
    mkdir -p "$site_packages"
    install -m644 build/python/libadalang.py "$site_packages"
    rm -rf "$pkgdir/usr/python"
}