Skip to content

Commit

Permalink
[libsndfile] Update to 1.0.29 (#12921)
Browse files Browse the repository at this point in the history
Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
evpobr and BillyONeal authored Aug 26, 2020
1 parent 4abea84 commit fd7e280
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 175 deletions.
15 changes: 3 additions & 12 deletions ports/aubio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,24 @@ set(CMAKE_DEBUG_POSTFIX d)
option(BUILD_TOOLS "Build and install tools" ON)
set(TOOLS_INSTALLDIR "bin" CACHE STRING "Target directory for installed tools")

find_path(LIBSNDFILE_H sndfile.h)
find_library(LIBSNDFILE_LIB NAMES libsndfile-1 libsndfile)
find_library(AVCODEC_LIB avcodec)
find_library(AVUTIL_LIB avutil)
find_library(AVDEVICE_LIB avdevice)
find_library(AVFILTER_LIB avfilter)
find_library(AVFORMAT_LIB avformat)
find_library(SWRESAMPLE_LIB swresample)
find_library(OGG_LIB ogg)
find_library(FLAC_LIB flac)
find_library(VORBIS_LIB vorbis)
find_library(VORBISENC_LIB vorbisenc)
find_package(BZip2 REQUIRED)
find_package(LibLZMA REQUIRED)
find_package(SndFile REQUIRED)

include_directories(src ${LIBSNDFILE_H} ${LIBLZMA_INCLUDE_DIRS})
include_directories(src ${LIBLZMA_INCLUDE_DIRS})

file(GLOB_RECURSE SOURCES src/*.c)

set_source_files_properties(src/io/sink_wavwrite.c PROPERTIES COMPILE_FLAGS /FIWinsock2.h)
add_library(aubio ${SOURCES})
target_link_libraries(aubio PUBLIC
${LIBSNDFILE_LIB}
${OGG_LIB}
${FLAC_LIB}
${VORBIS_LIB}
${VORBISENC_LIB}
SndFile::sndfile
${AVCODEC_LIB}
${AVUTIL_LIB}
${AVDEVICE_LIB}
Expand Down
3 changes: 2 additions & 1 deletion ports/aubio/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Source: aubio
Version: 0.4.9-1
Version: 0.4.9
Port-Version: 2
Homepage: https:/aubio/aubio
Description: Aubio is a tool designed for the extraction of annotations from audio signals. Its features include segmenting a sound file before each of its attacks, performing pitch detection, tapping the beat and producing midi streams from live audio.
Build-Depends: ffmpeg, libsndfile, libogg, libflac, libvorbis, bzip2, liblzma
37 changes: 37 additions & 0 deletions ports/libsndfile/0001-Improve-UWP-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/src/file_io.c b/src/file_io.c
index e5762ce8..90ef23d5 100644
--- a/src/file_io.c
+++ b/src/file_io.c
@@ -777,6 +777,21 @@ psf_open_handle (PSF_FILE * pfile)
return NULL ;
} ;

+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ if (!pfile->use_wchar)
+ return NULL ;
+
+ CREATEFILE2_EXTENDED_PARAMETERS cfParams = { 0 } ;
+ cfParams.dwSize = sizeof (CREATEFILE2_EXTENDED_PARAMETERS) ;
+ cfParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL ;
+
+ handle = CreateFile2 (pfile->path.wc, dwDesiredAccess, dwShareMode, dwCreationDistribution, &cfParams) ;
+
+ if (handle == INVALID_HANDLE_VALUE)
+ return NULL ;
+
+ return handle ;
+#else
if (pfile->use_wchar)
handle = CreateFileW (
pfile->path.wc, /* pointer to name of the file */
@@ -802,6 +817,7 @@ psf_open_handle (PSF_FILE * pfile)
return NULL ;

return handle ;
+#endif
} /* psf_open_handle */

/* USE_WINDOWS_API */ static void
--
2.27.0.windows.1

10 changes: 0 additions & 10 deletions ports/libsndfile/CONTROL

This file was deleted.

31 changes: 0 additions & 31 deletions ports/libsndfile/fix-install-path.patch

This file was deleted.

72 changes: 22 additions & 50 deletions ports/libsndfile/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
include(vcpkg_common_functions)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO erikd/libsndfile
REF 6830c421899e32f8d413a903a21a9b6cf384d369
SHA512 b13c5d7bc27218eff8a8c4ce89a964b4920b1d3946e4843e60be965d77ec205845750a82bf654a7c2c772bf3a24f6ff5706881b24ff12115f2525c8134b6d0b9
REF v1.0.29
SHA512 ff19e8cea629af9dea51c79f3446f7a63520525c8578c56b8b4b7a6f0ce07d2458ca488f0be9daeaf9ea3a1124b1fa7cac9a3b313b1ae1f43c76de852a10eed5
HEAD_REF master
PATCHES
uwp-createfile-getfilesize.patch
uwp-createfile-getfilesize-addendum.patch
fix-install-path.patch
PATCHES 0001-Improve-UWP-support.patch
)

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" CRT_LIB_STATIC)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)

