summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8ae0c6d6974b278d7b21a9108355d76030d86b05 (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
pkgname=mingw-w64-blosc
pkgver=1.17.0
pkgrel=1
pkgdesc="A blocking, shuffling and loss-less compression library (mingw-w64)"
url="http://blosc.org/"
license=('BSD')
arch=('any')
depends=('mingw-w64-zstd' 'mingw-w64-snappy' 'mingw-w64-lz4' 'mingw-w64-zlib')
makedepends=('mingw-w64-cmake')
options=('!buildflags' '!strip' 'staticlibs')
source=("https://github.com/Blosc/c-blosc/archive/v${pkgver}.tar.gz")
sha256sums=('75d98c752b8cf0d4a6380a3089d56523f175b0afa2d0cf724a1bd0a1a8f975a4')

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

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

  # dont use bundled pthread (missing _WIN32_WINNT 0x0600 define)
  sed -i 's|#include "win32/pthread.h"|#include <pthread.h>|g' blosc/blosc.c blosc/shuffle.c
  sed -i 's|#include "win32/pthread.c"||g' blosc/blosc.c

  sed -i 's|DESTINATION ${lib_dir}|LIBRARY DESTINATION ${lib_dir} ARCHIVE DESTINATION ${lib_dir} RUNTIME DESTINATION bin|g' blosc/CMakeLists.txt
}

build() {
  cd "$srcdir/c-blosc-${pkgver}"
  for _arch in ${_architectures}; do
    mkdir -p build-${_arch} && pushd build-${_arch}
    ${_arch}-cmake \
      -DPREFER_EXTERNAL_LZ4="ON" \
      -DPREFER_EXTERNAL_ZLIB="ON" \
      -DPREFER_EXTERNAL_SNAPPY="ON" \
      -DPREFER_EXTERNAL_ZSTD="ON" \
      -DBUILD_TESTS="OFF" \
      ..
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "$srcdir/c-blosc-${pkgver}/build-${_arch}"
    make install DESTDIR="$pkgdir"
    ${_arch}-strip --strip-unneeded "$pkgdir"/usr/${_arch}/bin/*.dll
    ${_arch}-strip -g "$pkgdir"/usr/${_arch}/lib/*.a
  done
}