aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libcerf
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libcerf
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libcerf')
-rw-r--r--vcpkg/ports/libcerf/begin-end-decls.diff44
-rw-r--r--vcpkg/ports/libcerf/cxx-flags.diff22
-rw-r--r--vcpkg/ports/libcerf/fix-source.diff26
-rw-r--r--vcpkg/ports/libcerf/install-dirs.diff13
-rw-r--r--vcpkg/ports/libcerf/portfile.cmake32
-rw-r--r--vcpkg/ports/libcerf/vcpkg.json16
6 files changed, 153 insertions, 0 deletions
diff --git a/vcpkg/ports/libcerf/begin-end-decls.diff b/vcpkg/ports/libcerf/begin-end-decls.diff
new file mode 100644
index 0000000..151d056
--- /dev/null
+++ b/vcpkg/ports/libcerf/begin-end-decls.diff
@@ -0,0 +1,44 @@
+diff --git a/lib/cerf.h b/lib/cerf.h
+index 28576ab..c9bc6dd 100644
+--- a/lib/cerf.h
++++ b/lib/cerf.h
+@@ -55,25 +55,23 @@
+ typedef double _Complex _cerf_cmplx;
+ # endif
+
+-# undef __BEGIN_DECLS
+-# undef __END_DECLS
+ # ifdef CERF_AS_CPP
+ # ifndef __cplusplus
+ impossible_case
+ # endif
+-# define __BEGIN_DECLS
+-# define __END_DECLS
++# define LIBCERF_BEGIN_DECLS
++# define LIBCERF_END_DECLS
+ # else
+ # ifdef __cplusplus // this include file called from C++ while library is compiled as C
+-# define __BEGIN_DECLS extern "C" {
+-# define __END_DECLS }
++# define LIBCERF_BEGIN_DECLS extern "C" {
++# define LIBCERF_END_DECLS }
+ # else
+-# define __BEGIN_DECLS
+-# define __END_DECLS
++# define LIBCERF_BEGIN_DECLS
++# define LIBCERF_END_DECLS
+ # endif
+ # endif
+
+-__BEGIN_DECLS
++LIBCERF_BEGIN_DECLS
+
+ #if _WIN32
+ #define EXPORT __declspec(dllexport)
+@@ -111,5 +109,5 @@ EXPORT double voigt(double x, double sigma, double gamma);
+ // compute the full width at half maximum of the Voigt function
+ EXPORT double voigt_hwhm(double sigma, double gamma);
+
+-__END_DECLS
++LIBCERF_END_DECLS
+ #endif /* __CERF_H__ */
diff --git a/vcpkg/ports/libcerf/cxx-flags.diff b/vcpkg/ports/libcerf/cxx-flags.diff
new file mode 100644
index 0000000..f571764
--- /dev/null
+++ b/vcpkg/ports/libcerf/cxx-flags.diff
@@ -0,0 +1,22 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e33ce56..f037190 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -45,16 +45,12 @@ if(MSVC)
+ message(FATAL_ERROR "Under MSVC, only CERF_CPP=ON is supported")
+ endif()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # parallel compilation
+- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS}")
+ set(MS_NOWARN "/wd4018 /wd4068 /wd4101 /wd4244 /wd4267 /wd4305 /wd4715 /wd4996")
+ set(MS_D "-D_CRT_SECURE_NO_WARNINGS -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING")
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${MS_NOWARN} ${MS_D}")
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MS_NOWARN} ${MS_D}")
+ set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
+ if(BUILD_SHARED_LIBS)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+- else()
+- # required for post-build validation under vcpkg:
+- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd") # multithreaded, debug
+ endif()
+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
diff --git a/vcpkg/ports/libcerf/fix-source.diff b/vcpkg/ports/libcerf/fix-source.diff
new file mode 100644
index 0000000..9b6f82c
--- /dev/null
+++ b/vcpkg/ports/libcerf/fix-source.diff
@@ -0,0 +1,26 @@
+diff --git a/lib/width.c b/lib/width.c
+index 37c3afa..b4b6bda 100644
+--- a/lib/width.c
++++ b/lib/width.c
+@@ -47,7 +47,7 @@ using std::isnan;
+ * Olivero & Longbothum [1977]
+ * Journal of Quantitative Spectroscopy and Radiative Transfer. 17:233
+ */
+-double hwhm0(double sigma, double gamma)
++static double hwhm0(double sigma, double gamma)
+ {
+ return .5*(1.06868*gamma+sqrt(0.86743*gamma*gamma+4*2*log(2)*sigma*sigma));
+ }
+diff --git a/test/widthtest.c b/test/widthtest.c
+index b395d34..a44b83f 100644
+--- a/test/widthtest.c
++++ b/test/widthtest.c
+@@ -28,7 +28,7 @@
+ #include "testtool.h"
+
+ // excellent approximation [Olivero & Longbothum, 1977], used as starting value in voigt_hwhm
+-double hwhm0(double sigma, double gamma)
++static double hwhm0(double sigma, double gamma)
+ {
+ return .5*(1.06868*gamma+sqrt(0.86743*gamma*gamma+4*2*log(2)*sigma*sigma));
+ }
diff --git a/vcpkg/ports/libcerf/install-dirs.diff b/vcpkg/ports/libcerf/install-dirs.diff
new file mode 100644
index 0000000..81e4c76
--- /dev/null
+++ b/vcpkg/ports/libcerf/install-dirs.diff
@@ -0,0 +1,13 @@
+diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
+index 0a54d5d..e69a984 100644
+--- a/lib/CMakeLists.txt
++++ b/lib/CMakeLists.txt
+@@ -38,7 +38,7 @@ target_include_directories(${lib} INTERFACE
+ install(
+ TARGETS ${lib}
+ EXPORT ${intf}
+- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ COMPONENT Libraries)
diff --git a/vcpkg/ports/libcerf/portfile.cmake b/vcpkg/ports/libcerf/portfile.cmake
new file mode 100644
index 0000000..671562e
--- /dev/null
+++ b/vcpkg/ports/libcerf/portfile.cmake
@@ -0,0 +1,32 @@
+vcpkg_from_gitlab(
+ OUT_SOURCE_PATH SOURCE_PATH
+ GITLAB_URL https://jugit.fz-juelich.de
+ REPO mlz/libcerf
+ REF "v${VERSION}"
+ SHA512 0e78a18c498705d5efa26e504932192c4d49485cc3f971235c86c4dc6ca7498063f33e188a55f4c939e25d0d2a2f215b22ef11d3776d80a4a7486ea62fad1d73
+ PATCHES
+ cxx-flags.diff
+ fix-source.diff
+ begin-end-decls.diff
+ install-dirs.diff
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DCERF_CPP=ON
+ -DLIB_MAN=OFF
+ -DLIB_RUN=OFF
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/cerf PACKAGE_NAME cerf)
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/cerf.h" "dllexport" "dllimport")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libcerf/vcpkg.json b/vcpkg/ports/libcerf/vcpkg.json
new file mode 100644
index 0000000..de42e09
--- /dev/null
+++ b/vcpkg/ports/libcerf/vcpkg.json
@@ -0,0 +1,16 @@
+{
+ "name": "libcerf",
+ "version": "2.4",
+ "description": "A self-contained numeric library that provides an efficient and accurate implementation of complex error functions, along with Dawson, Faddeeva, and Voigt functions.",
+ "homepage": "https://jugit.fz-juelich.de/mlz/libcerf",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}