git » harfbuzz.git » main » tree

[main] / PKGBUILD

# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgbase=harfbuzz
pkgname=(
  harfbuzz
  harfbuzz-icu
  harfbuzz-utils
  harfbuzz-docs
)
pkgver=8.4.0
if [ -z "$HARFBUZZ_NO_CAIRO" ]; then
 pkgname+=(harfbuzz-cairo)
 pkgrel=2
else
 pkgrel=1
fi

pkgdesc="OpenType text shaping engine"
url="https://www.freedesktop.org/wiki/Software/HarfBuzz"
arch=(armv7h 'aarch64')
license=(MIT)
makedepends=(
  freetype2
  git
  glib2
  gobject-introspection
  graphite
  gtk-doc
  icu
  meson
  python
)
if [ -z "$HARFBUZZ_NO_CAIRO" ]; then
  makedepends+=(cairo)
fi

#checkdepends=(
#  python-fonttools
#  python-setuptools
#)
_commit=63973005bc07aba599b47fdd4cf788647b601ccd  # tags/8.4.0^0
source=("git+https://github.com/harfbuzz/harfbuzz#commit=$_commit")
b2sums=('19f25dbf2ba6d90fdbb4ecb1039c8d0d72c55cff3dc3b30d6b75b626c15bf28a2118495837d80b7f622f0929dd7d4a07b5526963e1204bb9c90bc9f976c26977')

pkgver() {
  cd harfbuzz
  git describe --tags | sed 's/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd harfbuzz
}

build() {
  local meson_options=(
    -D graphite2=enabled
    -D chafa=disabled
  )
if [ -n "$HARFBUZZ_NO_CAIRO" ]; then
  meson_options+=(-Dcairo=disabled)
fi
  # Harfbuzz wants no exceptions
  CFLAGS="${CFLAGS/-fexceptions/}"
  CXXFLAGS="${CXXFLAGS/-fexceptions/}"

  arch-meson harfbuzz build "${meson_options[@]}"
  meson compile -C build
}

#check() {
#  mkdir -p tmp
#  TMPDIR="$PWD/tmp" meson test -C build --print-errorlogs
#  rm -r tmp
#}

_pick() {
  local p="$1" f d; shift
  for f; do
    d="$srcdir/$p/${f#$pkgdir/}"
    mkdir -p "$(dirname "$d")"
    mv "$f" "$d"
    rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  done
}

package_harfbuzz() {
  depends=(
    libfreetype.so
    libgraphite2.so
    libg{lib,object}-2.0.so
  )
  optdepends=('harfbuzz-utils: utilities')
  provides=(libharfbuzz{,-subset,-gobject}.so)

  meson install -C build --destdir "$pkgdir"

  ( cd "$pkgdir"

if [ -z "$HARFBUZZ_NO_CAIRO" ]; then
    _pick hb-cairo usr/lib/libharfbuzz-cairo*
    _pick hb-cairo usr/lib/pkgconfig/harfbuzz-cairo.pc
    _pick hb-cairo usr/include/harfbuzz/hb-cairo.h
fi

    _pick hb-icu usr/lib/libharfbuzz-icu*
    _pick hb-icu usr/lib/pkgconfig/harfbuzz-icu.pc
    _pick hb-icu usr/include/harfbuzz/hb-icu.h

    _pick hb-utils usr/bin

    _pick hb-docs usr/share/gtk-doc
  )

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-cairo() {
  pkgdesc+=" - Cairo integration"
  depends=(
    libcairo.so
    libharfbuzz.so
  )
  provides=(libharfbuzz-cairo.so)

  mv hb-cairo/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-icu() {
  pkgdesc+=" - ICU integration"
  depends=(
    libharfbuzz.so
    libicuuc.so
  )
  provides=(libharfbuzz-icu.so)

  mv hb-icu/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-utils() {
  pkgdesc+=" - Utilities"
  depends=(
    harfbuzz
    libcairo.so
    libchafa.so
    libfreetype.so
    libglib-2.0.so
    libgobject-2.0.so
    libharfbuzz-gobject.so
    libharfbuzz-subset.so
    libharfbuzz.so
  )
if [ -z "$HARFBUZZ_NO_CAIRO" ]; then
  depends+=(harfbuzz-cairo libharfbuzz-cairo.so)
fi

  mv hb-utils/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

package_harfbuzz-docs() {
  pkgdesc+=" - Documentation"
  depends=()

  mv hb-docs/* "$pkgdir"

  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 harfbuzz/COPYING
}

# vim:set sw=2 sts=-1 et: