mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 01:30:55 +08:00
[mpg123] Fix dllexport, fix pkgconfig, add test port (#42601)
This commit is contained in:
parent
f3961d4467
commit
b7601ed37e
16
ports/mpg123/fix-dllexport.diff
Normal file
16
ports/mpg123/fix-dllexport.diff
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/src/libmpg123/mpg123lib_intern.h b/src/libmpg123/mpg123lib_intern.h
|
||||
index b46c419..7cd5504 100644
|
||||
--- a/src/libmpg123/mpg123lib_intern.h
|
||||
+++ b/src/libmpg123/mpg123lib_intern.h
|
||||
@@ -21,7 +21,10 @@
|
||||
|
||||
// Only portable API plays a role in the library itself, outside of lfs_wrap.c.
|
||||
// Also, we need to ensure no suffix renaming for the primary implementations.
|
||||
-#define MPG123_PORTABLE_API
|
||||
+// But: The _definition_ of non-portable API needs to be present for those
|
||||
+// primary implementations being exported for DLL builds. Just the largefile
|
||||
+// renaming needs to be skipped!
|
||||
+#define MPG123_NO_LARGENAME
|
||||
#define MPG123_ENUM_API
|
||||
#include "mpg123.h"
|
||||
|
66
ports/mpg123/pkgconfig.diff
Normal file
66
ports/mpg123/pkgconfig.diff
Normal file
@ -0,0 +1,66 @@
|
||||
diff --git a/ports/cmake/src/CMakeLists.txt b/ports/cmake/src/CMakeLists.txt
|
||||
index 32bc03c..952141b 100644
|
||||
--- a/ports/cmake/src/CMakeLists.txt
|
||||
+++ b/ports/cmake/src/CMakeLists.txt
|
||||
@@ -450,3 +450,7 @@ if(UNIX AND NOT PORTABLE_API)
|
||||
endif()
|
||||
|
||||
configure_file(config.cmake.h.in config.h)
|
||||
+
|
||||
+set(LIBMPG123_LIBS "${LIBMPG123_LIBS}" PARENT_SCOPE)
|
||||
+set(LIBOUT123_LIBS "${LIBOUT123_LIBS}" PARENT_SCOPE)
|
||||
+set(LIBSYN123_LIBS "${LIBSYN123_LIBS}" PARENT_SCOPE)
|
||||
diff --git a/ports/cmake/src/libmpg123/CMakeLists.txt b/ports/cmake/src/libmpg123/CMakeLists.txt
|
||||
index 7cb08be..3e1c042 100644
|
||||
--- a/ports/cmake/src/libmpg123/CMakeLists.txt
|
||||
+++ b/ports/cmake/src/libmpg123/CMakeLists.txt
|
||||
@@ -235,6 +235,13 @@ else()
|
||||
target_sources(${TARGET} PRIVATE ${PLATFORM_SOURCES})
|
||||
endif()
|
||||
|
||||
+if(HAVE_M)
|
||||
+ string(APPEND LIBMPG123_LIBS " -lm")
|
||||
+endif()
|
||||
+if(WANT_WIN32_UNICODE)
|
||||
+ string(APPEND LIBMPG123_LIBS " -lshlwapi")
|
||||
+endif()
|
||||
+set(LIBMPG123_LIBS "${LIBMPG123_LIBS}" PARENT_SCOPE)
|
||||
target_link_libraries(${TARGET} PRIVATE
|
||||
$<$<BOOL:${HAVE_M}>:m>
|
||||
$<$<BOOL:${WANT_WIN32_UNICODE}>:shlwapi>)
|
||||
diff --git a/ports/cmake/src/libout123/CMakeLists.txt b/ports/cmake/src/libout123/CMakeLists.txt
|
||||
index d0fe358..cd800d8 100644
|
||||
--- a/ports/cmake/src/libout123/CMakeLists.txt
|
||||
+++ b/ports/cmake/src/libout123/CMakeLists.txt
|
||||
@@ -18,6 +18,13 @@ add_library(${TARGET}
|
||||
|
||||
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME out123)
|
||||
|
||||
+if(HAVE_UNIX_DL)
|
||||
+ string(APPEND LIBOUT123_LIBS " -ldl")
|
||||
+endif()
|
||||
+if(WANT_WIN32_UNICODE)
|
||||
+ string(APPEND LIBOUT123_LIBS " -lshlwapi")
|
||||
+endif()
|
||||
+set(LIBOUT123_LIBS "${LIBOUT123_LIBS}" PARENT_SCOPE)
|
||||
target_link_libraries(${TARGET} PRIVATE
|
||||
$<TARGET_NAME_IF_EXISTS:defaultmodule>
|
||||
$<$<BOOL:${HAVE_UNIX_DL}>:dl>
|
||||
diff --git a/ports/cmake/src/libsyn123/CMakeLists.txt b/ports/cmake/src/libsyn123/CMakeLists.txt
|
||||
index 6edb5b7..0b660f5 100644
|
||||
--- a/ports/cmake/src/libsyn123/CMakeLists.txt
|
||||
+++ b/ports/cmake/src/libsyn123/CMakeLists.txt
|
||||
@@ -19,6 +19,13 @@ target_include_directories(${TARGET} INTERFACE
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
|
||||
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
|
||||
|
||||
+if(HAVE_M)
|
||||
+ string(APPEND LIBSYN123_LIBS " -lm")
|
||||
+endif()
|
||||
+if(WANT_WIN32_UNICODE)
|
||||
+ string(APPEND LIBSYN123_LIBS " -lshlwapi")
|
||||
+endif()
|
||||
+set(LIBSYN123_LIBS "${LIBSYN123_LIBS}" PARENT_SCOPE)
|
||||
target_link_libraries(${TARGET} PRIVATE
|
||||
$<$<BOOL:${HAVE_M}>:m>
|
||||
$<$<BOOL:${WANT_WIN32_UNICODE}>:shlwapi>)
|
@ -5,7 +5,9 @@ vcpkg_from_sourceforge(
|
||||
FILENAME "mpg123-${VERSION}.tar.bz2"
|
||||
SHA512 dccb640b0845061811cb41bf145587e7093556d686d49a748232b079659b46284b6cc40db42d14febceac11277c58edf2b69d1b4c46c223829a3d15478e2e26c
|
||||
PATCHES
|
||||
fix-dllexport.diff
|
||||
have-fpu.diff
|
||||
pkgconfig.diff
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
@ -27,6 +29,8 @@ vcpkg_cmake_configure(
|
||||
${options}
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
BUILD_PROGRAMS
|
||||
CMAKE_DISABLE_FIND_PACKAGE_ALSA
|
||||
CMAKE_DISABLE_FIND_PACKAGE_PkgConfig
|
||||
)
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "mpg123",
|
||||
"version": "1.32.9",
|
||||
"port-version": 1,
|
||||
"description": "mpg123 is a real time MPEG 1.0/2.0/2.5 audio player/decoder for layers 1, 2 and 3 (MPEG 1.0 layer 3 also known as MP3).",
|
||||
"homepage": "https://sourceforge.net/projects/mpg123/",
|
||||
"license": "LGPL-2.1-or-later",
|
||||
|
10
scripts/test_ports/vcpkg-ci-mpg123/portfile.cmake
Normal file
10
scripts/test_ports/vcpkg-ci-mpg123/portfile.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
|
||||
|
||||
vcpkg_find_acquire_program(PKGCONFIG)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
|
||||
OPTIONS
|
||||
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
|
||||
)
|
||||
vcpkg_cmake_build()
|
14
scripts/test_ports/vcpkg-ci-mpg123/project/CMakeLists.txt
Normal file
14
scripts/test_ports/vcpkg-ci-mpg123/project/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
|
||||
project(vcpkg-ci-mpg123 C)
|
||||
|
||||
find_package(mpg123 REQUIRED)
|
||||
|
||||
add_executable(main main.c)
|
||||
target_link_libraries(main PRIVATE MPG123::libmpg123)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(MPG123_PC REQUIRED IMPORTED_TARGET libmpg123)
|
||||
|
||||
add_executable(main-pc main.c)
|
||||
target_link_libraries(main-pc PRIVATE PkgConfig::MPG123_PC)
|
11
scripts/test_ports/vcpkg-ci-mpg123/project/main.c
Normal file
11
scripts/test_ports/vcpkg-ci-mpg123/project/main.c
Normal file
@ -0,0 +1,11 @@
|
||||
#include <mpg123.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
mpg123_handle *m = mpg123_new(NULL, NULL);
|
||||
mpg123_open(m, "vcpkg");
|
||||
mpg123_scan(m);
|
||||
mpg123_close(m);
|
||||
mpg123_delete(m);
|
||||
return 0;
|
||||
}
|
12
scripts/test_ports/vcpkg-ci-mpg123/vcpkg.json
Normal file
12
scripts/test_ports/vcpkg-ci-mpg123/vcpkg.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "vcpkg-ci-mpg123",
|
||||
"version-string": "ci",
|
||||
"description": "Validates mpg123",
|
||||
"dependencies": [
|
||||
"mpg123",
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
@ -6098,7 +6098,7 @@
|
||||
},
|
||||
"mpg123": {
|
||||
"baseline": "1.32.9",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"mpi": {
|
||||
"baseline": "1",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "0c11d8d8818fece4a1fb1de93e5423a078f6c29e",
|
||||
"version": "1.32.9",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "24f943a44e7512101017022557b2291d5ef209be",
|
||||
"version": "1.32.9",
|
||||
|
Loading…
x
Reference in New Issue
Block a user