Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ buildPythonPackage {

dontPatchShebangs = true;
postFixup = ''
addToSearchPath program_PYTHONPATH $out/${python.sitePackages}
appendToSearchPath program_PYTHONPATH $out/${python.sitePackages}
patchPythonScript $out/share/matrix.py
substituteInPlace $out/${python.sitePackages}/matrix/server.py --replace-fail \"matrix_sso_helper\" \"$out/bin/matrix_sso_helper\"
substituteInPlace $out/${python.sitePackages}/matrix/uploads.py --replace-fail \"matrix_upload\" \"$out/bin/matrix_upload\"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/R/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addRLibPath () {
if [[ -d "$1/library" ]]; then
addToSearchPath R_LIBS_SITE "$1/library"
appendToSearchPath R_LIBS_SITE "$1/library"
fi
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/version-management/mercurial/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ let
meta.broken = !stdenv.hostPlatform.isLinux || stdenv.buildPlatform != stdenv.hostPlatform;
}
''
addToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}"
appendToSearchPathWithCustomDelimiter : PYTHONPATH "${mercurial}/${python.sitePackages}"

unpackPhase
cd "$sourceRoot"
Expand Down
15 changes: 8 additions & 7 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ let
bintools_bin = optionalString (!nativeTools) (getBin bintools);
# The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
coreutils_bin = optionalString (!nativeTools) (getBin coreutils);
gnugrep_bin = optionalString (!nativeTools) (getBin gnugrep);

