Skip to content
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: 0 additions & 3 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ jobs:
- build.cross
- build.cross-riscv64
- gcc
- xcb
- xcb.cross
- xcb.cross-riscv64
name: ${{ matrix.image }}
runs-on: depot-ubuntu-22.04
permissions:
Expand Down
13 changes: 8 additions & 5 deletions cpython-unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ PYTHON_DEP_DEPENDS := \
$(TOOLCHAIN_DEPENDS) \
$(NULL)

HOST_PYTHON_DEPENDS := $(OUTDIR)/cpython-$(PYTHON_MAJOR_VERSION)-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(HOST_PLATFORM).tar

default: $(OUTDIR)/cpython-$(CPYTHON_$(PYTHON_MAJOR_VERSION)_VERSION)-$(PACKAGE_SUFFIX).tar

ifndef PYBUILD_NO_DOCKER
Expand Down Expand Up @@ -149,16 +151,16 @@ $(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXAU_DEPENDS)

LIBXCB_DEPENDS = \
$(PYTHON_DEP_DEPENDS) \
$(HOST_PYTHON_DEPENDS) \
$(HERE)/build-libxcb.sh \
$(OUTDIR)/image-$(DOCKER_IMAGE_XCB).tar \
$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar \
$(OUTDIR)/libXau-$(LIBXAU_VERSION)-$(PACKAGE_SUFFIX).tar \
$(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar \
$(OUTDIR)/libpthread-stubs-$(LIBPTHREAD_STUBS_VERSION)-$(PACKAGE_SUFFIX).tar \
$(NULL)

$(OUTDIR)/libxcb-$(LIBXCB_VERSION)-$(PACKAGE_SUFFIX).tar: $(LIBXCB_DEPENDS)
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) libxcb
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) libxcb

$(OUTDIR)/m4-$(M4_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-m4.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) m4
Expand Down Expand Up @@ -204,22 +206,23 @@ $(OUTDIR)/tix-$(TIX_VERSION)-$(PACKAGE_SUFFIX).tar: $(TIX_DEPENDS)
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) tix

TK_DEPENDS = \
$(HOST_PYTHON_DEPENDS) \
$(HERE)/build-tk.sh \
$(OUTDIR)/tcl-$(TCL_VERSION)-$(PACKAGE_SUFFIX).tar \
$(if $(NEED_LIBX11),$(OUTDIR)/libX11-$(LIBX11_VERSION)-$(PACKAGE_SUFFIX).tar) \
$(NULL)

$(OUTDIR)/tk-$(TK_VERSION)-$(PACKAGE_SUFFIX).tar: $(TK_DEPENDS)
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) tk
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) tk

$(OUTDIR)/uuid-$(UUID_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-uuid.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) uuid

$(OUTDIR)/x11-util-macros-$(X11_UTIL_MACROS_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-x11-util-macros.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) x11-util-macros

$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xcb-proto.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_XCB) xcb-proto
$(OUTDIR)/xcb-proto-$(XCB_PROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HOST_PYTHON_DEPENDS) $(HERE)/build-xcb-proto.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) --python-host-version $(PYBUILD_PYTHON_VERSION) xcb-proto

$(OUTDIR)/xorgproto-$(XORGPROTO_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-xorgproto.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) xorgproto
Expand Down
4 changes: 0 additions & 4 deletions cpython-unix/base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ RUN for s in debian_jessie debian_jessie-updates debian-security_jessie/updates;
echo 'Acquire::Retries "5";'; \
) > /etc/apt/apt.conf.d/99cpython-portable

RUN ( echo 'amd64'; \
echo 'i386'; \
) > /var/lib/dpkg/arch

# apt iterates all available file descriptors up to rlim_max and calls
# fcntl(fd, F_SETFD, FD_CLOEXEC). This can result in millions of system calls
# (we've seen 1B in the wild) and cause operations to take seconds to minutes.
Expand Down
6 changes: 3 additions & 3 deletions cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ fi

