summaryrefslogtreecommitdiff
path: root/libre/antlr2/PKGBUILD
blob: 06ee835c508548cfc4b7fdcc05c6d7a5ca345b43 (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
89
90
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
# Maintainer (Arch): Andrea Scarpino <andrea@archlinux.org>
# Contributor (Arch): George Giorgidze <giorgidze (at) gmail.com>
# Contributor (Arch): Stefan Husmann <stefan-husmann@t-online.de>

pkgbase=antlr2
pkgname=('antlr2' antlr2-{java,python2,cxx})
pkgver=2.7.7
pkgrel=7.parabola2
pkgdesc="Language recognition tool providing a framework to build grammatical parsers"
arch=('i686' 'x86_64' 'armv7h')
url="http://www.antlr2.org/"
license=('custom:Public Domain')
makedepends=('java-environment' 'python2' 'bash' 'jh')
options=('staticlibs')
source=("http://www.antlr2.org/download/antlr-${pkgver}.tar.gz"
        "https://repo.maven.apache.org/maven2/antlr/antlr/$pkgver/antlr-$pkgver.pom"
        'runantlr2.sh'
        'gcc4.4.patch')
md5sums=('01cc9a2a454dd33dcd8c856ec89af090'
         '78af3de823003f6d8dded39c70bc30ae'
         '05cb34ec96d85fca430dda91c3200ba4'
         '158677e4c0f357afbb56656231a54815')

prepare() {
  cd "${srcdir}/antlr-${pkgver}"
  patch -Np1 -i "${srcdir}"/gcc4.4.patch
}

build() {
  cd "${srcdir}/antlr-${pkgver}"

  ./configure --prefix=/usr \
    --disable-examples \
    --disable-csharp
  make
}

_install_license() {
  install -Dm644 "$srcdir"/antlr-${pkgver}/LICENSE.txt \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_antlr2() {
  depends=('bash' 'antlr2-java')

  install -Dm755 "$srcdir"/runantlr2.sh "$pkgdir"/usr/bin/runantlr2
  _install_license
}

package_antlr2-java() {
  pkgdesc+=" (Java version)"
  depends=('java-runtime')

  provides=("java-antlr2=$pkgver")
  conflicts=("java-antlr2")
  replaces=("java-antlr2")

  DESTDIR="$pkgdir" jh mvn-install antlr antlr $pkgver \
    "$srcdir"/antlr-${pkgver}.pom \
    "$srcdir"/antlr-${pkgver}/antlr/antlr.jar \
    antlr2.jar

  ln -s "/usr/share/java/antlr2.jar" \
    "${pkgdir}/usr/share/java/antlr2-${pkgver}.jar"
  _install_license
}

package_antlr2-python2() {
  pkgdesc+=" (Python version)"
  depends=('python2')

  provides=("python2-antlr2=$pkgver")
  conflicts=("python2-antlr2")
  replaces=("python2-antlr2")

  cd "$srcdir"/antlr-${pkgver}/lib/python
  python2 setup.py install --root="${pkgdir}" --optimize=1

  _install_license
}

package_antlr2-cxx() {
  pkgdesc+=" (C++ version)"

  cd "$srcdir"/antlr-${pkgver}/lib/cpp
  make prefix="${pkgdir}/usr" install

  _install_license
}