Skip to content
Open
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
6 changes: 3 additions & 3 deletions cpython-unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ $(OUTDIR)/ncurses-$(NCURSES_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS
$(OUTDIR)/openssl-1.1-$(OPENSSL_1.1_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-openssl-1.1.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) openssl-1.1

$(OUTDIR)/openssl-3.0-$(OPENSSL_3.0_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-openssl-3.0.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) openssl-3.0
$(OUTDIR)/openssl-3.5-$(OPENSSL_3.5_VERSION)-$(PACKAGE_SUFFIX).tar: $(PYTHON_DEP_DEPENDS) $(HERE)/build-openssl-3.5.sh
$(RUN_BUILD) --docker-image $(DOCKER_IMAGE_BUILD) openssl-3.5

LIBEDIT_DEPENDS = \
$(PYTHON_DEP_DEPENDS) \
Expand Down Expand Up @@ -262,7 +262,7 @@ PYTHON_DEPENDS_$(1) := \
$$(if $$(NEED_MPDECIMAL),$$(OUTDIR)/mpdecimal-$$(MPDECIMAL_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_NCURSES),$$(OUTDIR)/ncurses-$$(NCURSES_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_OPENSSL_1_1),$$(OUTDIR)/openssl-1.1-$$(OPENSSL_1.1_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_OPENSSL_3_0),$$(OUTDIR)/openssl-3.0-$$(OPENSSL_3.0_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_OPENSSL_3_5),$$(OUTDIR)/openssl-3.5-$$(OPENSSL_3.5_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_PATCHELF),$$(OUTDIR)/patchelf-$$(PATCHELF_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_SQLITE),$$(OUTDIR)/sqlite-$$(SQLITE_VERSION)-$$(PACKAGE_SUFFIX).tar) \
$$(if $$(NEED_TCL),$$(OUTDIR)/tcl-$$(TCL_VERSION)-$$(PACKAGE_SUFFIX).tar) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ ROOT=`pwd`

export PATH=${TOOLS_PATH}/${TOOLCHAIN}/bin:${TOOLS_PATH}/host/bin:$PATH

tar -xf openssl-${OPENSSL_3_0_VERSION}.tar.gz
tar -xf openssl-${OPENSSL_3_5_VERSION}.tar.gz

pushd openssl-${OPENSSL_3_0_VERSION}
pushd openssl-${OPENSSL_3_5_VERSION}

# hardcode the vlenb CSR address (0xc22) as our GCC version doesn't know it
# https://github.com/riscv/riscv-isa-manual/blob/c001fa237cdd8b6079384044462a89eb0e3fd9cf/src/v-st-ext.adoc?plain=1#L74
if [[ "${TARGET_TRIPLE}" = "riscv64-unknown-linux-gnu" ]]; then
patch -p1 -i "${ROOT}/patch-openssl-3.5-riscv-vlenb-register.patch"
fi

# Otherwise it gets set to /tools/deps/ssl by default.
case "${TARGET_TRIPLE}" in
Expand Down
9 changes: 9 additions & 0 deletions cpython-unix/build.cross-riscv64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ RUN apt-get install \

# Cross-building.
RUN apt-get install \
g++-aarch64-linux-gnu \
g++-arm-linux-gnueabi \
g++-arm-linux-gnueabihf \
g++-mips-linux-gnu \
g++-mips64el-linux-gnuabi64 \
g++-mipsel-linux-gnu \
g++-powerpc64le-linux-gnu \
g++-riscv64-linux-gnu \
g++-s390x-linux-gnu \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
gcc-arm-linux-gnueabihf \
Expand Down
8 changes: 8 additions & 0 deletions cpython-unix/build.cross.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ RUN apt-get install \

# Cross-building.
RUN apt-get install \
g++-aarch64-linux-gnu \
g++-arm-linux-gnueabi \
g++-arm-linux-gnueabihf \
g++-mips-linux-gnu \
g++-mips64el-linux-gnuabi64 \
g++-mipsel-linux-gnu \
g++-powerpc64le-linux-gnu \
g++-s390x-linux-gnu \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
gcc-arm-linux-gnueabihf \
Expand Down
8 changes: 6 additions & 2 deletions cpython-unix/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,13 @@ def simple_build(

add_target_env(env, host_platform, target_triple, build_env)

if entry in ("openssl-1.1", "openssl-3.0"):
# for OpenSSL, set the OPENSSL_TARGET environment variable and copy in patches
if entry.startswith("openssl-"):
settings = get_targets(TARGETS_CONFIG)[target_triple]
env["OPENSSL_TARGET"] = settings["openssl_target"]
build_env.copy_file(
SUPPORT / "patch-openssl-3.5-riscv-vlenb-register.patch"
)

build_env.run("build-%s.sh" % entry, environment=env)

Expand Down Expand Up @@ -1113,7 +1117,7 @@ def main():
"mpdecimal",
"ncurses",
"openssl-1.1",
"openssl-3.0",
"openssl-3.5",
"patchelf",
"sqlite",
"tcl",
Expand Down
15 changes: 15 additions & 0 deletions cpython-unix/patch-openssl-3.5-riscv-vlenb-register.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/crypto/riscv64cpuid.pl b/crypto/riscv64cpuid.pl
index 5dcdc5c584..7751ad50d9 100644
--- a/crypto/riscv64cpuid.pl
+++ b/crypto/riscv64cpuid.pl
@@ -94,8 +94,8 @@ $code .= <<___;
.globl riscv_vlen_asm
.type riscv_vlen_asm,\@function
riscv_vlen_asm:
- csrr $ret, vlenb
- slli $ret, $ret, 3
+ csrr a0, 0xc22
+ slli a0, a0, 3
ret
.size riscv_vlen_asm,.-riscv_vlen_asm
___
53 changes: 28 additions & 25 deletions cpython-unix/targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ aarch64-apple-darwin:
- libffi
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- tcl
- tk
Expand Down Expand Up @@ -149,7 +149,7 @@ aarch64-apple-ios:
- libffi
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -190,7 +190,7 @@ aarch64-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -244,7 +244,7 @@ arm64-apple-tvos:
- expat
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -279,7 +279,7 @@ armv7-unknown-linux-gnueabi:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -320,7 +320,7 @@ armv7-unknown-linux-gnueabihf:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -361,7 +361,7 @@ mips-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -402,7 +402,7 @@ mipsel-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -443,7 +443,7 @@ ppc64le-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -484,7 +484,7 @@ riscv64-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand All @@ -511,6 +511,9 @@ s390x-unknown-linux-gnu:
host_cxx: /usr/bin/x86_64-linux-gnu-g++
target_cc: /usr/bin/s390x-linux-gnu-gcc
target_cxx: /usr/bin/s390x-linux-gnu-g++
target_cflags:
# set the minimum compatibility level to z10 (released 2008)
- '-march=z10'
needs:
- autoconf
- bdb
Expand All @@ -525,7 +528,7 @@ s390x-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -574,7 +577,7 @@ thumb7k-apple-watchos:
- expat
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -627,7 +630,7 @@ x86_64-apple-darwin:
- libffi
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- tcl
- tk
Expand Down Expand Up @@ -674,7 +677,7 @@ x86_64-apple-ios:
- libffi
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -717,7 +720,7 @@ x86_64-apple-tvos:
- expat
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -760,7 +763,7 @@ x86_64-apple-watchos:
- expat
- m4
- mpdecimal
- openssl-3.0
- openssl-3.5
- sqlite
- xz
- zstd
Expand Down Expand Up @@ -799,7 +802,7 @@ x86_64-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -846,7 +849,7 @@ x86_64_v2-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -893,7 +896,7 @@ x86_64_v3-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -940,7 +943,7 @@ x86_64_v4-unknown-linux-gnu:
- m4
- mpdecimal
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -985,7 +988,7 @@ x86_64-unknown-linux-musl:
- mpdecimal
- musl
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -1030,7 +1033,7 @@ x86_64_v2-unknown-linux-musl:
- mpdecimal
- musl
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -1075,7 +1078,7 @@ x86_64_v3-unknown-linux-musl:
- mpdecimal
- musl
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -1120,7 +1123,7 @@ x86_64_v4-unknown-linux-musl:
- mpdecimal
- musl
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down Expand Up @@ -1167,7 +1170,7 @@ aarch64-unknown-linux-musl:
- mpdecimal
- musl
- ncurses
- openssl-3.0
- openssl-3.5
- patchelf
- sqlite
- tcl
Expand Down
8 changes: 4 additions & 4 deletions cpython-windows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def hack_props(
raise Exception("unhandled architecture: %s" % arch)

try:
# CPython 3.11+ builds with OpenSSL 3.0 by default.
# CPython 3.11+ builds with OpenSSL 3.x by default.
static_replace_in_file(
openssl_props,
b"<_DLLSuffix>-3</_DLLSuffix>",
Expand Down Expand Up @@ -720,11 +720,11 @@ def build_openssl_for_arch(
log("extracting %s to %s" % (openssl_archive, build_root))
extract_tar_to_directory(openssl_archive, build_root)
log("extracting %s to %s" % (nasm_archive, build_root))
extract_tar_to_directory(nasm_archive, build_root)
extract_zip_to_directory(nasm_archive, build_root)
log("extracting %s to %s" % (jom_archive, build_root))
extract_zip_to_directory(jom_archive, build_root / "jom")

nasm_path = build_root / ("cpython-bin-deps-nasm-%s" % nasm_version)
nasm_path = build_root / ("nasm-%s" % nasm_version)
jom_path = build_root / "jom"

env = dict(os.environ)
Expand Down Expand Up @@ -1874,7 +1874,7 @@ def main() -> None:
if args.python in ("cpython-3.9", "cpython-3.10"):
openssl_entry = "openssl-1.1"
else:
openssl_entry = "openssl-3.0"
openssl_entry = "openssl-3.5"

openssl_archive = BUILD / (
"%s-%s-%s.tar" % (openssl_entry, target_triple, build_options)
Expand Down
Loading
Loading