python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / proj / default.nix
blobc7a31677821210481db3d2f33035465d43a4d472
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , cmake
5 , pkg-config
6 , buildPackages
7 , sqlite
8 , libtiff
9 , curl
10 , gtest
11 , nlohmann_json
14 stdenv.mkDerivation rec {
15   pname = "proj";
16   version = "9.0.0";
18   src = fetchFromGitHub {
19     owner = "OSGeo";
20     repo = "PROJ";
21     rev = version;
22     sha256 = "sha256-zMP+WzC65BFz8g8mF5t7toqxmxCJePysd6WJuqpe8yg=";
23   };
25   # https://github.com/OSGeo/PROJ/issues/3206
26   postPatch = ''
27     # NB will not apply once https://github.com/OSGeo/PROJ/pull/3150 is released
28     substituteInPlace cmake/ProjUtilities.cmake \
29       --replace '$\{exec_prefix\}/$'{PROJ_LIB_SUBDIR} '$'{CMAKE_INSTALL_FULL_LIBDIR} \
30       --replace '$\{prefix\}/$'{PROJ_INCLUDE_SUBDIR} '$'{CMAKE_INSTALL_FULL_INCLUDEDIR} \
31       --replace '$\{prefix\}/$'{CMAKE_INSTALL_DATAROOTDIR} '$'{CMAKE_INSTALL_FULL_DATAROOTDIR}
32     substituteInPlace cmake/project-config.cmake.in \
33       --replace '$'{_ROOT}/@INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
34       --replace '$'{_ROOT}/@LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
35       --replace '$'{_ROOT}/@BINDIR@ @CMAKE_INSTALL_FULL_BINDIR@
36   '';
38   outputs = [ "out" "dev" ];
40   nativeBuildInputs = [ cmake pkg-config ];
42   buildInputs = [ sqlite libtiff curl nlohmann_json ];
44   checkInputs = [ gtest ];
46   cmakeFlags = [
47     "-DUSE_EXTERNAL_GTEST=ON"
48     "-DRUN_NETWORK_DEPENDENT_TESTS=OFF"
49     "-DNLOHMANN_JSON_ORIGIN=external"
50     "-DEXE_SQLITE3=${buildPackages.sqlite}/bin/sqlite3"
51   ];
53   preCheck =
54     let
55       libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
56     in
57       ''
58         export HOME=$TMPDIR
59         export TMP=$TMPDIR
60         export ${libPathEnvVar}=$PWD/lib
61       '';
63   doCheck = true;
65   meta = with lib; {
66     description = "Cartographic Projections Library";
67     homepage = "https://proj.org/";
68     license = licenses.mit;
69     platforms = platforms.unix;
70     maintainers = with maintainers; [ dotlambda ];
71   };