Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portaudio] Control deps, cleanup #43323

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions ports/portaudio/fix-library-can-not-be-found.patch

This file was deleted.

34 changes: 0 additions & 34 deletions ports/portaudio/framework_link.patch

This file was deleted.

26 changes: 26 additions & 0 deletions ports/portaudio/jack.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 122fe93..8983f85 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,7 +288,8 @@ ELSE()
SET(PA_SOURCES ${PA_SOURCES} ${PA_JACK_SOURCES})
SET(PA_PRIVATE_COMPILE_DEFINITIONS ${PA_PRIVATE_COMPILE_DEFINITIONS} PA_USE_JACK)
SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${JACK_LIBRARIES})
- SET(PA_PKGCONFIG_LDFLAGS "${PA_PKGCONFIG_LDFLAGS} -ljack")
+ SET(PA_LIBRARY_DEPENDENCIES ${PA_LIBRARY_DEPENDENCIES} ${CMAKE_DL_LIBS})
+ SET(PA_PKGCONFIG_REQUIRES_PRIVATE "${PA_PKGCONFIG_REQUIRES_PRIVATE} jack")
ENDIF()

FIND_PACKAGE(ALSA)
diff --git a/cmake_support/portaudio-2.0.pc.in b/cmake_support/portaudio-2.0.pc.in
index 738803d..24b211c 100644
--- a/cmake_support/portaudio-2.0.pc.in
+++ b/cmake_support/portaudio-2.0.pc.in
@@ -6,6 +6,7 @@ includedir=${prefix}/include
Name: PortAudio
Description: Portable audio I/O
Requires:
+Requires.private: @PA_PKGCONFIG_REQUIRES_PRIVATE@
Version: @PA_PKGCONFIG_VERSION@

Libs: -L${libdir} -lportaudio @PA_PKGCONFIG_LDFLAGS@
54 changes: 34 additions & 20 deletions ports/portaudio/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,56 @@ vcpkg_from_github(
REF 147dd722548358763a8b649b3e4b41dfffbcfbb6
SHA512 0f56e5f5b004f51915f29771b8fc1fe886f1fef5d65ab5ea1db43f43c49917476b9eec14b36aa54d3e9fb4d8bdf61e68c79624d00b7e548d4c493395a758233a
PATCHES
fix-library-can-not-be-found.patch
framework_link.patch
jack.diff
)

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" PA_DLL_LINK_WITH_STATIC_RUNTIME)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PA_BUILD_SHARED)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" PA_BUILD_STATIC)

# NOTE: the ASIO backend will be built automatically if the ASIO-SDK is provided
# in a sibling folder of the portaudio source in vcpkg/buildtrees/portaudio/src
vcpkg_list(SET options)
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_list(APPEND options
-DPA_USE_ASIOSDK=OFF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes the Windows version of the port barely useable, as ASIO is the standard for all proffesional audio equipment on Windows. Why not linking the VCPKG asiosdk port as dependency or default feature here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original behavior is not acceptable. The port must not pick dependencies just because they are present in arbitrary locations. I can fix this broken behavior only by disabling asiosdk, because I cannot test the configuration with asiosdk.

  • You can and must add a proper feature to depend on, and use, port asiosdk.
  • You can and must use triplet customization to override this cmake option if you want to pick an external copy of asiosdk.

-DPA_DLL_LINK_WITH_STATIC_RUNTIME=${PA_DLL_LINK_WITH_STATIC_RUNTIME}
-DPA_LIBNAME_ADD_SUFFIX=OFF
)
elseif(VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_OSX)
vcpkg_list(APPEND options
# avoid absolute paths
-DCOREAUDIO_LIBRARY:STRING=-Wl,-framework,CoreAudio
-DAUDIOTOOLBOX_LIBRARY:STRING=-Wl,-framework,AudioToolbox
-DAUDIOUNIT_LIBRARY:STRING=-Wl,-framework,AudioUnit
-DCOREFOUNDATION_LIBRARY:STRING=-Wl,-framework,CoreFoundation
-DCORESERVICES_LIBRARY:STRING=-Wl,-framework,CoreServices
)
else()
vcpkg_list(APPEND options
-DPA_USE_JACK=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_Jack=ON
-DPA_USE_ALSA=OFF
)
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DPA_USE_DS=ON
-DPA_USE_WASAPI=ON
-DPA_USE_WDMKS=ON
-DPA_USE_WMME=ON
-DPA_LIBNAME_ADD_SUFFIX=OFF
${options}
-DPA_BUILD_SHARED=${PA_BUILD_SHARED}
-DPA_BUILD_STATIC=${PA_BUILD_STATIC}
-DPA_DLL_LINK_WITH_STATIC_RUNTIME=OFF
OPTIONS_DEBUG
-DPA_ENABLE_DEBUG_OUTPUT:BOOL=ON
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

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

# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/doc"
)

vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
7 changes: 6 additions & 1 deletion ports/portaudio/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
{
"name": "portaudio",
"version": "19.7",
"port-version": 5,
"port-version": 6,
"description": "PortAudio Portable Cross-platform Audio I/O API PortAudio is a free, cross-platform, open-source, audio I/O library. It lets you write simple audio programs in 'C' or C++ that will compile and run on many platforms including Windows, Macintosh OS X, and Unix (OSS/ALSA). It is intended to promote the exchange of audio software between developers on different platforms. Many applications use PortAudio for Audio I/O.",
"homepage": "http://www.portaudio.com",
"license": "MIT",
"supports": "!uwp",
"dependencies": [
{
"name": "jack2",
"platform": "!ios & !osx & !windows"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We distribute Mixxx with Jack support on macOS and Windows.
https://github.com/mixxxdj/vcpkg/tree/2.5/overlay/ports/portaudio

I am unsure how the upstream status is right now. Do you have interest to integrate our patches?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No extra patches to the old CMakeLists.txt. Portaudio needs to make a release.

},
{
"name": "vcpkg-cmake",
"host": true
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7174,7 +7174,7 @@
},
"portaudio": {
"baseline": "19.7",
"port-version": 5
"port-version": 6
},
"portmidi": {
"baseline": "2.0.4",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/portaudio.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "b355b107dec4037485783b2f1ae56e4e991220a3",
"version": "19.7",
"port-version": 6
},
{
"git-tree": "34d770f3357878c7b7668acf63e7a3095f1b5afc",
"version": "19.7",
Expand Down