summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0ae05e1951b93358be8904b2db7c0aae7755e71e (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
# Contributor: Thomas Poechtrager <tpoechtrager at g m a i l>

pkgname=mingw-w64-libgeoip
pkgver=1.6.12
pkgrel=1
pkgdesc="Non-DNS IP-to-country resolver C library (mingw-w64)"
arch=(any)
url="http://www.maxmind.com/app/c"
license=('LGPL')
makedepends=(mingw-w64-configure mingw-w64-gcc)
depends=(mingw-w64-crt)
options=(!libtool !strip !buildflags)
source=(https://github.com/maxmind/geoip-api-c/releases/download/v${pkgver}/GeoIP-${pkgver}.tar.gz)
sha256sums=('1dfb748003c5e4b7fd56ba8c4cd786633d5d6f409547584f6910398389636f80')

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

build() {
  cd ${srcdir}/GeoIP-${pkgver}

  sed -i 's/$as_echo "#define malloc rpl_malloc" >>confdefs.h//g' configure
  sed -i 's/$as_echo "#define realloc rpl_realloc" >>confdefs.h//g' configure

  for _arch in ${_architectures}; do
    mkdir build-${_arch} && pushd build-${_arch}
    ${_arch}-configure
    make
    popd
  done
}

package() {
  for _arch in ${_architectures}; do
    cd "${srcdir}/GeoIP-${pkgver}/build-${_arch}"
    make DESTDIR="$pkgdir" install
    find "$pkgdir/usr/${_arch}" -name '*.exe' -o -name '*.bat' -o -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
    find "$pkgdir/usr/${_arch}" -name '*.dll' | xargs -rtl1 ${_arch}-strip -x
    find "$pkgdir/usr/${_arch}" -name '*.a' -o -name '*.dll' | xargs -rtl1 ${_arch}-strip -g
  done
}