aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/build-support
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2020-01-10 20:09:37 +0000
committerKatharina Fey <kookie@spacekookie.de>2020-01-10 20:09:37 +0000
commit45431c078bf8f54aef7c9fae2e5913395ec82c31 (patch)
treefd8ff1346a963ddd72e782421f05b623f9759e2a /nixpkgs/pkgs/build-support
parentc86fea6086c212ea489cfb023a5f5c9c8f188810 (diff)
parent3ccbc8d89153ecf13f3eae7d9c106d91cd4ab9e5 (diff)
Merge commit '3ccbc8d89153ecf13f3eae7d9c106d91cd4ab9e5' into fuckthisshit
Diffstat (limited to 'nixpkgs/pkgs/build-support')
-rw-r--r--nixpkgs/pkgs/build-support/appimage/default.nix2
-rw-r--r--nixpkgs/pkgs/build-support/bintools-wrapper/default.nix20
-rw-r--r--nixpkgs/pkgs/build-support/bintools-wrapper/setup-hook.sh3
-rw-r--r--nixpkgs/pkgs/build-support/build-bazel-package/default.nix30
-rw-r--r--nixpkgs/pkgs/build-support/build-dotnet-package/default.nix8
-rw-r--r--nixpkgs/pkgs/build-support/cc-wrapper/default.nix10
-rw-r--r--nixpkgs/pkgs/build-support/cc-wrapper/setup-hook.sh3
-rw-r--r--nixpkgs/pkgs/build-support/emacs/setup-hook.sh6
-rwxr-xr-xnixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git1
-rw-r--r--nixpkgs/pkgs/build-support/fetchgit/private.nix26
-rw-r--r--nixpkgs/pkgs/build-support/fetchurl/default.nix4
-rw-r--r--nixpkgs/pkgs/build-support/kernel/make-initrd.nix19
-rw-r--r--nixpkgs/pkgs/build-support/nix-prefetch-github/default.nix29
-rw-r--r--nixpkgs/pkgs/build-support/nuke-references/default.nix5
-rw-r--r--nixpkgs/pkgs/build-support/ocaml/default.nix2
-rw-r--r--nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix27
-rw-r--r--nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix15
-rw-r--r--nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix22
-rw-r--r--nixpkgs/pkgs/build-support/rust/default.nix29
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/audit-tmpdir.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/compress-man-pages.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/find-xml-catalogs.sh4
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh9
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/move-lib64.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/move-sbin.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh6
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/patch-shebangs.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/prune-libtool-files.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/set-java-classpath.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/strip.sh4
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh2
-rw-r--r--nixpkgs/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh2
-rw-r--r--nixpkgs/pkgs/build-support/writers/default.nix4
-rw-r--r--nixpkgs/pkgs/build-support/writers/test.nix30
35 files changed, 151 insertions, 187 deletions
diff --git a/nixpkgs/pkgs/build-support/appimage/default.nix b/nixpkgs/pkgs/build-support/appimage/default.nix
index 7e2b2b347d9..c871df787b7 100644
--- a/nixpkgs/pkgs/build-support/appimage/default.nix
+++ b/nixpkgs/pkgs/build-support/appimage/default.nix
@@ -185,7 +185,7 @@ rec {
keyutils.lib
libjack2
fribidi
- p11_kit
+ p11-kit
# libraries not on the upstream include list, but nevertheless expected
# by at least one appimage
diff --git a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
index e02e77de45e..0abce22c676 100644
--- a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
+++ b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix
@@ -34,8 +34,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
- bintoolsVersion = (builtins.parseDrvName bintools.name).version;
- bintoolsName = (builtins.parseDrvName bintools.name).name;
+ bintoolsVersion = stdenv.lib.getVersion bintools;
+ bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
@@ -74,7 +74,7 @@ in
stdenv.mkDerivation {
name = targetPrefix
- + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${bintoolsName}-wrapper")
+ + (if name != "" then name else "${bintoolsName}-wrapper")
+ (stdenv.lib.optionalString (bintools != null && bintoolsVersion != "") "-${bintoolsVersion}");
preferLocalBuild = true;
@@ -111,17 +111,13 @@ stdenv.mkDerivation {
installPhase =
''
- set -u
-
mkdir -p $out/bin $out/nix-support
wrap() {
local dst="$1"
local wrapper="$2"
export prog="$3"
- set +u
substituteAll "$wrapper" "$out/bin/$dst"
- set -u
chmod +x "$out/bin/$dst"
}
''
@@ -163,8 +159,6 @@ stdenv.mkDerivation {
[[ -e "$underlying" ]] || continue
wrap ${targetPrefix}$variant ${./ld-wrapper.sh} $underlying
done
-
- set +u
'';
emulation = let
@@ -190,6 +184,7 @@ stdenv.mkDerivation {
else if targetPlatform.isMsp430 then "msp430"
else if targetPlatform.isAvr then "avr"
else if targetPlatform.isAlpha then "alpha"
+ else if targetPlatform.isVc4 then "vc4"
else throw "unknown emulation for platform: ${targetPlatform.config}";
in if targetPlatform.useLLVM or false then ""
else targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
@@ -205,11 +200,7 @@ stdenv.mkDerivation {
];
postFixup =
- ''
- set -u
- ''
-
- + optionalString (libc != null) (''
+ optionalString (libc != null) (''
##
## General libc support
##
@@ -307,7 +298,6 @@ stdenv.mkDerivation {
''
+ ''
- set +u
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
diff --git a/nixpkgs/pkgs/build-support/bintools-wrapper/setup-hook.sh b/nixpkgs/pkgs/build-support/bintools-wrapper/setup-hook.sh
index 2e15fa95c79..a714bd151c9 100644
--- a/nixpkgs/pkgs/build-support/bintools-wrapper/setup-hook.sh
+++ b/nixpkgs/pkgs/build-support/bintools-wrapper/setup-hook.sh
@@ -2,8 +2,6 @@
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.
-set -u
-
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
@@ -73,4 +71,3 @@ export NIX_HARDENING_ENABLE
# No local scope in sourced file
unset -v role_pre role_post cmd upper_case
-set +u
diff --git a/nixpkgs/pkgs/build-support/build-bazel-package/default.nix b/nixpkgs/pkgs/build-support/build-bazel-package/default.nix
index a1a38484386..8fa3cc55279 100644
--- a/nixpkgs/pkgs/build-support/build-bazel-package/default.nix
+++ b/nixpkgs/pkgs/build-support/build-bazel-package/default.nix
@@ -4,10 +4,30 @@
, lib
}:
-args@{ name, bazelFlags ? [], bazelBuildFlags ? [], bazelFetchFlags ? [], bazelTarget, buildAttrs, fetchAttrs, ... }:
+args@{
+ name
+, bazelFlags ? []
+, bazelBuildFlags ? []
+, bazelFetchFlags ? []
+, bazelTarget
+, buildAttrs
+, fetchAttrs
+
+# Newer versions of Bazel are moving away from built-in rules_cc and instead
+# allow fetching it as an external dependency in a WORKSPACE file[1]. If
+# removed in the fixed-output fetch phase, building will fail to download it.
+# This can be seen e.g. in #73097
+#
+# This option allows configuring the removal of rules_cc in cases where a
+# project depends on it via an external dependency.
+#
+# [1]: https://github.com/bazelbuild/rules_cc
+, removeRulesCC ? true
+, ...
+}:
let
- fArgs = removeAttrs args [ "buildAttrs" "fetchAttrs" ];
+ fArgs = removeAttrs args [ "buildAttrs" "fetchAttrs" "removeRulesCC" ];
fBuildAttrs = fArgs // buildAttrs;
fFetchAttrs = fArgs // removeAttrs fetchAttrs [ "sha256" ];
@@ -24,8 +44,12 @@ in stdenv.mkDerivation (fBuildAttrs // {
export bazelOut="$(echo ''${NIX_BUILD_TOP}/output | sed -e 's,//,/,g')"
export bazelUserRoot="$(echo ''${NIX_BUILD_TOP}/tmp | sed -e 's,//,/,g')"
export HOME="$NIX_BUILD_TOP"
+ export USER="nix"
# This is needed for git_repository with https remotes
export GIT_SSL_CAINFO="${cacert}/etc/ssl/certs/ca-bundle.crt"
+ # This is needed for Bazel fetchers that are themselves programs (e.g.
+ # rules_go using the go toolchain)
+ export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
'';
buildPhase = fFetchAttrs.buildPhase or ''
@@ -60,7 +84,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
# Remove all built in external workspaces, Bazel will recreate them when building
rm -rf $bazelOut/external/{bazel_tools,\@bazel_tools.marker}
- rm -rf $bazelOut/external/{rules_cc,\@rules_cc.marker}
+ ${if removeRulesCC then "rm -rf $bazelOut/external/{rules_cc,\\@rules_cc.marker}" else ""}
rm -rf $bazelOut/external/{embedded_jdk,\@embedded_jdk.marker}
rm -rf $bazelOut/external/{local_*,\@local_*.marker}
diff --git a/nixpkgs/pkgs/build-support/build-dotnet-package/default.nix b/nixpkgs/pkgs/build-support/build-dotnet-package/default.nix
index f36c69e4339..dae9ed888c7 100644
--- a/nixpkgs/pkgs/build-support/build-dotnet-package/default.nix
+++ b/nixpkgs/pkgs/build-support/build-dotnet-package/default.nix
@@ -29,9 +29,9 @@ attrsOrig @
configurePhase = ''
runHook preConfigure
- [ -z "$dontPlacateNuget" ] && placate-nuget.sh
- [ -z "$dontPlacatePaket" ] && placate-paket.sh
- [ -z "$dontPatchFSharpTargets" ] && patch-fsharp-targets.sh
+ [ -z "''${dontPlacateNuget-}" ] && placate-nuget.sh
+ [ -z "''${dontPlacatePaket-}" ] && placate-paket.sh
+ [ -z "''${dontPatchFSharpTargets-}" ] && patch-fsharp-targets.sh
runHook postConfigure
'';
@@ -69,7 +69,7 @@ attrsOrig @
cp -rv ${arrayToShell outputFiles} "''${outputFilesArray[@]}" "$target"
- if [ -z "$dontRemoveDuplicatedDlls" ]
+ if [ -z "''${dontRemoveDuplicatedDlls-}" ]
then
pushd "$out"
remove-duplicated-dlls.sh
diff --git a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
index cf2d38cd997..d02f47fde8c 100644
--- a/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
+++ b/nixpkgs/pkgs/build-support/cc-wrapper/default.nix
@@ -35,8 +35,8 @@ let
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
- ccVersion = (builtins.parseDrvName cc.name).version;
- ccName = (builtins.parseDrvName cc.name).name;
+ ccVersion = stdenv.lib.getVersion cc;
+ ccName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName cc);
libc_bin = if libc == null then null else getBin libc;
libc_dev = if libc == null then null else getDev libc;
@@ -94,7 +94,7 @@ assert nativePrefix == bintools.nativePrefix;
stdenv.mkDerivation {
name = targetPrefix
- + (if name != "" then name else stdenv.lib.removePrefix targetPrefix "${ccName}-wrapper")
+ + (if name != "" then name else "${ccName}-wrapper")
+ (stdenv.lib.optionalString (cc != null && ccVersion != "") "-${ccVersion}");
preferLocalBuild = true;
@@ -134,8 +134,6 @@ stdenv.mkDerivation {
installPhase =
''
- set -u
-
mkdir -p $out/bin $out/nix-support
wrap() {
@@ -224,8 +222,6 @@ stdenv.mkDerivation {
postFixup =
''
- set -u
-
# Backwards compatability for packages expecting this file, e.g. with
# `$NIX_CC/nix-support/dynamic-linker`.
#
diff --git a/nixpkgs/pkgs/build-support/cc-wrapper/setup-hook.sh b/nixpkgs/pkgs/build-support/cc-wrapper/setup-hook.sh
index 211b5063291..5b13f268309 100644
--- a/nixpkgs/pkgs/build-support/cc-wrapper/setup-hook.sh
+++ b/nixpkgs/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -54,8 +54,6 @@
# For more details, read the individual files where the mechanisms used to
# accomplish this will be individually documented.
-set -u
-
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
@@ -120,4 +118,3 @@ export NIX_HARDENING_ENABLE
# No local scope in sourced file
unset -v role_pre role_post
-set +u
diff --git a/nixpkgs/pkgs/build-support/emacs/setup-hook.sh b/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
index e1db3e828fd..b210511d670 100644
--- a/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
+++ b/nixpkgs/pkgs/build-support/emacs/setup-hook.sh
@@ -1,11 +1,13 @@
addEmacsVars () {
if test -d $1/share/emacs/site-lisp; then
- export EMACSLOADPATH="$1/share/emacs/site-lisp:$EMACSLOADPATH"
+ # it turns out, that the trailing : is actually required
+ # see https://www.gnu.org/software/emacs/manual/html_node/elisp/Library-Search.html
+ export EMACSLOADPATH="$1/share/emacs/site-lisp:${EMACSLOADPATH-}"
fi
}
# If this is for a wrapper derivation, emacs and the dependencies are all
# run-time dependencies. If this is for precompiling packages into bytecode,
# emacs is a compile-time dependency of the package.
-addEnvHooks "$targetOffset" addEmacsVars
+addEnvHooks "$hostOffset" addEmacsVars
addEnvHooks "$targetOffset" addEmacsVars
diff --git a/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git b/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git
index 931be1a3700..8020ba46f3f 100755
--- a/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/nixpkgs/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -42,6 +42,7 @@ Options:
--url url Any url understood by 'git clone'.
--rev ref Any sha1 or references (such as refs/heads/master)
--hash h Expected hash.
+ --branch-name Branch name to check out into
--deepClone Clone the entire repository.
--no-deepClone Make a shallow clone of just the required ref.
--leave-dotGit Keep the .git directories.
diff --git a/nixpkgs/pkgs/build-support/fetchgit/private.nix b/nixpkgs/pkgs/build-support/fetchgit/private.nix
deleted file mode 100644
index 6731cf87fbd..00000000000
--- a/nixpkgs/pkgs/build-support/fetchgit/private.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ fetchgit, runCommand, makeWrapper, openssh }: args: derivation ((fetchgit args).drvAttrs // {
- SSH_AUTH_SOCK = if (builtins.tryEval <ssh-auth-sock>).success
- then builtins.toString <ssh-auth-sock>
- else null;
-
- GIT_SSH = let
- config = let
- sshConfigFile = if (builtins.tryEval <ssh-config-file>).success
- then <ssh-config-file>
- else builtins.trace ''
- Please set your nix-path such that ssh-config-file points to a file that will allow ssh to access private repositories. The builder will not be able to see any running ssh agent sessions unless ssh-auth-sock is also set in the nix-path.
-
- Note that the config file and any keys it points to must be readable by the build user, which depending on your nix configuration means making it readable by the build-users-group, the user of the running nix-daemon, or the user calling the nix command which started the build. Similarly, if using an ssh agent ssh-auth-sock must point to a socket the build user can access.
-
- You may need StrictHostKeyChecking=no in the config file. Since ssh will refuse to use a group-readable private key, if using build-users you will likely want to use something like IdentityFile /some/directory/%u/key and have a directory for each build user accessible to that user.
- '' "/var/lib/empty/config";
- in builtins.toString sshConfigFile;
-
- ssh-wrapped = runCommand "fetchgit-ssh" {
- nativeBuildInputs = [ makeWrapper ];
- } ''
- mkdir -p $out/bin
- makeWrapper ${openssh}/bin/ssh $out/bin/ssh --prefix PATH : "$out/bin" --add-flags "-F ${config}" "$@"
- '';
- in "${ssh-wrapped}/bin/ssh";
-})
diff --git a/nixpkgs/pkgs/build-support/fetchurl/default.nix b/nixpkgs/pkgs/build-support/fetchurl/default.nix
index 6300587a7d1..7d23a3a7f8f 100644
--- a/nixpkgs/pkgs/build-support/fetchurl/default.nix
+++ b/nixpkgs/pkgs/build-support/fetchurl/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
+{ lib, buildPackages ? { inherit stdenvNoCC; }, stdenvNoCC, curl }: # Note that `curl' may be `null', in case of the native stdenvNoCC.
let
@@ -10,7 +10,7 @@ let
# resulting store derivations (.drv files) much smaller, which in
# turn makes nix-env/nix-instantiate faster.
mirrorsFile =
- stdenvNoCC.mkDerivation ({
+ buildPackages.stdenvNoCC.mkDerivation ({
name = "mirrors-list";
builder = ./write-mirror-list.sh;
preferLocalBuild = true;
diff --git a/nixpkgs/pkgs/build-support/kernel/make-initrd.nix b/nixpkgs/pkgs/build-support/kernel/make-initrd.nix
index 7a5642e565d..ed5dbdaee17 100644
--- a/nixpkgs/pkgs/build-support/kernel/make-initrd.nix
+++ b/nixpkgs/pkgs/build-support/kernel/make-initrd.nix
@@ -12,26 +12,26 @@
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
-{ stdenv, perl, cpio, contents, ubootTools
+{ stdenvNoCC, perl, cpio, contents, ubootTools
, name ? "initrd"
, compressor ? "gzip -9n"
, prepend ? []
, lib
}:
-let
+let
# !!! Move this into a public lib function, it is probably useful for others
- toValidStoreName = x: with builtins;
+ toValidStoreName = x: with builtins;
lib.concatStringsSep "-" (filter (x: !(isList x)) (split "[^a-zA-Z0-9_=.?-]+" x));
-in stdenv.mkDerivation rec {
+in stdenvNoCC.mkDerivation rec {
inherit name;
builder = ./make-initrd.sh;
- makeUInitrd = stdenv.hostPlatform.platform.kernelTarget == "uImage";
+ makeUInitrd = stdenvNoCC.hostPlatform.platform.kernelTarget == "uImage";
nativeBuildInputs = [ perl cpio ]
- ++ stdenv.lib.optional makeUInitrd ubootTools;
+ ++ stdenvNoCC.lib.optional makeUInitrd ubootTools;
# !!! should use XML.
objects = map (x: x.object) contents;
@@ -42,12 +42,11 @@ in stdenv.mkDerivation rec {
# Note: we don't use closureInfo yet, as that won't build with nix-1.x.
# See #36268.
exportReferencesGraph =
- lib.zipListsWith
- (x: i: [("closure-${toValidStoreName (baseNameOf x.symlink)}-${toString i}") x.object])
- contents
+ lib.zipListsWith
+ (x: i: [("closure-${toValidStoreName (baseNameOf x.symlink)}-${toString i}") x.object])
+ contents
(lib.range 0 (lib.length contents - 1));
pathsFromGraph = ./paths-from-graph.pl;
inherit compressor prepend;
}
-
diff --git a/nixpkgs/pkgs/build-support/nix-prefetch-github/default.nix b/nixpkgs/pkgs/build-support/nix-prefetch-github/default.nix
deleted file mode 100644
index 10a6daaf53f..00000000000
--- a/nixpkgs/pkgs/build-support/nix-prefetch-github/default.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ python3
-, fetchFromGitHub
-, stdenv
-}:
-
-python3.pkgs.buildPythonApplication rec {
- pname = "nix-prefetch-github";
- version = "2.3.1";
-
- src = fetchFromGitHub {
- owner = "seppeljordan";
- repo = "nix-prefetch-github";
- rev = "v${version}";
- sha256 = "13wvq13iiva97a16kahfpxar5ppb015nnbn7d4v9s9jyxdickc2c";
- };
-
- propagatedBuildInputs = with python3.pkgs; [
- attrs
- click
- effect
- jinja2
- ];
- meta = with stdenv.lib; {
- description = "Prefetch sources from github";
- homepage = https://github.com/seppeljordan/nix-prefetch-github;
- license = licenses.gpl3;
- maintainers = [ maintainers.seppeljordan ];
- };
-}
diff --git a/nixpkgs/pkgs/build-support/nuke-references/default.nix b/nixpkgs/pkgs/build-support/nuke-references/default.nix
index 8f976ad462c..d894b56d366 100644
--- a/nixpkgs/pkgs/build-support/nuke-references/default.nix
+++ b/nixpkgs/pkgs/build-support/nuke-references/default.nix
@@ -3,10 +3,11 @@
# path (/nix/store/eeee...). This is useful for getting rid of
# dependencies that you know are not actually needed at runtime.
-{ stdenv, perl }:
+{ stdenvNoCC, perl }:
-stdenv.mkDerivation {
+stdenvNoCC.mkDerivation {
name = "nuke-references";
builder = ./builder.sh;
+ # FIXME: get rid of perl dependency.
inherit perl;
}
diff --git a/nixpkgs/pkgs/build-support/ocaml/default.nix b/nixpkgs/pkgs/build-support/ocaml/default.nix
index cc2001c66e2..3957b955a2c 100644
--- a/nixpkgs/pkgs/build-support/ocaml/default.nix
+++ b/nixpkgs/pkgs/build-support/ocaml/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation (args // {
setupHook = if setupHook == null && hasSharedObjects
then writeText "setupHook.sh" ''
- export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/"
+ export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/"
''
else setupHook;
diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix
index e0a52e62561..db187d2ac14 100644
--- a/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix
+++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/build-crate.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, echo_build_heading, noisily, makeDeps }:
+{ lib, stdenv, echo_build_heading, noisily, makeDeps, rust }:
{ crateName,
dependencies,
crateFeatures, crateRenames, libName, release, libPath,
@@ -13,17 +13,6 @@
(if release then "-C opt-level=3" else "-C debuginfo=2")
(["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts);
rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
-
- # Some platforms have different names for rustc.
- rustPlatform =
- with stdenv.hostPlatform.parsed;
- let cpu_ = if cpu.name == "armv7a" then "armv7"
- else cpu.name;
- vendor_ = vendor.name;
- kernel_ = kernel.name;
- abi_ = abi.name;
- in
- "${cpu_}-${vendor_}-${kernel_}-${abi_}";
in ''
runHook preBuild
norm=""
@@ -67,7 +56,7 @@
${crateFeatures} --out-dir target/bin --emit=dep-info,link -L dependency=target/deps \
$LINK ${deps}$EXTRA_LIB --cap-lints allow \
$BUILD_OUT_DIR $EXTRA_BUILD $EXTRA_FEATURES --color ${colors} \
- ${if stdenv.hostPlatform != stdenv.buildPlatform then "--target ${rustPlatform} -C linker=${stdenv.hostPlatform.config}-gcc" else ""}
+ ${if stdenv.hostPlatform != stdenv.buildPlatform then "--target ${rust.toRustTarget stdenv.hostPlatform} -C linker=${stdenv.hostPlatform.config}-gcc" else ""}
if [ "$crate_name_" != "$crate_name" ]; then
mv target/bin/$crate_name_ target/bin/$crate_name
fi
@@ -91,18 +80,18 @@
echo "$EXTRA_LINK_SEARCH" | while read i; do
if [[ ! -z "$i" ]]; then
- for lib in $i; do
- echo "-L $lib" >> target/link
- L=$(echo $lib | sed -e "s#$(pwd)/target/build#$out/lib#")
+ for library in $i; do
+ echo "-L $library" >> target/link
+ L=$(echo $library | sed -e "s#$(pwd)/target/build#$lib/lib#")
echo "-L $L" >> target/link.final
done
fi
done
echo "$EXTRA_LINK" | while read i; do
if [[ ! -z "$i" ]]; then
- for lib in $i; do
- echo "-l $lib" >> target/link
- echo "-l $lib" >> target/link.final
+ for library in $i; do
+ echo "-l $library" >> target/link
+ echo "-l $library" >> target/link.final
done
fi
done
diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix
index 6534e21c0f0..edff3941636 100644
--- a/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix
+++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/default.nix
@@ -4,7 +4,7 @@
# This can be useful for deploying packages with NixOps, and to share
# binary dependencies between projects.
-{ lib, stdenv, defaultCrateOverrides, fetchCrate, rustc }:
+{ lib, stdenv, defaultCrateOverrides, fetchCrate, rustc, rust }:
let
# This doesn't appear to be officially documented anywhere yet.
@@ -22,9 +22,9 @@ let
else
extern;
in (if lib.lists.any (x: x == "lib") dep.crateType then
- " --extern ${name}=${dep.out}/lib/lib${extern}-${dep.metadata}.rlib"
+ " --extern ${name}=${dep.lib}/lib/lib${extern}-${dep.metadata}.rlib"
else
- " --extern ${name}=${dep.out}/lib/lib${extern}-${dep.metadata}${stdenv.hostPlatform.extensions.sharedLibrary}")
+ " --extern ${name}=${dep.lib}/lib/lib${extern}-${dep.metadata}${stdenv.hostPlatform.extensions.sharedLibrary}")
) dependencies);
echo_build_heading = colors: ''
@@ -59,7 +59,7 @@ let
'';
configureCrate = import ./configure-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps; };
- buildCrate = import ./build-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps; };
+ buildCrate = import ./build-crate.nix { inherit lib stdenv echo_build_heading noisily makeDeps rust; };
installCrate = import ./install-crate.nix;
in
@@ -96,12 +96,12 @@ stdenv.mkDerivation (rec {
buildInputs = (crate.buildInputs or []) ++ buildInputs_;
dependencies =
builtins.map
- (dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; })
+ (dep: lib.getLib (dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }))
dependencies_;
buildDependencies =
builtins.map
- (dep: dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; })
+ (dep: lib.getLib (dep.override { rust = rust; release = release; verbose = verbose; crateOverrides = crateOverrides; }))
buildDependencies_;
completeDeps = lib.lists.unique (dependencies ++ lib.lists.concatMap (dep: dep.completeDeps) dependencies);
@@ -160,6 +160,9 @@ stdenv.mkDerivation (rec {
};
installPhase = installCrate crateName metadata;
+ outputs = [ "out" "lib" ];
+ outputDev = [ "lib" ];
+
} // extraDerivationAttrs
)) {
rust = rustc;
diff --git a/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix b/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix
index 3b0282621ea..934c3a03176 100644
--- a/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix
+++ b/nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix
@@ -1,24 +1,26 @@
crateName: metadata:
''
runHook preInstall
- mkdir -p $out
+ # always create $out even if we do not have binaries. We are detecting binary targets during compilation, if those are missing there is no way to only have $lib
+ mkdir $out
if [[ -s target/env ]]; then
- cp target/env $out/env
+ mkdir -p $lib
+ cp target/env $lib/env
fi
if [[ -s target/link.final ]]; then
- mkdir -p $out/lib
- cp target/link.final $out/lib/link
+ mkdir -p $lib/lib
+ cp target/link.final $lib/lib/link
fi
if [[ "$(ls -A target/lib)" ]]; then
- mkdir -p $out/lib
- cp target/lib/* $out/lib #*/
- for lib in $out/lib/*.so $out/lib/*.dylib; do #*/
- ln -s $lib $(echo $lib | sed -e "s/-${metadata}//")
+ mkdir -p $lib/lib
+ cp target/lib/* $lib/lib #*/
+ for library in $lib/lib/*.so $lib/lib/*.dylib; do #*/
+ ln -s $library $(echo $library | sed -e "s/-${metadata}//")
done
fi
if [[ "$(ls -A target/build)" ]]; then # */
- mkdir -p $out/lib
- cp -r target/build/* $out/lib # */
+ mkdir -p $lib/lib
+ cp -r target/build/* $lib/lib # */
fi
if [[ -d target/bin ]]; then
if [[ "$(ls -A target/bin)" ]]; then
diff --git a/nixpkgs/pkgs/build-support/rust/default.nix b/nixpkgs/pkgs/build-support/rust/default.nix
index 27601e481c6..1d8e4448674 100644
--- a/nixpkgs/pkgs/build-support/rust/default.nix
+++ b/nixpkgs/pkgs/build-support/rust/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cacert, git, cargo, rustc, fetchcargo, buildPackages, windows }:
+{ stdenv, cacert, git, rust, cargo, rustc, fetchcargo, buildPackages, windows }:
{ name ? "${args.pname}-${args.version}"
, cargoSha256 ? "unset"
@@ -18,6 +18,7 @@
verifyCargoDeps ? false
, buildType ? "release"
, meta ? {}
+, target ? null
, cargoVendorDir ? null
, ... } @ args:
@@ -45,17 +46,13 @@ let
cargoDepsCopy="$sourceRoot/${cargoVendorDir}"
'';
- hostConfig = stdenv.hostPlatform.config;
-
- rustHostConfig = {
- x86_64-pc-mingw32 = "x86_64-pc-windows-gnu";
- }.${hostConfig} or hostConfig;
+ rustTarget = if target == null then rust.toRustTarget stdenv.hostPlatform else target;
ccForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc";
cxxForBuild="${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++";
ccForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
cxxForHost="${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
- releaseDir = "target/${rustHostConfig}/${buildType}";
+ releaseDir = "target/${rustTarget}/${buildType}";
in
stdenv.mkDerivation (args // {
@@ -85,10 +82,10 @@ stdenv.mkDerivation (args // {
--subst-var-by vendor "$(pwd)/$cargoDepsCopy"
cat >> .cargo/config <<'EOF'
- [target."${stdenv.buildPlatform.config}"]
+ [target."${rust.toRustTarget stdenv.buildPlatform}"]
"linker" = "${ccForBuild}"
${stdenv.lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) ''
- [target."${rustHostConfig}"]
+ [target."${rustTarget}"]
"linker" = "${ccForHost}"
${# https://github.com/rust-lang/rust/issues/46651#issuecomment-433611633
stdenv.lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isAarch64) ''
@@ -127,13 +124,13 @@ stdenv.mkDerivation (args // {
(
set -x
env \
- "CC_${stdenv.buildPlatform.config}"="${ccForBuild}" \
- "CXX_${stdenv.buildPlatform.config}"="${cxxForBuild}" \
- "CC_${stdenv.hostPlatform.config}"="${ccForHost}" \
- "CXX_${stdenv.hostPlatform.config}"="${cxxForHost}" \
+ "CC_${rust.toRustTarget stdenv.buildPlatform}"="${ccForBuild}" \
+ "CXX_${rust.toRustTarget stdenv.buildPlatform}"="${cxxForBuild}" \
+ "CC_${rust.toRustTarget stdenv.hostPlatform}"="${ccForHost}" \
+ "CXX_${rust.toRustTarget stdenv.hostPlatform}"="${cxxForHost}" \
cargo build \
${stdenv.lib.optionalString (buildType == "release") "--release"} \
- --target ${rustHostConfig} \
+ --target ${rustTarget} \
--frozen ${concatStringsSep " " cargoBuildFlags}
)
@@ -149,8 +146,8 @@ stdenv.mkDerivation (args // {
checkPhase = args.checkPhase or ''
runHook preCheck
- echo "Running cargo test"
- cargo test
+ echo "Running cargo cargo test -- ''${checkFlags} ''${checkFlagsArray+''${checkFlagsArray[@]}}"
+ cargo test -- ''${checkFlags} ''${checkFlagsArray+"''${checkFlagsArray[@]}"}
runHook postCheck
'';
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/audit-tmpdir.sh b/nixpkgs/pkgs/build-support/setup-hooks/audit-tmpdir.sh
index 5264ce39851..c9dd32d1dd2 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/audit-tmpdir.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/audit-tmpdir.sh
@@ -7,7 +7,7 @@
# the moment that would produce too many spurious errors (e.g. debug
# info or assertion messages that refer to $TMPDIR).
-fixupOutputHooks+=('if [ -z "$noAuditTmpdir" -a -e "$prefix" ]; then auditTmpdir "$prefix"; fi')
+fixupOutputHooks+=('if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi')
auditTmpdir() {
local dir="$1"
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh b/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh
index 6af8eb1aed9..52c50091d08 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh
@@ -228,7 +228,7 @@ autoPatchelf() {
# behaviour as fixupOutputHooks because the setup hook for patchelf is run in
# fixupOutput and the postFixup hook runs later.
postFixupHooks+=('
- if [ -z "$dontAutoPatchelf" ]; then
+ if [ -z "${dontAutoPatchelf-}" ]; then
autoPatchelf -- $(for output in $outputs; do
[ -e "${!output}" ] || continue
echo "${!output}"
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/compress-man-pages.sh b/nixpkgs/pkgs/build-support/setup-hooks/compress-man-pages.sh
index d10a898d6e4..82e48cd8aa7 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/compress-man-pages.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/compress-man-pages.sh
@@ -1,4 +1,4 @@
-fixupOutputHooks+=('if [ -z "$dontGzipMan" ]; then compressManPages "$prefix"; fi')
+fixupOutputHooks+=('if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi')
compressManPages() {
local dir="$1"
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/find-xml-catalogs.sh b/nixpkgs/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
index 85364a61f61..f446a6f27fd 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
@@ -11,12 +11,12 @@ addXMLCatalogs () {
done
}
-if [ -z "$libxmlHookDone" ]; then
+if [ -z "${libxmlHookDone-}" ]; then
libxmlHookDone=1
# Set up XML_CATALOG_FILES. An empty initial value prevents
# xmllint and xsltproc from looking in /etc/xml/catalog.
- export XML_CATALOG_FILES
+ export XML_CATALOG_FILES=''
if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
addEnvHooks "$hostOffset" addXMLCatalogs
fi
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh b/nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh
index 06891893e8c..8b7012677cd 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh
@@ -19,9 +19,6 @@ assertExecutable() {
# the environment
# --unset VAR : remove VAR from the environment
# --run COMMAND : run command before the executable
-# The command can push extra flags to a magic list
-# variable extraFlagsArray, which are then added to
-# the invocation of the executable
# --add-flags FLAGS : add FLAGS to invocation of executable
# --prefix ENV SEP VAL : suffix/prefix ENV with VAL, separated by SEP
@@ -109,12 +106,8 @@ makeWrapper() {
fi
done
- # Note: extraFlagsArray is an array containing additional flags
- # that may be set by --run actions.
- # Silence warning about unexpanded extraFlagsArray:
- # shellcheck disable=SC2016
echo exec ${argv0:+-a \"$argv0\"} \""$original"\" \
- "$flagsBefore" '"${extraFlagsArray[@]}"' '"$@"' >> "$wrapper"
+ "$flagsBefore" '"$@"' >> "$wrapper"
chmod +x "$wrapper"
}
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/move-lib64.sh b/nixpkgs/pkgs/build-support/setup-hooks/move-lib64.sh
index 7724be369c9..9517af79732 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/move-lib64.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/move-lib64.sh
@@ -8,7 +8,7 @@
fixupOutputHooks+=(_moveLib64)
_moveLib64() {
- if [ "$dontMoveLib64" = 1 ]; then return; fi
+ if [ "${dontMoveLib64-}" = 1 ]; then return; fi
if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then return; fi
echo "moving $prefix/lib64/* to $prefix/lib"
mkdir -p $prefix/lib
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/move-sbin.sh b/nixpkgs/pkgs/build-support/setup-hooks/move-sbin.sh
index cc51c27cafd..1c0c4dc9f2d 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/move-sbin.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/move-sbin.sh
@@ -5,7 +5,7 @@
fixupOutputHooks+=(_moveSbin)
_moveSbin() {
- if [ "$dontMoveSbin" = 1 ]; then return; fi
+ if [ "${dontMoveSbin-}" = 1 ]; then return; fi
if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then return; fi
echo "moving $prefix/sbin/* to $prefix/bin"
mkdir -p $prefix/bin
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh b/nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh
index d43b1877674..2e95495c96f 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/multiple-outputs.sh
@@ -9,8 +9,8 @@ _assignFirst() {
local varName="$1"
local REMOVE=REMOVE # slightly hacky - we allow REMOVE (i.e. not a variable name)
shift
- while [ $# -ge 1 ]; do
- if [ -n "${!1}" ]; then eval "${varName}"="$1"; return; fi
+ while (( $# )); do
+ if [ -n "${!1-}" ]; then eval "${varName}"="$1"; return; fi
shift
done
echo "Error: _assignFirst found no valid variant!"
@@ -19,7 +19,7 @@ _assignFirst() {
# Same as _assignFirst, but only if "$1" = ""
_overrideFirst() {
- if [ -z "${!1}" ]; then
+ if [ -z "${!1-}" ]; then
_assignFirst "$@"
fi
}
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/patch-shebangs.sh b/nixpkgs/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 3e900d0704c..29fed7ad794 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -105,7 +105,7 @@ patchShebangs() {
}
patchShebangsAuto () {
- if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then
+ if [ -z "${dontPatchShebangs-}" -a -e "$prefix" ]; then
# Dev output will end up being run on the build platform. An
# example case of this is sdl2-config. Otherwise, we can just
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/prune-libtool-files.sh b/nixpkgs/pkgs/build-support/setup-hooks/prune-libtool-files.sh
index 5d7432e8f09..0ec56549645 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/prune-libtool-files.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/prune-libtool-files.sh
@@ -8,7 +8,7 @@
fixupOutputHooks+=(_pruneLibtoolFiles)
_pruneLibtoolFiles() {
- if [ "$dontPruneLibtoolFiles" ] || [ ! -e "$prefix" ]; then
+ if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then
return
fi
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/set-java-classpath.sh b/nixpkgs/pkgs/build-support/setup-hooks/set-java-classpath.sh
index 5d3548dc2e8..445fa56d61d 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/set-java-classpath.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/set-java-classpath.sh
@@ -6,7 +6,7 @@ export CLASSPATH
addPkgToClassPath () {
local jar
for jar in $1/share/java/*.jar; do
- export CLASSPATH=''${CLASSPATH}''${CLASSPATH:+:}''${jar}
+ export CLASSPATH=''${CLASSPATH-}''${CLASSPATH:+:}''${jar}
done
}
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/strip.sh b/nixpkgs/pkgs/build-support/setup-hooks/strip.sh
index fc4c7bfbaf9..f5fa9378fd7 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/strip.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/strip.sh
@@ -10,7 +10,7 @@ _doStrip() {
local -ra stripCmds=(STRIP TARGET_STRIP)
# Optimization
- if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
+ if [[ "${STRIP-}" == "${TARGET_STRIP-}" ]]; then
dontStripTarget+=1
fi
@@ -20,7 +20,7 @@ _doStrip() {
local -n stripCmd="${stripCmds[$i]}"
# `dontStrip` disables them all
- if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
+ if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
then continue; fi
stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh b/nixpkgs/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh
index 66f4e91c7bb..ebd3afa05d9 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/update-autotools-gnu-config-scripts.sh
@@ -1,7 +1,7 @@
preConfigurePhases+=" updateAutotoolsGnuConfigScriptsPhase"
updateAutotoolsGnuConfigScriptsPhase() {
- if [ -n "$dontUpdateAutotoolsGnuConfigScripts" ]; then return; fi
+ if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then return; fi
for script in config.sub config.guess; do
for f in $(find . -type f -name "$script"); do
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/nixpkgs/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
index 717740f1f20..a05d4f689db 100644
--- a/nixpkgs/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
+++ b/nixpkgs/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
@@ -15,7 +15,7 @@ wrapGApp() {
wrapProgram "$program" "${gappsWrapperArgs[@]}" "$@"
}
-# Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set.
+# Note: $gappsWrapperArgs still gets defined even if ${dontWrapGApps-} is set.
wrapGAppsHook() {
# guard against running multiple times (e.g. due to propagation)
[ -z "$wrapGAppsHookHasRun" ] || return 0
diff --git a/nixpkgs/pkgs/build-support/writers/default.nix b/nixpkgs/pkgs/build-support/writers/default.nix
index 8dbe0dbdbd0..2cd4f1af022 100644
--- a/nixpkgs/pkgs/build-support/writers/default.nix
+++ b/nixpkgs/pkgs/build-support/writers/default.nix
@@ -92,13 +92,15 @@ rec {
PATH=${makeBinPath [
pkgs.binutils-unwrapped
pkgs.coreutils
+ pkgs.findutils
pkgs.gcc
pkgs.pkgconfig
]}
+ export PKG_CONFIG_PATH=${concatMapStringsSep ":" (pkg: "${pkg}/lib/pkgconfig") libraries}
gcc \
${optionalString (libraries != [])
"$(pkg-config --cflags --libs ${
- concatMapStringsSep " " (pkg: "$(find ${escapeShellArg pkg}/lib/pkgsconfig -name \*.pc -exec basename {} \;)") libraries
+ concatMapStringsSep " " (pkg: "$(find ${escapeShellArg pkg}/lib/pkgconfig -name \\*.pc)") libraries
})"
} \
-O \
diff --git a/nixpkgs/pkgs/build-support/writers/test.nix b/nixpkgs/pkgs/build-support/writers/test.nix
index d7c347a559e..3cd0a080ae8 100644
--- a/nixpkgs/pkgs/build-support/writers/test.nix
+++ b/nixpkgs/pkgs/build-support/writers/test.nix
@@ -1,4 +1,16 @@
-{ stdenv, lib, runCommand, haskellPackages, nodePackages, perlPackages, python2Packages, python3Packages, writers, writeText }:
+{
+ glib,
+ haskellPackages,
+ lib,
+ nodePackages,
+ perlPackages,
+ python2Packages,
+ python3Packages,
+ runCommand,
+ stdenv,
+ writers,
+ writeText
+}:
with writers;
let
@@ -49,9 +61,11 @@ let
python2 = writePython2Bin "test_writers" { libraries = [ python2Packages.enum ]; } ''
from enum import Enum
+
class Test(Enum):
a = "success"
+
print Test.a
'';
@@ -70,9 +84,19 @@ let
if [[ "test" == "test" ]]; then echo "success"; fi
'';
- c = writeC "test_c" { libraries = [ ]; } ''
+ c = writeC "test_c" { libraries = [ glib.dev ]; } ''
+ #include <gio/gio.h>
#include <stdio.h>
int main() {
+ GApplication *application = g_application_new ("hello.world", G_APPLICATION_FLAGS_NONE);
+ g_application_register (application, NULL, NULL);
+ GNotification *notification = g_notification_new ("Hello world!");
+ g_notification_set_body (notification, "This is an example notification.");
+ GIcon *icon = g_themed_icon_new ("dialog-information");
+ g_notification_set_icon (notification, icon);
+ g_object_unref (icon);
+ g_object_unref (notification);
+ g_object_unref (application);
printf("success\n");
return 0;
}
@@ -112,9 +136,11 @@ let
python2 = writePython2 "test_python2" { libraries = [ python2Packages.enum ]; } ''
from enum import Enum
+
class Test(Enum):
a = "success"
+
print Test.a
'';