Skip to content
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

Building manylinux2014 wheels: use custom vcpkg port to get zlib 1.2.5 #57

Merged
merged 4 commits into from
Mar 18, 2022
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
3 changes: 2 additions & 1 deletion ci/manylinux2014_x86_64-vcpkg-gdal.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RUN bootstrap-vcpkg.sh && \
vcpkg integrate bash

COPY ci/custom-triplets/x64-linux-dynamic.cmake opt/vcpkg/custom-triplets/x64-linux-dynamic.cmake
COPY ci/vcpkg-custom-ports/ opt/vcpkg/custom-ports/

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/vcpkg/installed/x64-linux-dynamic/lib"
RUN vcpkg install gdal[core]:x64-linux-dynamic --overlay-triplets=opt/vcpkg/custom-triplets
RUN vcpkg install gdal[core]:x64-linux-dynamic --overlay-triplets=opt/vcpkg/custom-triplets --overlay-ports=opt/vcpkg/custom-ports
20 changes: 20 additions & 0 deletions ci/vcpkg-custom-ports/zlib/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
[email protected] [email protected]
36 changes: 36 additions & 0 deletions ci/vcpkg-custom-ports/zlib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
set(VERSION 1.2.5)

vcpkg_download_distfile(ARCHIVE_FILE
URLS "https://downloads.sourceforge.net/project/libpng/zlib/${VERSION}/zlib-${VERSION}.tar.gz"
FILENAME "zlib125.tar.gz"
SHA512 83ce467787903b7e90ece203aaea0be42174b9cf4a9aa16fe3f72925a4993b549d50154dec4cc76b4cb1aa0b7b966118772aca3d73efa0601167256ff7ce7a12
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE_FILE}
REF ${VERSION}
)

# This is generated during the cmake build
file(REMOVE ${SOURCE_PATH}/zconf.h)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSKIP_INSTALL_FILES=ON
OPTIONS_DEBUG
-DSKIP_INSTALL_HEADERS=ON
)

vcpkg_install_cmake()
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

vcpkg_fixup_pkgconfig()

file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

vcpkg_copy_pdbs()

file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
4 changes: 4 additions & 0 deletions ci/vcpkg-custom-ports/zlib/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The package zlib is compatible with built-in CMake targets:

find_package(ZLIB REQUIRED)
target_link_libraries(main PRIVATE ZLIB::ZLIB)
12 changes: 12 additions & 0 deletions ci/vcpkg-custom-ports/zlib/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include" NO_DEFAULT_PATH)
find_library(ZLIB_LIBRARY_RELEASE NAMES zlib z PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" NO_DEFAULT_PATH)
find_library(ZLIB_LIBRARY_DEBUG NAMES zlibd z PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" NO_DEFAULT_PATH)
if(NOT ZLIB_INCLUDE_DIR OR NOT (ZLIB_LIBRARY_RELEASE OR ZLIB_LIBRARY_DEBUG))
message(FATAL_ERROR "Broken installation of vcpkg port zlib")
endif()
if(CMAKE_VERSION VERSION_LESS 3.4)
include(SelectLibraryConfigurations)
select_library_configurations(ZLIB)
unset(ZLIB_FOUND)
endif()
_find_package(${ARGS})
7 changes: 7 additions & 0 deletions ci/vcpkg-custom-ports/zlib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "zlib",
"version": "1.2.5",
"port-version": 0,
"description": "A compression library",
"homepage": "https://www.zlib.net/"
}
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ archs = ["auto64"]
manylinux-x86_64-image = "manylinux-vcpkg-gdal:latest"
build-verbosity = 3

[tool.cibuildwheel.linux]
# explicitly mention 2_27 for now because it fails for manylinux2014 (2_17)
repair-wheel-command = "auditwheel repair --plat manylinux_2_27_x86_64 -w {dest_dir} {wheel}"

[tool.cibuildwheel.linux.environment]
VCPKG_INSTALL = "$VCPKG_INSTALLATION_ROOT/installed/x64-linux-dynamic"
GDAL_INCLUDE_PATH = "$VCPKG_INSTALL/include"
Expand Down