[libsndfile] Update to 1.0.29 (#12921)

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
This commit is contained in:
evpobr 2020-08-26 06:42:26 +05:00 committed by GitHub
parent 4abea84d56
commit fd7e280af8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 86 additions and 175 deletions

View File

@ -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}

View File

@ -1,5 +1,6 @@
Source: aubio
Version: 0.4.9-1
Version: 0.4.9
Port-Version: 2
Homepage: https://github.com/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

View File

@ -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

View File

@ -1,10 +0,0 @@
Source: libsndfile
Version: 1.0.29
Port-Version: 10
Description: Library to read, write and manipulate many soundfile types. Authored by Eric de Castro Lopo
Homepage: https://github.com/erikd/libsndfile
Default-Features: external-libs
Feature: external-libs
Description: Support Ogg Vorbis and FLAC audio files
Build-Depends: libogg, libflac, libvorbis

View File

@ -1,31 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cc35414..d629adf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -641,12 +641,12 @@ if (ENABLE_PACKAGE_CONFIG)
LibSndFileConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
- install(EXPORT LibSndFileTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR})
+ install(EXPORT LibSndFileTargets DESTINATION share/libsndfile)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/LibSndFileConfigVersion.cmake
DESTINATION
- ${CMAKE_INSTALL_PACKAGEDIR})
+ share/libsndfile)
elseif (NOT ENABLE_PACKAGE_CONFIG)
@@ -698,9 +698,9 @@ set (html_DATA
doc/embedded_files.html
doc/octave.html
doc/tutorial.html)
-install (FILES ${html_DATA} DESTINATION ${CMAKE_INSTALL_DOCDIR})
+#install (FILES ${html_DATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/libsndfile)
-install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+#install (FILES ${CMAKE_CURRENT_BINARY_DIR}/sndfile.pc DESTINATION share/libsndfile/pkgconfig)
#
# Testing

View File

@ -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
@ -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()
# 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}")
if(WIN32 AND (NOT MINGW) AND (NOT CYGWIN))
set(CONFIG_PATH cmake)
else()
set(CONFIG_PATH lib/cmake/SndFile)
endif()
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)

View File

@ -1,13 +0,0 @@
diff --git a/src/file_io.c b/src/file_io.c
index 47351bc..54741c9 100644
--- a/src/file_io.c
+++ b/src/file_io.c
@@ -799,6 +799,8 @@ psf_open_handle (PSF_FILE * pfile)
if (handle == INVALID_HANDLE_VALUE)
return NULL;
+
+ return handle;
#else
if (pfile->use_wchar)
handle = CreateFileW (

View File

@ -1,58 +0,0 @@
diff --git a/src/file_io.c b/src/file_io.c
index 7cf8f0c..47351bc 100644
--- a/src/file_io.c
+++ b/src/file_io.c
@@ -787,6 +787,19 @@ 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;
+#else
if (pfile->use_wchar)
handle = CreateFileW (
pfile->path.wc, /* pointer to name of the file */
@@ -812,6 +825,7 @@ psf_open_handle (PSF_FILE * pfile)
return NULL ;
return handle ;
+#endif
} /* psf_open_handle */
/* USE_WINDOWS_API */ static void
@@ -1104,7 +1118,16 @@ psf_is_pipe (SF_PRIVATE *psf)
/* USE_WINDOWS_API */ sf_count_t
psf_get_filelen_handle (HANDLE handle)
-{ sf_count_t filelen ;
+{
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ LARGE_INTEGER size;
+
+ if (!GetFileSizeEx(handle, &size) && GetLastError() != NO_ERROR)
+ return (sf_count_t) -1 ;
+
+ return size.QuadPart;
+#else
+ sf_count_t filelen ;
DWORD dwFileSizeLow, dwFileSizeHigh, dwError = NO_ERROR ;
dwFileSizeLow = GetFileSize (handle, &dwFileSizeHigh) ;
@@ -1118,6 +1141,7 @@ psf_get_filelen_handle (HANDLE handle)
filelen = dwFileSizeLow + ((__int64) dwFileSizeHigh << 32) ;
return filelen ;
+#endif
} /* psf_get_filelen_handle */
/* USE_WINDOWS_API */ void

View File

@ -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://github.com/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"
]
}
]
}