1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 sqlite,
8 libtiff,
9 curl,
10 gtest,
11 fetchpatch,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "proj";
16 version = "7.2.1";
17
18 src = fetchFromGitHub {
19 owner = "OSGeo";
20 repo = "PROJ";
21 rev = version;
22 sha256 = "0mymvfvs8xggl4axvlj7kc1ksd9g94kaz6w1vdv0x2y5mqk93gx9";
23 };
24
25 patches = [
26 (fetchpatch {
27 # https://github.com/OSGeo/PROJ/issues/2557
28 name = "gie_self_tests-fail.diff"; # included in >= 8.0.1
29 url = "https://github.com/OSGeo/PROJ/commit/6f1a3c4648bf06862dca0b3725cbb3b7ee0284e3.diff";
30 sha256 = "0gapny0a9c3r0x9szjgn86sspjrrf4vwbija77b17w6ci5cq4pdf";
31 })
32 ./tests-sqlite-3.39.patch
33 ];
34
35 postPatch = lib.optionalString (version == "7.2.1") ''
36 substituteInPlace CMakeLists.txt \
37 --replace "MAJOR 7 MINOR 2 PATCH 0" "MAJOR 7 MINOR 2 PATCH 1"
38 '';
39
40 outputs = [
41 "out"
42 "dev"
43 ];
44
45 nativeBuildInputs = [
46 cmake
47 pkg-config
48 ];
49
50 buildInputs = [
51 sqlite
52 libtiff
53 curl
54 ];
55
56 nativeCheckInputs = [ gtest ];
57
58 cmakeFlags = [
59 "-DUSE_EXTERNAL_GTEST=ON"
60 ];
61 CXXFLAGS = [
62 # GCC 13: error: 'int64_t' in namespace 'std' does not name a type
63 "-include cstdint"
64 ];
65
66 doCheck = true;
67
68 meta = with lib; {
69 broken = true; # undefined reference to `TIFFReadEncodedStrip'
70 description = "Cartographic Projections Library";
71 homepage = "https://proj4.org";
72 license = licenses.mit;
73 platforms = platforms.unix;
74 maintainers = with maintainers; [ dotlambda ];
75 };
76}