Skip to content

Commit 0895db3

Browse files
authored
chore: only use custom libuv for glibc<2.12 (#178)
* chore: only use custom libuv for glibc<2.12 * ci: build both manylinux1 & manylinux2010 wheels
1 parent 3aad285 commit 0895db3

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

.github/workflows/build.yml

+29-2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,33 @@ jobs:
8484
with:
8585
path: ./wheelhouse/*.whl
8686

87+
build_manylinux1_wheels:
88+
name: Build ${{ matrix.arch }} manylinux1 wheels
89+
needs: [lint]
90+
runs-on: ubuntu-20.04
91+
strategy:
92+
fail-fast: false
93+
matrix:
94+
include:
95+
- arch: "x86_64"
96+
- arch: "i686"
97+
98+
steps:
99+
- uses: actions/checkout@v2
100+
with:
101+
fetch-depth: 0 # required for versioneer to find tags
102+
103+
- name: Build wheels
104+
uses: pypa/[email protected]
105+
env:
106+
CIBW_ARCHS: "${{ matrix.arch }}"
107+
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux1"
108+
CIBW_MANYLINUX_I686_IMAGE: "manylinux1"
109+
110+
- uses: actions/upload-artifact@v2
111+
with:
112+
path: ./wheelhouse/*.whl
113+
87114
build_sdist:
88115
name: Build source distribution
89116
needs: [lint]
@@ -139,7 +166,7 @@ jobs:
139166

140167
check_dist:
141168
name: Check dist
142-
needs: [build_wheels, build_sdist, test_sdist]
169+
needs: [build_wheels, build_manylinux1_wheels, build_sdist, test_sdist]
143170
runs-on: ubuntu-20.04
144171
steps:
145172
- uses: actions/download-artifact@v2
@@ -151,7 +178,7 @@ jobs:
151178

152179
upload_pypi:
153180
name: Upload to PyPI
154-
needs: [build_wheels, build_sdist, test_sdist, check_dist]
181+
needs: [build_wheels, build_manylinux1_wheels, build_sdist, test_sdist, check_dist]
155182
runs-on: ubuntu-latest
156183
if: github.event_name == 'push' && github.repository == 'scikit-build/cmake-python-distributions' && startsWith(github.ref, 'refs/tags/')
157184
steps:

CMakeLists.txt

+18
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,25 @@ set(CMAKE_EXE_LINKER_FLAGS \"-lstdc++ -lgcc -lrt\" CACHE STRING \"Initial cache\
203203
set(_cmake_cache_args)
204204

205205
# libuv
206+
set(UseCustomLibUV OFF)
206207
if(UNIX AND NOT APPLE)
208+
# libuv 1.23.0 is the last version to build on CentOS 5 (or glibc < 2.12)
209+
# Use libuv 1.23.0 instead of cmake embedded libuv when detecting glibc < 2.12
210+
# https://github.com/libuv/libuv/blob/v1.x/SUPPORTED_PLATFORMS.md
211+
include(CheckSymbolExists)
212+
check_symbol_exists(__GLIBC__ "stdlib.h" HAS_GLIBC_MAJOR)
213+
check_symbol_exists(__GLIBC_MINOR__ "stdlib.h" HAS_GLIBC_MINOR)
214+
if(HAS_GLIBC_MAJOR AND HAS_GLIBC_MINOR AND (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
215+
execute_process(COMMAND echo __GLIBC__ COMMAND "${CMAKE_CXX_COMPILER}" -E -P -imacros stdlib.h - OUTPUT_VARIABLE GLIBC_MAJOR_)
216+
string(STRIP "${GLIBC_MAJOR_}" GLIBC_MAJOR)
217+
execute_process(COMMAND echo __GLIBC_MINOR__ COMMAND "${CMAKE_CXX_COMPILER}" -E -P -imacros stdlib.h - OUTPUT_VARIABLE GLIBC_MINOR_)
218+
string(STRIP "${GLIBC_MINOR_}" GLIBC_MINOR)
219+
if("${GLIBC_MAJOR}.${GLIBC_MINOR}" VERSION_LESS "2.12")
220+
set(UseCustomLibUV ON)
221+
endif()
222+
endif()
223+
endif()
224+
if(UseCustomLibUV)
207225
set(LibUV_SOURCE_DIR ${CMAKE_BINARY_DIR}/LibUV-src)
208226
set(LibUV_BINARY_DIR ${CMAKE_BINARY_DIR}/LibUV-build)
209227
set(LibUV_INSTALL_DIR ${CMAKE_BINARY_DIR}/LibUV-install)

pyproject.toml

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ before-all = [
2828
"ninja --version",
2929
"./scripts/manylinux-build-and-install-openssl.sh",
3030
]
31-
manylinux-x86_64-image = "manylinux1"
32-
manylinux-i686-image = "manylinux1"
3331

3432
[tool.cibuildwheel.linux.environment]
3533
SKBUILD_CONFIGURE_OPTIONS = "-DOPENSSL_ROOT_DIR:PATH=/usr/local/ssl -DCMAKE_JOB_POOL_COMPILE:STRING=compile -DCMAKE_JOB_POOL_LINK:STRING=link -DCMAKE_JOB_POOLS:STRING=compile=2;link=1"

0 commit comments

Comments
 (0)