rmlint: fix NIX_* environment propagations to scons
scons build system does not work by default in nixpkgs envoironment as it filters system environment and throws away NIX_* flags: https://scons.org/doc/2.1.0/HTML/scons-user/x1750.html Fix build system to always propagate os.environment. Drop the workarounds that pass subset of the variables through.
This commit is contained in:
parent
92b7725154
commit
f6647dfd94
|
@ -31,6 +31,11 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
|
sha256 = "15xfkcw1bkfyf3z8kl23k3rlv702m0h7ghqxvhniynvlwbgh6j2x";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# pass through NIX_* environment variables to scons.
|
||||||
|
./scons-nix-env.patch
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
pkg-config
|
pkg-config
|
||||||
sphinx
|
sphinx
|
||||||
|
@ -56,9 +61,6 @@ stdenv.mkDerivation rec {
|
||||||
];
|
];
|
||||||
|
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
export CFLAGS="$NIX_CFLAGS_COMPILE"
|
|
||||||
export LDFLAGS="''${NIX_LDFLAGS//-rpath /-Wl,-rpath=}"
|
|
||||||
|
|
||||||
# remove sources of nondeterminism
|
# remove sources of nondeterminism
|
||||||
substituteInPlace lib/cmdline.c \
|
substituteInPlace lib/cmdline.c \
|
||||||
--replace "__DATE__" "\"Jan 1 1970\"" \
|
--replace "__DATE__" "\"Jan 1 1970\"" \
|
||||||
|
@ -67,6 +69,7 @@ stdenv.mkDerivation rec {
|
||||||
--replace "gzip -c " "gzip -cn "
|
--replace "gzip -c " "gzip -cn "
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Otherwise tries to access /usr.
|
||||||
prefixKey = "--prefix=";
|
prefixKey = "--prefix=";
|
||||||
|
|
||||||
sconsFlags = lib.optionals (!withGui) [ "--without-gui" ];
|
sconsFlags = lib.optionals (!withGui) [ "--without-gui" ];
|
||||||
|
|
19
pkgs/tools/misc/rmlint/scons-nix-env.patch
Normal file
19
pkgs/tools/misc/rmlint/scons-nix-env.patch
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
scons does not use os environment by default:
|
||||||
|
https://scons.org/doc/2.1.0/HTML/scons-user/x1750.html
|
||||||
|
|
||||||
|
nixpkgs' cc-wrapper on the other hand relies on various NIX_* variables
|
||||||
|
to be passed through like NIX_CFLAGS_COMPILE_BEFORE.
|
||||||
|
--- a/SConstruct
|
||||||
|
+++ b/SConstruct
|
||||||
|
@@ -559,10 +559,7 @@ options = dict(
|
||||||
|
SHLINKCOMSTR=link_shared_library_message,
|
||||||
|
LINKCOMSTR=link_program_message,
|
||||||
|
PREFIX=GetOption('prefix'),
|
||||||
|
- ENV = dict([ (key, os.environ[key])
|
||||||
|
- for key in os.environ
|
||||||
|
- if key in ['PATH', 'TERM', 'HOME', 'PKG_CONFIG_PATH']
|
||||||
|
- ])
|
||||||
|
+ ENV = os.environ,
|
||||||
|
)
|
||||||
|
|
||||||
|
if ARGUMENTS.get('VERBOSE') == "1":
|
Loading…
Reference in a new issue