archlinux-s390x/patches/pkgbuild/openssl.sh

45 lines
1.9 KiB
Bash
Raw Normal View History

[FIX] openssl: s390x needs the 64-bit Configure target The PKGBUILD composes its target as "linux-$CARCH", giving linux-s390x. That IS a valid OpenSSL target -- it is the 31-bit one. The 64-bit target is linux64-s390x. This one hid well. The log ends on Configuring OpenSSL version 3.6.3 for target linux-s390x and then fails, with the failure appearing to come from nowhere: the target name is right there, it looks correct, and nothing says the build is 31-bit on a 64-bit system. Four rounds of keyword grepping found nothing, because the answer was not in the log at all -- it was in the PKGBUILD, one line above the command that printed it. The PKGBUILD already special-cases exactly this for riscv64, so s390x joins that case rather than getting a mechanism of its own. filesystem now builds: the gid 11 the host was missing was the whole of it. --- FR --- Le PKGBUILD compose sa cible en « linux-$CARCH », ce qui donne linux-s390x. C EST une cible OpenSSL valide -- celle du 31 bits. La cible 64 bits s appelle linux64-s390x. Celle-la se cachait bien. Le journal s acheve sur Configuring OpenSSL version 3.6.3 for target linux-s390x puis echoue, et l echec semble venir de nulle part : le nom de la cible est la, il a l air juste, et rien ne dit qu on batit du 31 bits sur un systeme 64 bits. Quatre tours de recherche par mots-cles n ont rien trouve, parce que la reponse n etait pas dans le journal -- elle etait dans le PKGBUILD, une ligne au-dessus de la commande qui l imprimait. Le PKGBUILD traite deja exactement ce cas pour riscv64 ; s390x rejoint donc cette branche plutot que d obtenir un mecanisme a lui. filesystem se construit desormais : le gid 11 absent de l hote etait tout le probleme. Assisted-by: Claude Opus 5
2026-08-16 22:50:01 -04:00
#!/usr/bin/env bash
# openssl: s390x needs the 64-bit Configure target.
#
# The PKGBUILD composes its target as "linux-$CARCH", which gives
# linux-s390x. That IS a valid OpenSSL target -- it is the 31-bit one. The
# 64-bit target is linux64-s390x, and building 31-bit objects on a 64-bit
# system fails without ever saying so plainly: the log ends on
#
# Configuring OpenSSL version 3.6.3 for target linux-s390x
#
# and the failure looks like it came from nowhere.
#
# The PKGBUILD already special-cases exactly this for riscv64, so the fix is
# to join that case rather than invent a mechanism.
set -euo pipefail
python3 - <<'PY'
import io
s = io.open("PKGBUILD", encoding="utf-8").read()
old = '\t"riscv64")\n'
assert old in s, "riscv64 case not found"
s = s.replace(old, '\t"s390x" | "riscv64")\n', 1)
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
PY
grep -q '"s390x" | "riscv64")' PKGBUILD || { echo "openssl: case not extended" >&2; exit 1; }
echo "openssl: Configure target set to linux64-s390x (linux-s390x is 31-bit)"
[FIX] openssl: s390x is big-endian, drop the little-endian EC path crypto/ec/ec_local.h:520:2: error: "Can not enable ec_nistp_64_gcc_128 on big-endian systems" Arch enables this elliptic-curve optimisation, which uses a 128-bit integer representation that assumes little-endian byte order. s390x is BIG-endian. This is the first time in the whole port that endianness -- rather than word size, instruction set or packaging layout -- decides anything. Ten packages so far diverged on 32-bit multilib, missing front ends or path conventions; this one diverges on how bytes are ordered in a word. OpenSSL refuses at compile time rather than producing wrong results, which is the right call and makes this one honest to diagnose. Dropping the flag costs some NIST curve performance and nothing else: the curves still work through the portable implementation. --- FR --- crypto/ec/ec_local.h:520:2: error: "Can not enable ec_nistp_64_gcc_128 on big-endian systems" Arch active cette optimisation de courbes elliptiques, qui repose sur une representation entiere 128 bits supposant l ordre petit-boutiste. s390x est GROS-boutiste. C est la premiere fois dans tout le portage que l endianness -- et non la taille de mot, le jeu d instructions ou la convention de chemins -- tranche quoi que ce soit. Dix paquets ont diverge jusqu ici sur le multilib 32 bits, des frontaux absents ou des dispositions de repertoires ; celui-ci diverge sur l ordre des octets dans un mot. OpenSSL refuse a la compilation plutot que de produire des resultats faux, ce qui est le bon choix et rend ce cas honnete a diagnostiquer. Retirer l option coute un peu de performance sur les courbes NIST, et rien d autre : elles fonctionnent par l implementation portable. Assisted-by: Claude Opus 5
2026-08-16 22:53:33 -04:00
# enable-ec_nistp_64_gcc_128: little-endian only.
#
# crypto/ec/ec_local.h:520:2: error:
# "Can not enable ec_nistp_64_gcc_128 on big-endian systems"
#
# Arch turns on this elliptic-curve optimisation, which uses a 128-bit
# integer representation that assumes little-endian byte order. s390x is
# BIG-endian -- the first time endianness, rather than word size or
# instruction set, decides anything in this port.
#
# OpenSSL refuses at compile time rather than producing wrong results, which
# is the right behaviour and makes this one honest to diagnose. Dropping the
# flag costs some NIST curve performance and nothing else: the curves still
# work through the portable implementation.
sed -i '/enable-ec_nistp_64_gcc_128/d' PKGBUILD
grep -q 'enable-ec_nistp_64_gcc_128' PKGBUILD && {
echo "openssl: little-endian EC optimisation still enabled" >&2; exit 1; }
echo "openssl: ec_nistp_64_gcc_128 disabled (s390x is big-endian)"