Skip to content

Commit

Permalink
plfit: fix running tests, fix build with gcc
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 committed Dec 3, 2024
1 parent 2750de4 commit 6c11a1c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
13 changes: 10 additions & 3 deletions math/plfit/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,16 @@ test.target test

compiler.c_standard 1999

configure.args-append -DBUILD_SHARED_LIBS=ON \
-DPLFIT_ENABLE_LTO=AUTO \
-DPLFIT_USE_OPENMP=OFF
configure.args-append -DBUILD_SHARED_LIBS=ON \
-DPLFIT_ENABLE_LTO=AUTO \
-DPLFIT_USE_OPENMP=OFF

configure.pre_args-replace \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF

# ld: unknown option: --version-script=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_math_plfit/plfit/work/plfit-1.0.0/src/plfit.map
patchfiles-append patch-fix-linking-gcc.diff

variant openmp description {Enable OpenMP support} {
configure.args-replace -DPLFIT_USE_OPENMP=OFF -DPLFIT_USE_OPENMP=ON
Expand Down
11 changes: 11 additions & 0 deletions math/plfit/files/patch-fix-linking-gcc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/CMakeLists.txt 2024-11-21 17:12:31.000000000 +0800
+++ src/CMakeLists.txt 2024-12-03 09:42:09.000000000 +0800
@@ -25,7 +25,7 @@
target_link_libraries(plfit OpenMP::OpenMP_C)
endif()

-if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
+if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
set_target_properties(plfit PROPERTIES LINK_FLAGS "-Wl,--version-script=${PROJECT_SOURCE_DIR}/src/plfit.map")
set_target_properties(plfit PROPERTIES LINK_DEPENDS ${PROJECT_SOURCE_DIR}/src/plfit.map)
endif()

0 comments on commit 6c11a1c

Please sign in to comment.