aboutsummaryrefslogtreecommitdiff
path: root/ports/libflac
diff options
context:
space:
mode:
authorAlexander Saprykin <xelfium@gmail.com>2018-05-26 13:27:14 +0200
committerGitHub <noreply@github.com>2018-05-26 13:27:14 +0200
commit4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5 (patch)
treed95c9490352eb73f078d34a33bc4bb44ac9fa48b /ports/libflac
parentfb689bd13dd6ba563a885d71fff1dd2b32a615db (diff)
parent2ac7527b40b1dbeb7856b9f763362c1e139e2ca9 (diff)
downloadvcpkg-4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5.tar.gz
vcpkg-4ce5f064282c3a8d8d710aa82af7aa346b0c6dd5.zip
Merge pull request #1 from Microsoft/master
Update vcpkg from upstream
Diffstat (limited to 'ports/libflac')
-rw-r--r--ports/libflac/CMakeLists.txt30
-rw-r--r--ports/libflac/CONTROL2
-rw-r--r--ports/libflac/portfile.cmake12
-rw-r--r--ports/libflac/uwp-createfile2.patch38
-rw-r--r--ports/libflac/uwp-library-console.patch53
5 files changed, 118 insertions, 17 deletions
diff --git a/ports/libflac/CMakeLists.txt b/ports/libflac/CMakeLists.txt
index 518419c4f..d6f01399a 100644
--- a/ports/libflac/CMakeLists.txt
+++ b/ports/libflac/CMakeLists.txt
@@ -7,15 +7,22 @@ if(NOT DEFINED LIBFLAC_ARCHITECTURE)
message(FATAL_ERROR "Target architecture not specified")
endif()
-file(GLOB LIBFLAC_SOURCES
- ${PROJECT_SOURCE_DIR}/src/libFLAC/*.c
- ${PROJECT_SOURCE_DIR}/src/share/win_utf8_io/win_utf8_io.c)
+file(GLOB LIBFLAC_SOURCES src/libFLAC/*.c)
-file(GLOB LIBFLACXX_SOURCES
- ${PROJECT_SOURCE_DIR}/src/libFLAC++/*.cpp)
+if(WIN32)
+ list(APPEND LIBFLAC_SOURCES src/share/win_utf8_io/win_utf8_io.c)
+else()
+ list(FILTER LIBFLAC_SOURCES EXCLUDE REGEX "windows[^/]*$")
+
+ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config.h "#include <inttypes.h>")
+ include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ add_definitions(-DHAVE_CONFIG_H)
+endif()
+
+file(GLOB LIBFLACXX_SOURCES src/libFLAC++/*.cpp)
-include_directories(${PROJECT_SOURCE_DIR}/include)
-include_directories(${PROJECT_SOURCE_DIR}/src/libFLAC/include)
+include_directories(include)
+include_directories(src/libFLAC/include)
if(NOT LIBFLAC_ARCHITECTURE MATCHES arm)
add_definitions(-DFLAC__SSE_OS)
@@ -44,14 +51,15 @@ endif()
add_definitions(-DPACKAGE_VERSION="1.3.2")
add_definitions(-DFLAC__HAS_OGG)
add_definitions(-DFLAC__ALIGN_MALLOC_DATA) # 32 byte boundary
+add_definitions(-DHAVE_LROUND)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
add_library(libFLAC ${LIBFLAC_SOURCES})
add_library(libFLACXX ${LIBFLACXX_SOURCES})
-set_target_properties(libFLAC PROPERTIES OUTPUT_NAME flac)
-set_target_properties(libFLACXX PROPERTIES OUTPUT_NAME flac++)
+set_target_properties(libFLAC PROPERTIES OUTPUT_NAME FLAC)
+set_target_properties(libFLACXX PROPERTIES OUTPUT_NAME FLAC++)
find_library(OGG_LIBRARY ogg)
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
@@ -73,10 +81,10 @@ install(TARGETS libFLAC libFLACXX
LIBRARY DESTINATION lib)
if(NOT DEFINED LIBFLAC_SKIP_HEADERS)
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC/
+ install(DIRECTORY include/FLAC/
DESTINATION include/FLAC
FILES_MATCHING PATTERN "*.h")
- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/FLAC++/
+ install(DIRECTORY include/FLAC++/
DESTINATION include/FLAC++
FILES_MATCHING PATTERN "*.h")
endif()
diff --git a/ports/libflac/CONTROL b/ports/libflac/CONTROL
index b81ec3cd1..1a16c7a6a 100644
--- a/ports/libflac/CONTROL
+++ b/ports/libflac/CONTROL
@@ -1,4 +1,4 @@
Source: libflac
-Version: 1.3.2-2
+Version: 1.3.2-5
Description: Library for manipulating FLAC files
Build-Depends: libogg
diff --git a/ports/libflac/portfile.cmake b/ports/libflac/portfile.cmake
index cbf7d6fd3..236f51c8e 100644
--- a/ports/libflac/portfile.cmake
+++ b/ports/libflac/portfile.cmake
@@ -1,8 +1,3 @@
- # libFLAC uses winapi functions not available in WindowsStore
-if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
- message(FATAL_ERROR "Error: UWP builds are currently not supported.")
-endif()
-
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flac-1.3.2)
vcpkg_download_distfile(ARCHIVE
@@ -12,6 +7,13 @@ vcpkg_download_distfile(ARCHIVE
vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_apply_patches(
+ SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/flac-1.3.2
+ PATCHES
+ "${CMAKE_CURRENT_LIST_DIR}/uwp-library-console.patch"
+ "${CMAKE_CURRENT_LIST_DIR}/uwp-createfile2.patch"
+)
+
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
diff --git a/ports/libflac/uwp-createfile2.patch b/ports/libflac/uwp-createfile2.patch
new file mode 100644
index 000000000..cfb343990
--- /dev/null
+++ b/ports/libflac/uwp-createfile2.patch
@@ -0,0 +1,38 @@
+diff --git a/src/libFLAC/windows_unicode_filenames.c b/src/libFLAC/windows_unicode_filenames.c
+index 2404e31..d320bf5 100644
+--- a/src/libFLAC/windows_unicode_filenames.c
++++ b/src/libFLAC/windows_unicode_filenames.c
+@@ -185,6 +185,27 @@ int flac_internal_rename_utf8(const char *oldname, const char *newname)
+
+ HANDLE WINAPI flac_internal_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 (!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 (!utf8_filenames) {
+ return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
+ } else {
+@@ -198,4 +219,5 @@ HANDLE WINAPI flac_internal_CreateFile_utf8(const char *lpFileName, DWORD dwDesi
+
+ return handle;
+ }
++#endif
+ }
diff --git a/ports/libflac/uwp-library-console.patch b/ports/libflac/uwp-library-console.patch
new file mode 100644
index 000000000..bba2422c3
--- /dev/null
+++ b/ports/libflac/uwp-library-console.patch
@@ -0,0 +1,53 @@
+diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c
+index c61d27f..0870054 100644
+--- a/src/share/win_utf8_io/win_utf8_io.c
++++ b/src/share/win_utf8_io/win_utf8_io.c
+@@ -110,7 +110,11 @@ int get_utf8_argv(int *argc, char ***argv)
+ char **utf8argv;
+ int ret, i;
+
++#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
++ if ((handle = LoadPackagedLibrary("msvcrt.dll", 0)) == NULL) return 1;
++#else
+ if ((handle = LoadLibrary("msvcrt.dll")) == NULL) return 1;
++#endif
+ if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) {
+ FreeLibrary(handle);
+ return 1;
+@@ -163,6 +167,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);
+@@ -170,6 +177,7 @@ int win_get_console_width(void)
+ if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0)
+ width = csbi.dwSize.X;
+ return width;
++#endif
+ }
+
+ /* print functions */
+@@ -179,6 +187,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);
+@@ -197,6 +209,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)