[libflac] Bump to 1.4.2 (#29584)

* [libflac] Bump to 1.4.2.

- The license was incorrectly set to GFDL instead of BSD-3.
See: https://github.com/xiph/flac#components
- Remove patches that were merged upstream.
- Stack protection and fortify source under mingw is checked upstream.
- CMake config file location has changed.
- Use vcpkg_install_copyright to install license.

* [libflac] Add usage file.

* [libflac] Update baseline.
This commit is contained in:
Pierre Wendling 2023-02-13 10:37:00 -05:00 committed by GitHub
parent e74eb73ba3
commit 658a8165a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 98 deletions

View File

@ -1,26 +1,17 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xiph/flac
REF 1151c93e992bb8c7c6394e04aa880d711c531c7f #1.3.4
SHA512 ebf8de3dbd8fc2153af2f4a05ecc04817570233c30e0ec1fbdbc99f810860801b951248ca6404152cba4038f5839985f4076bcee477c00fd23bd583a45b89b17
REF "${VERSION}"
SHA512 1b4992024dffe83916f0da8726f73bf932a52d8c3346c35ab1ee81b82d68ff01faa8c477aa29d7099a09611664dee723db5be3087f709218c33e564f77810013
HEAD_REF master
PATCHES
uwp-library-console.patch
uwp-createfile2.patch
fix-compile-options.patch
)
if(VCPKG_TARGET_IS_MINGW)
set(WITH_STACK_PROTECTOR OFF)
string(APPEND VCPKG_C_FLAGS " -D_FORTIFY_SOURCE=0")
string(APPEND VCPKG_CXX_FLAGS " -D_FORTIFY_SOURCE=0")
else()
set(WITH_STACK_PROTECTOR ON)
endif()
if("asm" IN_LIST FEATURES)
VCPKG_FIND_ACQUIRE_PROGRAM(NASM)
GET_FILENAME_COMPONENT(NASM_PATH "${NASM}" DIRECTORY)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_PATH "${NASM}" DIRECTORY)
vcpkg_add_to_path("${NASM_PATH}")
endif()
@ -37,13 +28,12 @@ vcpkg_cmake_configure(
-DBUILD_EXAMPLES=OFF
-DBUILD_DOCS=OFF
-DBUILD_TESTING=OFF
-DWITH_STACK_PROTECTOR=${WITH_STACK_PROTECTOR}
-DINSTALL_MANPAGES=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(PACKAGE_NAME FLAC CONFIG_PATH share/FLAC/cmake)
vcpkg_cmake_config_fixup(PACKAGE_NAME FLAC CONFIG_PATH lib/cmake/FLAC)
vcpkg_copy_pdbs()
@ -83,4 +73,6 @@ vcpkg_fixup_pkgconfig()
# This license (BSD) is relevant only for library - if someone would want to install
# FLAC cmd line tools as well additional license (GPL) should be included
file(INSTALL "${SOURCE_PATH}/COPYING.Xiph" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING.Xiph")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

8
ports/libflac/usage Normal file
View File

@ -0,0 +1,8 @@
The package libflac provides CMake targets:
find_package(FLAC CONFIG REQUIRED)
target_link_libraries(main PRIVATE FLAC::FLAC)
# Or use the C++ API
find_package(FLAC CONFIG REQUIRED)
target_link_libraries(main PRIVATE FLAC::FLAC++)

View File

@ -1,40 +0,0 @@
diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
index 8b20bbb7..058295fa 100644
--- a/src/share/win_utf8_io/win_utf8_io.c
+++ b/src/share/win_utf8_io/win_utf8_io.c
@@ -156,6 +156,27 @@ int get_utf8_argv(int *argc, char ***argv)
/* similar to CreateFileW but accepts UTF-8 encoded lpFileName */
HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ HANDLE handle = INVALID_HANDLE_VALUE;
+
+ if (!flac_internal_get_utf8_filenames())
+ return handle;
+
+ wchar_t *wname;
+
+ if ((wname = wchar_from_utf8(lpFileName)) != NULL)
+ {
+ CREATEFILE2_EXTENDED_PARAMETERS cfParams = {0};
+ cfParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
+ cfParams.dwFileAttributes = dwFlagsAndAttributes & FILE_ATTRIBUTE_NORMAL;
+ cfParams.lpSecurityAttributes = lpSecurityAttributes;
+ cfParams.hTemplateFile = hTemplateFile;
+ handle = CreateFile2(wname, dwDesiredAccess, dwShareMode, dwCreationDisposition, &cfParams);
+ free(wname);
+ }
+
+ return handle;
+#else
if (!flac_internal_get_utf8_filenames()) {
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
} else {
@@ -169,6 +190,7 @@ HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWO
return handle;
}
+#endif
}
/* return number of characters in the UTF-8 string */

View File

@ -14,40 +14,3 @@ index bbb6a74a..8b20bbb7 100644
if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) {
FreeLibrary(handle);
return 1;
@@ -181,6 +185,9 @@ size_t strlen_utf8(const char *str)
/* get the console width in characters */
int win_get_console_width(void)
{
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ return 80;
+#else
int width = 80;
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -188,6 +195,7 @@ int win_get_console_width(void)
if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
width = csbi.dwSize.X;
return width;
+#endif
}
/* print functions */
@@ -197,6 +205,10 @@ static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
DWORD out;
int ret;
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ // disabled for UWP as there's no alternative:
+ // https://docs.microsoft.com/en-us/uwp/win32-and-com/alternatives-to-windows-apis-uwp
+#else
do {
if (stream == stdout) {
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -215,6 +227,7 @@ static int wprint_console(FILE *stream, const wchar_t *text, size_t len)
return out;
}
} while(0);
+#endif
ret = fputws(text, stream);
if (ret < 0)

View File

@ -1,10 +1,9 @@
{
"name": "libflac",
"version": "1.3.4",
"port-version": 1,
"version": "1.4.2",
"description": "Library for manipulating FLAC files",
"homepage": "https://xiph.org/flac/",
"license": "GFDL-1.2-or-later",
"license": "BSD-3-Clause",
"dependencies": [
"libogg",
{

View File

@ -3881,8 +3881,8 @@
"port-version": 1
},
"libflac": {
"baseline": "1.3.4",
"port-version": 1
"baseline": "1.4.2",
"port-version": 0
},
"libfontenc": {
"baseline": "1.1.4",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d5f68de2a2c015247322b369a6b94052135df51a",
"version": "1.4.2",
"port-version": 0
},
{
"git-tree": "6931704180602d16a54e15759cd6c04739d40699",
"version": "1.3.4",