From aab7991bf5ec6b415931683ea57c5931ad374e98 Mon Sep 17 00:00:00 2001 From: Robert Kirkman Date: Fri, 3 Jan 2025 03:22:01 -0600 Subject: [PATCH] fix(main/swi-prolog): continue even if ABI check fails Fixes termux#22737 --- packages/swi-prolog/build.sh | 1 + .../continue-on-abi-check-failure.patch | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 packages/swi-prolog/continue-on-abi-check-failure.patch diff --git a/packages/swi-prolog/build.sh b/packages/swi-prolog/build.sh index 8ba64b263927774..a8f30f8e6c1fb33 100644 --- a/packages/swi-prolog/build.sh +++ b/packages/swi-prolog/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Most popular and complete prolog implementation" TERMUX_PKG_LICENSE="BSD 2-Clause" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="9.3.17" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://www.swi-prolog.org/download/devel/src/swipl-${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SHA256=0c091d56ea8c941e3af760af24134f60e1e06b1379af8dcd42492c82f5b3ac46 TERMUX_PKG_DEPENDS="libandroid-execinfo, libarchive, libcrypt, libgmp, libyaml, ncurses, openssl, ossp-uuid, readline, zlib, pcre2" diff --git a/packages/swi-prolog/continue-on-abi-check-failure.patch b/packages/swi-prolog/continue-on-abi-check-failure.patch new file mode 100644 index 000000000000000..30dff03320e7e6a --- /dev/null +++ b/packages/swi-prolog/continue-on-abi-check-failure.patch @@ -0,0 +1,30 @@ +swi-prolog cannot currently continue in Termux on 32-bit ARM architecture without this patch. +https://github.com/termux/termux-packages/issues/22737 +--- a/src/pl-init.c ++++ b/src/pl-init.c +@@ -256,11 +256,21 @@ check_home(const char *dir) + Ssnprintf(abi_file_name, sizeof(abi_file_name), + "%s/ABI", dir); + if ( (fd = Sopen_file(abi_file_name, "r")) ) +- { char *abi_string = Sfgets(abi_buf, sizeof(abi_buf), fd); ++ { char *build_time_abi_string = Sfgets(abi_buf, sizeof(abi_buf), fd); + Sclose(fd); +- if ( abi_string ) +- { remove_trailing_whitespace(abi_string); +- return match_abi_version(abi_version(), abi_string); ++ if ( build_time_abi_string ) ++ { remove_trailing_whitespace(build_time_abi_string); ++ char *run_time_abi_string = abi_version(); ++ if (match_abi_version(run_time_abi_string, build_time_abi_string) == 1) ++ { return true; ++ } else ++ { printf("WARNING: ABI mismatch!\n"); ++ printf("build time ABI found in %s: %s\n", abi_file_name, build_time_abi_string); ++ printf("run time ABI returned by abi_version(): %s\n", run_time_abi_string); ++ printf("attempting to continue for workaround purposes...\n"); ++ // returning true to force the error into a warning ++ return true; ++ } + } else + { return BAD_HOME_BAD_ABI; + }