From 9c2fc5d3518bb7f729754b23440695f9c595576a Mon Sep 17 00:00:00 2001 From: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> Date: Tue, 10 Oct 2023 03:33:09 +0530 Subject: [PATCH] [libgig] New Port (#33255) --- ports/libgig/0001-msvc-fix-ssize_t.patch | 16 ++++++++++ ports/libgig/0002-cmake-fixes.patch | 18 +++++++++++ ports/libgig/0003-fix-usage.patch | 19 +++++++++++ ports/libgig/portfile.cmake | 40 ++++++++++++++++++++++++ ports/libgig/vcpkg.json | 31 ++++++++++++++++++ versions/baseline.json | 4 +++ versions/l-/libgig.json | 9 ++++++ 7 files changed, 137 insertions(+) create mode 100644 ports/libgig/0001-msvc-fix-ssize_t.patch create mode 100644 ports/libgig/0002-cmake-fixes.patch create mode 100644 ports/libgig/0003-fix-usage.patch create mode 100644 ports/libgig/portfile.cmake create mode 100644 ports/libgig/vcpkg.json create mode 100644 versions/l-/libgig.json diff --git a/ports/libgig/0001-msvc-fix-ssize_t.patch b/ports/libgig/0001-msvc-fix-ssize_t.patch new file mode 100644 index 0000000000..d2edce0e7b --- /dev/null +++ b/ports/libgig/0001-msvc-fix-ssize_t.patch @@ -0,0 +1,16 @@ +diff --git a/src/Serialization.h b/src/Serialization.h +index cccfc54..91a8fa4 100644 +--- a/src/Serialization.h ++++ b/src/Serialization.h +@@ -40,6 +40,11 @@ + #include + #include + ++#ifdef _MSC_VER ++#include ++using ssize_t = SSIZE_T; ++#endif ++ + #ifndef __has_extension + # define __has_extension(x) 0 + #endif diff --git a/ports/libgig/0002-cmake-fixes.patch b/ports/libgig/0002-cmake-fixes.patch new file mode 100644 index 0000000000..19982f251c --- /dev/null +++ b/ports/libgig/0002-cmake-fixes.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ae66913..893e3ea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,9 +1,9 @@ +-cmake_minimum_required(VERSION 3.0) ++cmake_minimum_required(VERSION 3.1) + project(libgig) + +-if(NOT MSVC) +- message(FATAL_ERROR "Please use configure and make, this cmake file is currently only to generate msvc solution files") +-endif() ++#To force the compiler to use C++ 11 ++set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + + + #configuration options diff --git a/ports/libgig/0003-fix-usage.patch b/ports/libgig/0003-fix-usage.patch new file mode 100644 index 0000000000..0b2c040bce --- /dev/null +++ b/ports/libgig/0003-fix-usage.patch @@ -0,0 +1,19 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 893e3ea..2eef641 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -128,12 +128,11 @@ install(TARGETS libgig EXPORT libgig-config + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/libgig) +-install(EXPORT libgig-config NAMESPACE libgig:: DESTINATION share/libgig) + +-install(TARGETS libakai EXPORT libakai-config ++install(TARGETS libakai EXPORT libgig-config + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include/libgig) +-install(EXPORT libakai-config NAMESPACE libgig:: DESTINATION share/libgig) ++install(EXPORT libgig-config NAMESPACE libgig:: DESTINATION share/libgig) + diff --git a/ports/libgig/portfile.cmake b/ports/libgig/portfile.cmake new file mode 100644 index 0000000000..57f2748f87 --- /dev/null +++ b/ports/libgig/portfile.cmake @@ -0,0 +1,40 @@ +vcpkg_download_distfile(ARCHIVE + URLS "https://download.linuxsampler.org/packages/libgig-4.3.0.tar.bz2" + FILENAME "libgig-4.3.0.tar.bz2" + SHA512 683c09b1d17acf69020c631452b7dfb25ac54c3701db5e97471d4e7973e9a06267667bf19bfe4eb00d2964223e8446f248d93b4cf29c062dec2588758b4dfba2 +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0001-msvc-fix-ssize_t.patch + 0002-cmake-fixes.patch + 0003-fix-usage.patch +) + +string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} dynamic LIBGIG_BUILD_SHARED) + +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + extra-tools LIBGIG_BUILD_TOOLS + tests LIBGIG_ENABLE_TESTING +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${FEATURE_OPTIONS} + -DLIBGIG_BUILD_SHARED=${LIBGIG_BUILD_SHARED} +) + +vcpkg_cmake_install() +if("tools" IN_LIST FEATURES) + vcpkg_copy_tools(TOOL_NAMES dlsdump gigdump gigmerge korg2gig korgdump rifftree sf2dump + SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/bin") +endif() +vcpkg_cmake_config_fixup() +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") diff --git a/ports/libgig/vcpkg.json b/ports/libgig/vcpkg.json new file mode 100644 index 0000000000..917fb405e9 --- /dev/null +++ b/ports/libgig/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "libgig", + "version": "4.3.0", + "description": "C++ library for loading Gigasampler files and DLS Level 1/2 files", + "homepage": "https://www.linuxsampler.org/libgig/", + "supports": "windows & !uwp", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "features": { + "tests": { + "description": "Build test cases", + "dependencies": [ + "cppunit" + ] + }, + "tools": { + "description": "Build extra tools", + "dependencies": [ + "libsndfile" + ] + } + } +} diff --git a/versions/baseline.json b/versions/baseline.json index 65e1996f4d..89251ff88e 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4196,6 +4196,10 @@ "baseline": "1.7.1", "port-version": 3 }, + "libgig": { + "baseline": "4.3.0", + "port-version": 0 + }, "libgit2": { "baseline": "1.6.4", "port-version": 1 diff --git a/versions/l-/libgig.json b/versions/l-/libgig.json new file mode 100644 index 0000000000..b68106b2e4 --- /dev/null +++ b/versions/l-/libgig.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "328bc5b2b64bc33badee7d282589b14d49aadb55", + "version": "4.3.0", + "port-version": 0 + } + ] +}