Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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
16}:
17
18stdenv.mkDerivation (finalAttrs: rec {
19 pname = "proj";
20 version = "9.2.0";
21
22 src = fetchFromGitHub {
23 owner = "OSGeo";
24 repo = "PROJ";
25 rev = version;
26 hash = "sha256-NC5H7ufIXit+PVDwNDhz5cv44fduTytsdmNOWyqDDYQ=";
27 };
28
29 patches = [
30 # https://github.com/OSGeo/PROJ/pull/3252
31 ./only-add-curl-for-static-builds.patch
32 ];
33
34 outputs = [ "out" "dev" ];
35
36 nativeBuildInputs = [ cmake pkg-config ];
37
38 buildInputs = [ sqlite libtiff curl nlohmann_json ];
39
40 nativeCheckInputs = [ cacert gtest ];
41
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 ];
48
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 '';
58
59 doCheck = true;
60
61 passthru.tests = {
62 python = python3.pkgs.pyproj;
63 proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; };
64 };
65
66 meta = with lib; {
67 changelog = "https://github.com/OSGeo/PROJ/blob/${src.rev}/docs/source/news.rst";
68 description = "Cartographic Projections Library";
69 homepage = "https://proj.org/";
70 license = licenses.mit;
71 platforms = platforms.unix;
72 maintainers = with maintainers; [ dotlambda ];
73 };
74})