summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b09a3063ae4a01a7b776b3620763773541b184e7 (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
# Maintainer: RĂ©mi Saurel <patadune@gmail.com>
# Contributor: Matthew Longley <randomticktock@gmail.com>

pkgname=javacc
pkgver=7.0.9
pkgrel=1
pkgdesc="Parser/scanner generator for Java"
arch=('any')
url="http://javacc.org/"
license=('BSD')
depends=('java-environment' 'apache-ant')
makedepends=('git')
source=("git+https://github.com/javacc/javacc.git#tag=javacc-$pkgver")
sha256sums=('SKIP')

build() {
    cd $srcdir/$pkgname
    ant
}

package() {
    cd $srcdir/$pkgname

    install -D LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
    mkdir -m755 -p "$pkgdir/usr/share/java/$pkgname/bin" "$pkgdir/usr/bin"

    # install examples
    cp -R "examples/" "$pkgdir/usr/share/java/$pkgname/examples"

    # install documentation
    cp -R "docs/" "$pkgdir/usr/share/java/$pkgname/docs"

    # install jar
    install -m755 -D "target/$pkgname-$pkgver.jar" "$pkgdir/usr/share/java/$pkgname/bin/lib/$pkgname.jar"
    ln -s /usr/share/java/$pkgname/bin/lib/javacc.jar $pkgdir/usr/share/java/javacc.jar

    # generate scripts to allow direct execution
    for i in jjtree jjdoc javacc; do
	printf "#\!bin/sh\nJAR=\"/usr/share/java/$pkgname/bin/lib/javacc.jar\"\n\njava -classpath \"\$JAR\" $i \"\$@\"\n" > "$pkgdir/usr/share/java/$pkgname/bin/$i";
	ln -s "/usr/share/java/$pkgname/bin/$i" "$pkgdir/usr/bin/$i";
    done

    # Set permissions
    chmod -R 755 "$pkgdir/usr/share/java/$pkgname/bin" "$pkgdir/usr/bin"
}