summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 032a41e90cf0a0c7af611e1cfc4c0fd38e40943b (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
pkgname=mingw-w64-libxml2
pkgver=2.12.6
pkgrel=1
arch=('any')
pkgdesc="XML parsing library, version 2 (mingw-w64)"
depends=('mingw-w64-crt' 'mingw-w64-libiconv' 'mingw-w64-zlib' 'mingw-w64-xz')
makedepends=('mingw-w64-configure')
options=('!buildflags' '!strip' 'staticlibs')
license=('LGPL')
url="http://www.xmlsoft.org/"
source=("https://download.gnome.org/sources/libxml2/${pkgver::4}/libxml2-${pkgver}.tar.xz")
sha256sums=('889c593a881a3db5fdd96cc9318c87df34eb648edfc458272ad46fd607353fbb')

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

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

  # disable doc & examples
  sed -i "s| doc example | |g" Makefile.am
  autoreconf -vfi
}

build()
{
  cd "${srcdir}/libxml2-${pkgver}"
  for _arch in ${_architectures}; do
    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-configure \
      --without-python
    make

    # deps symbols are not included in static lib:
    ${_arch}-ar x /usr/${_arch}/lib/libiconv.a
    ${_arch}-ar x /usr/${_arch}/lib/liblzma.a
    ${_arch}-ar x /usr/${_arch}/lib/libz.a
    ${_arch}-ar x /usr/${_arch}/lib/libws2_32.a
    ${_arch}-ar cru .libs/libxml2.a *.o 
    ${_arch}-ranlib .libs/libxml2.a

    popd
  done
}

package()
{
  for _arch in ${_architectures}; do
    cd "${srcdir}/libxml2-${pkgver}/build-${_arch}"
    make install DESTDIR="${pkgdir}"
    rm -r "${pkgdir}"/usr/${_arch}/share
    rm "${pkgdir}"/usr/${_arch}/bin/*.exe
    ${_arch}-strip --strip-unneeded "${pkgdir}"/usr/${_arch}/bin/*.dll
    ${_arch}-strip --strip-debug "${pkgdir}"/usr/${_arch}/lib/*.a
  done
}