2021-05-29 03:34:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
2022-11-21 17:40:18 +00:00
|
|
|
, fetchpatch
|
2021-05-29 03:34:57 +00:00
|
|
|
, cmake
|
|
|
|
, pkg-config
|
2022-04-27 09:35:20 +00:00
|
|
|
, buildPackages
|
2022-12-17 10:02:37 +00:00
|
|
|
, callPackage
|
2021-05-29 03:34:57 +00:00
|
|
|
, sqlite
|
|
|
|
, libtiff
|
|
|
|
, curl
|
|
|
|
, gtest
|
2022-04-27 09:35:20 +00:00
|
|
|
, nlohmann_json
|
2022-11-21 17:40:18 +00:00
|
|
|
, python3
|
2023-03-04 12:14:45 +00:00
|
|
|
, cacert
|
2021-05-29 03:34:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "proj";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "9.1.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "OSGeo";
|
|
|
|
repo = "PROJ";
|
|
|
|
rev = version;
|
2022-12-17 10:02:37 +00:00
|
|
|
hash = "sha256-yw7eSm64qFFt9egJWKVyVo0e7xQRSmfUY7pk6Cwvwdk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
patches = [
|
|
|
|
# https://github.com/OSGeo/PROJ/pull/3252
|
|
|
|
(fetchpatch {
|
|
|
|
name = "only-add-find_dependencyCURL-for-static-builds.patch";
|
|
|
|
url = "https://github.com/OSGeo/PROJ/commit/11f4597bbb7069bd5d4391597808703bd96df849.patch";
|
|
|
|
hash = "sha256-4w5Cu2m5VJZr6E2dUVRyWJdED2TyS8cI8G20EwfQ4u0=";
|
|
|
|
})
|
|
|
|
];
|
2022-09-30 11:47:45 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-29 03:34:57 +00:00
|
|
|
nativeBuildInputs = [ cmake pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
buildInputs = [ sqlite libtiff curl nlohmann_json ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
nativeCheckInputs = [ cacert gtest ];
|
2021-05-29 03:34:57 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DUSE_EXTERNAL_GTEST=ON"
|
2021-09-28 08:13:01 +00:00
|
|
|
"-DRUN_NETWORK_DEPENDENT_TESTS=OFF"
|
2022-04-27 09:35:20 +00:00
|
|
|
"-DNLOHMANN_JSON_ORIGIN=external"
|
|
|
|
"-DEXE_SQLITE3=${buildPackages.sqlite}/bin/sqlite3"
|
2021-05-29 03:34:57 +00:00
|
|
|
];
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
preCheck =
|
|
|
|
let
|
|
|
|
libPathEnvVar = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
|
|
|
|
in
|
|
|
|
''
|
|
|
|
export HOME=$TMPDIR
|
|
|
|
export TMP=$TMPDIR
|
|
|
|
export ${libPathEnvVar}=$PWD/lib
|
|
|
|
'';
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2021-09-28 08:13:01 +00:00
|
|
|
doCheck = true;
|
2021-05-29 03:34:57 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
passthru.tests = {
|
|
|
|
python = python3.pkgs.pyproj;
|
2022-12-17 10:02:37 +00:00
|
|
|
proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; };
|
2022-11-21 17:40:18 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Cartographic Projections Library";
|
2021-09-28 08:13:01 +00:00
|
|
|
homepage = "https://proj.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-05-29 03:34:57 +00:00
|
|
|
platforms = platforms.unix;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ dotlambda ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
})
|