Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into loongarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Oct 17, 2024
2 parents d4e277e + 47d8b3c commit ddd5187
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 138 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
platforms:
required: true
type: string
default: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,linux-loongarch64,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
default: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,linux-loongarch64,linux-s390x,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
buildsystem_branch:
required: false
type: string
Expand Down Expand Up @@ -52,7 +52,7 @@ env:
DEBUG_CI: ${{ inputs.debug }}
VERBOSE_CI: ${{ inputs.verbose }}
PORTABLE_PYTHON_BUILDSYSTEM_BRANCH: ${{ inputs.buildsystem_branch || 'portable-python' }}
image_map: '{"x86_64": "amd64/ubuntu:18.04", "i386": "i386/ubuntu:18.04", "aarch64": "arm64v8/ubuntu:18.04", "arm": "arm32v7/debian:bullseye", "riscv64": "riscv64/debian:sid", "loongarch64": "loongarch64/debian:sid"}'
image_map: '{"x86_64": "amd64/ubuntu:18.04", "i386": "i386/ubuntu:18.04", "aarch64": "arm64v8/ubuntu:18.04", "arm": "arm32v7/debian:bullseye", "riscv64": "riscv64/debian:sid", "loongarch64": "loongarch64/debian:sid", "s390x": "s390x/debian:bullseye"}'
freebsd_release_map: '{"14": "14.0", "13": "13.2"}'

jobs:
Expand All @@ -63,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: [x86_64, i386, aarch64, arm, riscv64, loongarch64]
arch: [x86_64, i386, aarch64, arm, riscv64, s390x, loongarch64]
distribution: [full, headless]
exclude:
- arch: ${{ !contains(inputs.platforms, 'linux-x86_64') && 'x86_64' || '' }}
Expand All @@ -72,6 +72,7 @@ jobs:
- arch: ${{ !contains(inputs.platforms, 'linux-arm') && 'arm' || '' }}
- arch: ${{ !contains(inputs.platforms, 'linux-riscv64') && 'riscv64' || '' }}
- arch: ${{ !contains(inputs.platforms, 'linux-loongarch64') && 'loongarch64' || '' }}
- arch: ${{ !contains(inputs.platforms, 'linux-s390x') && 's390x' || '' }}

steps:
- name: Parse image
Expand Down Expand Up @@ -543,8 +544,6 @@ jobs:
envs: 'RUN_TESTS DEBUG_CI VERBOSE_CI PORTABLE_PYTHON_BUILDSYSTEM_BRANCH'
usesh: true
copyback: false
prepare: |
/usr/sbin/pkg_add bash
run: |
cat > /tmp/test.sh <<EOF
unzip python/python-${{ inputs.python_version }}-cosmo-unknown.zip
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_python_on_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run_tests: ${{ inputs.run_tests || false }}
debug: ${{ inputs.debug || false }}
verbose: ${{ inputs.verbose || false }}
platforms: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,linux-loongarch64,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
platforms: "linux-x86_64,linux-aarch64,linux-i386,linux-arm,linux-riscv64,linux-loongarch64,linux-s390x,macos,windows,cosmo,freebsd13-x86_64,freebsd14-x86_64"
buildsystem_branch: ${{ inputs.buildsystem_branch || 'portable-python' }}

graalpy:
Expand Down
30 changes: 25 additions & 5 deletions scripts/build_linux_zig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ case "$ARCH" in
# workaround since the Zig compiler always targets ld-linux-riscv64-lp64.so.1
sudo ln -s /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld-linux-riscv64-lp64.so.1
;;
s390x)
sudo apt -y install libc6-s390x-cross
sudo ln -s /usr/s390x-linux-gnu/lib/ld64.so.1 /lib/ld64.so.1
;;
esac
sudo pip install https://github.com/mesonbuild/meson/archive/2baae24.zip ninja cmake==3.28.4 --break-system-packages
if [[ "${ARCH}" == "riscv64" ]]; then
sudo pip install patchelf==0.15.0.0
fi

