about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libe57format
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-15 10:30:44 +0000
commite0794be8a0d11e90461e5a9c85012a36b93ec976 (patch)
treeefd9cbc55ea3322867bf601c4d536758a3dd5fcc /nixpkgs/pkgs/development/libraries/libe57format
parent3538874082ded7647b1ccec0343c7c1e882cfef3 (diff)
parent1a57d96edd156958b12782e8c8b6a374142a7248 (diff)
downloadnixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.gz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.bz2
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.lz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.xz
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.tar.zst
nixlib-e0794be8a0d11e90461e5a9c85012a36b93ec976.zip
Merge commit '1a57d96edd156958b12782e8c8b6a374142a7248'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libe57format')
-rw-r--r--nixpkgs/pkgs/development/libraries/libe57format/default.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libe57format/default.nix b/nixpkgs/pkgs/development/libraries/libe57format/default.nix
index 6bb48c9530c8..137c73990f6a 100644
--- a/nixpkgs/pkgs/development/libraries/libe57format/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libe57format/default.nix
@@ -5,6 +5,9 @@
   boost,
   xercesc,
   icu,
+
+  dos2unix,
+  fetchpatch,
 }:
 
 stdenv.mkDerivation rec {
@@ -25,9 +28,39 @@ stdenv.mkDerivation rec {
   buildInputs = [
     boost
     icu
+  ];
+
+  propagatedBuildInputs = [
+    # Necessary for projects that try to find libE57Format via CMake
+    # due to the way that libe57format's CMake config is written.
     xercesc
   ];
 
+  # TODO: Remove CMake patching when https://github.com/asmaloney/libE57Format/pull/60 is available.
+
+  # GNU patch cannot patch `CMakeLists.txt` that has CRLF endings,
+  # see https://unix.stackexchange.com/questions/239364/how-to-fix-hunk-1-failed-at-1-different-line-endings-message/243748#243748
+  # so convert it first.
+  prePatch = ''
+    ${dos2unix}/bin/dos2unix CMakeLists.txt
+  '';
+  patches = [
+    (fetchpatch {
+      name = "libE57Format-cmake-Fix-config-filename.patch";
+      url = "https://github.com/asmaloney/libE57Format/commit/279d8d6b60ee65fb276cdbeed74ac58770a286f9.patch";
+      sha256 = "0fbf92hs1c7yl169i7zlbaj9yhrd1yg3pjf0wsqjlh8mr5m6rp14";
+    })
+  ];
+  # It appears that while the patch has
+  #     diff --git a/cmake/E57Format-config.cmake b/cmake/e57format-config.cmake
+  #     similarity index 100%
+  #     rename from cmake/E57Format-config.cmake
+  #     rename to cmake/e57format-config.cmake
+  # GNU patch doesn't interpret that.
+  postPatch = ''
+    mv cmake/E57Format-config.cmake cmake/e57format-config.cmake
+  '';
+
   # The build system by default builds ONLY static libraries, and with
   # `-DE57_BUILD_SHARED=ON` builds ONLY shared libraries, see:
   #     https://github.com/asmaloney/libE57Format/issues/48