Skip to content

Commit

Permalink
devel/lightning: Fix build on armv6/armv7
Browse files Browse the repository at this point in the history
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
  • Loading branch information
clausecker authored and 5u623l20 committed Nov 30, 2022
1 parent 30be1d3 commit fc86afb
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
16 changes: 12 additions & 4 deletions devel/lightning/Makefile
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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>
11 changes: 11 additions & 0 deletions 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);
20 changes: 20 additions & 0 deletions 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)
{

0 comments on commit fc86afb

Please sign in to comment.