aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/brotli
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/brotli
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/brotli')
-rw-r--r--vcpkg/ports/brotli/install.patch47
-rw-r--r--vcpkg/ports/brotli/pkgconfig.patch17
-rw-r--r--vcpkg/ports/brotli/portfile.cmake36
-rw-r--r--vcpkg/ports/brotli/usage7
-rw-r--r--vcpkg/ports/brotli/vcpkg.json17
5 files changed, 124 insertions, 0 deletions
diff --git a/vcpkg/ports/brotli/install.patch b/vcpkg/ports/brotli/install.patch
new file mode 100644
index 0000000..04990fb
--- /dev/null
+++ b/vcpkg/ports/brotli/install.patch
@@ -0,0 +1,47 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 22b21d2..90003a8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -152,14 +152,13 @@ endif() # BUILD_SHARED_LIBS
+
+ foreach(lib ${BROTLI_SHARED_LIBRARIES} ${BROTLI_STATIC_LIBRARIES})
+ target_link_libraries(${lib} ${LIBM_LIBRARY})
+- set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS})
+ set_target_properties(${lib} PROPERTIES
+ VERSION "${BROTLI_ABI_COMPATIBILITY}.${BROTLI_ABI_AGE}.${BROTLI_ABI_REVISION}"
+ SOVERSION "${BROTLI_ABI_COMPATIBILITY}")
+ if (NOT BROTLI_EMSCRIPTEN)
+ set_target_properties(${lib} PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
+ endif()
+- set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${BROTLI_INCLUDE_DIRS}>")
++ set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<BUILD_INTERFACE:${BROTLI_INCLUDE_DIRS}>" $<INSTALL_INTERFACE:include>)
+ endforeach() # BROTLI_xxx_LIBRARIES
+
+ target_link_libraries(brotlidec brotlicommon)
+@@ -187,12 +186,15 @@ if (NOT BROTLI_BUNDLED_MODE)
+ if (BROTLI_BUILD_TOOLS)
+ install(
+ TARGETS brotli
+- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
++ RUNTIME DESTINATION tools/brotli
++ BUNDLE DESTINATION tools/brotli
++ CONFIGURATIONS Release
+ )
+ endif()
+
+ install(
+ TARGETS ${BROTLI_SHARED_LIBRARIES} ${BROTLI_STATIC_LIBRARIES}
++ EXPORT brotli
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+@@ -201,7 +203,9 @@ if (NOT BROTLI_BUNDLED_MODE)
+ install(
+ DIRECTORY ${BROTLI_INCLUDE_DIRS}/brotli
+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
++ CONFIGURATIONS Release
+ )
++ install(EXPORT brotli FILE unofficial-brotli-config.cmake NAMESPACE unofficial::brotli:: DESTINATION share/unofficial-brotli)
+ endif() # BROTLI_BUNDLED_MODE
+
+ # Tests
diff --git a/vcpkg/ports/brotli/pkgconfig.patch b/vcpkg/ports/brotli/pkgconfig.patch
new file mode 100644
index 0000000..77e74fb
--- /dev/null
+++ b/vcpkg/ports/brotli/pkgconfig.patch
@@ -0,0 +1,17 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 90003a8..10632c8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -368,6 +368,12 @@ function(transform_pc_file INPUT_FILE OUTPUT_FILE VERSION)
+
+ string(REGEX REPLACE "@PACKAGE_VERSION@" "${VERSION}" TEXT ${TEXT})
+
++ if(NOT BUILD_SHARED_LIBS)
++ if(LIBM_LIBRARY)
++ string(REPLACE " -lbrotlicommon" " -lbrotlicommon -l${LIBM_LIBRARY}" TEXT ${TEXT})
++ endif()
++ endif()
++
+ file(WRITE ${OUTPUT_FILE} ${TEXT})
+ endfunction()
+
diff --git a/vcpkg/ports/brotli/portfile.cmake b/vcpkg/ports/brotli/portfile.cmake
new file mode 100644
index 0000000..e55c69c
--- /dev/null
+++ b/vcpkg/ports/brotli/portfile.cmake
@@ -0,0 +1,36 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO google/brotli
+ REF v${VERSION} # v1.1.0
+ SHA512 f94542afd2ecd96cc41fd21a805a3da314281ae558c10650f3e6d9ca732b8425bba8fde312823f0a564c7de3993bdaab5b43378edab65ebb798cefb6fd702256
+ HEAD_REF master
+ PATCHES
+ install.patch
+ pkgconfig.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBROTLI_DISABLE_TESTS=ON
+)
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+vcpkg_cmake_config_fixup(CONFIG_PATH share/unofficial-brotli PACKAGE_NAME unofficial-brotli)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/tools")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/man")
+
+# Under emscripten the brotli executable tool is produced with .js extension but vcpkg_copy_tools
+# has no special behaviour in this case and searches for the tool name with no extension
+if(VCPKG_TARGET_IS_EMSCRIPTEN)
+ set(TOOL_SUFFIX ".js" )
+endif()
+
+vcpkg_copy_tools(TOOL_NAMES "brotli${TOOL_SUFFIX}" SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools/brotli")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/brotli/usage b/vcpkg/ports/brotli/usage
new file mode 100644
index 0000000..d3dde76
--- /dev/null
+++ b/vcpkg/ports/brotli/usage
@@ -0,0 +1,7 @@
+brotli provides CMake targets:
+
+ find_package(unofficial-brotli CONFIG REQUIRED)
+ # Brotli decoder library
+ target_link_libraries(main PRIVATE unofficial::brotli::brotlidec)
+ # Brotli encoder library
+ target_link_libraries(main PRIVATE unofficial::brotli::brotlienc)
diff --git a/vcpkg/ports/brotli/vcpkg.json b/vcpkg/ports/brotli/vcpkg.json
new file mode 100644
index 0000000..c5bf679
--- /dev/null
+++ b/vcpkg/ports/brotli/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "brotli",
+ "version": "1.2.0",
+ "description": "a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling.",
+ "homepage": "https://github.com/google/brotli",
+ "license": "MIT",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}