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) <noreply@anthropic.com>
This commit is contained in:
jolavillette 2026-08-16 21:24:45 +02:00
parent 339c765235
commit 40d487caba

View File

@ -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 $?