commit:     b06fbe382208ce06556038081c9990e2375b123f
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Thu Jul 14 00:57:43 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 01:19:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b06fbe38

dev-libs/ffcall: Fix the build with slibtool

Bug: https://bugs.gentoo.org/776976
Upstream-ML: https://lists.gnu.org/archive/html/libffcall/2022-07/msg00000.html
Signed-off-by: orbea <orbea <AT> riseup.net>
Closes: https://github.com/gentoo/gentoo/pull/26394
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-libs/ffcall/ffcall-2.4-r1.ebuild            | 67 +++++++++++++++++++
 dev-libs/ffcall/files/ffcall-2.4-slibtool.patch | 86 +++++++++++++++++++++++++
 2 files changed, 153 insertions(+)

diff --git a/dev-libs/ffcall/ffcall-2.4-r1.ebuild 
b/dev-libs/ffcall/ffcall-2.4-r1.ebuild
new file mode 100644
index 000000000000..370cad023a20
--- /dev/null
+++ b/dev-libs/ffcall/ffcall-2.4-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic
+
+MY_PV="libffcall-${PV}"
+
+DESCRIPTION="Build foreign function call interfaces in embedded interpreter"
+HOMEPAGE="https://www.gnu.org/software/libffcall/";
+SRC_URI="mirror://gnu/libffcall/${MY_PV}.tar.gz"
+S="${WORKDIR}"/${MY_PV}
+
+# "Ffcall is under GNU GPL. As a special exception, if used in GNUstep
+# or in derivate works of GNUstep, the included parts of ffcall are
+# under GNU LGPL." -ffcall author
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
+
+PATCHES=(
+       # bug 842915, drop on next version bump
+       "${FILESDIR}"/${PN}-2.4-vacall-riscv-pic.patch
+       "${FILESDIR}"/${PN}-2.4-slibtool.patch # 776976
+)
+
+src_prepare() {
+       # The build system is a strange mix of autogenerated
+       # files and manual tweaks on top. Uses $CFLAGS / $LDFLAGS randomly.
+       # We are adding them consistently here and a bit over the top:
+       # bugs: #334581
+       local mfi
+       for mfi in {,*/,*/*/,}Makefile.in ; do
+               einfo "Patching '${mfi}'"
+               # usually uses only assembler here, but -march=
+               # and -Wa, are a must to pass here.
+               sed -e 's/$(CC) /&$(CFLAGS) /g' \
+                       -i "${mfi}" || die
+       done
+
+       default
+}
+
+src_configure() {
+       append-flags -fPIC
+
+       # Doc goes in datadir
+       econf \
+               --datadir="${EPREFIX}"/usr/share/doc/${PF} \
+               --enable-shared \
+               --disable-static
+}
+
+src_compile() {
+       # TODO. Remove -j1
+       emake -j1
+}
+
+src_install() {
+       dodoc NEWS README
+       dodir /usr/share/man
+
+       default
+
+       find "${ED}" -name '*.la' -delete || die
+}

diff --git a/dev-libs/ffcall/files/ffcall-2.4-slibtool.patch 
b/dev-libs/ffcall/files/ffcall-2.4-slibtool.patch
new file mode 100644
index 000000000000..73c896c4f211
--- /dev/null
+++ b/dev-libs/ffcall/files/ffcall-2.4-slibtool.patch
@@ -0,0 +1,86 @@
+Bug: https://bugs.gentoo.org/776976
+Upstream-ML: https://lists.gnu.org/archive/html/libffcall/2022-07/msg00000.html
+
+From: orbea <[email protected]>
+Date: Wed, 13 Jul 2022 17:45:05 -0700
+Subject: [PATCH] build: Fix the build with slibtool
+
+Using symlinks to create dummy .lo files does not work with slibtool
+which tries to find the corresponding .o file which doesn't exist.
+
+Its better to use the real .lo file instead.
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -2,6 +2,8 @@
+ 
+ #### Start of system configuration section. ####
+ 
++CPU = @HOST_CPU_C_ABI@
++
+ # Directories used by "make":
+ srcdir = @srcdir@
+ 
+@@ -69,8 +71,8 @@ ffcall-version.h : $(srcdir)/ffcall-version.in.h
+ ffcall-version.lo : $(srcdir)/ffcall-version.c ffcall-version.h config.h
+       $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) 
$(CFLAGS) -c $(srcdir)/ffcall-version.c
+ 
+-libffcall.la : ffcall-version.lo avcall/avcall.lo avcall/avcall-libapi.lo 
avcall/avcall-structcpy.lo callback/vacall_r/libvacall.la 
callback/trampoline_r/libtrampoline.la callback/callback-libapi.lo
+-      $(LIBTOOL_LINK) $(CC) $(CFLAGS) $(CFLAGS) -o libffcall.la -rpath 
$(libdir) -no-undefined -export-symbols-regex 
$(LIBFFCALL_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBFFCALL_VERSION_INFO) 
ffcall-version.lo avcall/avcall.lo avcall/avcall-libapi.lo 
avcall/avcall-structcpy.lo callback/vacall_r/vacall.lo 
callback/vacall_r/vacall-libapi.lo callback/vacall_r/vacall-structcpy.lo 
callback/trampoline_r/*.lo callback/callback-libapi.lo gnulib-lib/libgnu.la 
$(LDFLAGS) $(LTLIBTHREAD)
++libffcall.la : ffcall-version.lo avcall/avcall-$(CPU).lo 
avcall/avcall-libapi.lo avcall/avcall-structcpy.lo 
callback/vacall_r/libvacall.la callback/trampoline_r/libtrampoline.la 
callback/callback-libapi.lo
++      $(LIBTOOL_LINK) $(CC) $(CFLAGS) $(CFLAGS) -o libffcall.la -rpath 
$(libdir) -no-undefined -export-symbols-regex 
$(LIBFFCALL_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBFFCALL_VERSION_INFO) 
ffcall-version.lo avcall/avcall-$(CPU).lo avcall/avcall-libapi.lo 
avcall/avcall-structcpy.lo callback/vacall_r/vacall-$(CPU).lo 
callback/vacall_r/vacall-libapi.lo callback/vacall_r/vacall-structcpy.lo 
callback/trampoline_r/*.lo callback/callback-libapi.lo gnulib-lib/libgnu.la 
$(LDFLAGS) $(LTLIBTHREAD)
+ 
+ install : force
+       mkdir -p $(DESTDIR)$(prefix)
+--- a/avcall/Makefile.in
++++ b/avcall/Makefile.in
+@@ -58,7 +58,7 @@ SHELL = /bin/sh
+ # Needed by $(LIBTOOL).
+ top_builddir = ..
+ 
+-OBJECTS = avcall.lo avcall-libapi.lo avcall-structcpy.lo avcall-compat.lo
++OBJECTS = avcall-$(CPU).lo avcall-libapi.lo avcall-structcpy.lo 
avcall-compat.lo
+ 
+ # Limit the set of exported symbols, on those platforms where libtool 
supports it.
+ # Currently this does not exclude any symbol; maybe sometime in the future...
+@@ -70,11 +70,6 @@ LIBAVCALL_VERSION_INFO = 2:0:1
+ 
+ all : $(OBJECTS) libavcall.la $(srcdir)/avcall.3 $(srcdir)/avcall.html
+ 
+-avcall.lo : avcall-$(CPU).lo
+-      $(RM) avcall.lo avcall.@OBJEXT@
+-      $(LN) avcall-$(CPU).lo avcall.lo
+-      if test -f avcall-$(CPU).@OBJEXT@; then $(LN) avcall-$(CPU).@OBJEXT@ 
avcall.@OBJEXT@; fi
+-
+ @[email protected] : avcall-i386.s
+ @IFNOT_MSVC@  $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) @GCC_X_NONE@ -c avcall-i386.s
+ 
+--- a/callback/Makefile.in
++++ b/callback/Makefile.in
+@@ -77,7 +77,7 @@ callback-compat.lo : $(srcdir)/callback-compat.c ../config.h
+       $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c 
$(srcdir)/callback-compat.c
+ 
+ libcallback.la : vacall_r/libvacall.la trampoline_r/libtrampoline.la 
callback-libapi.lo callback-compat.lo
+-      $(LIBTOOL_LINK) $(CC) $(CFLAGS) -o libcallback.la -rpath $(libdir) 
-no-undefined -export-symbols-regex $(LIBCALLBACK_EXPORTED_SYMBOLS_REGEX) 
-version-info $(LIBCALLBACK_VERSION_INFO) vacall_r/vacall.lo 
vacall_r/vacall-libapi.lo vacall_r/vacall-structcpy.lo trampoline_r/*.lo 
callback-libapi.lo callback-compat.lo ../gnulib-lib/libgnu.la $(LDFLAGS) 
$(LTLIBTHREAD)
++      $(LIBTOOL_LINK) $(CC) $(CFLAGS) -o libcallback.la -rpath $(libdir) 
-no-undefined -export-symbols-regex $(LIBCALLBACK_EXPORTED_SYMBOLS_REGEX) 
-version-info $(LIBCALLBACK_VERSION_INFO) vacall_r/vacall-$(CPU).lo 
vacall_r/vacall-libapi.lo vacall_r/vacall-structcpy.lo trampoline_r/*.lo 
callback-libapi.lo callback-compat.lo ../gnulib-lib/libgnu.la $(LDFLAGS) 
$(LTLIBTHREAD)
+ 
+ # Installs the library and include files only. Typically called with only
+ # $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here.
+--- a/callback/vacall_r/Makefile.in
++++ b/callback/vacall_r/Makefile.in
+@@ -54,15 +54,10 @@ SHELL = /bin/sh
+ # Needed by $(LIBTOOL).
+ top_builddir = ../..
+ 
+-OBJECTS = vacall.lo vacall-libapi.lo vacall-structcpy.lo
++OBJECTS = vacall-$(CPU).lo vacall-libapi.lo vacall-structcpy.lo
+ 
+ all : $(OBJECTS) libvacall.la
+ 
+-vacall.lo : vacall-$(CPU).lo
+-      $(RM) vacall.lo vacall.@OBJEXT@
+-      $(LN) vacall-$(CPU).lo vacall.lo
+-      if test -f vacall-$(CPU).@OBJEXT@; then $(LN) vacall-$(CPU).@OBJEXT@ 
vacall.@OBJEXT@; fi
+-
+ @[email protected] : vacall-i386.s
+ @IFNOT_MSVC@  $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) @GCC_X_NONE@ -c vacall-i386.s
+ 

Reply via email to