Skip to content

Commit

Permalink
texinfoInteractive: fix cross build
Browse files Browse the repository at this point in the history
  • Loading branch information
thefloweringash authored and bjornfor committed Dec 30, 2019
1 parent 2e8e023 commit 6dd60c6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkgs/development/tools/misc/texinfo/common.nix
Expand Up @@ -6,6 +6,10 @@
, interactive ? false, ncurses, procps
}:

let
crossBuildTools = interactive && stdenv.hostPlatform != stdenv.buildPlatform;
in

with stdenv.lib;

stdenv.mkDerivation {
Expand All @@ -17,7 +21,13 @@ stdenv.mkDerivation {
inherit sha256;
};

patches = optional (version == "6.5") ./perl.patch;
patches = optional (version == "6.5") ./perl.patch
++ optional crossBuildTools ./cross-tools-flags.patch;

# ncurses is required to build `makedoc'
# this feature is introduced by the ./cross-tools-flags.patch
NATIVE_TOOLS_CFLAGS = if crossBuildTools then "-I${getDev buildPackages.ncurses}/include" else null;
NATIVE_TOOLS_LDFLAGS = if crossBuildTools then "-L${getLib buildPackages.ncurses}/lib" else null;

# We need a native compiler to build perl XS extensions
# when cross-compiling.
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/tools/misc/texinfo/cross-tools-flags.patch
@@ -0,0 +1,12 @@
diff -ur texinfo-6.5/configure texinfo-6.5-patched/configure
--- texinfo-6.5/configure 2017-09-13 03:50:18.000000000 +0900
+++ texinfo-6.5-patched/configure 2019-12-28 17:39:06.692818866 +0900
@@ -23281,7 +23281,7 @@
# env -i gives this build host configure a clean environment;
# consequently, we have to re-initialize $PATH.
env -i CC="$BUILD_CC" AR="$BUILD_AR" RANLIB="$BUILD_RANLIB" \
- PATH="$PATH" \
+ PATH="$PATH" CFLAGS="$NATIVE_TOOLS_CFLAGS" LDFLAGS="$NATIVE_TOOLS_LDFLAGS" \
tools_only=1 \
${confdir}/configure --build=${build} --host=${build} \
--disable-rpath --disable-nls

0 comments on commit 6dd60c6

Please sign in to comment.