aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libmodplug
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/libmodplug
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libmodplug')
-rw-r--r--vcpkg/ports/libmodplug/002-detect_sinf.patch35
-rw-r--r--vcpkg/ports/libmodplug/003-use-static-cast-for-ctype.patch14
-rw-r--r--vcpkg/ports/libmodplug/004-export-pkgconfig.patch52
-rw-r--r--vcpkg/ports/libmodplug/005-fix-install-paths.patch16
-rw-r--r--vcpkg/ports/libmodplug/portfile.cmake29
-rw-r--r--vcpkg/ports/libmodplug/vcpkg.json15
6 files changed, 161 insertions, 0 deletions
diff --git a/vcpkg/ports/libmodplug/002-detect_sinf.patch b/vcpkg/ports/libmodplug/002-detect_sinf.patch
new file mode 100644
index 0000000..784e2e6
--- /dev/null
+++ b/vcpkg/ports/libmodplug/002-detect_sinf.patch
@@ -0,0 +1,35 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2ada51b..468f1a3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4,6 +4,7 @@ project(libmodplug)
+ add_definitions(-DMODPLUG_BUILD)
+
+ include (CheckFunctionExists)
++include (CheckIncludeFile)
+
+ include_directories(AFTER
+ src
+@@ -11,6 +12,10 @@ include_directories(AFTER
+ ${PROJECT_BINARY_DIR}
+ )
+
++if (UNIX)
++ set (CMAKE_REQUIRED_LIBRARIES m)
++endif()
++
+ if (WIN32)
+ add_definitions(-D_USE_MATH_DEFINES)
+ add_definitions(-DNOMINMAX)
+@@ -44,6 +49,11 @@ if (WIN32 AND NOT (MINGW OR MSYS))
+ "Compilation may fail if inttypes.h is not natively supported by the compiler."
+ "You can get inttypes.h from http://code.google.com/p/msinttypes/")
+ endif()
++else()
++ check_include_file("stdint.h" HAVE_STDINT)
++ if (HAVE_STDINT)
++ add_definitions(-DHAVE_STDINT_H)
++ endif()
+ endif()
+
+ check_function_exists("setenv" HAVE_SETENV)
diff --git a/vcpkg/ports/libmodplug/003-use-static-cast-for-ctype.patch b/vcpkg/ports/libmodplug/003-use-static-cast-for-ctype.patch
new file mode 100644
index 0000000..2054e8a
--- /dev/null
+++ b/vcpkg/ports/libmodplug/003-use-static-cast-for-ctype.patch
@@ -0,0 +1,14 @@
+diff --git a/src/load_abc.cpp b/src/load_abc.cpp
+index ee79f39..874ab8f 100644
+--- a/src/load_abc.cpp
++++ b/src/load_abc.cpp
+@@ -268,7 +268,8 @@ static void setenv(const char *name, const char *value, int overwrite)
+ #endif
+
+ static int abc_isvalidchar(char c) {
+- return(isalpha(c) || isdigit(c) || isspace(c) || c == '%' || c == ':');
++ unsigned char u = static_cast<unsigned char>(c);
++ return(isalpha(u) || isdigit(u) || isspace(u) || c == '%' || c == ':');
+ }
+ #if 0
+ static const char *abc_skipspace(const char *p)
diff --git a/vcpkg/ports/libmodplug/004-export-pkgconfig.patch b/vcpkg/ports/libmodplug/004-export-pkgconfig.patch
new file mode 100644
index 0000000..97509b5
--- /dev/null
+++ b/vcpkg/ports/libmodplug/004-export-pkgconfig.patch
@@ -0,0 +1,52 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2ada51b..a0a28d5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 2.8.0)
++cmake_minimum_required(VERSION 3.5)
+
+ project(libmodplug)
+ add_definitions(-DMODPLUG_BUILD)
+@@ -131,7 +131,24 @@ if(HAVE_SINF)
+ add_definitions(-DHAVE_SINF)
+ endif(HAVE_SINF)
+
+-if (NOT WIN32)
++if(WIN32)
++ set(LIBS_PRIVATE "-luser32")
++else(WIN32)
++ set(FAKE_CXX_LINKAGE "")
++ foreach(lib IN LISTS CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
++ if(lib IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
++ continue()
++ elseif(EXISTS "${lib}")
++ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FILE_FLAG}${lib}")
++ else()
++ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FLAG}${lib}")
++ endif()
++ endforeach()
++ set(LIBS_PRIVATE " ${FAKE_CXX_LINKAGE} ")
++ if(NOT LIBS_PRIVATE MATCHES " -lm ")
++ string(APPEND LIBS_PRIVATE "-lm")
++ endif()
++endif(WIN32)
+ set(prefix "${CMAKE_INSTALL_PREFIX}")
+ set(exec_prefix "${CMAKE_INSTALL_PREFIX}")
+ set(libdir "${CMAKE_INSTALL_PREFIX}/lib")
+@@ -142,4 +159,3 @@ if (NOT WIN32)
+ install(FILES "${PROJECT_BINARY_DIR}/libmodplug.pc"
+ DESTINATION lib/pkgconfig
+ )
+-endif (NOT WIN32)
+diff --git a/libmodplug.pc.in b/libmodplug.pc.in
+index bbf05f9..e4a43cc 100644
+--- a/libmodplug.pc.in
++++ b/libmodplug.pc.in
+@@ -8,5 +8,5 @@ Description: The ModPlug mod file playing library.
+ Version: @VERSION@
+ Requires:
+ Libs: -L${libdir} -lmodplug
+-Libs.private: -lstdc++ -lm
++Libs.private: @LIBS_PRIVATE@
+ Cflags: -I${includedir}
diff --git a/vcpkg/ports/libmodplug/005-fix-install-paths.patch b/vcpkg/ports/libmodplug/005-fix-install-paths.patch
new file mode 100644
index 0000000..a41acf0
--- /dev/null
+++ b/vcpkg/ports/libmodplug/005-fix-install-paths.patch
@@ -0,0 +1,16 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 468f1a3..b58b11e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -119,7 +119,10 @@ add_library(modplug ${LIB_TYPE}
+ )
+
+ # install the library:
+-install(TARGETS modplug DESTINATION lib)
++install(TARGETS modplug
++ RUNTIME DESTINATION bin
++ LIBRARY DESTINATION lib
++ ARCHIVE DESTINATION lib)
+
+ # incstall the headers:
+ install(FILES
diff --git a/vcpkg/ports/libmodplug/portfile.cmake b/vcpkg/ports/libmodplug/portfile.cmake
new file mode 100644
index 0000000..4d4b545
--- /dev/null
+++ b/vcpkg/ports/libmodplug/portfile.cmake
@@ -0,0 +1,29 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO Konstanty/libmodplug
+ REF 5a39f5913d07ba3e61d8d5afdba00b70165da81d # cf. https://github.com/Konstanty/libmodplug/issues/48
+ SHA512 c43bb3190b62c3a4e3636bba121b5593bbf8e6577ca9f2aa04d90b03730ea7fb590e640cdadeb565758b92e81187bc456e693fe37f1f4deace9b9f37556e3ba1
+ PATCHES
+ 002-detect_sinf.patch
+ 003-use-static-cast-for-ctype.patch
+ 004-export-pkgconfig.patch
+ 005-fix-install-paths.patch # https://github.com/Konstanty/libmodplug/pull/61
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DCMAKE_CXX_STANDARD=11
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libmodplug/modplug.h" "defined(MODPLUG_STATIC)" "1")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libmodplug/stdafx.h" "defined(MODPLUG_STATIC)" "1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/libmodplug/vcpkg.json b/vcpkg/ports/libmodplug/vcpkg.json
new file mode 100644
index 0000000..0a34096
--- /dev/null
+++ b/vcpkg/ports/libmodplug/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "name": "libmodplug",
+ "version": "0.8.9.0",
+ "port-version": 15,
+ "description": "The ModPlug mod file playing library.",
+ "homepage": "https://github.com/Konstanty/libmodplug",
+ "license": null,
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}