diff --git a/libsndfile-1.1.0-liblame-3.100.patch b/libsndfile-1.1.0-liblame-3.100.patch new file mode 100644 index 0000000..f95f628 --- /dev/null +++ b/libsndfile-1.1.0-liblame-3.100.patch @@ -0,0 +1,249 @@ +From eff5f0a640ef2a21ac77b42aa22d42b30fd46c97 Mon Sep 17 00:00:00 2001 +From: evpobr +Date: Sat, 2 Apr 2022 11:04:55 +0500 +Subject: [PATCH] cmake: fix LAME dependency search + +--- + CHANGELOG.md | 4 +++ + CMakeLists.txt | 19 ++-------- + cmake/FindLame.cmake | 66 ----------------------------------- + cmake/Findmp3lame.cmake | 67 ++++++++++++++++++++++++++++++++++++ + cmake/SndFileChecks.cmake | 4 +-- + cmake/SndFileConfig.cmake.in | 2 +- + 6 files changed, 77 insertions(+), 85 deletions(-) + delete mode 100644 cmake/FindLame.cmake + create mode 100644 cmake/Findmp3lame.cmake + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 3719e0f8e..19eda17e5 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 + + ## [Unreleased] + ++### Fixed ++ ++* Searching for LAME dependency with CMake build system (issue #821). ++ + ## [1.1.0] - 2022-03-27 + + ### Added +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b1b49e956..ae8ebec70 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -174,7 +174,7 @@ set_package_properties (FLAC PROPERTIES + DESCRIPTION "Free Lossless Audio Codec Library" + PURPOSE "Enables FLAC support" + ) +-set_package_properties (Lame PROPERTIES ++set_package_properties (mp3lame PROPERTIES + TYPE RECOMMENDED + URL "https://lame.sourceforge.io/" + DESCRIPTION "High quality MPEG Audio Layer III (MP3) encoder" +@@ -237,20 +237,7 @@ if (INSTALL_PKGCONFIG_MODULE) + endif () + if (ENABLE_MPEG) + set (EXTERNAL_MPEG_REQUIRE "libmpg123") +- get_filename_component(LAME_WE ${LAME_LIBRARY} NAME_WE) +- if (LAME_HIP_LIBRARY) +- get_filename_component(LAME_HIP_WE ${LAME_HIP_LIBRARY} NAME_WE) +- endif () +- if (CMAKE_IMPORT_LIBRARY_PREFIX) +- string (REGEX REPLACE "^${CMAKE_IMPORT_LIBRARY_PREFIX}" "" LAME_WE_NO_PREFIX ${LAME_WE}) +- if (LAME_HIP_LIBRARY) +- string (REGEX REPLACE "^${CMAKE_IMPORT_LIBRARY_PREFIX}" "" LAME_HIP_WE_NO_PREFIX ${LAME_HIP_WE}) +- endif () +- endif () +- set (EXTERNAL_MPEG_LIBS "-l${LAME_WE_NO_PREFIX}") +- if (LAME_HIP_LIBRARY) +- set (EXTERNAL_MPEG_LIBS "${MPEG_LIBS} -l${LAME_HIP_WE}") +- endif () ++ set (EXTERNAL_MPEG_LIBS "-lmp3lame") + endif () + + configure_file (sndfile.pc.in sndfile.pc @ONLY) +@@ -411,7 +398,7 @@ target_link_libraries (sndfile + $<$,$,$>:Speex::Speex> + $<$:Opus::opus> + $<$:MPG123::libmpg123> +- $<$:Lame::Lame> ++ $<$:mp3lame::mp3lame> + ) + set_target_properties (sndfile PROPERTIES + PUBLIC_HEADER "${sndfile_HDRS}" +diff --git a/cmake/FindLame.cmake b/cmake/FindLame.cmake +deleted file mode 100644 +index be32475aa..000000000 +--- a/cmake/FindLame.cmake ++++ /dev/null +@@ -1,66 +0,0 @@ +-# - Find lame +-# Find the native lame includes and libraries +-# +-# LAME_INCLUDE_DIRS - where to find lame.h, etc. +-# LAME_LIBRARIES - List of libraries when using lame. +-# LAME_FOUND - True if Lame found. +- +-if (LAME_INCLUDE_DIR) +- # Already in cache, be silent +- set(LAME_FIND_QUIETLY TRUE) +-endif () +- +-find_path (LAME_INCLUDE_DIR lame/lame.h +- HINTS +- ${LAME_ROOT} +- ) +- +-# MSVC built lame may be named mp3lame_static. +-# The provided project files name the library with the lib prefix. +- +-find_library (LAME_LIBRARY +- NAMES +- mp3lame +- mp3lame_static +- libmp3lame +- libmp3lame_static +- libmp3lame-static +- HINTS +- ${LAME_ROOT} +- ) +- +-find_library (LAME_HIP_LIBRARY +- NAMES +- mpghip-static +- libmpghip-static +- HINTS +- ${LAME_ROOT} +- ) +- +-# Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND +-# to TRUE if all listed variables are TRUE. +-include(FindPackageHandleStandardArgs) +-find_package_handle_standard_args (Lame +- REQUIRED_VARS +- LAME_LIBRARY +- LAME_INCLUDE_DIR +- ) +- +-if (LAME_FOUND) +- set (LAME_LIBRARIES ${LAME_LIBRARY} ${LAME_HIP_LIBRARY}) +- set (LAME_INCLUDE_DIRS ${LAME_INCLUDE_DIR}) +- +- if (NOT TARGET Lame::Lame) +- add_library (Lame::Lame UNKNOWN IMPORTED) +- set_target_properties (Lame::Lame PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${LAME_INCLUDE_DIRS}" +- IMPORTED_LOCATION "${LAME_LIBRARY}" +- ) +- if (LAME_HIP_LIBRARY) +- set_property (TARGET Lame::Lame APPEND PROPERTY +- INTERFACE_LINK_LIBRARIES "${LAME_HIP_LIBRARY}") +- endif () +- endif () +-endif () +- +-mark_as_advanced(LAME_INCLUDE_DIR LAME_LIBRARY LAME_HIP_LIBRARY) +diff --git a/cmake/Findmp3lame.cmake b/cmake/Findmp3lame.cmake +new file mode 100644 +index 000000000..223dd08f5 +--- /dev/null ++++ b/cmake/Findmp3lame.cmake +@@ -0,0 +1,67 @@ ++# - Find lame ++# Find the native lame includes and libraries ++# ++# MP3LAME_INCLUDE_DIRS - where to find lame.h, etc. ++# MP3LAME_LIBRARIES - List of libraries when using lame. ++# MP3LAME_FOUND - True if Lame found. ++ ++if (MP3LAME_INCLUDE_DIR) ++ # Already in cache, be silent ++ set(MP3LAME_FIND_QUIETLY TRUE) ++endif () ++ ++find_path (MP3LAME_INCLUDE_DIR lame/lame.h ++ HINTS ++ ${LAME_ROOT} ++ ) ++ ++# MSVC built lame may be named mp3lame_static. ++# The provided project files name the library with the lib prefix. ++ ++find_library (MP3LAME_LIBRARY ++ NAMES ++ mp3lame ++ mp3lame_static ++ libmp3lame ++ libmp3lame_static ++ libmp3lame-static ++ HINTS ++ ${MP3LAME_ROOT} ++ ) ++ ++find_library (MP3LAME_HIP_LIBRARY ++ NAMES ++ mpghip-static ++ libmpghip-static ++ HINTS ++ ${MP3LAME_ROOT} ++ ) ++ ++# Handle the QUIETLY and REQUIRED arguments and set LAME_FOUND ++# to TRUE if all listed variables are TRUE. ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args (mp3lame ++ REQUIRED_VARS ++ MP3LAME_LIBRARY ++ MP3LAME_INCLUDE_DIR ++ ) ++ ++if (MP3LAME_FOUND) ++ set (MP3LAME_LIBRARIES ${MP3LAME_LIBRARY} ${MP3LAME_HIP_LIBRARY}) ++ set (MP3LAME_INCLUDE_DIRS ${MP3LAME_INCLUDE_DIR}) ++ ++ if (NOT TARGET mp3lame::mp3lame) ++ add_library (mp3lame::mp3lame UNKNOWN IMPORTED) ++ set_target_properties (mp3lame::mp3lame PROPERTIES ++ INTERFACE_INCLUDE_DIRECTORIES "${MP3LAME_INCLUDE_DIRS}" ++ IMPORTED_LOCATION "${MP3LAME_LIBRARY}" ++ ) ++ if (MP3LAME_HIP_LIBRARY AND (NOT TARGET mp3lame::mpghip)) ++ add_library (mp3lame::mpghip STATIC IMPORTED) ++ set_property (mp3lame::mpghip PROPERTY IMPORTED_LOCATION "${MP3LAME_HIP_LIBRARY}") ++ set_property (TARGET mp3lame::mp3lame PROPERTY INTERFACE_LINK_LIBRARIES "mp3lame::mpghip") ++ endif () ++ endif () ++endif () ++ ++mark_as_advanced(MP3LAME_INCLUDE_DIR MP3LAME_LIBRARY MP3LAME_HIP_LIBRARY) +diff --git a/cmake/SndFileChecks.cmake b/cmake/SndFileChecks.cmake +index f5d5994b7..2e09ba6f5 100644 +--- a/cmake/SndFileChecks.cmake ++++ b/cmake/SndFileChecks.cmake +@@ -56,9 +56,9 @@ else () + set (HAVE_EXTERNAL_XIPH_LIBS 0) + endif () + +-find_package (Lame) ++find_package (mp3lame) + find_package (Mpg123 1.25.10) +-if (LAME_FOUND AND (TARGET MPG123::libmpg123)) ++if (TARGET mp3lame::mp3lame AND (TARGET MPG123::libmpg123)) + set (HAVE_MPEG_LIBS 1) + else () + set (HAVE_MPEG_LIBS 0) +diff --git a/cmake/SndFileConfig.cmake.in b/cmake/SndFileConfig.cmake.in +index 1d5463aa6..0c98e7e28 100644 +--- a/cmake/SndFileConfig.cmake.in ++++ b/cmake/SndFileConfig.cmake.in +@@ -18,7 +18,7 @@ if (SndFile_WITH_EXTERNAL_LIBS AND NOT @BUILD_SHARED_LIBS@) + endif () + + if (SndFile_WITH_MPEG AND NOT @BUILD_SHARED_LIBS@) +- find_dependency (Lame) ++ find_dependency (mp3lame) + find_dependency (MPG123) + endif () + diff --git a/libsndfile.spec b/libsndfile.spec index a66b85d..3546476 100644 --- a/libsndfile.spec +++ b/libsndfile.spec @@ -1,6 +1,6 @@ Name: libsndfile Version: 1.1.0 -Release: 1mamba +Release: 2mamba Summary: A library for reading and writing files containing sampled sound Group: System/Libraries Vendor: openmamba @@ -8,6 +8,7 @@ Distribution: openmamba Packager: Silvan Calarco URL: https://github.com/libsndfile/libsndfile Source: https://github.com/libsndfile/libsndfile.git/%{version}/libsndfile-%{version}.tar.bz2 +Patch0: libsndfile-1.1.0-liblame-3.100.patch License: LGPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -46,6 +47,7 @@ This package contains tools for %{name}. %prep %setup -q +%patch0 -p1 -b .liblame-3.100 %build %cmake -d build @@ -84,6 +86,9 @@ This package contains tools for %{name}. %{_mandir}/man1/* %changelog +* Sun Apr 24 2022 Silvan Calarco 1.1.0-2mamba +- added upstream patch to fix lame library search in pkgconfig file + * Sat Apr 16 2022 Silvan Calarco 1.1.0-1mamba - update to 1.1.0