summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d62cdcb1f1f1735841b622e47794b18a17f515e6 (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
# Maintainer: Andrew Sun <adsun701@gmail.com>

pkgname=mingw-w64-hunspell
pkgver=1.7.0
pkgrel=2
pkgdesc="Spell checker and morphological analyzer library and program (mingw-w64)"
arch=(any)
url="https://hunspell.github.io/"
license=("GPL" "LGPL" "MPL")
makedepends=('mingw-w64-configure' 'mingw-w64-readline' 'mingw-w64-wine')
depends=('mingw-w64-gettext' 'mingw-w64-pdcurses' 'mingw-w64-readline')
options=(!strip !buildflags staticlibs !debug !emptydirs)
source=("hunspell-${pkgver}.tar.gz"::"https://github.com/hunspell/hunspell/archive/v${pkgver}.tar.gz"
        "01-relocate.patch"
        "02-fix-link-with-pdcurses.patch")
sha256sums=('bb27b86eb910a8285407cf3ca33b62643a02798cf2eef468c0a74f6c3ee6bc8a'
            'b3a978749ef723481286e6237944729b6965bc57eacc5407b5f7fedf7d6aa8a1'
            '260432a8f01525e83124c79e375cc9f0692b1a6c97773add4c69b8efe081cf1d')

_architectures="i686-w64-mingw32 x86_64-w64-mingw32"

prepare() {
  cd "${srcdir}/hunspell-${pkgver}"

  # Remove files created by patch
  rm -rf src/tools/pathtools.cxx src/tools/pathtools.hxx
  patch -Np1 -i ${srcdir}/01-relocate.patch
  patch -Np1 -i ${srcdir}/02-fix-link-with-pdcurses.patch
  autoreconf -fiv
}

build() {
  cd "${srcdir}/hunspell-${pkgver}"
  for _arch in ${_architectures}; do
    CPPFLAGS+=" -I/usr/${_arch}/include/pdcurses"
    CFLAGS+=" -I/usr/${_arch}/include/pdcurses"
    CXXFLAGS+=" -I/usr/${_arch}/include/pdcurses"

    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-configure \
      --disable-rpath \
      --with-ui \
      --with-readline
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "${srcdir}/hunspell-${pkgver}/build-${_arch}"
    make DESTDIR="$pkgdir" install
    find "$pkgdir/usr/${_arch}" -name '*.exe' -exec ${_arch}-strip {} \;
    find "$pkgdir/usr/${_arch}" -name '*.dll' -exec ${_arch}-strip --strip-unneeded {} \;
    find "$pkgdir/usr/${_arch}" -name '*.a' -o -name '*.dll' | xargs ${_arch}-strip -g
    ln -s "/usr/${_arch}/lib/libhunspell-${pkgver%.*}.a" "$pkgdir/usr/${_arch}/lib/libhunspell.a"
    ln -s "/usr/${_arch}/lib/libhunspell-${pkgver%.*}.dll.a" "$pkgdir/usr/${_arch}/lib/libhunspell.dll.a"
  done
}