Files
nixpkgs/pkgs/by-name/pr/proj/package.nix
Luflosi a7c694d3d8 proj: Fix compatibility issue with mapnik
Without this change, mapnik fails to compile with the following strange error message:
```
CMake Error in CMakeLists.txt:
  No known features for C compiler

  ""

  version .
```
2026-09-26 18:20:28 +02:00

105 lines
2.1 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
cmake,
pkg-config,
buildPackages,
callPackage,
sqlite,
libtiff,
curl,
gtest,
nlohmann_json,
python3,
cacert,
writableTmpDirAsHomeHook,
fetchpatch2,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "proj";
version = "9.9.0";
__structuredAttrs = true;
strictDeps = true;
src = fetchFromGitHub {
owner = "OSGeo";
repo = "PROJ";
tag = finalAttrs.version;
hash = "sha256-3WJCqH+8MCs/UOmnCqIehLEnkoLCBRCReO05UP2A02A=";
};
patches = [
# https://github.com/OSGeo/PROJ/pull/3252
./only-add-curl-for-static-builds.patch
# Unbreak mapnik
(fetchpatch2 {
name = "fix_issue_with_target_compile_features.patch";
# https://github.com/OSGeo/PROJ/pull/4863
url = "https://github.com/OSGeo/PROJ/commit/7ea0fd3ba479845464b34ccf5265b8e6d055cde5.patch?full_index=1";
hash = "sha256-IIe0T1/8Jv7tvhUupFn46PaFi7zggAT79EC55cmxHSs=";
})
];
outputs = [
"out"
"dev"
];
nativeBuildInputs = [
cmake
pkg-config
];
buildInputs = [
sqlite
libtiff
curl
nlohmann_json
];
nativeCheckInputs = [
cacert
sqlite
writableTmpDirAsHomeHook
];
checkInputs = [
gtest
];
cmakeFlags = [
"-DUSE_EXTERNAL_GTEST=ON"
"-DRUN_NETWORK_DEPENDENT_TESTS=OFF"
"-DNLOHMANN_JSON_ORIGIN=external"
"-DEXE_SQLITE3=${lib.getExe buildPackages.sqlite}"
];
preCheck =
let
libPathEnvVar = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH";
in
''
export TMP=$TMPDIR
export ${libPathEnvVar}=$PWD/lib
'';
doCheck = true;
passthru.tests = {
python = python3.pkgs.pyproj;
proj = callPackage ./tests.nix { proj = finalAttrs.finalPackage; };
};
meta = {
changelog = "https://github.com/OSGeo/PROJ/blob/${finalAttrs.src.tag}/NEWS.md";
description = "Cartographic Projections Library";
homepage = "https://proj.org/";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dotlambda ];
teams = [ lib.teams.geospatial ];
platforms = lib.platforms.unix;
};
})