commit:     28561f34fc266ed077cfa514ad8206c8faafa032
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Thu May 15 14:42:37 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May 22 15:58:48 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28561f34

dev-util/unicorn: don't call strings directly

Closes: https://bugs.gentoo.org/940715
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/42100
Closes: https://github.com/gentoo/gentoo/pull/42100
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/unicorn/files/unicorn-2.1.3-strings.patch | 40 ++++++++++++++++++++++
 dev-util/unicorn/unicorn-2.1.3.ebuild              |  8 ++++-
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/dev-util/unicorn/files/unicorn-2.1.3-strings.patch 
b/dev-util/unicorn/files/unicorn-2.1.3-strings.patch
new file mode 100644
index 000000000000..00cf498d15e7
--- /dev/null
+++ b/dev-util/unicorn/files/unicorn-2.1.3-strings.patch
@@ -0,0 +1,40 @@
+https://github.com/unicorn-engine/unicorn/pull/2186
+
+From e57d319971005235cc6946f0ba9e832a339aecb1 Mon Sep 17 00:00:00 2001
+From: "Z. Liu" <[email protected]>
+Date: Thu, 15 May 2025 21:50:55 +0800
+Subject: [PATCH] qemu/configure: make strings command can be redefined by
+ ${STRINGS}
+
+Signed-off-by: Z. Liu <[email protected]>
+---
+ qemu/configure | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/qemu/configure b/qemu/configure
+index e8eb427c..af3781c3 100755
+--- a/qemu/configure
++++ b/qemu/configure
+@@ -339,6 +339,7 @@ ld="${LD-${cross_prefix}ld}"
+ ranlib="${RANLIB-${cross_prefix}ranlib}"
+ nm="${NM-${cross_prefix}nm}"
+ strip="${STRIP-${cross_prefix}strip}"
++strings="${STRINGS-${cross_prefix}strings}"
+ pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
+ query_pkg_config() {
+     "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
+@@ -1233,9 +1234,9 @@ int main(int argc, char *argv[]) {
+ EOF
+ 
+ if compile_object ; then
+-    if strings -a $TMPO | grep -q BiGeNdIaN ; then
++    if ${strings} -a $TMPO | grep -q BiGeNdIaN ; then
+         bigendian="yes"
+-    elif strings -a $TMPO | grep -q LiTtLeEnDiAn ; then
++    elif ${strings} -a $TMPO | grep -q LiTtLeEnDiAn ; then
+         bigendian="no"
+     else
+         echo big/little test failed
+-- 
+2.45.2
+

diff --git a/dev-util/unicorn/unicorn-2.1.3.ebuild 
b/dev-util/unicorn/unicorn-2.1.3.ebuild
index 0b60c04c3d9b..dd0f2cf96f16 100644
--- a/dev-util/unicorn/unicorn-2.1.3.ebuild
+++ b/dev-util/unicorn/unicorn-2.1.3.ebuild
@@ -9,7 +9,7 @@ DISTUTILS_USE_PEP517=setuptools
 DISTUTILS_OPTIONAL=1
 PYTHON_COMPAT=( python3_{10..13} )
 
-inherit cmake distutils-r1
+inherit cmake distutils-r1 toolchain-funcs
 
 DESCRIPTION="A lightweight multi-platform, multi-architecture CPU emulator 
framework"
 HOMEPAGE="https://www.unicorn-engine.org";
@@ -44,6 +44,10 @@ UNICORN_TARGETS="x86 arm aarch64 riscv mips sparc m68k ppc 
s390x tricore"
 
 export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}
 
+PATCHES=(
+       "${FILESDIR}"/${PN}-2.1.3-strings.patch
+)
+
 wrap_python() {
        if use python; then
                # src_prepare
@@ -69,6 +73,8 @@ src_prepare() {
 }
 
 src_configure(){
+       tc-export STRINGS
+
        local mycmakeargs=(
                -DUNICORN_ARCH="${UNICORN_TARGETS// /;}"
                -DUNICORN_LOGGING=$(usex logging)

Reply via email to