commit:     5b89df93ef88388f452bf3d2caf6337c5314395d
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Sun Apr  6 14:01:39 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 10 10:38:05 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b89df93

dev-libs/ffcall: fix build w/ clang

1. apply patch from upstream
2. ignore PROT_MPROTECT for linux, which is NetBSD only

Closes: https://bugs.gentoo.org/829663
Closes: https://bugs.gentoo.org/943754
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/41474
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/ffcall/ffcall-2.5.ebuild                  | 12 ++++-
 .../files/ffcall-2.5-add-support-for-clang.patch   | 53 ++++++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/dev-libs/ffcall/ffcall-2.5.ebuild 
b/dev-libs/ffcall/ffcall-2.5.ebuild
index 7f9d8f6bfae9..2ab0965e1c5c 100644
--- a/dev-libs/ffcall/ffcall-2.5.ebuild
+++ b/dev-libs/ffcall/ffcall-2.5.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=8
 
-inherit flag-o-matic libtool
+inherit autotools flag-o-matic libtool
 
 MY_PV="libffcall-${PV}"
 
@@ -19,6 +19,10 @@ LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos"
 
+PATCHES=(
+       "${FILESDIR}"/ffcall-2.5-add-support-for-clang.patch
+)
+
 src_prepare() {
        # The build system is a strange mix of autogenerated
        # files and manual tweaks on top. Uses $CFLAGS / $LDFLAGS randomly.
@@ -35,6 +39,12 @@ src_prepare() {
 
        default
        elibtoolize
+       eautoreconf
+
+       if use kernel_linux ; then
+               QA_CONFIG_IMPL_DECL_SKIP=( PROT_MPROTECT )
+       fi
+
 }
 
 src_configure() {

diff --git a/dev-libs/ffcall/files/ffcall-2.5-add-support-for-clang.patch 
b/dev-libs/ffcall/files/ffcall-2.5-add-support-for-clang.patch
new file mode 100644
index 000000000000..2a8cc2676401
--- /dev/null
+++ b/dev-libs/ffcall/files/ffcall-2.5-add-support-for-clang.patch
@@ -0,0 +1,53 @@
+https://git.savannah.gnu.org/cgit/libffcall.git/commit/?id=fe6d9f089d8326b077420c10fec8c2174557be30
+
+From fe6d9f089d8326b077420c10fec8c2174557be30 Mon Sep 17 00:00:00 2001
+From: Bruno Haible <[email protected]>
+Date: Tue, 20 Aug 2024 13:38:19 +0200
+Subject: [PATCH] Add support for Android.
+
+* m4/cc-gcc.m4 (CL_CC_GCC): If using clang as compiler, add the option
+-no-integrated-as to GCC_X_NONE.
+* NEWS: Mention Android as supported.
+
+diff --git a/m4/cc-gcc.m4 b/m4/cc-gcc.m4
+index 1e12d8e..97c2dac 100644
+--- a/m4/cc-gcc.m4
++++ b/m4/cc-gcc.m4
+@@ -1,5 +1,5 @@
+ dnl -*- Autoconf -*-
+-dnl Copyright (C) 1993-2017 Free Software Foundation, Inc.
++dnl Copyright (C) 1993-2024 Free Software Foundation, Inc.
+ dnl This file is free software, distributed under the terms of the GNU
+ dnl General Public License as published by the Free Software Foundation;
+ dnl either version 2 of the License, or (at your option) any later version.
+@@ -27,6 +27,27 @@ AC_DEFUN([CL_CC_GCC],
+   if test $cl_cv_prog_cc_gcc = yes; then
+     CC_GCC=true
+     GCC_X_NONE='-x none'
++
++    dnl On arm, there are two slightly different syntaxes for assembly 
language:
++    dnl The "divided" syntax (standard since ca. 2000) and the "unified" 
syntax
++    dnl (supported by GNU binutils since 2009).  See
++    dnl 
https://sourceware.org/binutils/docs/as/ARM_002dInstruction_002dSet.html
++    dnl While GNU as and thus GCC supports both, clang by default uses an
++    dnl "integrated" assembler that supports only the "unified" syntax, 
leading
++    dnl to errors "error: invalid instruction" on instructions such as 
stmeqia.
++    dnl We therefore need to tell clang to use the external assembler.
++    AC_CACHE_CHECK([whether using clang], [cl_cv_prog_cc_clang],
++      [AC_EGREP_CPP([yes],
++         [#ifdef __clang__
++          yes
++          #endif
++         ],
++         [cl_cv_prog_cc_clang=yes],
++         [cl_cv_prog_cc_clang=no])
++      ])
++    if test $cl_cv_prog_cc_clang = yes; then
++      GCC_X_NONE="$GCC_X_NONE -no-integrated-as"
++    fi
+   else
+     CC_GCC=false
+     GCC_X_NONE=''
+-- 
+2.45.2
+

Reply via email to