Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / proj / default.nix
blobce1f74f0b15371721a636337bd739e8a229cd284
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , cmake
6 , pkg-config
7 , buildPackages
8 , callPackage
9 , sqlite
10 , libtiff
11 , curl
12 , gtest
13 , nlohmann_json
14 , python3
15 , cacert
18 stdenv.mkDerivation (finalAttrs: rec {
19   pname = "proj";
20   version = "9.3.0";
22   src = fetchFromGitHub {
23     owner = "OSGeo";
24     repo = "PROJ";
25     rev = version;
26     hash = "sha256-M1KUXzht4qIjPfHxvzPr7XUnisMwtbegKp18XQjNYHg=";
27   };
29   patches = [
30     # https://github.com/OSGeo/PROJ/pull/3252
31     ./only-add-curl-for-static-builds.patch
32   ];
34   outputs = [ "out" "dev" ];
36   nativeBuildInputs = [ cmake pkg-config ];
38   buildInputs = [ sqlite libtiff curl nlohmann_json ];
40   nativeCheckInputs = [ cacert gtest ];
42   cmakeFlags = [
43     "-DUSE_EXTERNAL_GTEST=ON"
44     "-DRUN_NETWORK_DEPENDENT_TESTS=OFF"
45     "-DNLOHMANN_JSON_ORIGIN=external"
46     "-DEXE_SQLITE3=${buildPackages.sqlite}/bin/sqlite3"
47   ];
49   preCheck =
50     let
51       libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
52     in
53       ''
54         export HOME=$TMPDIR
55         export TMP=$TMPDIR
56         export ${libPathEnvVar}=$PWD/lib
57       '';
59   doCheck = true;
61   passthru.tests = {
62     python = python3.pkgs.pyproj;
63     proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; };
64   };
66   meta = with lib; {
67     changelog = "https://github.com/OSGeo/PROJ/blob/${src.rev}/NEWS";
68     description = "Cartographic Projections Library";
69     homepage = "https://proj.org/";
70     license = licenses.mit;
71     maintainers = with maintainers; teams.geospatial.members ++ [ dotlambda ];
72     platforms = platforms.unix;
73   };