diff --git a/ports/libmodplug/automagically-define-modplug-static.patch b/ports/libmodplug/001-automagically-define-modplug-static.patch similarity index 72% rename from ports/libmodplug/automagically-define-modplug-static.patch rename to ports/libmodplug/001-automagically-define-modplug-static.patch index eaa7e6ca6b..d0df45473b 100644 --- a/ports/libmodplug/automagically-define-modplug-static.patch +++ b/ports/libmodplug/001-automagically-define-modplug-static.patch @@ -1,7 +1,7 @@ -diff --git a/libmodplug/modplug.h b/libmodplug/modplug.h +diff --git a/src/modplug.h b/src/modplug.h index 3ffbf9d..fd19ae5 100644 ---- a/libmodplug/modplug.h -+++ b/libmodplug/modplug.h +--- a/src/modplug.h ++++ b/src/modplug.h @@ -11,6 +11,8 @@ extern "C" { #endif diff --git a/ports/libmodplug/002-detect_sinf.patch b/ports/libmodplug/002-detect_sinf.patch new file mode 100644 index 0000000000..784e2e6635 --- /dev/null +++ b/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/ports/libmodplug/CONTROL b/ports/libmodplug/CONTROL index e0cc81a3bf..2a6cb4638c 100644 --- a/ports/libmodplug/CONTROL +++ b/ports/libmodplug/CONTROL @@ -1,3 +1,3 @@ Source: libmodplug -Version: 0.8.9.0-1 +Version: 0.8.9.0-4 Description: The ModPlug mod file playing library. diff --git a/ports/libmodplug/portfile.cmake b/ports/libmodplug/portfile.cmake index bac7340840..2876160880 100644 --- a/ports/libmodplug/portfile.cmake +++ b/ports/libmodplug/portfile.cmake @@ -1,14 +1,30 @@ - set(MODPLUG_HASH 5a39f5913d07ba3e61d8d5afdba00b70165da81d) -include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libmodplug-${MODPLUG_HASH}) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Konstanty/libmodplug/archive/${MODPLUG_HASH}.zip" - FILENAME "libmodplug-${MODPLUG_HASH}.zip" - SHA512 71b1314c44c98694c66ac17b638e997b99abc1ad61f7ac2e971000bdd4276d50d538259f4ee4dd39a3f672d28d3d322a32c83a9be0b1ffe5099ecc81273b5b55) -vcpkg_extract_source_archive(${ARCHIVE}) +include(vcpkg_common_functions) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + vcpkg_from_github(ARCHIVE + OUT_SOURCE_PATH SOURCE_PATH + REPO Konstanty/libmodplug + REF ${MODPLUG_HASH} + SHA512 c43bb3190b62c3a4e3636bba121b5593bbf8e6577ca9f2aa04d90b03730ea7fb590e640cdadeb565758b92e81187bc456e693fe37f1f4deace9b9f37556e3ba1 + PATCHES + "001-automagically-define-modplug-static.patch" + "002-detect_sinf.patch" + ) +else() + vcpkg_from_github(ARCHIVE + OUT_SOURCE_PATH SOURCE_PATH + REPO JackBister/libmodplug + REF ${MODPLUG_HASH} + SHA512 c43bb3190b62c3a4e3636bba121b5593bbf8e6577ca9f2aa04d90b03730ea7fb590e640cdadeb565758b92e81187bc456e693fe37f1f4deace9b9f37556e3ba1 + PATCHES + "002-detect_sinf.patch" + ) +endif() + vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA) + vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) @@ -19,11 +35,6 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/modplug.dll ${CURRENT_PACKAGES_DIR}/debug/bin/modplug.dll) vcpkg_copy_pdbs() -else() - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/automagically-define-modplug-static.patch) endif() file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmodplug)