ipv6calc: add optional ip2location support

This only links to the C library.
The database must be downloaded manually.
This commit is contained in:
Tobias Geerinckx-Rice 2015-09-07 03:33:58 +02:00
parent be10d389f1
commit de2bba6d8c

View File

@ -1,4 +1,6 @@
{ stdenv, fetchurl, geoip, geolite-legacy, getopt, openssl, perl }:
{ stdenv, fetchurl, getopt, ip2location-c, openssl, perl
, geoip ? null, geolite-legacy ? null
, ip2location-database ? null }:
let version = "0.99.1"; in
stdenv.mkDerivation rec {
@ -9,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "0a0xpai14y969hp6l10r2wcd16sqf3v40fq5h97m4a69hcpmvg5h";
};
buildInputs = [ geoip geolite-legacy getopt openssl ];
buildInputs = [ geoip geolite-legacy getopt ip2location-c openssl ];
nativeBuildInputs = [ perl ];
patchPhase = ''
@ -30,6 +32,8 @@ stdenv.mkDerivation rec {
"--enable-geoip"
] ++ stdenv.lib.optional (geolite-legacy != null) [
"--with-geoip-db=${geolite-legacy}/share/GeoIP"
] ++ stdenv.lib.optional (ip2location-c != null ) [
"--enable-ip2location"
];
enableParallelBuilding = true;