mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
Merge pull request #550 from fbrosson/geoipupdate
geoipupdate: create recipe.
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
SUMMARY="Non-DNS IP-to-country resolver C library & utils"
|
||||
DESCRIPTION="The GeoIP Legacy C library enables the user to find geographical \
|
||||
and network information of an IP address.
|
||||
geoiplookup and geoiplookup6 will use any available databases in /var/lib/geoip.
|
||||
Call \"geoipupdate.sh -a\" after installation to download the GeoIP(v6), \
|
||||
GeiLiteCity(v6) and GeoIPASNum(v6) free databases for the first time. Call \
|
||||
and network information of an IP address. geoiplookup and geoiplookup6 will \
|
||||
use any GeoIP Legacy databases available in /system/cache/GeoIP. Call
|
||||
\"geoipupdate.sh -a\" after installation to download the GeoIP(v6), \
|
||||
GeoLiteCity(v6) and GeoIPASNum(v6) free databases for the first time. Call \
|
||||
\"geoipupdate.sh\" (without any argument) from time to time (e.g. once per \
|
||||
month) to update them later. Another package, geoipupdate, may be used to \
|
||||
download non-free database files from MaxMind with a UserId and LicenseKey."
|
||||
download GeoLite Legacy, GeoLite2 and GeoIP2 databases from MaxMind."
|
||||
HOMEPAGE="https://dev.maxmind.com/geoip/legacy/"
|
||||
COPYRIGHT="2002-2016 MaxMind, Inc."
|
||||
LICENSE="GNU LGPL v2.1"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/maxmind/geoip-api-c/archive/v$portVersion.tar.gz"
|
||||
#SOURCE_URI="https://github.com/maxmind/geoip-api-c/releases/download/v$portVersion/GeoIP-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="05468adbb6bdbddc588ee6f0df990f47b1b24d278519c35d59f7a8058a2a9825"
|
||||
SOURCE_FILENAME="geoip-api-c-$portVersion.tar.gz"
|
||||
SOURCE_DIR="geoip-api-c-$portVersion"
|
||||
@@ -71,7 +70,8 @@ BUILD()
|
||||
libtoolize
|
||||
autoconf
|
||||
automake --add-missing
|
||||
runConfigure ./configure
|
||||
runConfigure --omit-dirs dataDir ./configure \
|
||||
--datadir="`finddir B_SYSTEM_CACHE_DIRECTORY`"
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
@@ -80,8 +80,9 @@ INSTALL()
|
||||
make install
|
||||
|
||||
if [ -z "$secondaryArchSuffix" ]; then
|
||||
mkdir -p $binDir $sharedStateDir/lib/geoip
|
||||
sed -e "s,^\(GEOIPDIR=\).*,\1/$relativeSharedStateDir/lib/geoip," \
|
||||
CACHE_DIR="`finddir B_SYSTEM_CACHE_DIRECTORY`"
|
||||
mkdir -p $binDir $prefix${CACHE_DIR#/boot/system}/GeoIP
|
||||
sed -e "s,^\(GEOIPDIR=\).*,\1${CACHE_DIR#/boot}/GeoIP," \
|
||||
$sourceDir2/geoipupdate-r5.sh > $binDir/geoipupdate.sh
|
||||
chmod +x $binDir/geoipupdate.sh
|
||||
else
|
||||
|
||||
@@ -48,39 +48,3 @@ index a56e744..62dddf8 100644
|
||||
--
|
||||
2.7.0
|
||||
|
||||
|
||||
From 45c11bfe515cec78489dcff01592e891f4c3f146 Mon Sep 17 00:00:00 2001
|
||||
From: fbrosson <fbrosson@localhost>
|
||||
Date: Fri, 25 Mar 2016 10:03:51 +0000
|
||||
Subject: Use $sharedstatedir/lib/geoip/ instead of $pkgdatadir/GeoIP/
|
||||
|
||||
|
||||
diff --git a/libGeoIP/GeoIP.c b/libGeoIP/GeoIP.c
|
||||
index 793fb84..a2a0e99 100644
|
||||
--- a/libGeoIP/GeoIP.c
|
||||
+++ b/libGeoIP/GeoIP.c
|
||||
@@ -734,7 +734,7 @@ char *_GeoIP_full_path_to(const char *file_name)
|
||||
if (GeoIP_custom_directory == NULL) {
|
||||
#if !defined(_WIN32)
|
||||
memset(path, 0, sizeof(char) * 1024);
|
||||
- snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", GEOIPDATADIR,
|
||||
+ snprintf(path, sizeof(char) * 1024 - 1, "%s/%s", GEOIPSHAREDSTATEDIR "/lib/geoip",
|
||||
file_name);
|
||||
#else
|
||||
char buf[MAX_PATH], *p, *q = NULL;
|
||||
diff --git a/libGeoIP/Makefile.am b/libGeoIP/Makefile.am
|
||||
index f85cd00..8d3668f 100644
|
||||
--- a/libGeoIP/Makefile.am
|
||||
+++ b/libGeoIP/Makefile.am
|
||||
@@ -2,7 +2,7 @@ lib_LTLIBRARIES = libGeoIP.la
|
||||
|
||||
EXTRA_DIST = Makefile.vc GeoIP_internal.h pread.c pread.h
|
||||
|
||||
-AM_CPPFLAGS = -DGEOIPDATADIR=\"$(pkgdatadir)\" -Wall
|
||||
+AM_CPPFLAGS = -DGEOIPSHAREDSTATEDIR=\"$(sharedstatedir)\" -Wall
|
||||
|
||||
libGeoIP_la_SOURCES = GeoIP.c GeoIP_deprecated.c GeoIPCity.c regionName.c timeZone.c
|
||||
include_HEADERS = GeoIP.h GeoIPCity.h
|
||||
--
|
||||
2.7.0
|
||||
|
||||
|
||||
90
dev-libs/geoip/patches/geoipupdate-r5.patchset
Normal file
90
dev-libs/geoip/patches/geoipupdate-r5.patchset
Normal file
@@ -0,0 +1,90 @@
|
||||
From f50fd9c259aee1fa429076ddafe0cfbbac43850f Mon Sep 17 00:00:00 2001
|
||||
From: fbrosson <fbrosson@localhost>
|
||||
Date: Fri, 25 Mar 2016 10:03:51 +0000
|
||||
Subject: Use timestamps to find out if a file is up-to-date.
|
||||
|
||||
|
||||
diff --git a/geoipupdate-r5.sh b/geoipupdate-r5.sh
|
||||
index 484ff7e..da72a2d 100644
|
||||
--- a/geoipupdate-r5.sh
|
||||
+++ b/geoipupdate-r5.sh
|
||||
@@ -13,10 +13,20 @@ DATABASES="
|
||||
asnum/GeoIPASNumv6
|
||||
"
|
||||
|
||||
+# This script, when called without any option, will download all files you already have, if they are outdated.
|
||||
+# Use "-a" to force download all files unless they are up-to-date.
|
||||
+# Use "-f" to download all files, even if they are already up-to-to-date.
|
||||
+
|
||||
if [ "${1}" = -f ] || [ "${1}" = --force ]; then
|
||||
force=true
|
||||
fi
|
||||
|
||||
+if [ "${1}" = -a ] || [ "${1}" = --all ]; then
|
||||
+ all=true
|
||||
+fi
|
||||
+
|
||||
+[ "${force}" -o "${all}" ] && [ ! -d "${GEOIPDIR}" ] && mkdir -p "${GEOIPDIR}"
|
||||
+
|
||||
if [ -d "${GEOIPDIR}" ]; then
|
||||
cd $GEOIPDIR
|
||||
if [ -n "${DATABASES}" ]; then
|
||||
@@ -26,20 +36,44 @@ if [ -d "${GEOIPDIR}" ]; then
|
||||
|
||||
for db in $DATABASES; do
|
||||
fname=$(basename $db)
|
||||
+ echo -n "${GEOIPDIR}/${fname}.dat"
|
||||
+ unset TIME_COND
|
||||
+ if [ -f "${GEOIPDIR}/${fname}.dat" ]; then
|
||||
+ if [ -s "${GEOIPDIR}/${fname}.dat" -a ! "${force}" ]; then
|
||||
+ TIME_COND="${GEOIPDIR}/${fname}.dat"
|
||||
+ fi
|
||||
+ else
|
||||
+ if [ ! "${force}" -a ! "${all}" ]; then
|
||||
+ continue
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ curl --silent --remote-time --retry 3 --connect-timeout 60 --url \
|
||||
+ "${GEOIP_MIRROR}/${db}.dat.gz" \
|
||||
+ ${TIME_COND+--time-cond "$TIME_COND"} \
|
||||
+ --output "${TMPDIR}/${fname}.dat.gz"
|
||||
|
||||
- if [ -f "${GEOIPDIR}/${fname}.dat" ] || [ ${force} ]; then
|
||||
- wget --no-verbose -t 3 -T 60 \
|
||||
- "${GEOIP_MIRROR}/${db}.dat.gz" \
|
||||
- -O "${TMPDIR}/${fname}.dat.gz"
|
||||
- if [ $? -eq 0 ]; then
|
||||
- gunzip -fdc "${TMPDIR}/${fname}.dat.gz" > "${TMPDIR}/${fname}.dat"
|
||||
- mv "${TMPDIR}/${fname}.dat" "${GEOIPDIR}/${fname}.dat"
|
||||
- chmod 0644 "${GEOIPDIR}/${fname}.dat"
|
||||
- case ${fname} in
|
||||
- GeoLite*) ln -sf ${fname}.dat `echo ${fname} | sed 's/GeoLite/GeoIP/'`.dat ;;
|
||||
- esac
|
||||
+ if [ $? -eq 0 ]; then
|
||||
+ if [ -f "${TMPDIR}/${fname}.dat.gz" ]; then
|
||||
+ gunzip "${TMPDIR}/${fname}.dat.gz" && \
|
||||
+ mv -f "${TMPDIR}/${fname}.dat" "${GEOIPDIR}/${fname}.dat" && \
|
||||
+ chmod 0644 "${GEOIPDIR}/${fname}.dat" && \
|
||||
+ echo " updated." || echo " could not be updated."
|
||||
+ else
|
||||
+ echo " already up-to-date."
|
||||
fi
|
||||
+ else
|
||||
+ echo " not updated."
|
||||
fi
|
||||
+ case ${fname} in
|
||||
+ GeoLite*)
|
||||
+ SYMLINK="GeoIP${fname#GeoLite}.dat"
|
||||
+ if [ ! -e "${GEOIPDIR}/$SYMLINK" -o \
|
||||
+ -h "${GEOIPDIR}/$SYMLINK" -a \
|
||||
+ "`readlink "${GEOIPDIR}/$SYMLINK"`" != "${fname}.dat" ]; then
|
||||
+ ln -sf "${fname}.dat" "${GEOIPDIR}/$SYMLINK"
|
||||
+ fi
|
||||
+ esac
|
||||
done
|
||||
[ -d "${TMPDIR}" ] && rm -rf $TMPDIR
|
||||
fi
|
||||
--
|
||||
2.7.0
|
||||
|
||||
89
net-misc/geoipupdate/geoipupdate-2.2.2.recipe
Normal file
89
net-misc/geoipupdate/geoipupdate-2.2.2.recipe
Normal file
@@ -0,0 +1,89 @@
|
||||
SUMMARY="Utility to update GeoIP2 and GeoIP Legacy binary databases"
|
||||
DESCRIPTION="geoipupdate can download both GeoIP Legacy and GeoIP2 binary \
|
||||
databases from MaxMind's website provided a valid UserID and its LicenseKey \
|
||||
are supplied in the configuration file for the set of chosen ProductIds. A \
|
||||
generic UserId may be used, however, to download some databases, including \
|
||||
GeoLite2 Country and GeoLite2 City."
|
||||
HOMEPAGE="https://github.com/maxmind/geoipupdate"
|
||||
COPYRIGHT="2002-2016 MaxMind, Inc."
|
||||
LICENSE="GNU GPL v2"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/maxmind/geoipupdate/releases/download/v$portVersion/geoipupdate-$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="156ab7604255a9c62c4a442c76d48d024ac813c6542639bffa93b28e2a781621"
|
||||
PATCHES="geoipupdate-$portVersion.patchset"
|
||||
|
||||
GLOBAL_WRITABLE_FILES="settings/GeoIP.conf keep-old"
|
||||
USER_SETTINGS_FILES="
|
||||
settings/GeoIP.conf template data/geoipupdate/GeoIP.conf.default
|
||||
"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86 x86_64"
|
||||
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"
|
||||
|
||||
# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
|
||||
commandSuffix=$secondaryArchSuffix
|
||||
commandBinDir=$binDir
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
commandSuffix=
|
||||
commandBinDir=$prefix/bin
|
||||
fi
|
||||
|
||||
PROVIDES="
|
||||
geoipupdate$secondaryArchSuffix = $portVersion
|
||||
cmd:geoipupdate$commandSuffix = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libGeoIP$secondaryArchSuffix
|
||||
lib:libcurl$secondaryArchSuffix
|
||||
lib:libz$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libGeoIP$secondaryArchSuffix
|
||||
devel:libcurl$secondaryArchSuffix
|
||||
devel:libz$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:aclocal
|
||||
cmd:autoconf
|
||||
cmd:automake
|
||||
cmd:make
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:libtoolize$secondaryArchSuffix
|
||||
cmd:ld$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
aclocal
|
||||
autoconf
|
||||
automake --add-missing
|
||||
CACHE_DIR="`finddir B_SYSTEM_CACHE_DIRECTORY`"
|
||||
runConfigure --omit-dirs binDir,sharedStateDir ./configure \
|
||||
--bindir=$commandBinDir \
|
||||
--sharedstatedir="${CACHE_DIR#/boot}"
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
|
||||
CACHE_DIR="`finddir B_SYSTEM_CACHE_DIRECTORY`"
|
||||
|
||||
sed -i \
|
||||
-e "s,$dataDir/GeoIP,${CACHE_DIR#/boot}/GeoIP," \
|
||||
-e "s,$sysconfDir/,/system/$relativeSettingsDir/," \
|
||||
-e "s,BIN_DIR/,/bin/," \
|
||||
$manDir/man1/geoipupdate.1 \
|
||||
$manDir/man5/GeoIP.conf.5
|
||||
|
||||
sed -i -e "s,/usr/local/share/GeoIP,${CACHE_DIR#/boot}/GeoIP," \
|
||||
$settingsDir/GeoIP.conf.default \
|
||||
$settingsDir/GeoIP.conf
|
||||
|
||||
mkdir -p $dataDir/geoipupdate
|
||||
mv $settingsDir/GeoIP.conf.default $dataDir/geoipupdate
|
||||
}
|
||||
101
net-misc/geoipupdate/patches/geoipupdate-2.2.2.patchset
Normal file
101
net-misc/geoipupdate/patches/geoipupdate-2.2.2.patchset
Normal file
@@ -0,0 +1,101 @@
|
||||
From 4b551e57c8cfbe6e4a2dca067d018a66f995e466 Mon Sep 17 00:00:00 2001
|
||||
From: fbrosson <fbrosson@localhost>
|
||||
Date: Wed, 30 Mar 2016 22:47:18 +0000
|
||||
Subject: Search for xasprintf in libroot.
|
||||
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 97f6e75..47dbbb4 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -29,6 +29,7 @@ AC_CHECK_HEADERS(curl/curl.h, , AC_MSG_ERROR(curl header (curl/curl.h) not found
|
||||
|
||||
AC_CHECK_LIB(z, gzopen, [], [AC_MSG_ERROR([libz not found.])])
|
||||
AC_CHECK_LIB(curl, curl_easy_setopt, [], [AC_MSG_ERROR([libcurl not found.])])
|
||||
+AC_CHECK_LIB(root, xasprintf, [], [])
|
||||
|
||||
AC_CHECK_FUNCS([ getline fgets asprintf strcasecmp memset socket strchr strdup strstr strrchr memchr strspn])
|
||||
|
||||
--
|
||||
2.7.0
|
||||
|
||||
|
||||
From b20de449da1f21dbc4d85065d8470ab2a3dc0a5b Mon Sep 17 00:00:00 2001
|
||||
From: fbrosson <fbrosson@localhost>
|
||||
Date: Wed, 30 Mar 2016 22:47:18 +0000
|
||||
Subject: Use $sharedStateDir/GeoIP/ instead of $datadir/GeoIP/
|
||||
|
||||
We need to use the default $dataDir for the installation of the
|
||||
default config file in system/data/geoipupdate/GeoIP.conf.default
|
||||
and, at the same time, pass "`finddir B_SYSTEM_CACHE_DIRECTORY`" as
|
||||
$sharedStateDir.
|
||||
|
||||
diff --git a/bin/Makefile.am b/bin/Makefile.am
|
||||
index b4a6e07..b2a3397 100644
|
||||
--- a/bin/Makefile.am
|
||||
+++ b/bin/Makefile.am
|
||||
@@ -1,4 +1,4 @@
|
||||
-AM_CPPFLAGS = -I$(top_srcdir)/src -DSYSCONFDIR=\"$(sysconfdir)\" -DDATADIR=\"$(datadir)/GeoIP\" -Wall
|
||||
+AM_CPPFLAGS = -I$(top_srcdir)/src -DSYSCONFDIR=\"$(sysconfdir)\" -DSHAREDSTATEDIR=\"$(sharedstatedir)\" -Wall
|
||||
|
||||
bin_PROGRAMS = geoipupdate
|
||||
|
||||
diff --git a/bin/geoipupdate_s.c b/bin/geoipupdate_s.c
|
||||
index 948e1fc..f49727e 100644
|
||||
--- a/bin/geoipupdate_s.c
|
||||
+++ b/bin/geoipupdate_s.c
|
||||
@@ -9,7 +9,7 @@ geoipupdate_s *geoipupdate_s_new(void)
|
||||
geoipupdate_s *gu = xmalloc(size);
|
||||
memset(gu, 0, size);
|
||||
gu->license_file = strdup(SYSCONFDIR "/GeoIP.conf");
|
||||
- gu->database_dir = strdup(DATADIR);
|
||||
+ gu->database_dir = strdup(SHAREDSTATEDIR "/GeoIP");
|
||||
gu->proto = strdup("https");
|
||||
gu->host = strdup("updates.maxmind.com");
|
||||
gu->proxy = strdup("");
|
||||
--
|
||||
2.7.0
|
||||
|
||||
|
||||
From d45d2746a970be2cd9d279e368ef45124f9204be Mon Sep 17 00:00:00 2001
|
||||
From: fbrosson <fbrosson@localhost>
|
||||
Date: Tue, 5 Apr 2016 10:05:21 +0000
|
||||
Subject: Make the default GeoIP.conf file usable out of the box.
|
||||
|
||||
|
||||
diff --git a/conf/GeoIP.conf.default b/conf/GeoIP.conf.default
|
||||
index 91fbe9b..9c608c7 100644
|
||||
--- a/conf/GeoIP.conf.default
|
||||
+++ b/conf/GeoIP.conf.default
|
||||
@@ -9,7 +9,27 @@ LicenseKey YOUR_LICENSE_KEY_HERE
|
||||
|
||||
# Enter the product IDs of the databases you would like to update.
|
||||
# Multiple product IDs are separated by spaces.
|
||||
-ProductIds GeoIP2-Country GeoIP2-City 106 132
|
||||
+#ProductIds GeoIP2-Country GeoIP2-City 106 132
|
||||
+
|
||||
+# Some databases may be downloaded by the GeoIP Update program, geoipupdate,
|
||||
+# without an account if the following generic UsedId is specified:
|
||||
+UserId 999999
|
||||
+
|
||||
+# List of databases available without an account:
|
||||
+# (Source: https://dev.maxmind.com/geoip/geoipupdate/)
|
||||
+
|
||||
+# ProductIds Filename Database name
|
||||
+# --------------------------- --------------------- ---------------------------
|
||||
+# 506 GeoLiteCountry.dat GeoLite Legacy Country
|
||||
+# 517 GeoLiteASNum.dat GeoLite Legacy ASN
|
||||
+# 533 GeoLiteCity.dat GeoLite Legacy City
|
||||
+# GeoLite-Legacy-IPv6-Country GeoIPv6.dat GeoLite Legacy IPv6 Country
|
||||
+# GeoLite-Legacy-IPv6-City GeoLiteCityv6.dat GeoLite Legacy IPv6 City
|
||||
+# GeoLite2-Country GeoLite2-Country.mmdb GeoLite2 Country
|
||||
+# GeoLite2-City GeoLite2-City.mmdb GeoLite2 City
|
||||
+
|
||||
+#ProductIds 506 517 533 GeoLite-Legacy-IPv6-Country GeoLite-Legacy-IPv6-City
|
||||
+ProductIds GeoLite2-Country GeoLite2-City
|
||||
|
||||
# The remaining settings are OPTIONAL.
|
||||
|
||||
--
|
||||
2.7.0
|
||||
|
||||
Reference in New Issue
Block a user