diff --git a/pkgs/by-name/fi/fim/native-tools.patch b/pkgs/by-name/fi/fim/native-tools.patch new file mode 100644 index 000000000000..643e535dbd2c --- /dev/null +++ b/pkgs/by-name/fi/fim/native-tools.patch @@ -0,0 +1,26 @@ +diff --git a/doc/Makefile.in b/doc/Makefile.in +index be8ebe5..13ae676 100644 +--- a/doc/Makefile.in ++++ b/doc/Makefile.in +@@ -684,7 +684,7 @@ fimgs.man.html: fimgs.man + if test ! -s $@ ; then $(MAN2TXT) ./$< > $<.txt && $(srcdir)/vim2html.pl tags $<.txt && mv $<.txt.html $@ ; fi + + doctags$(EXEEXT): doctags.c +- $(CC) -o $@ $< ++ @cc_for_build@ -o $@ $< + + #clean: + # $(RM) -f doctags.o doctags$(EXEEXT) FIM.html tags fim-stylesheet.css fim.man.html fimgs.man.html +diff --git a/src/Makefile.in b/src/Makefile.in +index 76f5e1e..027159c 100644 +--- a/src/Makefile.in ++++ b/src/Makefile.in +@@ -1132,7 +1132,7 @@ help-acm.cpp: fim.h + $(ECHO) '//#endif' >> $@ + + b2ba$(EXEEXT): b2ba.c +- $(CC) -o $@ $< ++ @cc_for_build@ -o $@ $< + + @FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE@@HAVE_RUNNABLE_TESTS_TRUE@default_font_byte_array.h: $(FIM_CUSTOM_HARDCODED_CONSOLEFONT) b2ba$(EXEEXT) + @FIM_WANT_CUSTOM_HARDCODED_CONSOLEFONT_TRUE@@HAVE_RUNNABLE_TESTS_TRUE@ ./b2ba$(EXEEXT) < $< > $@ diff --git a/pkgs/by-name/fi/fim/package.nix b/pkgs/by-name/fi/fim/package.nix index 8e8954f52d50..3a452fac4bda 100644 --- a/pkgs/by-name/fi/fim/package.nix +++ b/pkgs/by-name/fi/fim/package.nix @@ -4,13 +4,17 @@ autoconf, automake, pkg-config, + substituteAll, lib, perl, flex, bison, readline, libexif, - x11Support ? true, + bash, + buildPackages, + # SDL depends on Qt, which doesn't cross-compile + x11Support ? (stdenv.buildPlatform.canExecute stdenv.hostPlatform), SDL, svgSupport ? true, inkscape, @@ -35,24 +39,33 @@ stdenv.mkDerivation rec { sha256 = "sha256-/p7bjeZM46DJOQ9sgtebhkNpBPj2RJYY3dMXhzHnNmg="; }; + patches = [ + # build tools with a build compiler + (substituteAll { + src = ./native-tools.patch; + cc_for_build = lib.getExe buildPackages.stdenv.cc; + }) + ]; + postPatch = '' - substituteInPlace doc/vim2html.pl \ - --replace /usr/bin/perl ${perl}/bin/perl + patchShebangs --build doc/vim2html.pl ''; nativeBuildInputs = [ autoconf automake + bison + flex + perl pkg-config ]; buildInputs = [ - perl flex - bison readline libexif + bash ] ++ lib.optional x11Support SDL ++ lib.optional svgSupport inkscape @@ -62,6 +75,15 @@ stdenv.mkDerivation rec { ++ lib.optional jpegSupport libjpeg ++ lib.optional pngSupport libpng; + configureFlags = [ + # mmap works on all relevant platforms + "ac_cv_func_mmap_fixed_mapped=yes" + # system regexp works on all relevant platforms + "fim_cv_regex_broken=no" + ]; + + env.LIBAA_CONFIG = lib.getExe' (lib.getDev aalib) "aalib-config"; + env.LIBPNG_CONFIG = lib.getExe' (lib.getDev libpng) "libpng-config"; env.NIX_CFLAGS_COMPILE = lib.optionalString x11Support "-lSDL"; meta = with lib; {