# See description in cc-wrapper.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config
Expand Down Expand Up @@ -155,6 +156,7 @@ stdenvNoCC.mkDerivation {
passthru = {
inherit targetPrefix suffixSalt;
inherit bintools libc nativeTools nativeLibc nativePrefix isGNU isLLVM;
inherit libc_bin libc_dev libc_lib;

emacsBufferSetup = pkgs: ''
; We should handle propagation here too
Expand Down Expand Up @@ -198,7 +200,7 @@ stdenvNoCC.mkDerivation {

ldPath="${nativePrefix}/bin"
'' else ''
echo $bintools_bin > $out/nix-support/orig-bintools
echo ${bintools_bin} > $out/nix-support/orig-bintools

ldPath="${bintools_bin}/bin"
''
Expand Down Expand Up @@ -242,6 +244,7 @@ stdenvNoCC.mkDerivation {
'';

strictDeps = true;
propagatedBuildInputs = [ bintools_bin libc_bin coreutils_bin gnugrep_bin ];
depsTargetTargetPropagated = extraPackages;

setupHooks = [
Expand Down Expand Up @@ -303,7 +306,7 @@ stdenvNoCC.mkDerivation {
# install the wrapper, you get tools like objdump (same for any
# binaries of libc).
+ optionalString (!nativeTools) ''
printWords ${bintools_bin} ${optionalString (libc != null) libc_bin} > $out/nix-support/propagated-user-env-packages
printWords ${bintools_bin} ${libc_bin} > $out/nix-support/propagated-user-env-packages
''

##
Expand Down Expand Up @@ -340,7 +343,7 @@ stdenvNoCC.mkDerivation {

+ optionalString (libc != null && targetPlatform.isAvr) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags
echo "-L${libc_lib}/avr/lib/$isa" >> $out/nix-support/libc-cflags
done
''

Expand Down Expand Up @@ -401,13 +404,11 @@ stdenvNoCC.mkDerivation {
# TODO(@sternenseemann): invent something cleaner than passing in "" in case of absence
expandResponseParams = "${expand-response-params}/bin/expand-response-params";
# TODO(@sternenseemann): rename env var via stdenv rebuild
shell = (getBin runtimeShell + runtimeShell.shellPath or "");
gnugrep_bin = optionalString (!nativeTools) gnugrep;
shell = getBin runtimeShell + runtimeShell.shellPath or "";
rm = if nativeTools then "rm" else lib.getExe' coreutils "rm";
mktemp = if nativeTools then "mktemp" else lib.getExe' coreutils "mktemp";
wrapperName = "BINTOOLS_WRAPPER";
inherit dynamicLinker targetPrefix suffixSalt coreutils_bin;
inherit bintools_bin libc_bin libc_dev libc_lib;
inherit dynamicLinker targetPrefix suffixSalt;
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
} // lib.mapAttrs (_: lib.optionalString targetPlatform.isDarwin) {
# These will become empty strings when not targeting Darwin.
Expand Down
6 changes: 0 additions & 6 deletions pkgs/build-support/bintools-wrapper/ld-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ fi

path_backup="$PATH"

# phase separation makes this look useless
# shellcheck disable=SC2157
if [ -n "@coreutils_bin@" ]; then
PATH="@coreutils_bin@/bin"
fi

source @out@/nix-support/utils.bash

source @out@/nix-support/darwin-sdk-setup.bash
Expand Down
15 changes: 0 additions & 15 deletions pkgs/build-support/bintools-wrapper/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,6 @@ getTargetRoleWrapper

addEnvHooks "$targetOffset" bintoolsWrapper_addLDVars

# shellcheck disable=SC2157
if [ -n "@bintools_bin@" ]; then
addToSearchPath _PATH @bintools_bin@/bin
fi

# shellcheck disable=SC2157
if [ -n "@libc_bin@" ]; then
addToSearchPath _PATH @libc_bin@/bin
fi

# shellcheck disable=SC2157
if [ -n "@coreutils_bin@" ]; then
addToSearchPath _PATH @coreutils_bin@/bin
fi

# Export tool environment variables so various build systems use the right ones.

export NIX_BINTOOLS${role_post}=@out@
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/cc-wrapper/add-flags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ done

# Arocc does not support "-B"
if [[ -z "@isArocc@" ]]; then
# `-B@bintools@/bin' forces cc to use ld-wrapper.sh when calling ld.
NIX_CFLAGS_COMPILE_@suffixSalt@="-B@bintools@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@"
# `-B@bintools_bin@/bin' forces cc to use ld-wrapper.sh when calling ld.
NIX_CFLAGS_COMPILE_@suffixSalt@="-B@bintools_bin@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@"
fi

# Export and assign separately in order that a failing $(..) will fail
Expand Down
7 changes: 0 additions & 7 deletions pkgs/build-support/cc-wrapper/cc-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ fi

path_backup="$PATH"

# That @-vars are substituted separately from bash evaluation makes
# shellcheck think this, and others like it, are useless conditionals.
# shellcheck disable=SC2157
if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then
PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin"
fi

source @out@/nix-support/utils.bash

source @out@/nix-support/darwin-sdk-setup.bash
Expand Down
44 changes: 25 additions & 19 deletions pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ let
libc_bin = optionalString (libc != null) (getBin libc);
libc_dev = optionalString (libc != null) (getDev libc);
libc_lib = optionalString (libc != null) (getLib libc);
bintools_bin = optionalString (!nativeTools) (getBin bintools);
cc_solib = getLib cc
+ optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";

# The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
coreutils_bin = optionalString (!nativeTools) (getBin coreutils);
gnugrep_bin = optionalString (!nativeTools) (getBin gnugrep);

# The "suffix salt" is a arbitrary string added in the end of env vars
# defined by cc-wrapper's hooks so that multiple cc-wrappers can be used
Expand Down Expand Up @@ -319,6 +321,7 @@ stdenvNoCC.mkDerivation {
# unused middle-ground name that evokes both.
inherit bintools;
inherit cc libc libcxx nativeTools nativeLibc nativePrefix isGNU isClang isZig;
inherit libc_bin libc_dev libc_lib;

emacsBufferSetup = pkgs: ''
; We should handle propagation here too
Expand Down Expand Up @@ -372,14 +375,14 @@ stdenvNoCC.mkDerivation {

ccPath="${if targetPlatform.isDarwin then cc else nativePrefix}/bin"
'' else ''
echo $cc > $out/nix-support/orig-cc
echo ${cc} > $out/nix-support/orig-cc

ccPath="${cc}/bin"
'')

# Create symlinks to everything in the bintools wrapper.
+ ''
for bbin in $bintools/bin/*; do
for bbin in ${bintools_bin}/bin/*; do
mkdir -p "$out/bin"
ln -s "$bbin" "$out/bin/$(basename $bbin)"
done
Expand Down Expand Up @@ -460,8 +463,14 @@ stdenvNoCC.mkDerivation {
'';

strictDeps = true;
propagatedBuildInputs = [ bintools ] ++ extraTools ++ optionals cc.langD or cc.langJava or false [ zlib ];
depsTargetTargetPropagated = optional (libcxx != null) libcxx ++ extraPackages;
propagatedBuildInputs = [
coreutils_bin
libc_bin
bintools_bin
gnugrep_bin
] ++ extraTools
++ optionals cc.langD or cc.langJava or false [ zlib ];
depsTargetTargetPropagated = [cc] ++ optional (libc != null) libc ++ optional (libcxx != null) libcxx ++ extraPackages;

setupHooks = [
../setup-hooks/role.bash
Expand All @@ -471,9 +480,9 @@ stdenvNoCC.mkDerivation {
name = "win-dll-hook.sh";
dontUnpack = true;
installPhase = ''
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out
echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out
echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out
echo appendToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out
'';
});

Expand All @@ -491,11 +500,11 @@ stdenvNoCC.mkDerivation {
# TODO(@Ericson2314): Remove this after stable release and force
# everyone to refer to bintools-wrapper directly.
+ optionalString (!isArocc) ''
if [[ -f "$bintools/nix-support/dynamic-linker" ]]; then
ln -s "$bintools/nix-support/dynamic-linker" "$out/nix-support"
if [[ -f "${bintools}/nix-support/dynamic-linker" ]]; then
ln -s "${bintools}/nix-support/dynamic-linker" "$out/nix-support"
fi
if [[ -f "$bintools/nix-support/dynamic-linker-m32" ]]; then
ln -s "$bintools/nix-support/dynamic-linker-m32" "$out/nix-support"
if [[ -f "${bintools}/nix-support/dynamic-linker-m32" ]]; then
ln -s "${bintools}/nix-support/dynamic-linker-m32" "$out/nix-support"
fi
''

Expand Down Expand Up @@ -624,7 +633,7 @@ stdenvNoCC.mkDerivation {
'' + optionalString (cc.langAda or false && !isArocc) ''
touch "$out/nix-support/gnat-cflags"
touch "$out/nix-support/gnat-ldflags"
basePath=$(echo $cc/lib/*/*/*)
basePath=$(echo ${cc}/lib/*/*/*)
ccCFlags+=" -B$basePath -I$basePath/adainclude"
gnatCFlags="-I$basePath/adainclude -I$basePath/adalib"

Expand Down Expand Up @@ -699,7 +708,7 @@ stdenvNoCC.mkDerivation {

+ optionalString (libc != null && targetPlatform.isAvr && !isArocc) ''
for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do
echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags
echo "-B${libc_lib}/avr/lib/$isa" >> $out/nix-support/libc-crt1-cflags
done
''

Expand Down Expand Up @@ -753,15 +762,12 @@ stdenvNoCC.mkDerivation {
expandResponseParams = lib.optionalString (expand-response-params != "") (lib.getExe expand-response-params);
# TODO(@sternenseemann): rename env var via stdenv rebuild
shell = getBin runtimeShell + runtimeShell.shellPath or "";
gnugrep_bin = optionalString (!nativeTools) gnugrep;
rm = if nativeTools then "rm" else lib.getExe' coreutils "rm";
mktemp = if nativeTools then "mktemp" else lib.getExe' coreutils "mktemp";
# stdenv.cc.cc should not be null and we have nothing better for now.
# if the native impure bootstrap is gotten rid of this can become `inherit cc;` again.
cc = optionalString (!nativeTools) cc;
wrapperName = "CC_WRAPPER";
inherit suffixSalt coreutils_bin bintools;
inherit libc_bin libc_dev libc_lib;
bintools = optionalString (!nativeTools) bintools;
inherit bintools_bin;
inherit suffixSalt;
inherit darwinPlatformForCC;
default_hardening_flags_str = builtins.toString defaultHardeningFlags;
} // lib.mapAttrs (_: lib.optionalString targetPlatform.isDarwin) {
Expand Down
7 changes: 0 additions & 7 deletions pkgs/build-support/cc-wrapper/gnat-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ fi

path_backup="$PATH"

# That @-vars are substituted separately from bash evaluation makes
# shellcheck think this, and others like it, are useless conditionals.
# shellcheck disable=SC2157
if [[ -n "@coreutils_bin@" && -n "@gnugrep_bin@" ]]; then
PATH="@coreutils_bin@/bin:@gnugrep_bin@/bin"
fi

cInclude=0

source @out@/nix-support/utils.bash
Expand Down
18 changes: 0 additions & 18 deletions pkgs/build-support/cc-wrapper/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,6 @@ getTargetRoleWrapper
# sort of deps (those with that offset).
addEnvHooks "$targetOffset" ccWrapper_addCVars

# Note 1: these come *after* $out in the PATH (see setup.sh).
# Note 2: phase separation makes this look useless to shellcheck.

# shellcheck disable=SC2157
if [ -n "@cc@" ]; then
addToSearchPath _PATH @cc@/bin
fi

# shellcheck disable=SC2157
if [ -n "@libc_bin@" ]; then
addToSearchPath _PATH @libc_bin@/bin
fi

# shellcheck disable=SC2157
if [ -n "@coreutils_bin@" ]; then
addToSearchPath _PATH @coreutils_bin@/bin
fi

# Export tool environment variables so various build systems use the right ones.

export NIX_CC${role_post}=@out@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dartFixupHook() {
# which is not what application authors expect.
APPLICATION_LD_LIBRARY_PATH=""
for runtimeDependency in "${runtimeDependencies[@]}"; do
addToSearchPath APPLICATION_LD_LIBRARY_PATH "${runtimeDependency}/lib"
appendToSearchPath APPLICATION_LD_LIBRARY_PATH "${runtimeDependency}/lib"
done
if [[ ! -z "$APPLICATION_LD_LIBRARY_PATH" ]]; then
wrapProgramArgs+=(--suffix LD_LIBRARY_PATH : \"$APPLICATION_LD_LIBRARY_PATH\")
Expand Down
4 changes: 2 additions & 2 deletions pkgs/build-support/pkg-config-wrapper/setup-hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ pkgConfigWrapper_addPkgConfigPath () {
local role_post
getHostRoleEnvHook

addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"
addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig"
appendToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"
appendToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig"
}

# See ../setup-hooks/role.bash
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
setupDebugInfoDirs () {
addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug
appendToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug
}

addEnvHooks "$targetOffset" setupDebugInfoDirs
6 changes: 3 additions & 3 deletions pkgs/build-support/setup-hooks/win-dll-link.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ fixupOutputHooks+=(_linkDLLs)
addEnvHooks "$targetOffset" linkDLLGetFolders

linkDLLGetFolders() {
addToSearchPath "LINK_DLL_FOLDERS" "$1/lib"
addToSearchPath "LINK_DLL_FOLDERS" "$1/bin"
appendToSearchPath "LINK_DLL_FOLDERS" "$1/lib"
appendToSearchPath "LINK_DLL_FOLDERS" "$1/bin"
}

_linkDLLs() {
Expand Down Expand Up @@ -46,7 +46,7 @@ linkDLLsInfolder() {
local DLLPATH=""
local outName
for outName in $(getAllOutputNames); do
addToSearchPath DLLPATH "${!outName}/bin"
appendToSearchPath DLLPATH "${!outName}/bin"
done
DLLPATH="$DLLPATH:$LINK_DLL_FOLDERS"

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/bu/budgie-control-center/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ stdenv.mkDerivation (finalAttrs: {

preConfigure = ''
# For ITS rules
addToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share"
appendToSearchPath "XDG_DATA_DIRS" "${polkit.out}/share"
'';

postInstall = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ch/chez-racket/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addChezLibraryPath() {
addToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site"
appendToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site"
}

addEnvHooks "$targetOffset" addChezLibraryPath
2 changes: 1 addition & 1 deletion pkgs/by-name/ch/chez/setup-hook.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addChezLibraryPath() {
addToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site"
appendToSearchPath CHEZSCHEMELIBDIRS "$1/lib/csv-site"
}

addEnvHooks "$targetOffset" addChezLibraryPath
Loading
Loading