Skip to content

Commit

Permalink
[fluidsynth] Update patch and portfile (#29636)
Browse files Browse the repository at this point in the history
* [fluidsynth] Update gentables patch.

Installation of FluidSynthTargets.cmake was accidentally turned off with
the previous version of the patch.

* [fluidsynth] Update portfile.

- Remove manpages.
- vcpkg_copy_tools already cleans up the bin directories
- Copy pdbs after moving the tools.
- Remove `enable-debug` as it no longer exists.

* [fluidsynth] Install usage.

* [fluidsynth] Bump port version.

* [fluidsynth] Update baseline.

* [fluidsynth] Find dependencies in the config file.

The library dependencies of `FluidSynth::libfluidsynth-OBJ` were not
searched for in the Config file.

* [fluidsynth] Update version.

* [fluidsynth] Apply suggestion from review.

Do not set `VCPKG_BUILD_MAKE_TABLES` in the patch.

* [fluidsynth] Update version.

* [fluidsynth] Update patch.

- Avoid using REQUIRED to find packages.
- Check for ALSA on Linux.
- Provide versions for pkg-config modules.

* [fluidsynth] Update version.
  • Loading branch information
FtZPetruska committed Feb 14, 2023
1 parent a1b1c72 commit ce8d96a
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 32 deletions.
22 changes: 22 additions & 0 deletions ports/fluidsynth/add-usage-requirements.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/FluidSynthConfig.cmake.in b/FluidSynthConfig.cmake.in
index 1ffdf598..0be65e0e 100644
--- a/FluidSynthConfig.cmake.in
+++ b/FluidSynthConfig.cmake.in
@@ -6,5 +6,17 @@
# define variables for configuration options:
# set(network-enabled @enable-network@)

+include(CMakeFindDependencyMacro)
+find_dependency(OpenMP COMPONENTS C)
+find_dependency(PkgConfig)
+pkg_check_modules(GLIB IMPORTED_TARGET glib-2.0>=2.6.5 gthread-2.0>=2.6.5)
+set(ALSA_SUPPORT @ALSA_SUPPORT@)
+if(ALSA_SUPPORT)
+ pkg_check_modules(ALSA IMPORTED_TARGET alsa>=0.9.1)
+endif()
+set(LIBSNDFILE_SUPPORT @LIBSNDFILE_SUPPORT@)
+if(LIBSNDFILE_SUPPORT)
+ pkg_check_modules(LIBSNDFILE IMPORTED_TARGET sndfile>=1.0.0)
+endif()
# finally, include the targets file
include("${CMAKE_CURRENT_LIST_DIR}/FluidSynthTargets.cmake")
34 changes: 13 additions & 21 deletions ports/fluidsynth/gentables.patch
Original file line number Diff line number Diff line change
@@ -1,59 +1,51 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e86a642..426d9e8 100644
index e86a6429..9240e091 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -520,6 +520,11 @@ else ( MACOSX_FRAMEWORK )
install ( FILES ${public_main_HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} )
endif ( MACOSX_FRAMEWORK )
@@ -538,6 +538,9 @@ install(EXPORT FluidSynthTargets

# ******* Auto Generated Lookup Tables ******

+option(VCPKG_BUILD_MAKE_TABLES "Build `make_tables`" OFF)
+if(VCPKG_BUILD_MAKE_TABLES)
+ add_subdirectory(gentables)
+elseif(0)
+
# Exported targets.
include(ExternalProject)

# build_interface: for the libfluidsynth target when imported from the build directory.
@@ -557,4 +562,13 @@ ExternalProject_Add(gentables
set (GENTAB_SDIR ${CMAKE_CURRENT_SOURCE_DIR}/gentables)
@@ -557,4 +560,11 @@ ExternalProject_Add(gentables
"${CMAKE_COMMAND}" --build "${GENTAB_BDIR}"
INSTALL_COMMAND ${GENTAB_BDIR}/make_tables.exe "${FluidSynth_BINARY_DIR}/"
)
+
+endif()
+if(TARGET make_tables AND NOT CMAKE_CROSSCOMPILING)
+ set(GENTABLES make_tables)
+else()
+ find_program(GENTABLES make_tables REQUIRED)
+endif()
+add_custom_target(gentables COMMAND "${GENTABLES}" "${CMAKE_BINARY_DIR}/")
+
add_dependencies(libfluidsynth-OBJ gentables)
diff --git a/src/gentables/CMakeLists.txt b/src/gentables/CMakeLists.txt
index 9cb69f2..b88d1d6 100644
index 9cb69f2b..c393a670 100644
--- a/src/gentables/CMakeLists.txt
+++ b/src/gentables/CMakeLists.txt
@@ -12,6 +12,8 @@ unset(ENV{LDFLAGS})
@@ -12,6 +12,7 @@ unset(ENV{LDFLAGS})

project (gentables C)

+if (0)
+
set ( CMAKE_BUILD_TYPE Debug )

# hardcode ".exe" as suffix to the binary, else in case of cross-platform cross-compiling the calling cmake will not know the suffix used here and fail to find the binary
@@ -21,6 +23,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
@@ -20,6 +21,7 @@ set ( CMAKE_EXECUTABLE_SUFFIX ".exe" )
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})

+endif()
+
# Add the executable that generates the table
add_executable( make_tables
make_tables.c
@@ -34,3 +38,5 @@ if ( WIN32 )
@@ -34,3 +36,4 @@ if ( WIN32 )
else ( WIN32 )
target_link_libraries (make_tables "m")
endif ()
+
+install(TARGETS make_tables DESTINATION bin)

18 changes: 8 additions & 10 deletions ports/fluidsynth/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vcpkg_from_github(
HEAD_REF master
PATCHES
gentables.patch
add-usage-requirements.patch
)

vcpkg_check_features(
Expand Down Expand Up @@ -45,8 +46,6 @@ vcpkg_cmake_configure(
${FEATURE_OPTIONS}
-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}
-Denable-framework=OFF # Needs system permission to install framework
OPTIONS_DEBUG
-Denable-debug:BOOL=ON
MAYBE_UNUSED_VARIABLES
enable-coreaudio
enable-coremidi
Expand All @@ -56,7 +55,6 @@ vcpkg_cmake_configure(
COREMIDI_FOUND
VCPKG_BUILD_MAKE_TABLES
enable-framework
enable-debug
)

vcpkg_cmake_install()
Expand All @@ -71,13 +69,13 @@ if("buildtools" IN_LIST FEATURES)
endif()
vcpkg_copy_tools(TOOL_NAMES ${tools} AUTO_CLEAN)

# Remove unnecessary files
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
vcpkg_copy_pdbs()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/man")

# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
5 changes: 5 additions & 0 deletions ports/fluidsynth/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The package fluidsynth provides CMake targets:

find_package(FluidSynth CONFIG REQUIRED)
target_link_libraries(main PRIVATE FluidSynth::libfluidsynth)
add_custom_command(OUTPUT result COMMAND FluidSynth::fluidsynth ARGS ...)
1 change: 1 addition & 0 deletions ports/fluidsynth/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "fluidsynth",
"version": "2.3.1",
"port-version": 1,
"description": "FluidSynth reads and handles MIDI events from the MIDI input device. It is the software analogue of a MIDI synthesizer. FluidSynth can also play midifiles using a Soundfont.",
"homepage": "https://github.com/FluidSynth/fluidsynth",
"license": "LGPL-2.1-or-later",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2466,7 +2466,7 @@
},
"fluidsynth": {
"baseline": "2.3.1",
"port-version": 0
"port-version": 1
},
"fmem": {
"baseline": "c-libs-2ccee3d2fb",
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/fluidsynth.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d165bef87ad633962767f10a3036a2e69f38b7e3",
"version": "2.3.1",
"port-version": 1
},
{
"git-tree": "bb16308067c170bdc65b1a9e1a0db2fc124f2c6b",
"version": "2.3.1",
Expand Down

0 comments on commit ce8d96a

Please sign in to comment.