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

pkgname=mingw-w64-tinyxml
pkgver=2.6.2
pkgrel=3
pkgdesc="Simple, small, C++ XML parser that can be easily integrated into other programs (mingw-w64)"
arch=(any)
url="http://www.grinninglizard.com/tinyxml"
license=("zlib")
depends=('mingw-w64-crt')
makedepends=('mingw-w64-cmake')
options=('!strip' '!buildflags' 'staticlibs')
source=("http://downloads.sourceforge.net/tinyxml/tinyxml_${pkgver//./_}.tar.gz"
        "entity.patch"
        "tinyxml-2.5.3-stl.patch"
        "tinyxml.pc"
        "CMakeLists.txt")
sha256sums=('15bdfdcec58a7da30adc87ac2b078e4417dbe5392f3afb719f9ba6d062645593'
            'ef493209b0a51160171fd834a7ecdddd02679463b85fb89a2ea254213e47f99b'
            '3baf2c4dbc2c8f54a151dac8860113d2f549174f83ed85d552b094dfaebb52af'
            '3a658c2d84d461cd64f48aa489baf78bcf06ad193d18455f3e9048a52a1f3b9d'
            'SKIP')

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

prepare() {
  cd "$srcdir/tinyxml"
  patch -p0 -i "$srcdir"/entity.patch
  patch -p1 -i "$srcdir"/tinyxml-2.5.3-stl.patch
  cp "$srcdir"/CMakeLists.txt .
}

build() {
  cd "$srcdir/tinyxml"
  for _arch in ${_architectures}; do
    # Shared
    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-cmake ..
    make
    popd
    
    # Static
    mkdir -p build-${_arch}-static && pushd build-${_arch}-static
    ${_arch}-cmake -DBUILD_SHARED_LIBS=OFF ..
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "$srcdir/tinyxml/build-${_arch}-static"
    make DESTDIR="$pkgdir" install
    cd "$srcdir/tinyxml/build-${_arch}"
    make DESTDIR="$pkgdir" install
    
    # .pc file
    install -Dm644 "${srcdir}/tinyxml.pc" "${pkgdir}/usr/${_arch}/lib/pkgconfig/tinyxml.pc"
    sed -i "s,@PREFIX@,/usr/${_arch}," "${pkgdir}/usr/${_arch}/lib/pkgconfig/tinyxml.pc"
    
    # strip libraries
    ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
  done
}