diff --git a/pkgs/development/tools/build-managers/jam/default.nix b/pkgs/development/tools/build-managers/jam/default.nix index 192c27682ab5..2a40c5970984 100644 --- a/pkgs/development/tools/build-managers/jam/default.nix +++ b/pkgs/development/tools/build-managers/jam/default.nix @@ -1,7 +1,9 @@ -{ lib, stdenv, fetchurl, bison, buildPackages }: +{ lib, stdenv, fetchurl, bison, buildPackages, pkgsBuildTarget }: let - mkJam = { meta ? { }, ... } @ args: stdenv.mkDerivation (args // { + mkJam = { pname, version, src, meta ? { } }: stdenv.mkDerivation { + inherit pname version src; + depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ bison ]; @@ -10,6 +12,23 @@ let export AR="$AR rc" ''; + # When cross-compiling, we need to set the preprocessor macros + # OSMAJOR/OSMINOR/OSPLAT to the values from the target platform, not the + # host platform. This looks a little ridiculous because the vast majority of + # build tools don't embed target-specific information into their binary, but + # in this case we behave more like a compiler than a make(1)-alike. + postPatch = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) '' + cat >>jam.h <