summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9809d3d8a907d47ef932610c5f1ac44ad82d4dad (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
# Maintainer: Guillaume Maudoux <layus DOT on @AT@ gmail DOT com>

pkgname=mozart2-git
pkgver=v2.0.0.alpha.0.4180.g7bdb820
pkgrel=1
pkgdesc="The Mozart Programming System version 2"
arch=('i686' 'x86_64')
url="https://github.com/mozart/mozart2"
license=('BSD')
depends=('boost-libs' 'tk' 'gmp' 'hicolor-icon-theme' 'xdg-utils')
optdepends=('emacs: Interactive programming interface (recommended)')
makedepends=('java-runtime-headless' 'emacs' 'gcc' 'boost>=1.61' 'cmake' 'gtest' 'clang' 'llvm')
provides=('mozart')
conflicts=('mozart' 'mozart-git' 'mozart2' 'mozart2-bin')
install="${pkgname}.install"
source=(
    "$pkgname::git+https://github.com/mozart/mozart2"
    'git+https://github.com/mozart/mozart2-stdlib'
    'git+https://github.com/google/googletest'
)
sha256sums=('SKIP' 'SKIP' 'SKIP')

pkgver() {
    cd "$pkgname"
    git describe --always | sed 's|-|.|g'
}

prepare() {
    cd "$srcdir/$pkgname"

    git submodule init
    git config submodule.stdlib.url $srcdir/mozart2-stdlib
    git config submodule.gtest.url $srcdir/googletest
    git submodule update

    # Add required libraries to executable.
    # TODO : Explore clang build process, I have no idea why this may be needed.
    #        Normally ld should be able to identify required LLVM/Clang libs by itself.
    libs="LLVM clang clangTooling clangFrontendTool clangFrontend \
          clangDriver clangSerialization clangCodeGen clangParse clangSema \
          clangStaticAnalyzerFrontend clangStaticAnalyzerCheckers \
          clangStaticAnalyzerCore clangAnalysis clangARCMigrate clangEdit \
          clangAST clangLex clangBasic"
    sed -i'' \
        -e "s%(generator \"\${CLANG_LIBRARY}\"%\\0 $libs%" \
        vm/generator/main/CMakeLists.txt

    # Remove hard-coded palette settings in QTk (Avoids bug in GUI's on Linux).
    sed -i'' '/tk_setPalette/ s/^/%/' \
        stdlib/wp/qtk/QTkBare.oz
}

build() {
    mkdir -p "$srcdir/build"
    cd "$srcdir/build"
    cmake \
          -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/usr/ \
          -DMOZART_BOOST_USE_STATIC_LIBS=OFF \
          "$srcdir/$pkgname"

    make #VERBOSE=1
}

check() {
    cd "$srcdir/build"
    make test
}

package() {
    cd "$srcdir/build"
    make DESTDIR="$pkgdir/" install

    install -D -m644 "$srcdir/$pkgname/LICENSE.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}