Unverified Commit 14c2ff7a authored by Ivan Mincik's avatar Ivan Mincik Committed by GitHub
Browse files

mapcache: fix darwin build (#401616)

parents bca8c7d1 501a95df
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
  fcgi,
  gdal,
  geos,
  gfortran,
  libgeotiff,
  libjpeg,
  libpng,
@@ -23,20 +24,25 @@
  zlib,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "mapcache";
  version = "1.14.1";

  src = fetchFromGitHub {
    owner = "MapServer";
    repo = "mapcache";
    rev = "rel-${lib.replaceStrings [ "." ] [ "-" ] version}";
    tag = "rel-${lib.replaceStrings [ "." ] [ "-" ] finalAttrs.version}";
    hash = "sha256-AwdZdOEq9SZ5VzuBllg4U1gdVxZ9IVdqiDrn3QuRdCk=";
  };

  nativeBuildInputs = [
  nativeBuildInputs =
    [
      cmake
      pkg-config
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      # work around for `ld: file not found: @rpath/libquadmath.0.dylib`
      gfortran.cc
    ];

  buildInputs = [
@@ -70,6 +76,12 @@ stdenv.mkDerivation rec {

  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-std=c99";

  prePatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace CMakeLists.txt \
      --replace-fail "include_directories(\''${TIFF_INCLUDE_DIR})" "" \
      --replace-fail "target_link_libraries(mapcache \''${TIFF_LIBRARY})" "target_link_libraries(mapcache TIFF::TIFF)"
  '';

  meta = {
    description = "Server that implements tile caching to speed up access to WMS layers";
    homepage = "https://mapserver.org/mapcache/";
@@ -78,4 +90,4 @@ stdenv.mkDerivation rec {
    maintainers = lib.teams.geospatial.members;
    platforms = lib.platforms.unix;
  };
}
})