git: 749ca3ec2e60 - 2022Q4 - devel/lightning: Fix build on armv6/armv7
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 30 Nov 2022 14:46:53 UTC
The branch 2022Q4 has been updated by bofh:
URL: https://cgit.FreeBSD.org/ports/commit/?id=749ca3ec2e60189bcce1736c2f44faf54496e958
commit 749ca3ec2e60189bcce1736c2f44faf54496e958
Author: Robert Clausecker <fuz@fuz.su>
AuthorDate: 2022-11-30 14:34:36 +0000
Commit: Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-11-30 14:46:31 +0000
devel/lightning: Fix build on armv6/armv7
Fix the problem that made the build fail with LLVM. However,
compiling with LLVM still leads to test suite failures on ARM
so we compile with gcc instead. The patch for LLVM is left
in for if a future version of the library fixes the problem.
PR: 268079
Reported by: fuz@fuz.su
MFH: 2022Q4
(cherry picked from commit fc86afb83def6fe03212dea1ad2e953daa735847)
---
devel/lightning/Makefile | 16 ++++++++++++----
devel/lightning/files/patch-check_lightning.c | 11 +++++++++++
devel/lightning/files/patch-lib_jit__arm-swf.c | 20 ++++++++++++++++++++
3 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/devel/lightning/Makefile b/devel/lightning/Makefile
index c2d441cbfcaf..2bf08dff09ef 100644
--- a/devel/lightning/Makefile
+++ b/devel/lightning/Makefile
@@ -11,8 +11,6 @@ LICENSE= LGPL3+
LICENSE_FILE= ${WRKSRC}/COPYING.LESSER
ONLY_FOR_ARCHS= aarch64 amd64 arm armv6 armv7 i386 mips powerpc powerpc64 powerpc64le powerpcspe sparc64
-BROKEN_armv6= fails to link: ../lib/.libs/liblightning.so: undefined reference to `__addsf3'
-BROKEN_armv7= fails to link: ../lib/.libs/liblightning.so: undefined reference to `__addsf3'
USES= cpe libtool pathfix
CPE_VENDOR= gnu
@@ -22,7 +20,7 @@ INSTALL_TARGET= install-strip
TEST_TARGET= check
USE_LDCONFIG= yes
-PLIST_SUB= JIT_ARCH=${ARCH:S/i386/x86/:S/amd64/x86/:S/x86_64/x86/:S/sparc64/sparc/:C/powerpc.*/ppc/}
+PLIST_SUB= JIT_ARCH=${ARCH:S/i386/x86/:S/amd64/x86/:S/x86_64/x86/:S/sparc64/sparc/:C/powerpc.C/ppc/:C/armv./arm/}
INFO= lightning
@@ -32,4 +30,14 @@ ASSERTIONS_DESC=Enable runtime code generation assertions
ASSERTIONS_CONFIGURE_ON=--enable-assertions=yes
ASSERTIONS_CONFIGURE_OFF=--enable-assertions=no
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${ARCH:Marmv?}
+USE_GCC= yes
+.endif
+
+pre-configure:
+ @${REINPLACE_CMD} -e \
+ 's|%%CC%%|${CC:T}|' ${WRKSRC}/check/lightning.c
+
+.include <bsd.port.post.mk>
diff --git a/devel/lightning/files/patch-check_lightning.c b/devel/lightning/files/patch-check_lightning.c
new file mode 100644
index 000000000000..31cad88264e6
--- /dev/null
+++ b/devel/lightning/files/patch-check_lightning.c
@@ -0,0 +1,11 @@
+--- check/lightning.c.orig 2022-11-08 16:00:32 UTC
++++ check/lightning.c
+@@ -4333,7 +4333,7 @@ main(int argc, char *argv[])
+ #else
+ # define cc "gcc"
+ #endif
+- opt_short = snprintf(cmdline, sizeof(cmdline), cc " -E -x c %s", argv[opt_index]);
++ opt_short = snprintf(cmdline, sizeof(cmdline), "%%CC%% -E -x c %s", argv[opt_index]);
+ opt_short += snprintf(cmdline + opt_short,
+ sizeof(cmdline) - opt_short,
+ " -D__WORDSIZE=%d", __WORDSIZE);
diff --git a/devel/lightning/files/patch-lib_jit__arm-swf.c b/devel/lightning/files/patch-lib_jit__arm-swf.c
new file mode 100644
index 000000000000..f2a77e8f03a1
--- /dev/null
+++ b/devel/lightning/files/patch-lib_jit__arm-swf.c
@@ -0,0 +1,20 @@
+--- lib/jit_arm-swf.c.orig 2022-11-30 10:43:45 UTC
++++ lib/jit_arm-swf.c
+@@ -402,7 +402,7 @@ static void _swf_vaarg_d(jit_state_t*, jit_int32_t, ji
+ BICI(rt, rn, encode_arm_immediate(im)); \
+ } while (0)
+
+-#if !defined(__GNUC__)
++#if !defined(__GNUC__) || defined(__llvm__)
+ float __addsf3(float u, float v)
+ {
+ return (u + v);
+@@ -414,6 +414,8 @@ __adddf3(double u, double v)
+ return (u + v);
+ }
+
++#endif
++#if !defined(__GNUC__)
+ float
+ __aeabi_fsub(float u, float v)
+ {