From 40d487cabaece1195ee77d63eab80f4bc27c8ef6 Mon Sep 17 00:00:00 2001 From: jolavillette Date: Sun, 16 Aug 2026 21:24:45 +0200 Subject: [PATCH] Android: skip the rnp cross-compile patch when upstream already has it rnp merged the CMAKE_CROSSCOMPILING_EMULATOR support that this script adds by hand (rnpgp/rnp 0a0672af, merged 2026-07-31), and LIBRNP_SOURCE_VERSION tracks origin/main, so the sed patches now land on top of the upstream code: the emulator is prepended to FOF twice and the OpenSSL feature probe runs "qemu-aarch64 /usr/bin/qemu-aarch64 build/findopensslfeatures", which dies with CMake Error at cmake/Modules/FindOpenSSLFeatures.cmake:184 (message): Error getting supported OpenSSL hashes: 255 qemu-aarch64: /usr/bin/qemu-aarch64: Invalid ELF image for this architecture Guard the patch on the checkout not handling the emulator itself, so both current main and an older pinned rnp still configure. Co-Authored-By: Claude Opus 5 (1M context) --- misc/Android/prepare-toolchain-clang.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/misc/Android/prepare-toolchain-clang.sh b/misc/Android/prepare-toolchain-clang.sh index 43f2103de..ca3270c9b 100755 --- a/misc/Android/prepare-toolchain-clang.sh +++ b/misc/Android/prepare-toolchain-clang.sh @@ -859,8 +859,18 @@ build_librnp() # 3. Add -static linking via MKF so the binary doesn't need the Android # dynamic linker which is unavailable on the host even via qemu # 4. Remove quotes around FOF so CMake expands the list correctly - # TODO: remove when upstream patches are accepted # + # Skip the patch when the checkout already handles the emulator on its own: + # rnp got this upstream (rnpgp/rnp 0a0672af, merged 2026-07-31) and + # LIBRNP_SOURCE_VERSION tracks origin/main, so patching on top of it + # prepends the emulator twice and the probe becomes + # "qemu-aarch64 /usr/bin/qemu-aarch64 build/findopensslfeatures", which + # fails with "Invalid ELF image for this architecture". + # TODO: drop the whole block once no supported rnp version needs it + # + grep -q CMAKE_CROSSCOMPILING_EMULATOR \ + "${S_dir}/cmake/Modules/FindOpenSSLFeatures.cmake" || + { sed -i '/foreach(feature "hashes"/i\ if(CMAKE_CROSSCOMPILING_EMULATOR)\ set(FOF ${CMAKE_CROSSCOMPILING_EMULATOR} ${FOF})\ @@ -877,6 +887,7 @@ endif(CMAKE_CROSSCOMPILING_EMULATOR)' \ sed -i 's|COMMAND "${FOF}" "${feature}"|COMMAND ${FOF} "${feature}"|' \ "${S_dir}/cmake/Modules/FindOpenSSLFeatures.cmake" + } rm -rf "$B_dir"; mkdir "$B_dir" pushd "$B_dir" || return $?