aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-27 19:27:44 -0700
committerGitHub <noreply@github.com>2017-04-27 19:27:44 -0700
commit58b0560f89669774a1e1cc3ee776f28dab7a4640 (patch)
treef26e1b8cfabe3f1a6dfbe3b2e2e19aecac7b5f8c
parentf39570172f1f6b879b4b5636d5d5daa405b6a8fe (diff)
parentf6b74a9e4c20e0b7bb454757daa3790e02b2b652 (diff)
downloadvcpkg-58b0560f89669774a1e1cc3ee776f28dab7a4640.tar.gz
vcpkg-58b0560f89669774a1e1cc3ee776f28dab7a4640.zip
Merge pull request #994 from jbhelm/taglib
add ports/taglib
-rw-r--r--ports/taglib/CONTROL4
-rw-r--r--ports/taglib/dont-assume-latin-1.patch18
-rw-r--r--ports/taglib/ignore_c4996_error.patch16
-rw-r--r--ports/taglib/portfile.cmake39
-rw-r--r--ports/taglib/replace_non-uwp_functions.patch29
5 files changed, 106 insertions, 0 deletions
diff --git a/ports/taglib/CONTROL b/ports/taglib/CONTROL
new file mode 100644
index 000000000..ca7992b84
--- /dev/null
+++ b/ports/taglib/CONTROL
@@ -0,0 +1,4 @@
+Source: taglib
+Version: 1.11.1-1
+Description: TagLib Audio Meta-Data Library
+Build-Depends: zlib \ No newline at end of file
diff --git a/ports/taglib/dont-assume-latin-1.patch b/ports/taglib/dont-assume-latin-1.patch
new file mode 100644
index 000000000..39557f74d
--- /dev/null
+++ b/ports/taglib/dont-assume-latin-1.patch
@@ -0,0 +1,18 @@
+diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
+index b267aaa..3db0521 100644
+--- a/taglib/toolkit/tfilestream.cpp
++++ b/taglib/toolkit/tfilestream.cpp
+@@ -54,7 +54,12 @@ namespace
+ if(!path.wstr().empty())
+ return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
+ else if(!path.str().empty())
+- return CreateFile2(std::wstring(path.str().cbegin(), path.str().end()).c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
++ {
++ auto size = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path.str().data(), path.str().size(), NULL, 0);
++ std::wstring tmp(size, L'\0');
++ MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, path.str().data(), path.str().size(), &tmp[0], tmp.size());
++ return CreateFile2(tmp.c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
++ }
+ else
+ return InvalidFileHandle;
+ }
diff --git a/ports/taglib/ignore_c4996_error.patch b/ports/taglib/ignore_c4996_error.patch
new file mode 100644
index 000000000..1990b4730
--- /dev/null
+++ b/ports/taglib/ignore_c4996_error.patch
@@ -0,0 +1,16 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a59efc9..8ac3266 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -64,6 +64,11 @@ if(MSVC AND ENABLE_STATIC_RUNTIME)
+ endforeach(flag_var)
+ endif()
+
++# disable error on usage of vsprintf() for UWP builds
++if(MSVC)
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996")
++endif()
++
+ # Read version information from file taglib/toolkit/taglib.h into variables
+ # TAGLIB_LIB_MAJOR_VERSION, TAGLIB_LIB_MINOR_VERSION, TAGLIB_LIB_PATCH_VERSION.
+ foreach(version_part MAJOR MINOR PATCH)
diff --git a/ports/taglib/portfile.cmake b/ports/taglib/portfile.cmake
new file mode 100644
index 000000000..12ff923c5
--- /dev/null
+++ b/ports/taglib/portfile.cmake
@@ -0,0 +1,39 @@
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/taglib-1.11.1)
+vcpkg_download_distfile(ARCHIVE
+ URLS "http://taglib.org/releases/taglib-1.11.1.tar.gz"
+ FILENAME "taglib-1.11.1.tar.gz"
+ SHA512 7846775c4954ea948fe4383e514ba7c11f55d038ee06b6ea5a0a1c1069044b348026e76b27aa4ba1c71539aa8143e1401fab39184cc6e915ba0ae2c06133cb98
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+#patches for UWP
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES
+ ${CMAKE_CURRENT_LIST_DIR}/ignore_c4996_error.patch
+ ${CMAKE_CURRENT_LIST_DIR}/replace_non-uwp_functions.patch
+ ${CMAKE_CURRENT_LIST_DIR}/dont-assume-latin-1.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+# remove the debug/include files
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# copyright file
+file(COPY ${SOURCE_PATH}/COPYING.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/taglib)
+file(COPY ${SOURCE_PATH}/COPYING.MPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/taglib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/taglib/COPYING.LGPL ${CURRENT_PACKAGES_DIR}/share/taglib/copyright)
+
+# remove bin directory for static builds (taglib creates a cmake batch file there)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif()
+
+vcpkg_copy_pdbs() \ No newline at end of file
diff --git a/ports/taglib/replace_non-uwp_functions.patch b/ports/taglib/replace_non-uwp_functions.patch
new file mode 100644
index 000000000..5f01672d5
--- /dev/null
+++ b/ports/taglib/replace_non-uwp_functions.patch
@@ -0,0 +1,29 @@
+diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
+index 5205bae..b267aaa 100644
+--- a/taglib/toolkit/tfilestream.cpp
++++ b/taglib/toolkit/tfilestream.cpp
+@@ -52,9 +52,9 @@ namespace
+ const DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE);
+
+ if(!path.wstr().empty())
+- return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
++ return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
+ else if(!path.str().empty())
+- return CreateFileA(path.str().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
++ return CreateFile2(std::wstring(path.str().cbegin(), path.str().end()).c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
+ else
+ return InvalidFileHandle;
+ }
+@@ -437,9 +437,10 @@ long FileStream::length()
+ #ifdef _WIN32
+
+ SetLastError(NO_ERROR);
+- const DWORD fileSize = GetFileSize(d->file, NULL);
++ LARGE_INTEGER fileSize;
++ GetFileSizeEx(d->file, &fileSize);
+ if(GetLastError() == NO_ERROR) {
+- return static_cast<long>(fileSize);
++ return fileSize.QuadPart;
+ }
+ else {
+ debug("FileStream::length() -- Failed to get the file size.");