summaryrefslogtreecommitdiff
path: root/pcr/jlex/PKGBUILD
blob: 6cdc1e5d76b646682715322e6e468060ec3abe13 (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=jlex
pkgver=1.2.6
pkgrel=1.parabola2
pkgdesc="Lex-style lexical analyser generator for Java"
arch=('any')
license=('custom')
url="http://www.cs.princeton.edu/~appel/modern/java/JLex/"
depends=('java-runtime')
makedepends=('java-environment' 'jh')
source=("http://www.cs.princeton.edu/~appel/modern/java/JLex/Archive/1.2.6/Main.java"
        "http://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex"
        "jlex.sh")
md5sums=('fe0cff5db3e2f0f5d67a153cf6c783af'
         'ae887758b2657981d023a72a165da830'
         '902c30f6d3c2c8f6cb52b11c56e0bedf')

prepare() {
  cd ${srcdir}
  mkdir -p build/classes
  head -167 Main.java | tail -21 > LICENSE.txt
}

build() {
  cd ${srcdir}
  javac -d "build/classes" Main.java
  javadoc -d "build/javadoc" Main.java

  jar -cvfe JLex.jar JLex.Main -C "build/classes" .
}

package() {
  cd ${srcdir}

  # Install license file
  install -Dm644 LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"

  # Install documentation
  install -d "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r "build/javadoc" "${pkgdir}/usr/share/doc/${pkgname}"
  cp -r "sample.lex" "${pkgdir}/usr/share/doc/${pkgname}/examples"

  # Install jar file
  install -Dm644 JLex.jar "${pkgdir}/usr/share/java/JLex.jar"

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

  install -Dm755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
}