From 7b265868a43e61a766d1263836a50cfdfc143d1b Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Tue, 1 Feb 2022 08:32:18 +0100 Subject: [PATCH] Add geoipupdate package Se we can drop the unsupported geoip2-database --- mingw-w64-geoipupdate/001-relocate.patch | 21 ++++++++++ mingw-w64-geoipupdate/PKGBUILD | 51 ++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 mingw-w64-geoipupdate/001-relocate.patch create mode 100644 mingw-w64-geoipupdate/PKGBUILD diff --git a/mingw-w64-geoipupdate/001-relocate.patch b/mingw-w64-geoipupdate/001-relocate.patch new file mode 100644 index 0000000000..2436f1b128 --- /dev/null +++ b/mingw-w64-geoipupdate/001-relocate.patch @@ -0,0 +1,21 @@ +--- geoipupdate-4.8.0/cmd/geoipupdate/main.go.orig 2022-02-01 08:23:33.340000000 +0100 ++++ geoipupdate-4.8.0/cmd/geoipupdate/main.go 2022-02-01 08:08:48.823592300 +0100 +@@ -21,11 +21,16 @@ + func main() { + log.SetFlags(0) + ++ ex, err := os.Executable() ++ if err != nil { ++ panic(err) ++ } ++ + if defaultConfigFile == "" { +- defaultConfigFile = geoipupdate.DefaultConfigFile ++ defaultConfigFile = filepath.Join(filepath.Dir(ex), "..", "etc", "GeoIP.conf") + } + if defaultDatabaseDirectory == "" { +- defaultDatabaseDirectory = geoipupdate.DefaultDatabaseDirectory ++ defaultDatabaseDirectory = filepath.Join(filepath.Dir(ex), "..", "var", "lib", "GeoIP") + } + + args := getArgs() diff --git a/mingw-w64-geoipupdate/PKGBUILD b/mingw-w64-geoipupdate/PKGBUILD new file mode 100644 index 0000000000..9dc0c68688 --- /dev/null +++ b/mingw-w64-geoipupdate/PKGBUILD @@ -0,0 +1,51 @@ +# Maintainer: Christoph Reiter + +_realname=geoipupdate +pkgbase=mingw-w64-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") +pkgver=4.8.0 +pkgrel=1 +pkgdesc='Update GeoIP2 and GeoIP Legacy binary databases from MaxMind (mingw-w64)' +arch=('any') +mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64') +url="https://dev.maxmind.com/geoip/geoipupdate" +license=('spdx:Apache-2.0 OR MIT') +makedepends=("${MINGW_PACKAGE_PREFIX}-go") +backup=("${MINGW_PREFIX:1}/etc/GeoIP.conf") +options=('!strip') +source=("https://github.com/maxmind/geoipupdate/archive/v$pkgver/$_realname-$pkgver.tar.gz" + "001-relocate.patch") +sha256sums=('ca718c3ffcc595ef441363699888d20150f1d3a6583ac2d60bcbd34f052db09f' + '13a011e60eb044281c41420723f3854b8870c174a7876c3ecd7ccc22393c909f') + +prepare() { + cd "$srcdir/$_realname-$pkgver" + + sed -i 's/EditionIDs .*/EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country/' conf/GeoIP.conf.default + + patch -Nbp1 -i "${srcdir}/001-relocate.patch" +} + +build() { + cd "$srcdir/$_realname-$pkgver" + + export GOROOT=${MINGW_PREFIX}/lib/go + + cd cmd/geoipupdate + mkdir -p "$srcdir/build" + go build -o "$srcdir/build/geoipupdate.exe" -ldflags "-X main.version=$pkgver" +} + +package() { + cd "$srcdir/$_realname-$pkgver" + + install -dm755 "${pkgdir}${MINGW_PREFIX}/var/lib/GeoIP" + install -Dm600 conf/GeoIP.conf.default "${pkgdir}${MINGW_PREFIX}/etc/GeoIP.conf" + + cd "$srcdir/build" + install -Dm755 geoipupdate.exe "${pkgdir}${MINGW_PREFIX}/bin/geoipupdate.exe" + + cd "$srcdir/$_realname-$pkgver" + install -Dm644 LICENSE-APACHE "${pkgdir}${MINGW_PREFIX}/usr/share/licenses/$_realname/LICENSE-APACHE" + install -Dm644 LICENSE-MIT "${pkgdir}${MINGW_PREFIX}/usr/share/licenses/$_realname/LICENSE-MIT" +}