summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4142283d923f79a5b7fb3e5fc8ac47b4dd4bced4 (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
pkgname=mingw-w64-libsquish
pkgver=1.14
pkgrel=1
pkgdesc="DXT compression library (mingw-w64)"
arch=(any)
url="http://sourceforge.net/projects/libsquish"
license=("MIT")
makedepends=(mingw-w64-cmake)
depends=(mingw-w64-crt)
options=(!libtool !strip !buildflags staticlibs)
source=("http://downloads.sourceforge.net/libsquish/libsquish-$pkgver.tgz"
"gcc440.patch")
sha1sums=('6a395d8ffa01b201794499dd1affc8c67f92cad3'
          '51bcc11eafbf79d9cde24769397c7a42f886154a')

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

prepare() {
  patch -Np0 -i ../gcc440.patch
}

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

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