summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7af060905a97a4f1fd3b45a2b633372edff3ad9a (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
# Maintainer: Michael Yang <ohmyarchlinux@gmail.com>

pkgname=mingw-w64-libxlsxwriter-git
pkgver=0.7.5.r528.18c8cb6
pkgrel=1
pkgdesc='A C library for creating Excel XLSX files (mingw-w64)'
arch=('any')
url='https://libxlsxwriter.github.io'
license=('BSD')
makedepends=('git' 'mingw-w64-cmake' 'mingw-w64-minizip')
options=('!strip' '!buildflags' 'staticlibs')
conflicts=('mingw-w64-libxlsxwriter')
provides=('mingw-w64-libxlsxwriter')
source=('git://github.com/jmcnamara/libxlsxwriter.git')
sha512sums=('SKIP')

_architectures='i686-w64-mingw32 x86_64-w64-mingw32'

pkgver() {
  cd libxlsxwriter
  echo "$(grep LXW_VERSION include/xlsxwriter.h | cut -d '"' -f2).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

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

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