summaryrefslogtreecommitdiff
path: root/libre/javacc/PKGBUILD
blob: 5aa3b3c71abdf50fc42a602d84a9d7e38b96e7a9 (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
# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>

pkgname=javacc
pkgver=6.1.2
pkgdesc="Java Compiler Compiler; a parser generator"
url="http://javacc.java.net/"
license=('BSD3')

arch=('any')
pkgrel=1
depends=('java-runtime')
makedepends=('apache-ant' 'junit' 'jh')
source=("https://java.net/projects/${pkgname}/downloads/download/releases/Release%20${pkgver}/${pkgname}-${pkgver}-sources.jar"
	'build-xml-bootstrap.patch')
md5sums=('a29fdd55ccb738dc07a489b80b74e062'
         'c863ce2ed275f36ff0eebfc9e2776592')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  ln -sfT /usr/share/java/junit.jar lib/junit3.8.1/junit.jar
  rm -f bootstrap/javacc.jar
  sed -i "s|^  <version>.*</version>|  <version>$pkgver</version>|" pom.xml
  cd ..
  cp -a "$pkgname-$pkgver" "$pkgname-$pkgver"-bootstrap
  patch -i build-xml-bootstrap.patch "$pkgname-$pkgver"-bootstrap/build.xml
  rm -rf "$pkgname-$pkgver"/src/main/generated-sources
}


build() {
  cd "$srcdir"/$pkgname-$pkgver-bootstrap
  ant
  cd ../$pkgname-$pkgver
  ln -srf "$PWD"-bootstrap/target/javacc-$pkgver.jar bootstrap/javacc.jar

  ant

  cd ..
  local prog
  for prog in javacc jjdoc jjtree; do
    printf '#!/bin/sh\nexec java -classpath %q %s "$@"\n' \
	   /usr/share/java/javacc.jar $prog \
	   > $prog.sh
  done
}

package() {
  cd "$srcdir"

  local prog
  for prog in javacc jjdoc jjtree; do
	  install -Dm755 $prog.sh "$pkgdir"/usr/bin/$prog
  done

  cd "$pkgname-$pkgver"
  DESTDIR="$pkgdir" jh mvn-install net.java.dev.javacc javacc "$pkgver" \
	 pom.xml target/javacc-$pkgver.jar javacc.jar
  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}