# Configure nerfs RUNSHARED when cross-compiling, which prevents PGO from running when
# we can in fact run the target binaries (e.g. x86_64 host and i686 target). Undo that.
# TODO this may not be needed after removing support for i686 builds. But it
# may still be useful since CPython's definition of cross-compiling has historically
# been very liberal and kicks in when it arguably shouldn't.
if [ -n "${CROSS_COMPILING}" ]; then
if [ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" ]; then
patch -p1 -i ${ROOT}/patch-dont-clear-runshared-14.patch
Expand Down Expand Up @@ -1058,9 +1061,6 @@ armv7-unknown-linux-gnueabi)
armv7-unknown-linux-gnueabihf)
PYTHON_ARCH="arm-linux-gnueabihf"
;;
i686-unknown-linux-gnu)
PYTHON_ARCH="i386-linux-gnu"
;;
mips-unknown-linux-gnu)
PYTHON_ARCH="mips-linux-gnu"
;;
Expand Down
6 changes: 0 additions & 6 deletions cpython-unix/build-libX11.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ if [ -n "${CROSS_COMPILING}" ]; then
armv7-unknown-linux-gnueabihf)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
i686-unknown-linux-gnu)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
mips-unknown-linux-gnu)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
Expand All @@ -81,9 +78,6 @@ if [ -n "${CROSS_COMPILING}" ]; then
aarch64-unknown-linux-musl)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
i686-unknown-linux-musl)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
mips-unknown-linux-musl)
EXTRA_FLAGS="${EXTRA_FLAGS} --enable-malloc0returnsnull"
;;
Expand Down
2 changes: 1 addition & 1 deletion cpython-unix/build-xcb-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pkg-config --version
export PATH=/tools/${TOOLCHAIN}/bin:/tools/host/bin:$PATH
export PKG_CONFIG_PATH=/tools/deps/share/pkgconfig

tar -xf xcb-proto-${XCB_PROTO_VERSION}.tar.gz
tar -xf xcb-proto-${XCB_PROTO_VERSION}.tar.xz
pushd xcb-proto-${XCB_PROTO_VERSION}

CFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" LDFLAGS="${EXTRA_TARGET_LDFLAGS}" ./configure \
Expand Down
4 changes: 0 additions & 4 deletions cpython-unix/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{% include 'base.Dockerfile' %}

# libc6-dev:i386 pulls in 32-bit system libraries to enable cross-compiling
# to i386.
#
# libffi-dev and zlib1g-dev are present so host Python (during cross-builds)
# can build the ctypes and zlib extensions. So comment in build-cpython.sh
# for more context.
Expand All @@ -14,7 +11,6 @@ RUN ulimit -n 10000 && apt-get install \
bzip2 \
file \
libc6-dev \
libc6-dev:i386 \
libffi-dev \
make \
patch \
Expand Down
21 changes: 21 additions & 0 deletions cpython-unix/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def simple_build(
dest_archive,
extra_archives=None,
tools_path="deps",
python_host_version=None,
):
archive = download_entry(entry, DOWNLOADS_PATH)

Expand All @@ -264,6 +265,15 @@ def simple_build(
for a in extra_archives or []:
build_env.install_artifact_archive(BUILD, a, target_triple, build_options)

if python_host_version:
majmin = ".".join(python_host_version.split(".")[0:2])
build_env.install_toolchain_archive(
BUILD,
f"cpython-{majmin}",
host_platform,
version=python_host_version,
)

build_env.copy_file(archive)
build_env.copy_file(SUPPORT / ("build-%s.sh" % entry))

Expand Down Expand Up @@ -796,6 +806,7 @@ def build_cpython(
for p in sorted(packages):
build_env.install_artifact_archive(BUILD, p, target_triple, build_options)

# Install the host CPython.
build_env.install_toolchain_archive(
BUILD, entry_name, host_platform, version=python_version
)
Expand Down Expand Up @@ -1032,6 +1043,11 @@ def main():
default=None,
help="A custom path to CPython source files to use",
)
parser.add_argument(
"--python-host-version",
default=None,
help="Python X.Y version for host Python installation",
)
parser.add_argument("action")

args = parser.parse_args()
Expand All @@ -1047,6 +1063,8 @@ def main():
dest_archive = pathlib.Path(args.dest_archive)
docker_image = args.docker_image

python_host_version = args.python_host_version

settings = get_target_settings(TARGETS_CONFIG, target_triple)

if args.action == "dockerfiles":
Expand Down Expand Up @@ -1213,6 +1231,7 @@ def main():
target_triple=target_triple,
build_options=build_options,
dest_archive=dest_archive,
python_host_version=python_host_version,
)

elif action == "libxcb":
Expand All @@ -1226,6 +1245,7 @@ def main():
build_options=build_options,
dest_archive=dest_archive,
extra_archives={"libpthread-stubs", "libXau", "xcb-proto", "xorgproto"},
python_host_version=python_host_version,
)

