summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c37eee5a358f0e90cda88c459a8303cfa21513ea (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
# Maintainer: Kuan-Yen Chou <kuanyenchou at gmail dot com>

pkgname=cxx-common
pkgver=0.0.14
pkgrel=4
pkgdesc="Common dependency management for various Trail of Bits C++ codebases"
arch=('x86_64')
url="https://github.com/trailofbits/cxx-common"
license=('Apache')
depends=('python' 'openssl' 'ncurses' 'libxml2' 'zlib')
makedepends=('python-setuptools' 'clang' 'cmake' 'ninja' 'git')
checkdepends=()
options=('staticlibs' '!strip')
source=("https://github.com/trailofbits/cxx-common/archive/v${pkgver}.tar.gz")
sha256sums=('1f7c3de3fa491cfba52abd4ae5fe5cc00112309239737b89ecc8c00a9b6cb2c2')

build() {
    export LLVM_VERSION=1000
    export BOOTSTRAP="$srcdir/bootstrap"
    export LIBRARIES="$srcdir/libraries"
    cd "$srcdir/$pkgname-$pkgver"

    ## bootstrap cmake
    ./pkgman.py \
        --verbose \
        --c_compiler=/usr/bin/clang \
        --cxx_compiler=/usr/bin/clang++ \
        --repository_path="${BOOTSTRAP}" \
        --packages=cmake

    ## build z3 and llvm
    ./pkgman.py \
        --verbose \
        --c_compiler=/usr/bin/clang \
        --cxx_compiler=/usr/bin/clang++ \
        --llvm_version=${LLVM_VERSION} \
        --exclude_libcxx \
        --additional_paths="${BOOTSTRAP}/cmake/bin" \
        --repository_path="${LIBRARIES}" \
        --packages=z3,llvm

    rm -rf "$srcdir/$pkgname-$pkgver"/build/cmake*

    ## build the rest of the libraries
    ./pkgman.py \
        --verbose \
        --c_compiler="${LIBRARIES}/llvm/bin/clang" \
        --cxx_compiler="${LIBRARIES}/llvm/bin/clang++" \
        --additional_paths="${BOOTSTRAP}/cmake/bin:${LIBRARIES}/llvm/bin" \
        --repository_path="${LIBRARIES}" \
        --packages=cmake,google,xed
}

package() {
    install -dm 755 "$pkgdir/opt/$pkgname"
    cp -r "$srcdir/libraries" "$pkgdir/opt/$pkgname/"
    find "$pkgdir/opt/$pkgname"/libraries/*/lib/pkgconfig -type f -name '*.pc' \
        -exec sed -i -e "s|$srcdir|/opt/$pkgname|g" {} \;
}

# vim: set sw=4 ts=4 et: