commit b51494f458b1e0ce26fce5266c86c8eb947e9634
parent 15198e629a29092cc49d367b33ae4c6f670559aa
Author: Nikolay Korotkiy <sikmir@disroot.org>
Date: Mon, 29 Sep 2025 20:44:10 +0400
Up
Diffstat:
2 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/pkgs/osm/libgeodesk/default.nix b/pkgs/osm/libgeodesk/default.nix
@@ -4,16 +4,17 @@
fetchFromGitHub,
cmake,
geos,
+ replaceVars,
}:
let
- catch2 = fetchFromGitHub {
+ catch2Src = fetchFromGitHub {
owner = "catchorg";
repo = "Catch2";
tag = "v3.7.1";
hash = "sha256-Zt53Qtry99RAheeh7V24Csg/aMW25DT/3CN/h+BaeoM=";
};
- gtl = fetchFromGitHub {
+ gtlSrc = fetchFromGitHub {
owner = "greg7mdp";
repo = "gtl";
tag = "v1.2.0";
@@ -31,19 +32,19 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-OIwYudqTPWIcyh7rpcM1ThPgBfsrTu6REWdTxkC86I0=";
};
- postPatch = ''
- substituteInPlace CMakeLists.txt \
- --replace-fail "GIT_REPOSITORY https://github.com/catchorg/Catch2.git" "SOURCE_DIR ${catch2}" \
- --replace-fail "GIT_TAG v3.7.1" "" \
- --replace-fail "GIT_REPOSITORY https://github.com/greg7mdp/gtl.git" "SOURCE_DIR ${gtl}" \
- --replace-fail "GIT_TAG v1.2.0" ""
- '';
+ patches = [
+ (replaceVars ./remove-fetchcontent-usage.patch {
+ # We will download them instead of cmake's fetchContent
+ inherit catch2Src gtlSrc;
+ })
+ ];
nativeBuildInputs = [ cmake ];
buildInputs = [ geos ];
cmakeFlags = [
+ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
(lib.cmakeBool "GEODESK_WITH_GEOS" true)
(lib.cmakeFeature "GEOS_INCLUDE_PATHS" "${geos}/include")
];
diff --git a/pkgs/osm/libgeodesk/remove-fetchcontent-usage.patch b/pkgs/osm/libgeodesk/remove-fetchcontent-usage.patch
@@ -0,0 +1,31 @@
+diff --git i/CMakeLists.txt w/CMakeLists.txt
+index 8822ae8..e4e212c 100644
+--- i/CMakeLists.txt
++++ w/CMakeLists.txt
+@@ -33,8 +33,7 @@ endif()
+ include(FetchContent)
+
+ FetchContent_Declare(gtl
+- GIT_REPOSITORY https://github.com/greg7mdp/gtl.git
+- GIT_TAG v1.2.0)
++ SOURCE_DIR @gtlSrc@)
+ FetchContent_MakeAvailable(gtl)
+
+ set(PREVIOUS_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
+@@ -43,8 +42,7 @@ set(CATCH_BUILD_STATIC_LIBRARY ON)
+ set(GEODESK_LIBERO ON)
+ # Fetch Catch2 from its GitHub repository
+ FetchContent_Declare(Catch2
+- GIT_REPOSITORY https://github.com/catchorg/Catch2.git
+- GIT_TAG v3.7.1
++ SOURCE_DIR @catch2Src@
+ )
+ FetchContent_MakeAvailable(Catch2)
+ set(BUILD_SHARED_LIBS ${PREVIOUS_BUILD_SHARED_LIBS})
+@@ -152,4 +150,4 @@ if(NOT GEODESK_PYTHON AND NOT BUILD_SHARED_LIBS)
+ endif()
+
+ message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER}")
+-message(STATUS "MSVC_VERSION: ${MSVC_VERSION}")
+\ No newline at end of file
++message(STATUS "MSVC_VERSION: ${MSVC_VERSION}")