From 1aef840be5f8b75040f0b5a6e6a68f331e51a613 Mon Sep 17 00:00:00 2001 From: fbrosson Date: Fri, 25 Mar 2016 10:03:51 +0000 Subject: [PATCH] geoip: create recipe. Includes geoiupdate.sh script based on the one from the Gentoo port. --- dev-libs/geoip/geoip-1.6.9.recipe | 99 +++++++++++++++++++++ dev-libs/geoip/patches/geoip-1.6.9.patchset | 86 ++++++++++++++++++ 2 files changed, 185 insertions(+) create mode 100644 dev-libs/geoip/geoip-1.6.9.recipe create mode 100644 dev-libs/geoip/patches/geoip-1.6.9.patchset diff --git a/dev-libs/geoip/geoip-1.6.9.recipe b/dev-libs/geoip/geoip-1.6.9.recipe new file mode 100644 index 000000000..a5052a3fb --- /dev/null +++ b/dev-libs/geoip/geoip-1.6.9.recipe @@ -0,0 +1,99 @@ +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 \ +\"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." +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" +SOURCE_URI_2="https://gitweb.gentoo.org/repo/gentoo.git/plain/dev-libs/geoip/files/geoipupdate-r5.sh#noarchive" +CHECKSUM_SHA256_2="4c2b032e280b614ff028e930c9612c27bf4281e189c38e572eecfe36fb5e4cd8" +SOURCE_DIR_2="" +PATCHES="geoip-$portVersion.patchset" +PATCHES_2="geoipupdate-r5.patchset" + +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PROVIDES=" + geoip$secondaryArchSuffix = $portVersion + lib:libGeoIP$secondaryArchSuffix = $portVersion + " +if [ -z "$secondaryArchSuffix" ]; then + PROVIDES="$PROVIDES + cmd:geoiplookup + cmd:geoiplookup6 + cmd:geoipupdate.sh + " +fi + +REQUIRES=" + haiku$secondaryArchSuffix + cmd:curl + " + +PROVIDES_devel=" + geoip${secondaryArchSuffix}_devel = $portVersion + devel:libGeoIP$secondaryArchSuffix = $portVersion + " +REQUIRES_devel=" + geoip$secondaryArchSuffix == $portVersion base + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:ar$secondaryArchSuffix + cmd:autoconf + cmd:autom4te + cmd:automake + cmd:make + cmd:gcc$secondaryArchSuffix + cmd:libtoolize$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + " + +BUILD() +{ + aclocal + libtoolize + autoconf + automake --add-missing + runConfigure ./configure + make $jobArgs +} + +INSTALL() +{ + make install + + if [ -z "$secondaryArchSuffix" ]; then + mkdir -p $binDir $sharedStateDir/lib/geoip + sed -e "s,^\(GEOIPDIR=\).*,\1/$relativeSharedStateDir/lib/geoip," \ + $sourceDir2/geoipupdate-r5.sh > $binDir/geoipupdate.sh + chmod +x $binDir/geoipupdate.sh + else + rm -rf $binDir $documentationDir + fi + + prepareInstalledDevelLibs \ + libGeoIP + + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir +} diff --git a/dev-libs/geoip/patches/geoip-1.6.9.patchset b/dev-libs/geoip/patches/geoip-1.6.9.patchset new file mode 100644 index 000000000..f3b2c947f --- /dev/null +++ b/dev-libs/geoip/patches/geoip-1.6.9.patchset @@ -0,0 +1,86 @@ +From a20693b4c5274fa40af7378c67c279fc316804c1 Mon Sep 17 00:00:00 2001 +From: fbrosson +Date: Fri, 25 Mar 2016 10:03:51 +0000 +Subject: Search for gethostbyname in libnetwork. + + +diff --git a/configure.ac b/configure.ac +index a56e744..62dddf8 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -34,9 +34,33 @@ AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF)) + AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF)) + AC_CHECK_FUNC(vsprintf, AC_DEFINE(HAVE_VSPRINTF)) + +-AC_CHECK_FUNC(gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME), +- AC_CHECK_LIB(nsl, gethostbyname, AC_DEFINE(HAVE_GETHOSTBYNAME) +- LIBS="${LIBS} -lsocket -lnsl")) ++dnl gethostbyname without lib or in the nsl lib? ++AC_CHECK_FUNC(gethostbyname, ++ [HAVE_GETHOSTBYNAME="1" ++ ], ++ [ AC_CHECK_LIB(nsl, gethostbyname, ++ [HAVE_GETHOSTBYNAME="1" ++ LIBS="-lnsl $LIBS" ++ ]) ++ ]) ++ ++if test "$HAVE_GETHOSTBYNAME" != "1" ++then ++ dnl gethostbyname in the socket lib? ++ AC_CHECK_LIB(socket, gethostbyname, ++ [HAVE_GETHOSTBYNAME="1" ++ LIBS="-lsocket $LIBS" ++ ]) ++fi ++ ++if test "$HAVE_GETHOSTBYNAME" != "1" ++then ++ dnl gethostbyname in the network lib - for Haiku OS ++ AC_CHECK_LIB(network, gethostbyname, ++ [HAVE_GETHOSTBYNAME="1" ++ LIBS="-lnetwork $LIBS" ++ ]) ++fi + + AC_CHECK_FUNC(gethostbyname_r, [ + AC_DEFINE(HAVE_GETHOSTBYNAME_R) +-- +2.7.0 + + +From 45c11bfe515cec78489dcff01592e891f4c3f146 Mon Sep 17 00:00:00 2001 +From: fbrosson +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 +