guix/gnu/packages/patches/iniparser-remove-fetchcontent-usage.patch
Murilo 5f974caf64
gnu: iniparser: Update to 4.2.6.
* gnu/packages/samba.scm (iniparser): Update to 4.2.6.
[source]: Update upstream repository URL to GitLab; Add patch.
[build-system]: Switch from gnu-build-system to cmake-build-system.
[arguments]<#:make-flags>: Remove it.
<#:phases>{configure}: Do not replace it.
{build}: Do not replace it.
{install}: Do not replace it.
{patch-runner}: New phase.
{symlink-lib}: New phase.
[native-inputs]: Add pkg-config, doxygen, ruby, unity-test.
[home-page]: Use new GitLab URL.
[license]: Switch from X11 to MIT (expat).
* gnu/packages/patches/iniparser-remove-fetchcontent-usage.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register new patch files.

Change-Id: I3cb60ed6feb56c63c1e978a9d5b0d002f097b6fe
Signed-off-by: John Kehayias <john@guixotic.coop>
2026-01-14 15:04:30 -05:00

57 lines
2 KiB
Diff

This patch prevents iniparser from fetching external dependencies on build
phase.
This patch has been taken from nixpkgs' iniparser package:
https://github.com/NixOS/nixpkgs/blob/3497aa5c9457a9d88d71fa93a4a8368816fbeeba/pkgs/by-name/in/iniparser/remove-fetchcontent-usage.patch
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0735d27..32c5cdb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -26,16 +26,8 @@ endif()
set(FETCHCONTENT_QUIET OFF)
-FetchContent_Declare(
- unity
- GIT_REPOSITORY "https://github.com/throwtheswitch/unity.git"
- GIT_PROGRESS TRUE
- PATCH_COMMAND ${CMAKE_COMMAND} -E copy
- ${CMAKE_CURRENT_LIST_DIR}/unity_config.h ./src/)
-
-FetchContent_MakeAvailable(unity)
-target_compile_definitions(unity PUBLIC UNITY_INCLUDE_CONFIG_H
- UNITY_USE_COMMAND_LINE_ARGS)
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(UNITY REQUIRED unity)
function(create_test_runner)
set(options)
@@ -52,7 +44,7 @@ function(create_test_runner)
add_custom_command(
OUTPUT test_${TEST_RUNNER_NAME}_runner.c
COMMAND
- ${RUBY_EXECUTABLE} ${unity_SOURCE_DIR}/auto/generate_test_runner.rb
+ @UNITY-GENERATE-TEST-RUNNER@
${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
test_${TEST_RUNNER_NAME}_runner.c ${CMAKE_CURRENT_LIST_DIR}/unity-config.yml
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/test_${TEST_RUNNER_NAME}.c
@@ -62,10 +54,18 @@ function(create_test_runner)
test_${TEST_RUNNER_NAME}_runner.c)
foreach(TARGET_TYPE ${TARGET_TYPES})
# if BUILD_STATIC_LIBS=ON shared takes precedence
+ target_include_directories(
+ test_${TEST_RUNNER_NAME}
+ PUBLIC
+ ${UNITY_INCLUDE_DIRS})
+ target_compile_options(
+ test_${TEST_RUNNER_NAME}
+ PUBLIC
+ ${UNITY_CFLAGS_OTHER})
target_link_libraries(
test_${TEST_RUNNER_NAME}
${PROJECT_NAME}-${TARGET_TYPE}
- unity)
+ ${UNITY_LIBRARIES})
endforeach()
endfunction()