judy: fix cross compilation

This commit is contained in:
Nick Cao 2022-01-23 18:30:18 +08:00
parent 63db2abf0d
commit 407a02edff
No known key found for this signature in database
GPG Key ID: 068A56CEF48FA2C1
2 changed files with 26 additions and 6 deletions

View File

@ -0,0 +1,22 @@
--- a/src/Judy1/Makefile.am
+++ b/src/Judy1/Makefile.am
@@ -18,7 +18,7 @@
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
Judy1Tables.c: Judy1TablesGen.c
- $(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o Judy1TablesGen Judy1TablesGen.c; ./Judy1TablesGen
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o Judy1TablesGen Judy1TablesGen.c; ./Judy1TablesGen
Judy1ByCount.c:../JudyCommon/JudyByCount.c
cp -f ../JudyCommon/JudyByCount.c Judy1ByCount.c
--- a/src/JudyL/Makefile.am
+++ b/src/JudyL/Makefile.am
@@ -18,7 +18,7 @@
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
JudyLTables.c: JudyLTablesGen.c
- $(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
+ $(CC_FOR_BUILD) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
JudyLByCount.c: ../JudyCommon/JudyByCount.c
cp -f ../JudyCommon/JudyByCount.c JudyLByCount.c

View File

@ -1,4 +1,4 @@
{lib, stdenv, fetchurl}:
{ lib, stdenv, fetchurl, pkgsBuildBuild, autoreconfHook }:
stdenv.mkDerivation rec {
pname = "judy";
@ -9,11 +9,9 @@ stdenv.mkDerivation rec {
sha256 = "1sv3990vsx8hrza1mvq3bhvv9m6ff08y4yz7swn6znszz24l0w6j";
};
# gcc 4.8 optimisations break judy.
# https://sourceforge.net/p/judy/mailman/message/31995144/
preConfigure = lib.optionalString stdenv.cc.isGNU ''
configureFlagsArray+=("CFLAGS=-fno-strict-aliasing -fno-aggressive-loop-optimizations")
'';
nativeBuildInputs = [ autoreconfHook ];
depsBuildBuild = [ pkgsBuildBuild.stdenv.cc ];
patches = [ ./cross.patch ];
# Disable parallel builds as manpages lack some dependencies:
# ../tool/jhton ext/JudyHS_funcs_3.htm | grep -v '^[ ]*$' | sed -e 's/\.C//' > man/man3/JudyHS_funcs