From bc133dafc47c7dc507eb5e1d8ee4ebe98d6e82ee Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 4 Dec 2024 15:39:17 -0500 Subject: [PATCH 1/3] autoconf: Sync config.guess, config.sub with CPython repo `config.sub.patch` is derived from: https://github.com/python/cpython/commit/bee7bb3310b356e99e3a0f75f23efbc97f1b0a24 https://lists.gnu.org/archive/html/config-patches/2024-02/msg00001.html --- autoconf/Dockerfile | 13 ++++++++ autoconf/config.sub.patch | 63 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 autoconf/config.sub.patch diff --git a/autoconf/Dockerfile b/autoconf/Dockerfile index da9abba..af6be6e 100644 --- a/autoconf/Dockerfile +++ b/autoconf/Dockerfile @@ -3,6 +3,10 @@ FROM docker.io/library/ubuntu:24.04 ARG AUTOCONF_VERSION="2.72" ARG AUTOCONF_ARCHIVE_VERSION="2023.02.20" ARG AUTOMAKE_VERSION="1.16.5" +# Specific revisions of https://git.savannah.gnu.org/git/config.git +# for config.guess and config.sub. +ARG CONFIG_GUESS_REV="9428e344e65176b03b69e4bf4ed0d0fc51d4c26f" +ARG CONFIG_SUB_REV="948ae97ca5703224bd3eada06b7a69f40dd15a02" LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers" LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" @@ -40,6 +44,15 @@ RUN PATCH_VERBOSE=1 curl https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archi && ./configure --prefix=/usr/local \ && make \ && make install +ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=${CONFIG_GUESS_REV} \ + /usr/local/share/autoconf/build-aux/config.guess +ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=${CONFIG_SUB_REV} \ + /usr/local/share/autoconf/build-aux/config.sub +COPY config.sub.patch . +RUN p=$(pwd)/config.sub.patch \ + && cd /usr/local/share/autoconf/build-aux \ + && patch -p1 <$p \ + && rm "$p" # https://stackoverflow.com/questions/8811381/possibly-undefined-macro-ac-msg-error/49103418#49103418 RUN cp /usr/local/share/aclocal/*.m4 /usr/share/aclocal \ diff --git a/autoconf/config.sub.patch b/autoconf/config.sub.patch new file mode 100644 index 0000000..827d50c --- /dev/null +++ b/autoconf/config.sub.patch @@ -0,0 +1,63 @@ +From bee7bb3310b356e99e3a0f75f23efbc97f1b0a24 Mon Sep 17 00:00:00 2001 +From: Russell Keith-Magee +Date: Mon, 26 Feb 2024 09:21:10 +0800 +Subject: [PATCH] config.sub: Include support for arm64_32 and iOS/tvOS/watchOS + simulators + + * Normalise the watchOS CPU architecture descriptor used by + Apple (`arm64_32`). + * Accept the `-simulator` suffix for descriptors for iOS, tvOS and + watchOS. + +The following is the list of compiler triples generated by Apple's +clang toolchains for iOS 12.0, tvOS 9.0, and watchOS 4.0: + + * `arm64-apple-ios12.0` + * `x86_64-apple-ios12.0-simulator` + * `arm64-apple-ios12.0-simulator` + * `arm64-apple-tvos9.0` + * `x86_64-apple-tvos9.0-simulator` + * `arm64-apple-tvos9.0-simulator` + * `arm64_32-apple-watchos4.0` + * `arm64-apple-watchos4.0-simulator` + +The `-simulator` suffix is significant because iOS devices and iOS +simulators have a different ABI. It is therefore essential that these +can be differentiated in a compiler triple. +--- + config.sub | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/config.sub b/config.sub +index 2c6a07a..1bb6a05 100755 +--- a/config.sub ++++ b/config.sub +@@ -4,6 +4,7 @@ + + # shellcheck disable=SC2006,SC2268 # see below for rationale + ++# Patched 2024-02-03 to include support for arm64_32 and iOS/tvOS/watchOS simulators + timestamp='2024-01-01' + + # This file is free software; you can redistribute it and/or modify it +@@ -1127,7 +1128,7 @@ case $cpu-$vendor in + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; +- arm64-* | aarch64le-*) ++ arm64-* | aarch64le-* | arm64_32-*) + cpu=aarch64 + ;; + +@@ -1866,6 +1867,8 @@ case $kernel-$os-$obj in + ;; + *-eabi*- | *-gnueabi*-) + ;; ++ ios*-simulator- | tvos*-simulator- | watchos*-simulator- ) ++ ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format +-- +2.47.1 + From 2941b7e7b519a55713ff304fb538ed5cf05ee321 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 7 Jan 2025 04:02:29 -0500 Subject: [PATCH 2/3] autoconf: Update config.guess and config.sub Also refresh `config.sub.patch` to match . --- autoconf/Dockerfile | 9 ++++----- autoconf/config.sub.patch | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/autoconf/Dockerfile b/autoconf/Dockerfile index af6be6e..9e809fb 100644 --- a/autoconf/Dockerfile +++ b/autoconf/Dockerfile @@ -3,10 +3,9 @@ FROM docker.io/library/ubuntu:24.04 ARG AUTOCONF_VERSION="2.72" ARG AUTOCONF_ARCHIVE_VERSION="2023.02.20" ARG AUTOMAKE_VERSION="1.16.5" -# Specific revisions of https://git.savannah.gnu.org/git/config.git +# Specific revision of https://git.savannah.gnu.org/git/config.git # for config.guess and config.sub. -ARG CONFIG_GUESS_REV="9428e344e65176b03b69e4bf4ed0d0fc51d4c26f" -ARG CONFIG_SUB_REV="948ae97ca5703224bd3eada06b7a69f40dd15a02" +ARG CONFIG_GIT_REV="00b15927496058d23e6258a28d8996f87cf1f191" LABEL org.opencontainers.image.source="https://github.com/python/cpython-devcontainers" LABEL org.opencontainers.image.base.name="docker.io/library/ubuntu:22.04" @@ -44,9 +43,9 @@ RUN PATCH_VERBOSE=1 curl https://ftp.gnu.org/gnu/autoconf-archive/autoconf-archi && ./configure --prefix=/usr/local \ && make \ && make install -ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=${CONFIG_GUESS_REV} \ +ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=${CONFIG_GIT_REV} \ /usr/local/share/autoconf/build-aux/config.guess -ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=${CONFIG_SUB_REV} \ +ADD --chmod=755 https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=${CONFIG_GIT_REV} \ /usr/local/share/autoconf/build-aux/config.sub COPY config.sub.patch . RUN p=$(pwd)/config.sub.patch \ diff --git a/autoconf/config.sub.patch b/autoconf/config.sub.patch index 827d50c..3cbd448 100644 --- a/autoconf/config.sub.patch +++ b/autoconf/config.sub.patch @@ -1,4 +1,4 @@ -From bee7bb3310b356e99e3a0f75f23efbc97f1b0a24 Mon Sep 17 00:00:00 2001 +From 7a7c6fc48512405ede8b2db440b702e866364b00 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Mon, 26 Feb 2024 09:21:10 +0800 Subject: [PATCH] config.sub: Include support for arm64_32 and iOS/tvOS/watchOS @@ -25,22 +25,23 @@ The `-simulator` suffix is significant because iOS devices and iOS simulators have a different ABI. It is therefore essential that these can be differentiated in a compiler triple. --- - config.sub | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) + config.sub | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config.sub b/config.sub -index 2c6a07a..1bb6a05 100755 +index 4aaae46..335706d 100755 --- a/config.sub +++ b/config.sub -@@ -4,6 +4,7 @@ +@@ -4,7 +4,7 @@ - # shellcheck disable=SC2006,SC2268 # see below for rationale + # shellcheck disable=SC2006,SC2268,SC2162 # see below for rationale -+# Patched 2024-02-03 to include support for arm64_32 and iOS/tvOS/watchOS simulators - timestamp='2024-01-01' +-timestamp='2024-05-27' ++timestamp='2025-01-06' # This file is free software; you can redistribute it and/or modify it -@@ -1127,7 +1128,7 @@ case $cpu-$vendor in + # under the terms of the GNU General Public License as published by +@@ -1194,7 +1194,7 @@ case $cpu-$vendor in xscale-* | xscalee[bl]-*) cpu=`echo "$cpu" | sed 's/^xscale/arm/'` ;; @@ -49,7 +50,7 @@ index 2c6a07a..1bb6a05 100755 cpu=aarch64 ;; -@@ -1866,6 +1867,8 @@ case $kernel-$os-$obj in +@@ -2249,6 +2249,8 @@ case $kernel-$os-$obj in ;; *-eabi*- | *-gnueabi*-) ;; From 5668d85da62852879975bce7243b2ff7f33b11fc Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 7 Jan 2025 04:09:11 -0500 Subject: [PATCH 3/3] autoconf: Force overwrite the `--install` files Also, use `set -x` to make troubleshooting easier. --- autoconf/entry.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/autoconf/entry.sh b/autoconf/entry.sh index 5075608..d73b08c 100755 --- a/autoconf/entry.sh +++ b/autoconf/entry.sh @@ -22,6 +22,14 @@ if [ "$#" = "0" ]; then fi echo "Rebuilding configure script using $($AUTOCONF --version | head -n 1)" + set -x + # autoreconf's '--force' option doesn't affect any of the files installed + # by the '--install' option. Remove the files to truly force them to be + # updated so that the CPython repo doesn't drift from this repo. + rm -f /src/aclocal.m4 + rm -f /src/config.guess + rm -f /src/config.sub + rm -f /src/install-sh exec $AUTORECONF -ivf -Werror $@ fi