summaryrefslogtreecommitdiff
path: root/libre/closure-compiler/PKGBUILD
blob: 9eb355307b87087649319d5b76e133488875ea38 (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
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Contributor: Luke Shumaker <lukeshu@sbcglobal.net>

pkgname=closure-compiler
pkgver=20170218
pkgrel=1.parabola1
pkgdesc="Performs checking, instrumentation and optimizations on Javascript code."
arch=('any')
url="https://developers.google.com/closure/compiler/"
license=('APACHE')
depends=('java-runtime')
makedepends=('apache-ant' 'args4j' 'java-gson' 'java-guava' 'jsr305' 'protobuf-java' 'jh')
source=("https://repo.parabola.nu/other/$pkgname/$pkgname-$pkgver.tar.gz"
        "https://repo1.maven.org/maven2/com/google/jsinterop/jsinterop-annotations/1.0.1/jsinterop-annotations-1.0.1-sources.jar"
        'build.xml' 'closure-compiler.sh')
sha256sums=('d37ae7ba79da6f8cfaac5d3788fef28f7ed6797f720fec76073a5bba8d4c34a4'
            '082d7a7cba06f0543b7d0085929897f343054acd8491a4d7020ab433d4f6daf5'
            '7b3db592705a140dde6c60b61ed6de1f36be43389327aad132461cc36f1759b4'
            '10b0d74a305548b029f05bd4fb0ffabec2ff782f9e3c054c2f5236f1bf4c6630')

mkdepends=(git)
mksource=("$pkgname-$pkgver::git+https://github.com/google/closure-compiler.git#tag=v$pkgver")
mkmd5sums=('SKIP')

mksource() {
  cd "$srcdir/$pkgname-$pkgver"

  sed -i "s/1.0-SNAPSHOT/v$pkgver/g" \
    externs/pom.xml \
    pom.xml \
    pom-main.xml
}

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

  mv ../build.xml .
  sed -i "s/1.0-SNAPSHOT/v$pkgver/g" build.xml

  mkdir -p {jsinterop,lib}
  ln -sf /usr/share/apache-ant/lib/ant.jar    lib/ant.jar
  ln -sf /usr/share/java/args4j.jar           lib/args4j.jar
  ln -sf /usr/share/java/guava.jar            lib/guava.jar
  ln -sf /usr/share/java/gson.jar             lib/gson.jar
  ln -sf /usr/share/java/jsr305.jar           lib/jsr305.jar
  ln -sf /usr/share/java/protobuf.jar         lib/protobuf-java.jar
}

build() {
  cd "$srcdir/$pkgname-$pkgver"

  javac -d jsinterop $(find ../jsinterop/ -name \*.java)
  jar -cvf lib/jsinterop.jar -C jsinterop .

  ant jar javadoc
}

package() {
  cd "$srcdir/$pkgname-$pkgver"

  # Install license file
  install -Dm644 COPYING "$pkgdir/usr/share/licenses/$pkgname/COPYING"

  # Install documentation
  install -d "$pkgdir/usr/share/doc/$pkgname"
  cp -r build/javadoc "$pkgdir/usr/share/doc/$pkgname"

  # Install Maven artifacts
  export DESTDIR=$pkgdir
  jh mvn-install com.google.javascript "$pkgname-parent"  "v$pkgver" pom.xml
  jh mvn-install com.google.javascript "$pkgname-externs" "v$pkgver" externs/pom.xml
  jh mvn-install com.google.javascript "$pkgname"         "v$pkgver" pom-main.xml \
    build/compiler.jar "$pkgname.jar"

  ln -s "/usr/share/java/$pkgname.jar" \
    "$pkgdir/usr/share/java/$pkgname-$pkgver.jar"

  install -Dm755 "$srcdir/closure-compiler.sh" "$pkgdir/usr/bin/closure-compiler"
}