summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: efe649d15bb0d1be4edd7218777891da8429351b (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
# Maintainer: Jakob Gahde <j5lx@fmail.co.uk>

_pkgname=sfntly
pkgname=${_pkgname}-git
pkgver=r157.64f78562
pkgrel=1
pkgdesc="A Library for Using, Editing, and Creating SFNT-based Fonts"
arch=('i686' 'x86_64')
url="https://github.com/googlei18n/sfntly"
license=('Apache')
depends=('java-environment' 'icu' 'bash')
makedepends=('git' 'apache-ant' 'cmake')
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
source=("git+https://github.com/googlei18n/${_pkgname}.git")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/${_pkgname}"

  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${srcdir}/${_pkgname}/java"

  export ANT_OPTS="-Dfile.encoding=UTF-8"
  ant

  cd "${srcdir}/${_pkgname}/cpp"

  bsdtar xCf "ext" "ext/redist/gtest-1.6.0.zip"
  ln -s "gtest-1.6.0" "ext/gtest"
  mkdir "build"
  cd "build"
  cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=ON -DBUILD_SHARED_LIBS=ON
  make sfntly subsetter subtly subtly_subsetter subtly_merger subtly_debug chrome_subsetter
}

package() {
  cd "${srcdir}/${_pkgname}/java/dist"

  install -Dm644 "lib/sfntly.jar" "${pkgdir}/usr/share/java/sfntly/sfntly.jar"
  install -Dm644 "sample/sflint/sflint.jar" "${pkgdir}/usr/share/java/sfntly/sflint.jar"
  install -Dm644 "sample/sfntdump/sfntdump.jar" "${pkgdir}/usr/share/java/sfntly/sfntdump.jar"
  install -Dm644 "tools/fontinfo/fontinfo.jar" "${pkgdir}/usr/share/java/sfntly/fontinfo.jar"
  install -Dm644 "tools/sfnttool/sfnttool.jar" "${pkgdir}/usr/share/java/sfntly/sfnttool.jar"

  for tool in sflint sfntdump fontinfo sfnttool; do
    echo "#!/bin/sh" > "${tool}"
    echo "exec /usr/bin/java -jar '/usr/share/java/sfntly/${tool}.jar' \"\$@\"" >> "${tool}"
    install -Dm755 "${tool}" "${pkgdir}/usr/bin/${tool}"
  done

  mkdir "doc"
  cd "doc"
  jar xf "../lib/sfntly-javadoc.jar"
  rm -rf "META-INF"
  install -dm755 "${pkgdir}/usr/share/doc/sfntly"
  cp -a * "${pkgdir}/usr/share/doc/sfntly/"

  cd "${srcdir}/${_pkgname}/cpp/build"

  for file in {bin,lib}/*; do
    install -Dm755 "${file}" "${pkgdir}/usr/${file}"
  done
}