zabbix70: 7.0.7 -> 7.0.8 (#374091)
[NixPkgs.git] / pkgs / development / libraries / geoip / default.nix
blobe9ff8223501a27a2a9a02f9f25b677adc8ae8c79
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   autoreconfHook,
6   drvName ? "geoip",
8   # in geoipDatabase, you can insert a package defining
9   # "${geoipDatabase}/share/GeoIP" e.g. geolite-legacy
10   geoipDatabase ? "/var/lib/geoip-databases",
13 let
14   dataDir =
15     if lib.isDerivation geoipDatabase then "${toString geoipDatabase}/share/GeoIP" else geoipDatabase;
18 stdenv.mkDerivation rec {
19   pname = drvName;
20   version = "1.6.12";
22   src = fetchFromGitHub {
23     owner = "maxmind";
24     repo = "geoip-api-c";
25     rev = "v${version}";
26     sha256 = "0ixyp3h51alnncr17hqp1p0rlqz9w69nlhm60rbzjjz3vjx52ajv";
27   };
29   nativeBuildInputs = [ autoreconfHook ];
31   # Cross compilation shenanigans
32   configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
33     "ac_cv_func_malloc_0_nonnull=yes"
34     "ac_cv_func_realloc_0_nonnull=yes"
35   ];
37   # Fix up the default data directory
38   postConfigure = ''
39     find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \;
40   '';
42   passthru = { inherit dataDir; };
44   meta = with lib; {
45     description = "API for GeoIP/Geolocation databases";
46     maintainers = with maintainers; [
47       thoughtpolice
48       raskin
49     ];
50     license = licenses.lgpl21;
51     platforms = platforms.unix;
52     homepage = "https://www.maxmind.com";
53   };