Skip to content

Map zlib to zlib-ng #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ jobs:
- name: Read zlib config
if: steps.zlib.outcome == 'success' || steps.zlib.outcome == 'failure'
continue-on-error: true
run: Get-Content ./buildtrees/zlib/config-${{ matrix.triplet }}-out.log
run: Get-Content ./buildtrees/zlib-ng/config-${{ matrix.triplet }}-out.log
- name: Read zlib debug build log
if: steps.zlib.outcome == 'success' || steps.zlib.outcome == 'failure'
continue-on-error: true
run: Get-Content ./buildtrees/zlib/install-${{ matrix.triplet }}-dbg-out.log
run: Get-Content ./buildtrees/zlib-ng/install-${{ matrix.triplet }}-dbg-out.log
- name: Read zlib release build log
if: steps.zlib.outcome == 'success' || steps.zlib.outcome == 'failure'
continue-on-error: true
run: Get-Content ./buildtrees/zlib/install-${{ matrix.triplet }}-rel-out.log
run: Get-Content ./buildtrees/zlib-ng/install-${{ matrix.triplet }}-rel-out.log

- name: Build brotli
id: brotli
Expand Down
2 changes: 1 addition & 1 deletion .reqcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
owner: unicode-org
repo: icu

zlib:
zlib-ng:
host: github
owner: zlib-ng
repo: zlib-ng
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
| Library | Version | Release Date |
|---|:---:|:---:|
| [icu](http://site.icu-project.org) | 76.1 | 2024-10-24 |
| [zlib](https://github.com/zlib-ng/zlib-ng) | 2.2.2 | 2024-09-17 |
| [curl](https://curl.se) | 8.11.0 | 2024-11-05 |
| [libxml2](http://xmlsoft.org) | 2.13.5 | 2024-11-12 |
| [sqlite](http://sqlite.org) | 3.47.0 | 2024-10-21 |
Expand Down
41 changes: 2 additions & 39 deletions ports/zlib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,39 +1,2 @@
set(VERSION 2.2.2)

set(FILENAME "zlib-ng-${VERSION}.zip")
set(URLS "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/${VERSION}.zip")

# Get archive
vcpkg_download_distfile(ARCHIVE
URLS ${URLS}
FILENAME ${FILENAME}
SHA512 98586b3ce67bf481ccb94f3263340dffde10c3735218b0c60173a91fe931f4e40a772691c7d19b691a167ae9709f62efcc247c2711d15cf19ca3bd318cab9689
)

# Extract archive
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
REF ${VERSION}
PATCHES ${PATCHES}
)

# Run CMake build
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DZLIB_COMPAT=ON
-DZLIB_ENABLE_TESTS=OFF
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)

vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ZLIB)
vcpkg_fixup_pkgconfig()

# Prepare distribution
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/zlib RENAME copyright)
file(WRITE ${CURRENT_PACKAGES_DIR}/share/zlib/version "${VERSION}")
# Mapping zlib-ng to zlib
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
11 changes: 2 additions & 9 deletions ports/zlib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{
"name": "zlib",
"version": "2.2.2",
"version-string": "zlib-ng",
"description": "A compression library",
"homepage": "https://github.com/zlib-ng/zlib-ng",
"license": "Zlib",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
"zlib-ng"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to remove vcpkg-cmake and vcpkg-cmake-config.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that and the general technique!

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The show-stopper might be the lack of activating ZLIB_COMPAT. AFAICS it is not (and cannot be) mapped to a feature, and so it would need to be injected by triplet file customization.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's disappointing. The whole point of zlib-ng is to have a drop in replacement.

You have an example on how one would inject it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Drop-in replacement" is the same as "alternative", and vcpkg is unable to allow alternatives.

Basically, all (overlay) triplet files need

if(PORT STREQUAL "zlib-ng")
    set(VCPKG_CMAKE_CONFIGURE_OPTIONS "-DZLIB_COMPAT=ON")
endif()

(There are other efforts, but I don't think anything is ready now.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alrighty so it seems like the port itself needs a change to make this work

if(ZLIB_COMPAT)
    set(_cmake_dir "ZLIB")
else()
    set(_port_suffix "zlib-ng")
endif()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${_cmake_dir})

Can wait until microsoft/vcpkg#43122 lands before proposing the changes.

]
}
5 changes: 5 additions & 0 deletions triplets/x64-windows-webkit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ if (PORT STREQUAL "highway")
elseif (PORT STREQUAL "pixman")
set(VCPKG_LIBRARY_LINKAGE static)
endif ()

# Turn on zlib compatibility
if (PORT STREQUAL "zlib-ng")
set(ZLIB_COMPAT ON)
endif ()