option(BUILD_EXECUTABLES "Build sndfile tools and install to folder tools" OFF)

if("external-libs" IN_LIST FEATURES)
set(SNDFILE_WITHOUT_EXTERNAL_LIBS OFF)
else()
set(SNDFILE_WITHOUT_EXTERNAL_LIBS ON)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_find_acquire_program(PYTHON3)
endif()

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES external-libs ENABLE_EXTERNAL_LIBS
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
Expand All @@ -31,49 +25,27 @@ vcpkg_configure_cmake(
-DBUILD_REGTEST=OFF
-DBUILD_TESTING=OFF
-DENABLE_BOW_DOCS=OFF
-DBUILD_PROGRAMS=OFF
-DENABLE_STATIC_RUNTIME=${CRT_LIB_STATIC}
-DBUILD_STATIC_LIBS=${BUILD_STATIC}
-DDISABLE_EXTERNAL_LIBS=${SNDFILE_WITHOUT_EXTERNAL_LIBS}
OPTIONS_RELEASE
-DBUILD_PROGRAMS=${BUILD_EXECUTABLES}
OPTIONS_DEBUG
-DBUILD_PROGRAMS=0
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
-DPYTHON_EXECUTABLE=${PYTHON3}
${FEATURE_OPTIONS}
)

vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()
vcpkg_install_cmake()

if(WIN32 AND (NOT MINGW) AND (NOT CYGWIN))
set(CONFIG_PATH cmake)
else()
set(CONFIG_PATH lib/cmake/SndFile)
endif()

# Fix applied for 6830c421899e32f8d413a903a21a9b6cf384d369
file(READ "${CURRENT_PACKAGES_DIR}/share/libsndfile/LibSndFileTargets.cmake" _contents)
string(REPLACE "INTERFACE_INCLUDE_DIRECTORIES \"\${_IMPORT_PREFIX}/lib\"" "INTERFACE_INCLUDE_DIRECTORIES \"\${_IMPORT_PREFIX}/include\"" _contents "${_contents}")
file(WRITE "${CURRENT_PACKAGES_DIR}/share/libsndfile/LibSndFileTargets.cmake" "${_contents}")
vcpkg_fixup_cmake_targets(CONFIG_PATH ${CONFIG_PATH} TARGET_PATH share/SndFile)

vcpkg_copy_pdbs()

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

if(CMAKE_HOST_WIN32)
set(EXECUTABLE_SUFFIX ".exe")
set(SHARED_LIB_SUFFIX ".dll")
else()
set(EXECUTABLE_SUFFIX)
set(SHARED_LIB_SUFFIX)
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/libsndfile-1${SHARED_LIB_SUFFIX})
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/libnsdfile-1${SHARED_LIB_SUFFIX})
endif()

if(BUILD_EXECUTABLES)
file(GLOB TOOLS ${CURRENT_PACKAGES_DIR}/bin/*${EXECUTABLE_SUFFIX})
file(COPY ${TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT})
file(REMOVE ${TOOLS})
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
endif(BUILD_EXECUTABLES)

# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/COPYING ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
13 changes: 0 additions & 13 deletions ports/libsndfile/uwp-createfile-getfilesize-addendum.patch

This file was deleted.

58 changes: 0 additions & 58 deletions ports/libsndfile/uwp-createfile-getfilesize.patch

This file was deleted.

22 changes: 22 additions & 0 deletions ports/libsndfile/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "libsndfile",
"version-string": "1.0.29",
"port-version": 11,
"description": "Library to read, write and manipulate many soundfile types. Authored by Eric de Castro Lopo",
"homepage": "https:/erikd/libsndfile",
"license": "LGPL-2.1",
"default-features": [
"external-libs"
],
"features": [
{
"name": "external-libs",
"description": "Default feature. Enables Ogg Vorbis, FLAC and Ogg Opus formats support.",
"dependencies": [
"libflac",
"libvorbis",
"opus"
]
}
]
}

0 comments on commit fd7e280

Please sign in to comment.