export ZIG_FLAGS=""
export CFLAGS="-fno-sanitize=undefined -I${DEPSDIR}/include"
export CPPFLAGS="-fno-sanitize=undefined -I${DEPSDIR}/include"
export CFLAGS="-Wno-date-time -fno-sanitize=undefined -I${DEPSDIR}/include"
export CPPFLAGS="-Wno-date-time -fno-sanitize=undefined -I${DEPSDIR}/include"
export CXXFLAGS="${CPPFLAGS}"
export LDFLAGS="-L${DEPSDIR}/lib"
export PKG_CONFIG_PATH="${DEPSDIR}/lib/pkgconfig:${DEPSDIR}/share/pkgconfig"
Expand Down Expand Up @@ -98,6 +102,8 @@ else
export CFLAGS="-Wl,--undefined-version ${CFLAGS}"
elif [[ "${ARCH}" == "loongarch64" ]]; then
export ZIG_FLAGS="-target loongarch64-linux-gnu.2.36"
elif [[ "${ARCH}" == "s390x" ]]; then
export ZIG_FLAGS="-target s390x-linux-gnu.2.19"
else
export ZIG_FLAGS="-target ${ARCH}-linux-gnu.2.17"
fi
Expand Down Expand Up @@ -141,6 +147,8 @@ elif [[ "${ARCH}" == "riscv64" ]]; then
CFLAGS="${CFLAGS} -fgnuc-version=0 -D__STDC_NO_ATOMICS__" ./Configure linux-generic64 no-shared --prefix=${DEPSDIR} --openssldir=${DEPSDIR}
elif [[ "${ARCH}" == "loongarch64" ]]; then
./Configure linux64-loongarch64 no-shared --prefix=${DEPSDIR} --openssldir=${DEPSDIR}
elif [[ "${ARCH}" == "s390x" ]]; then
./Configure linux64-s390x no-shared --prefix=${DEPSDIR} --openssldir=${DEPSDIR}
else
./Configure linux-${ARCH} no-shared --prefix=${DEPSDIR} --openssldir=${DEPSDIR}
fi
Expand All @@ -155,8 +163,15 @@ echo "::endgroup::"
echo "::group::libffi"
cd ${BUILDDIR}

download_verify_extract libffi-3.4.6.tar.gz
cd libffi*
if [[ "${ARCH}" == "s390x" ]]; then
git clone https://github.com/bjia56/libffi.git
cd libffi
git checkout v3.4.6-s390x
./autogen.sh
else
download_verify_extract libffi-3.4.6.tar.gz
cd libffi*
fi
CFLAGS="${CFLAGS} -Wl,--undefined-version" ./configure --host=${CHOST} --prefix=${DEPSDIR}
make -j4
make install
Expand Down Expand Up @@ -471,7 +486,7 @@ if [[ "${DISTRIBUTION}" != "headless" ]]; then

download_verify_extract tk8.6.13-src.tar.gz
cd tk*/unix
LDFLAGS="${LDFLAGS} -lxml2" ./configure --disable-shared --host=${CHOST} --prefix=${DEPSDIR}
LDFLAGS="${LDFLAGS} -lxml2 -lxcb -lXau" ./configure --disable-shared --host=${CHOST} --prefix=${DEPSDIR}
make -j4
make install
cd ..
Expand Down Expand Up @@ -525,6 +540,11 @@ if [[ "${ARCH}" == "x86_64" && ${PYTHON_MINOR} -ge 11 ]]; then
opensslparams+=(
-DOPENSSL_LIBRARIES="${DEPSDIR}/lib64/libssl.a;${DEPSDIR}/lib64/libcrypto.a"
)
elif [[ "${ARCH}" == "s390x" && ${PYTHON_MINOR} -ge 11 ]]; then
# openssl 3 appears to install to lib64
opensslparams+=(
-DOPENSSL_LIBRARIES="${DEPSDIR}/lib64/libssl.a;${DEPSDIR}/lib64/libcrypto.a"
)
else
opensslparams+=(
-DOPENSSL_LIBRARIES="${DEPSDIR}/lib/libssl.a;${DEPSDIR}/lib/libcrypto.a"
Expand Down
4 changes: 4 additions & 0 deletions scripts/qemu_s390x_interpreter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
# this interpreter shim is used by cmake to run platform
# detection programs
LD_LIBRARY_PATH=/usr/s390x-linux-gnu/lib qemu-s390x-static "$@"
19 changes: 0 additions & 19 deletions zigshim/patches/01-arm-xstatver.h.patch

This file was deleted.

108 changes: 0 additions & 108 deletions zigshim/patches/02-riscv64.patch

This file was deleted.

0 comments on commit ddd5187

Please sign in to comment.