From 089675b38b037312394271a2dd75fceec82ececc Mon Sep 17 00:00:00 2001 From: apfelkuchen06 Date: Sun, 26 Mar 2023 23:17:55 +0200 Subject: [PATCH] texlive.bin.core-big: fix cross compilation --- pkgs/tools/typesetting/tex/texlive/bin.nix | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix index 304298ea69ca..b67fdf295fd3 100644 --- a/pkgs/tools/typesetting/tex/texlive/bin.nix +++ b/pkgs/tools/typesetting/tex/texlive/bin.nix @@ -203,7 +203,7 @@ core-big = stdenv.mkDerivation { #TODO: upmendex hardeningDisable = [ "format" ]; - inherit (core) nativeBuildInputs; + inherit (core) nativeBuildInputs depsBuildBuild; buildInputs = core.buildInputs ++ [ core cairo harfbuzz icu graphite2 libX11 ]; configureFlags = common.configureFlags @@ -218,7 +218,15 @@ core-big = stdenv.mkDerivation { #TODO: upmendex # we use static libtexlua, because it's only used by a single binary postConfigure = let luajit = lib.optionalString withLuaJIT ",luajit"; - in '' + in + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) + # without this, the native builds attempt to use the binary + # ${target-triple}-gcc, but we need to use the wrapper script. + '' + export BUILDCC=${buildPackages.stdenv.cc}/bin/cc + '' + + + '' mkdir ./WorkDir && cd ./WorkDir for path in libs/{pplib,teckit,lua53${luajit}} texk/web2c; do ( @@ -227,7 +235,18 @@ core-big = stdenv.mkDerivation { #TODO: upmendex else extraConfig="" fi - + '' + lib.optionalString (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) + # results of the tests performed by the configure scripts are + # toolchain-dependent, so native components and cross components cannot use + # the same cached test results. + # Disable the caching for components with native subcomponents. + '' + if [[ "$path" =~ "libs/luajit" ]] || [[ "$path" =~ "texk/web2c" ]]; then + extraConfig="$extraConfig --cache-file=/dev/null" + fi + '' + + + '' mkdir -p "$path" && cd "$path" "../../../$path/configure" $configureFlags $extraConfig