diff options
| author | lando <du33169@qq.com> | 2024-05-20 21:21:11 +0800 |
|---|---|---|
| committer | lando <du33169@qq.com> | 2024-05-23 17:41:21 +0800 |
| commit | 09ceb1d0543325181fd8beced65844216f7105b7 (patch) | |
| tree | 254258359a244f5ae6a4ad88dda93e1496893dc7 | |
| parent | 96fc74f60ef9c55dc46f55c4d96250db1d939af4 (diff) | |
Fixed build failure on win32 & removed failed windows cibw-only
| -rw-r--r-- | .github/workflows/build.yml | 33 | ||||
| -rw-r--r-- | build_jq.mk | 6 | ||||
| -rw-r--r-- | setup.py | 6 |
3 files changed, 24 insertions, 21 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b07367..a63724f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,14 +89,15 @@ jobs: env: CIBW_ARCHS_LINUX: "auto aarch64" CIBW_ARCHS_MACOS: "auto" + run: | MATRIX=$( { cibuildwheel --print-build-identifiers --platform linux \ - | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-20.04"}/' \ + | sed 's/.*/{"cibw-only": "&", "os": "ubuntu-20.04"}/' \ && cibuildwheel --print-build-identifiers --platform macos \ | sed 's/.*/{"cibw-only": "&", "os": "macos-13" }/' \ - && cibuildwheel --print-build-identifiers --platform windows \ + && env CIBW_SKIP="pp* cp36*" cibuildwheel --print-build-identifiers --platform windows \ | sed 's/.*/{"cibw-only": "&", "os": "windows-latest" }/' } | jq --slurp --compact-output '{"include": .}' ) @@ -127,22 +128,23 @@ jobs: with: platforms: all - - name: Set up MSYS + - name: set up MSYS2 if: runner.os == 'Windows' uses: msys2/setup-msys2@v2 with: - msystem: UCRT64 - update: true - install: mingw-w64-ucrt-x86_64-gcc make + release: false + msystem: ${{ contains(matrix.cibw-only, 'win32') && 'mingw32' || 'ucrt64' }} + install: make mingw-w64-${{ contains(matrix.cibw-only, 'win32') && 'i686' || 'ucrt-x86_64' }}-gcc - - name: Setup windows build environment + - name: Setup windows build variables id: setup-build-win if: runner.os == 'Windows' - shell: msys2 {0} + shell: msys2 {0} run: | JQ_VERSION=$(ls deps/jq-*.tar.gz | grep -oP 'jq-\K[\d.]+(?=.tar.gz)') echo jq-lib-version="$JQ_VERSION" >> $GITHUB_OUTPUT - echo use-prebuilt-jq=1 >>$GITHUB_OUTPUT + echo arch=$( grep -o 'win_amd64\|win32' <<< ${{matrix.cibw-only}}) >> $GITHUB_OUTPUT + ${{ contains(matrix.cibw-only, 'win32') && 'echo "C:/msys64/mingw32/bin" >> $GITHUB_PATH' || 'echo no need to set PATH for win_amd64' }} printf "[build]\ncompiler=mingw32" > setup.cfg - name: Cache pre-built jq lib @@ -151,13 +153,12 @@ jobs: uses: actions/cache@v4 with: path: _deps/build - key: ${{ runner.os }}-prebuilt-jq-${{steps.setup-build-win.outputs.jq-lib-version}} + key: prebuilt-jq-${{steps.setup-build-win.outputs.jq-lib-version}}-${{ steps.setup-build-win.outputs.arch }} - name: Build jq lib if: runner.os == 'Windows' && steps.cache-prebuilt-jq.outputs.cache-hit != 'true' shell: msys2 {0} - run: | - make -f build_jq.mk + run: make -f build_jq.mk - name: Print build identifiers run: | @@ -165,20 +166,20 @@ jobs: python -m cibuildwheel --only ${{ matrix.cibw-only }} --print-build-identifiers - name: Build wheels - if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || matrix.cibw-only == 'cp310-manylinux_x86_64' || matrix.cibw-only == 'cp311-win_amd64' }} + # if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || matrix.cibw-only == 'cp310-manylinux_x86_64' || matrix.cibw-only == 'cp311-win_amd64' }} uses: pypa/cibuildwheel@v2.17.0 with: only: ${{ matrix.cibw-only }} env: - CIBW_ENVIRONMENT: JQPY_USE_PREBUILT_LIBS="${{steps.setup-build-win.outputs.use-prebuilt-jq }}" + CIBW_ENVIRONMENT: ${{ runner.os == 'Windows' && 'JQPY_USE_PREBUILT_LIBS' || '' }} ${{ contains(matrix.cibw-only, 'win32') && 'CC=i686-w64-mingw32-gcc.exe' || '' }} + - uses: actions/upload-artifact@v3 - if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || matrix.cibw-only == 'cp310-manylinux_x86_64' || matrix.cibw-only == 'cp311-win_amd64' }} + # if: ${{ (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) || matrix.cibw-only == 'cp310-manylinux_x86_64' || matrix.cibw-only == 'cp311-win_amd64' }} with: path: ./wheelhouse/*.whl build_wheels_macosx_arm64: name: Build macOS arm64 wheels - runs-on: macos-14 steps: diff --git a/build_jq.mk b/build_jq.mk index 66e7711..fb17f65 100644 --- a/build_jq.mk +++ b/build_jq.mk @@ -1,9 +1,9 @@ # makefile for building jq - -.PHONY: jq_tarball jq_src jq_lib +.PHONY: jq_tarball jq_src jq_lib clean jq_build_parent:=_deps/build -jq_version=$(shell echo $(shell ls deps/jq-*.tar.gz) | grep -oP 'jq-\K[\d.]+(?=.tar.gz)') + +jq_version:=$(shell echo $(shell ls deps/jq-*.tar.gz) | grep -oP 'jq-\K[\d.]+(?=.tar.gz)') jq_tarball_path:=deps/jq-$(jq_version).tar.gz jq_build_path:=$(jq_build_parent)/jq-$(jq_version) @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +import sys import subprocess import tarfile import shutil @@ -67,6 +68,8 @@ class jq_with_deps_build_ext(build_ext): use_system_libs = bool(os.environ.get("JQPY_USE_SYSTEM_LIBS")) use_prebuilt_libs = bool(os.environ.get("JQPY_USE_PREBUILT_LIBS")) +print(f"use_system_libs={use_system_libs}") +print(f"use_prebuilt_libs={use_prebuilt_libs}") if use_system_libs: jq_build_ext = build_ext @@ -80,11 +83,10 @@ else: os.path.join(jq_lib_dir, "modules/oniguruma/src/.libs/libonig.a"), ] - jq_extension = Extension( "jq", sources=["jq.c"], - define_macros=[("MS_WIN64", 1)] if os.name == 'nt' else [], + define_macros=[("MS_WIN64" , 1)] if os.name == 'nt' and sys.maxsize > 2**32 else None, # https://github.com/cython/cython/issues/2670 include_dirs=[os.path.join(jq_lib_dir, "src")], extra_link_args=["-lm"] + (["-Wl,-Bstatic", "-lpthread", "-lshlwapi", "-static-libgcc"] if os.name == 'nt' else []) + link_args_deps, extra_objects=extra_objects, |