elif action == "tix":
Expand Down Expand Up @@ -1260,6 +1280,7 @@ def main():
build_options=build_options,
dest_archive=dest_archive,
extra_archives=extra_archives,
python_host_version=python_host_version,
)

elif action.startswith("cpython-") and action.endswith("-host"):
Expand Down
3 changes: 0 additions & 3 deletions cpython-unix/extension-modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ _decimal:
- define: CONFIG_32=1
targets:
- armv7-.*
- i686-.*
- mips-.*
- mipsel-.*
- define: CONFIG_64=1
Expand Down Expand Up @@ -299,7 +298,6 @@ _hashlib:
# a static library so there isn't a runtime dependency.
- name: ':libatomic.a'
targets:
- i686-unknown-linux-gnu
- mips-unknown-linux-gnu
- mipsel-unknown-linux-gnu
- x86_64.*-unknown-linux-gnu
Expand Down Expand Up @@ -570,7 +568,6 @@ _ssl:
# a static library so there isn't a runtime dependency.
- name: ':libatomic.a'
targets:
- i686-unknown-linux-gnu
- mips-unknown-linux-gnu
- mipsel-unknown-linux-gnu
- x86_64.*-unknown-linux-gnu
Expand Down
46 changes: 0 additions & 46 deletions cpython-unix/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,52 +318,6 @@ armv7-unknown-linux-gnueabihf:
- zlib
openssl_target: linux-armv4

i686-unknown-linux-gnu:
host_platforms:
- linux_x86_64
pythons_supported:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
needs_toolchain: true
host_cc: clang
host_cxx: clang++
target_cc: clang
target_cxx: clang++
target_cflags:
- '-m32'
- '-fvisibility=hidden'
target_ldflags:
- '-m32'
needs:
- autoconf
- bdb
- binutils
- bzip2
- expat
- libedit
- libffi
- libX11
- libXau
- libxcb
- m4
- mpdecimal
- ncurses
- openssl-3.0
- patchelf
- sqlite
- tcl
- tk
- tix
- uuid
- xorgproto
- xz
- zlib
openssl_target: linux-x86-clang

mips-unknown-linux-gnu:
host_platforms:
- linux_x86_64
Expand Down
3 changes: 0 additions & 3 deletions cpython-unix/xcb.Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions cpython-unix/xcb.cross-riscv64.Dockerfile

This file was deleted.

3 changes: 0 additions & 3 deletions cpython-unix/xcb.cross.Dockerfile

This file was deleted.

18 changes: 8 additions & 10 deletions pythonbuild/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,11 @@
"licenses": ["MIT"],
"license_file": "LICENSE.libXau.txt",
},
# Newer versions of libxcb require a modern Python to build. We can take this
# dependency once we feel like doing the work.
"libxcb": {
"url": "https://xcb.freedesktop.org/dist/libxcb-1.14.tar.gz",
"size": 640322,
"sha256": "2c7fcddd1da34d9b238c9caeda20d3bd7486456fc50b3cc6567185dbd5b0ad02",
"version": "1.14",
"url": "https://xcb.freedesktop.org/dist/libxcb-1.17.0.tar.gz",
"size": 661593,
"sha256": "2c69287424c9e2128cb47ffe92171e10417041ec2963bceafb65cb3fcf8f0b85",
"version": "1.17.0",
"library_names": ["xcb"],
"licenses": ["MIT"],
"license_file": "LICENSE.libxcb.txt",
Expand Down Expand Up @@ -380,10 +378,10 @@
"version": "1.20.1",
},
"xcb-proto": {
"url": "https://www.x.org/archive/individual/proto/xcb-proto-1.14.1.tar.gz",
"size": 194674,
"sha256": "85cd21e9d9fbc341d0dbf11eace98d55d7db89fda724b0e598855fcddf0944fd",
"version": "1.14.1",
"url": "https://xcb.freedesktop.org/dist/xcb-proto-1.17.0.tar.xz",
"size": 151748,
"sha256": "2c1bacd2110f4799f74de6ebb714b94cf6f80fb112316b1219480fd22562148c",
"version": "1.17.0",
},
# Newer versions from at least 2023 have build failures for reasons we haven't
# fully investigated.
Expand Down
1 change: 0 additions & 1 deletion pythonbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def write_triples_makefiles(
image_suffix = settings.get("docker_image_suffix", "")

lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)

entry = clang_toolchain(host_platform, triple)
lines.append(
Expand Down