From 32b591493aacabbc1114f170144a1e795befb147 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 09:27:39 -0800 Subject: [PATCH 01/10] [woff2] fix static linking and alternate toolchain First, this change teaches the woff2 CMake configuration to understand the vcpkg's custom unofficial-brotli pkg-config configuration in order to support static linking. This fixes a build failure on x64-linux or other triplets when VCPKG_LIBRARY_LINKAGE is set to static. Secondly, the CANONICAL_PREFIXES option for the woff2 CMake configuration has been changed to be on by default, otherwise custom triplets or toolchains using alternate compilers such as Clang/LLVM or other versions of GCC will fail. Leaving CANONICAL_PREFIXES set to OFF causes -no-canonical-prefixes to be passed to the compiler, which prevents symlinked compiler toolchains from working correctly. If a user does actually need non-canonical prefixes, chances are they will have a custom triplet or toolchain file that passes in -no-canonical-prefixes as a CFLAG for every port, and so setting it to ON here is a better default for vcpkg. --- ports/woff2/0001-unofficial-brotli.patch | 91 ++++++++++++++++++++++++ ports/woff2/portfile.cmake | 4 ++ 2 files changed, 95 insertions(+) create mode 100644 ports/woff2/0001-unofficial-brotli.patch diff --git a/ports/woff2/0001-unofficial-brotli.patch b/ports/woff2/0001-unofficial-brotli.patch new file mode 100644 index 00000000000000..7d0ed46ccc9b99 --- /dev/null +++ b/ports/woff2/0001-unofficial-brotli.patch @@ -0,0 +1,91 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ecfbb83..17a440b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,13 +34,24 @@ endif() + # Find Brotli dependencies + set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + find_package(BrotliDec) +-if (NOT BROTLIDEC_FOUND) +- message(FATAL_ERROR "librotlidec is needed to build woff2.") +-endif () + find_package(BrotliEnc) +-if (NOT BROTLIENC_FOUND) +- message(FATAL_ERROR "librotlienc is needed to build woff2.") +-endif () ++if(BROTLIDEC_FOUND AND BROTLIENC_FOUND) ++ include_directories("${BROTLIDEC_INCLUDE_DIRS}" "${BROTLIENC_INCLUDE_DIRS}") ++ set(WOFF2_BROTLIDEC libbrotlidec) ++ set(WOFF2_BROTLIENC libbrotlienc) ++ set(WOFF2_BORTLIDEC_LIBRARIES "${BROTLIDEC_LIBRARIES}") ++ set(WOFF2_BORTLIENC_LIBRARIES "${BROTLIENC_LIBRARIES}") ++else() ++ unset(BROTLI_LINKAGE) ++ if(VCPKG_LIBRARY_LINKAGE STREQUAL static) ++ set(BROTLI_LINKAGE -static) ++ endif() ++ find_package(unofficial-brotli REQUIRED) ++ set(WOFF2_BROTLIDEC unofficial::brotli::brotlidec${BROTLI_LINKAGE}) ++ set(WOFF2_BROTLIENC unofficial::brotli::brotlienc${BROTLI_LINKAGE}) ++ set(WOFF2_BORTLIDEC_LIBRARIES unofficial::brotli::brotlidec${BROTLI_LINKAGE} unofficial::brotli::brotlicommon${BROTLI_LINKAGE}) ++ set(WOFF2_BORTLIENC_LIBRARIES unofficial::brotli::brotlienc${BROTLI_LINKAGE} unofficial::brotli::brotlicommon${BROTLI_LINKAGE}) ++endif() + + # Set compiler flags + if (NOT CANONICAL_PREFIXES) +@@ -63,9 +74,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAG}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAG}") + set(CMAKE_CXX_STANDARD 11) + +-# Set search path for our private/public headers as well as Brotli headers +-include_directories("src" "include" +- "${BROTLIDEC_INCLUDE_DIRS}" "${BROTLIENC_INCLUDE_DIRS}") ++# Set search path for our private/public headers ++include_directories("src" "include") + + # Common part used by decoder and encoder + add_library(woff2common +@@ -77,7 +87,7 @@ add_library(woff2common + add_library(woff2dec + src/woff2_dec.cc + src/woff2_out.cc) +-target_link_libraries(woff2dec woff2common "${BROTLIDEC_LIBRARIES}") ++target_link_libraries(woff2dec woff2common ${WOFF2_BORTLIDEC_LIBRARIES}) + add_executable(woff2_decompress src/woff2_decompress.cc) + target_link_libraries(woff2_decompress woff2dec) + +@@ -88,7 +98,7 @@ add_library(woff2enc + src/normalize.cc + src/transform.cc + src/woff2_enc.cc) +-target_link_libraries(woff2enc woff2common "${BROTLIENC_LIBRARIES}") ++target_link_libraries(woff2enc woff2common ${WOFF2_BORTLIENC_LIBRARIES}) + add_executable(woff2_compress src/woff2_compress.cc) + target_link_libraries(woff2_compress woff2enc) + +@@ -246,7 +256,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2dec.pc" + DESCRIPTION "WOFF2 decoder library" + URL "https://github.com/google/woff2" + VERSION "${WOFF2_VERSION}" +- DEPENDS libbrotlidec ++ DEPENDS ${WOFF2_BROTLIDEC} + DEPENDS_PRIVATE libwoff2common + LIBRARIES woff2dec) + +@@ -255,7 +265,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2enc.pc" + DESCRIPTION "WOFF2 encoder library" + URL "https://github.com/google/woff2" + VERSION "${WOFF2_VERSION}" +- DEPENDS libbrotlienc ++ DEPENDS ${WOFF2_BROTLIENC} + DEPENDS_PRIVATE libwoff2common + LIBRARIES woff2enc) + +@@ -264,6 +274,7 @@ if (NOT BUILD_SHARED_LIBS) + install( + TARGETS woff2_decompress woff2_compress woff2_info + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" + ) + endif() + diff --git a/ports/woff2/portfile.cmake b/ports/woff2/portfile.cmake index 9ec3e55cd25bca..7e71859bf04bd7 100644 --- a/ports/woff2/portfile.cmake +++ b/ports/woff2/portfile.cmake @@ -8,11 +8,15 @@ vcpkg_from_github( REF v1.0.2 SHA512 c788bba1530aec463e755e901f9342f4b599e3a07f54645fef1dc388ab5d5c30625535e5dd38e9e792e04a640574baa50eeefb6b7338ab403755f4a4e0c3044d HEAD_REF master + PATCHES + 0001-unofficial-brotli.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA + OPTIONS + -DCANONICAL_PREFIXES=ON ) vcpkg_install_cmake() From d9822235244ac6b92a488aba88f25c8172398668 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 09:50:55 -0800 Subject: [PATCH 02/10] [woff2] update versions --- versions/baseline.json | 2 +- versions/w-/woff2.json | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/versions/baseline.json b/versions/baseline.json index 611b7b01597641..b28c58ce3dd2a5 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6214,7 +6214,7 @@ }, "woff2": { "baseline": "1.0.2", - "port-version": 0 + "port-version": 1 }, "wordnet": { "baseline": "3.0", diff --git a/versions/w-/woff2.json b/versions/w-/woff2.json index b6bdca1a07c60a..3d354e03f6ae7c 100644 --- a/versions/w-/woff2.json +++ b/versions/w-/woff2.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "194e7c58fa4340ea2a961ecff7180e23dfe62e9b", + "version-string": "1.0.2", + "port-version": 1 + }, { "git-tree": "c39668ee425b3e9bb5ead506876f144656acf359", "version-string": "1.0.2", From 02c8bb84f7f291052d1941e8b1762d3970ee652e Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 10:24:21 -0800 Subject: [PATCH 03/10] [woff2] update control file --- ports/woff2/CONTROL | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/woff2/CONTROL b/ports/woff2/CONTROL index e4e6511ca5c5ea..69a5c0ce25d94c 100644 --- a/ports/woff2/CONTROL +++ b/ports/woff2/CONTROL @@ -1,4 +1,5 @@ Source: woff2 Version: 1.0.2 Build-Depends: brotli +Port-Version: 1 Description: font compression reference code From 38ca09e8e5e1fa3aead110539df79dd6b145baee Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 10:29:06 -0800 Subject: [PATCH 04/10] [woff2] update versions --- versions/w-/woff2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/w-/woff2.json b/versions/w-/woff2.json index 3d354e03f6ae7c..319739265d22a6 100644 --- a/versions/w-/woff2.json +++ b/versions/w-/woff2.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "194e7c58fa4340ea2a961ecff7180e23dfe62e9b", + "git-tree": "a079b85bd986568d3435c31572dfacd3fc60fcf4", "version-string": "1.0.2", "port-version": 1 }, From 49b6d5738a2ba7aeac3ef995604fa6dd3d2fa1dd Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 21:14:05 -0800 Subject: [PATCH 05/10] [woff2] update ci.baseline.txt --- scripts/ci.baseline.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 6b3feb06a78162..a05f7413adaf0d 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1657,10 +1657,6 @@ wintoast:arm-uwp=fail wintoast:x64-linux=fail wintoast:x64-osx=fail wintoast:x64-uwp=fail -woff2:x64-linux=fail -woff2:x64-osx=fail -woff2:x64-windows-static=fail -woff2:x64-windows-static-md=fail wpilib:arm64-windows=fail wpilib:x64-osx=fail wxchartdir:x64-osx=fail From 33fd0d8af8f9f574cb80b51e467d2fc52c08abea Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 22:48:40 -0800 Subject: [PATCH 06/10] Update ports/woff2/0001-unofficial-brotli.patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> --- ports/woff2/0001-unofficial-brotli.patch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/woff2/0001-unofficial-brotli.patch b/ports/woff2/0001-unofficial-brotli.patch index 7d0ed46ccc9b99..1abb1fd5cf5d0b 100644 --- a/ports/woff2/0001-unofficial-brotli.patch +++ b/ports/woff2/0001-unofficial-brotli.patch @@ -20,11 +20,10 @@ index ecfbb83..17a440b 100644 + set(WOFF2_BORTLIDEC_LIBRARIES "${BROTLIDEC_LIBRARIES}") + set(WOFF2_BORTLIENC_LIBRARIES "${BROTLIENC_LIBRARIES}") +else() -+ unset(BROTLI_LINKAGE) -+ if(VCPKG_LIBRARY_LINKAGE STREQUAL static) -+ set(BROTLI_LINKAGE -static) -+ endif() + find_package(unofficial-brotli REQUIRED) ++ if (TARGET unofficial::brotli::brotlidec-static) ++ set(BROTLI_LINKAGE -static) ++ endif() + set(WOFF2_BROTLIDEC unofficial::brotli::brotlidec${BROTLI_LINKAGE}) + set(WOFF2_BROTLIENC unofficial::brotli::brotlienc${BROTLI_LINKAGE}) + set(WOFF2_BORTLIDEC_LIBRARIES unofficial::brotli::brotlidec${BROTLI_LINKAGE} unofficial::brotli::brotlicommon${BROTLI_LINKAGE}) From f5eafa5856505e440a4dc5420aa2147f02d5128a Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 23:28:28 -0800 Subject: [PATCH 07/10] [woff2] regenerate 0001-unofficial-brotli.patch file --- ports/woff2/0001-unofficial-brotli.patch | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ports/woff2/0001-unofficial-brotli.patch b/ports/woff2/0001-unofficial-brotli.patch index 1abb1fd5cf5d0b..6664b721940ffe 100644 --- a/ports/woff2/0001-unofficial-brotli.patch +++ b/ports/woff2/0001-unofficial-brotli.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index ecfbb83..17a440b 100644 +index ecfbb83..0c757ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -34,13 +34,24 @@ endif() +@@ -34,13 +34,23 @@ endif() # Find Brotli dependencies set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") find_package(BrotliDec) @@ -13,7 +13,7 @@ index ecfbb83..17a440b 100644 -if (NOT BROTLIENC_FOUND) - message(FATAL_ERROR "librotlienc is needed to build woff2.") -endif () -+if(BROTLIDEC_FOUND AND BROTLIENC_FOUND) ++if (BROTLIDEC_FOUND AND BROTLIENC_FOUND) + include_directories("${BROTLIDEC_INCLUDE_DIRS}" "${BROTLIENC_INCLUDE_DIRS}") + set(WOFF2_BROTLIDEC libbrotlidec) + set(WOFF2_BROTLIENC libbrotlienc) @@ -21,8 +21,8 @@ index ecfbb83..17a440b 100644 + set(WOFF2_BORTLIENC_LIBRARIES "${BROTLIENC_LIBRARIES}") +else() + find_package(unofficial-brotli REQUIRED) -+ if (TARGET unofficial::brotli::brotlidec-static) -+ set(BROTLI_LINKAGE -static) ++ if (TARGET VCPKG_LIBRARY_LINKAGE STREQUAL static) ++ set(BROTLI_LINKAGE -static) + endif() + set(WOFF2_BROTLIDEC unofficial::brotli::brotlidec${BROTLI_LINKAGE}) + set(WOFF2_BROTLIENC unofficial::brotli::brotlienc${BROTLI_LINKAGE}) @@ -32,7 +32,7 @@ index ecfbb83..17a440b 100644 # Set compiler flags if (NOT CANONICAL_PREFIXES) -@@ -63,9 +74,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAG}") +@@ -63,9 +73,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_FLAG}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAG}") set(CMAKE_CXX_STANDARD 11) @@ -44,7 +44,7 @@ index ecfbb83..17a440b 100644 # Common part used by decoder and encoder add_library(woff2common -@@ -77,7 +87,7 @@ add_library(woff2common +@@ -77,7 +86,7 @@ add_library(woff2common add_library(woff2dec src/woff2_dec.cc src/woff2_out.cc) @@ -53,7 +53,7 @@ index ecfbb83..17a440b 100644 add_executable(woff2_decompress src/woff2_decompress.cc) target_link_libraries(woff2_decompress woff2dec) -@@ -88,7 +98,7 @@ add_library(woff2enc +@@ -88,7 +97,7 @@ add_library(woff2enc src/normalize.cc src/transform.cc src/woff2_enc.cc) @@ -62,7 +62,7 @@ index ecfbb83..17a440b 100644 add_executable(woff2_compress src/woff2_compress.cc) target_link_libraries(woff2_compress woff2enc) -@@ -246,7 +256,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2dec.pc" +@@ -246,7 +255,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2dec.pc" DESCRIPTION "WOFF2 decoder library" URL "https://github.com/google/woff2" VERSION "${WOFF2_VERSION}" @@ -71,7 +71,7 @@ index ecfbb83..17a440b 100644 DEPENDS_PRIVATE libwoff2common LIBRARIES woff2dec) -@@ -255,7 +265,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2enc.pc" +@@ -255,7 +264,7 @@ generate_pkg_config ("${CMAKE_CURRENT_BINARY_DIR}/libwoff2enc.pc" DESCRIPTION "WOFF2 encoder library" URL "https://github.com/google/woff2" VERSION "${WOFF2_VERSION}" @@ -80,7 +80,7 @@ index ecfbb83..17a440b 100644 DEPENDS_PRIVATE libwoff2common LIBRARIES woff2enc) -@@ -264,6 +274,7 @@ if (NOT BUILD_SHARED_LIBS) +@@ -264,6 +273,7 @@ if (NOT BUILD_SHARED_LIBS) install( TARGETS woff2_decompress woff2_compress woff2_info RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" From 1790d3e703abe299cf5c0d04d27bc22148f2d435 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 23:29:12 -0800 Subject: [PATCH 08/10] [woff2] update versions --- versions/w-/woff2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/w-/woff2.json b/versions/w-/woff2.json index 319739265d22a6..1bd51530d4fed4 100644 --- a/versions/w-/woff2.json +++ b/versions/w-/woff2.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "a079b85bd986568d3435c31572dfacd3fc60fcf4", + "git-tree": "bb9f23b5d70e43d707f53c58255a2ec6232f3e1b", "version-string": "1.0.2", "port-version": 1 }, From cad91d60a6fb8e25f9ade75c04c1a76d0c4f1902 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 23:49:04 -0800 Subject: [PATCH 09/10] [woff2] regenerate 0001-unofficial-brotli.patch file attempt #2 --- ports/woff2/0001-unofficial-brotli.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/woff2/0001-unofficial-brotli.patch b/ports/woff2/0001-unofficial-brotli.patch index 6664b721940ffe..a0163a02c151e0 100644 --- a/ports/woff2/0001-unofficial-brotli.patch +++ b/ports/woff2/0001-unofficial-brotli.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index ecfbb83..0c757ba 100644 +index ecfbb83..7fb7a15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,13 +34,23 @@ endif() @@ -13,7 +13,7 @@ index ecfbb83..0c757ba 100644 -if (NOT BROTLIENC_FOUND) - message(FATAL_ERROR "librotlienc is needed to build woff2.") -endif () -+if (BROTLIDEC_FOUND AND BROTLIENC_FOUND) ++if(BROTLIDEC_FOUND AND BROTLIENC_FOUND) + include_directories("${BROTLIDEC_INCLUDE_DIRS}" "${BROTLIENC_INCLUDE_DIRS}") + set(WOFF2_BROTLIDEC libbrotlidec) + set(WOFF2_BROTLIENC libbrotlienc) @@ -21,7 +21,7 @@ index ecfbb83..0c757ba 100644 + set(WOFF2_BORTLIENC_LIBRARIES "${BROTLIENC_LIBRARIES}") +else() + find_package(unofficial-brotli REQUIRED) -+ if (TARGET VCPKG_LIBRARY_LINKAGE STREQUAL static) ++ if(TARGET unofficial::brotli::brotlidec-static) + set(BROTLI_LINKAGE -static) + endif() + set(WOFF2_BROTLIDEC unofficial::brotli::brotlidec${BROTLI_LINKAGE}) From c371afe22b30c8c0cd49ab9bfdc7a22f7a60d208 Mon Sep 17 00:00:00 2001 From: Jesse Towner Date: Wed, 24 Feb 2021 23:49:29 -0800 Subject: [PATCH 10/10] [woff2] update versions --- versions/w-/woff2.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions/w-/woff2.json b/versions/w-/woff2.json index 1bd51530d4fed4..1cbece83e4727d 100644 --- a/versions/w-/woff2.json +++ b/versions/w-/woff2.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "bb9f23b5d70e43d707f53c58255a2ec6232f3e1b", + "git-tree": "1a8e802f8168798c4171f8384cd2e50b97af3a9b", "version-string": "1.0.2", "port-version": 1 },