summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ff2f248b5ac17c1d9d1510a3b64d53ed972971f6 (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
# Maintainer: Andrew Sun <adsun701 at gmail dot com>

pkgname=mingw-w64-hunspell
pkgver=1.7.2
pkgrel=1
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=('69fa312d3586c988789266eaf7ffc9861d9f6396c31fc930a014d551b59bbd6e'
            '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
    mkdir -p build-${_arch} && pushd build-${_arch}
    CPPFLAGS+=" -I/usr/${_arch}/include/pdcurses" \
    CFLAGS+=" -I/usr/${_arch}/include/pdcurses" \
    CXXFLAGS+=" -I/usr/${_arch}/include/pdcurses" \
    ${_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
}