summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 307a6139de8a23ece8866be67f6cc64c69017d79 (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-libsquish
pkgver=1.15
pkgrel=1
pkgdesc="DXT compression library (mingw-w64)"
arch=(any)
url="http://sourceforge.net/projects/libsquish"
license=("MIT")
makedepends=(mingw-w64-cmake mingw-w64-libpng)
depends=(mingw-w64-crt)
options=(!libtool !strip !buildflags staticlibs)
optdepends=(mingw-w64-libpng)
source=("http://downloads.sourceforge.net/libsquish/libsquish-$pkgver.tgz"
"gcc440.patch"
"0001-fix-install.patch")
sha1sums=('51844b9a8bc815a27e2cc0ffbede5fee3ef75110'
          '51bcc11eafbf79d9cde24769397c7a42f886154a'
          'f533643fb9c15d89a9e8f89eb5b722099b9d7aa1')

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

prepare() {
  patch -Np0 -i ${srcdir}/gcc440.patch
  patch -p1 -i ${srcdir}/0001-fix-install.patch
}

build() {
  for _arch in ${_architectures}; do
    unset LDFLAGS
    mkdir "build-${_arch}-static" && pushd "build-${_arch}-static"
    ${_arch}-cmake \
			-DCMAKE_BUILD_TYPE=Release \
			-DBUILD_SHARED_LIBS=OFF \
			..
    make
    popd
    mkdir "build-${_arch}-shared" && pushd "build-${_arch}-shared"
    ${_arch}-cmake \
			-DCMAKE_BUILD_TYPE=Release \
			-DBUILD_SQUISH_EXTRA=ON \
			..
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
		cd "${srcdir}/build-${_arch}-static"
    make DESTDIR="$pkgdir" install
    cd "${srcdir}/build-${_arch}-shared"
    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
  done
}