desktop/scala/PKGBUILD
2017-04-28 00:27:59 +02:00

66 lines
2.6 KiB
Bash

pkgbase=scala
pkgname=('scala' 'scala-docs' 'scala-sources')
pkgver=2.12.2
pkgrel=1
_watch="https://github.com/scala/scala/releases"
pkgdesc="A Java-interoperable language with object-oriented and functional features"
arch=('any')
url="http://www.scala-lang.org"
license=('BSD')
makedepends=('git' 'java-runtime>=8')
_sbtver=0.13.13
source=("scala-$pkgver.tar.gz::https://github.com/scala/scala/archive/v${pkgver}.tar.gz"
"scala-docs-${pkgver}.tar.xz::http://www.scala-lang.org/files/archive/scala-docs-${pkgver}.txz"
# sbt is used to build scala
"https://dl.bintray.com/sbt/native-packages/sbt/${_sbtver}/sbt-${_sbtver}.tgz")
sha256sums=('822ef9c8077765cf558c1bbc88e957ccae77402ca02f432053f4f3bf4f91a2b1'
'b64ac34aac4d61c8925ec51fcedc13438aa2ad8d49afa25d46ba4a1d0bb87f6c'
'40d03d21a260c5a6a43f8349298f41c9d047f97972057d9d915afd8945faf979')
build() {
sbt_exec=$srcdir/sbt-launcher-packaging-$_sbtver/bin/sbt
cd "$srcdir"/${pkgname}-${pkgver}
$sbt_exec dist/mkPack packageSrc packageDoc
}
package_scala() {
# baseline java version is 8 for 2.12.x
depends=('java-runtime>=8' 'java-environment>=8')
optdepends=('scala-docs' 'scala-sources' 'graphviz: generate diagrams')
cd "$srcdir"/${pkgname}-${pkgver}/build/pack
install -d "$pkgdir"/usr/{bin,share} "$pkgdir"/usr/share/man/man1 "$pkgdir"/usr/share/scala/{bin,lib}
cp -r lib "$pkgdir"/usr/share/scala/
# cp -r target/scala-dist/resource_managed/main/man "$pkgdir"/usr/share/
install -m 755 bin/{fsc,scala,scalac,scalap,scaladoc} "$pkgdir"/usr/share/scala/bin
install -D -m0644 "$srcdir"/scala-${pkgver}/doc/LICENSE.md "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE.md
ln -s ../share/scala/bin/fsc "$pkgdir"/usr/bin/fsc
ln -s ../share/scala/bin/scala "$pkgdir"/usr/bin/scala
ln -s ../share/scala/bin/scalac "$pkgdir"/usr/bin/scalac
ln -s ../share/scala/bin/scalap "$pkgdir"/usr/bin/scalap
ln -s ../share/scala/bin/scaladoc "$pkgdir"/usr/bin/scaladoc
}
package_scala-docs() {
pkgdesc="Scala documentation"
cd "$srcdir"/scala-${pkgver}
mkdir -p "$pkgdir"/usr/share/doc/
cp -r api "$pkgdir"/usr/share/doc/scala
install -D -m0644 "$srcdir"/scala-${pkgver}/doc/LICENSE.md "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE.md
}
package_scala-sources() {
pkgdesc="Scala sources"
cd "$srcdir"/scala-${pkgver}
mkdir -p "$pkgdir"/usr/share/scala/
find . -type f -name '*-sources.jar' | while read f; do
install -Dm0644 $f "$pkgdir"/usr/share/scala/src/`basename $f`
done
install -D -m0644 "$srcdir"/scala-${pkgver}/doc/LICENSE.md "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE.md
}