uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
12
pkgs/build-support/pkg-config-wrapper/add-flags.sh
Normal file
12
pkgs/build-support/pkg-config-wrapper/add-flags.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# See cc-wrapper for comments.
|
||||
var_templates_list=(
|
||||
PKG_CONFIG_PATH
|
||||
)
|
||||
|
||||
accumulateRoles
|
||||
|
||||
for var in "${var_templates_list[@]}"; do
|
||||
mangleVarListGeneric ":" "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
|
||||
done
|
||||
|
||||
export NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@=1
|
||||
131
pkgs/build-support/pkg-config-wrapper/default.nix
Normal file
131
pkgs/build-support/pkg-config-wrapper/default.nix
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
# The wrapper script ensures variables like PKG_CONFIG_PATH and
|
||||
# PKG_CONFIG_PATH_FOR_BUILD work properly.
|
||||
|
||||
{ stdenvNoCC
|
||||
, lib
|
||||
, buildPackages
|
||||
, pkg-config
|
||||
, baseBinName ? "pkg-config"
|
||||
, propagateDoc ? pkg-config != null && pkg-config ? man
|
||||
, extraPackages ? [], extraBuildCommands ? ""
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
stdenv = stdenvNoCC;
|
||||
inherit (stdenv) hostPlatform targetPlatform;
|
||||
|
||||
# Prefix for binaries. Customarily ends with a dash separator.
|
||||
#
|
||||
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
||||
# default.
|
||||
targetPrefix = lib.optionalString (targetPlatform != hostPlatform)
|
||||
(targetPlatform.config + "-");
|
||||
|
||||
# See description in cc-wrapper.
|
||||
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = targetPrefix + pkg-config.pname + "-wrapper";
|
||||
inherit (pkg-config) version;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
preferLocalBuild = true;
|
||||
|
||||
shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or "";
|
||||
|
||||
inherit targetPrefix suffixSalt baseBinName;
|
||||
|
||||
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc");
|
||||
|
||||
passthru = {
|
||||
inherit pkg-config;
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
|
||||
# Additional flags passed to pkg-config.
|
||||
addFlags = lib.optional stdenv.targetPlatform.isStatic "--static";
|
||||
|
||||
unpackPhase = ''
|
||||
src=$PWD
|
||||
'';
|
||||
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin $out/nix-support
|
||||
|
||||
wrap() {
|
||||
local dst="$1"
|
||||
local wrapper="$2"
|
||||
export prog="$3"
|
||||
substituteAll "$wrapper" "$out/bin/$dst"
|
||||
chmod +x "$out/bin/$dst"
|
||||
}
|
||||
|
||||
echo $pkg-config > $out/nix-support/orig-pkg-config
|
||||
|
||||
wrap ${targetPrefix}${baseBinName} ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/${baseBinName}"
|
||||
''
|
||||
# symlink in share for autoconf to find macros
|
||||
|
||||
# TODO(@Ericson2314): in the future just make the unwrapped pkg-config a
|
||||
# propagated dep once we can rely on downstream deps comming first in
|
||||
# search paths. (https://github.com/NixOS/nixpkgs/pull/31414 took a crack
|
||||
# at this.)
|
||||
+ ''
|
||||
ln -s ${pkg-config}/share $out/share
|
||||
'';
|
||||
|
||||
wrapperName = "PKG_CONFIG_WRAPPER";
|
||||
|
||||
setupHooks = [
|
||||
../setup-hooks/role.bash
|
||||
./setup-hook.sh
|
||||
];
|
||||
|
||||
postFixup =
|
||||
##
|
||||
## User env support
|
||||
##
|
||||
|
||||
# Propagate the underling unwrapped pkg-config so that if you
|
||||
# install the wrapper, you get anything else it might provide.
|
||||
''
|
||||
printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages
|
||||
''
|
||||
|
||||
##
|
||||
## Man page and doc support
|
||||
##
|
||||
+ optionalString propagateDoc (''
|
||||
ln -s ${pkg-config.man} $man
|
||||
'' + optionalString (pkg-config ? doc) ''
|
||||
ln -s ${pkg-config.doc} $doc
|
||||
'')
|
||||
|
||||
+ ''
|
||||
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
|
||||
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
|
||||
''
|
||||
|
||||
##
|
||||
## Extra custom steps
|
||||
##
|
||||
+ extraBuildCommands;
|
||||
|
||||
meta =
|
||||
let pkg-config_ = if pkg-config != null then pkg-config else {}; in
|
||||
(if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) //
|
||||
{ description =
|
||||
lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_
|
||||
+ " (wrapper script)";
|
||||
priority = 10;
|
||||
};
|
||||
}
|
||||
23
pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
Normal file
23
pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#! @shell@
|
||||
set -eu -o pipefail +o posix
|
||||
shopt -s nullglob
|
||||
|
||||
if (( "${NIX_DEBUG:-0}" >= 7 )); then
|
||||
set -x
|
||||
fi
|
||||
|
||||
source @out@/nix-support/utils.bash
|
||||
|
||||
if [ -z "${NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
|
||||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
set -- "$@" @addFlags@
|
||||
|
||||
if (( ${#role_suffixes[@]} > 0 )); then
|
||||
# replace env var with nix-modified one
|
||||
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_@suffixSalt@ exec @prog@ "$@"
|
||||
else
|
||||
# pkg-config isn't a real dependency so ignore setup hook entirely
|
||||
exec @prog@ "$@"
|
||||
fi
|
||||
29
pkgs/build-support/pkg-config-wrapper/setup-hook.sh
Normal file
29
pkgs/build-support/pkg-config-wrapper/setup-hook.sh
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# pkg-config Wrapper hygiene
|
||||
#
|
||||
# See comments in cc-wrapper's setup hook. This works exactly the same way.
|
||||
|
||||
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
|
||||
# native compile.
|
||||
#
|
||||
# TODO(@Ericson2314): No native exception
|
||||
[[ -z ${strictDeps-} ]] || (( "$hostOffset" < 0 )) || return 0
|
||||
|
||||
pkgConfigWrapper_addPkgConfigPath () {
|
||||
# See ../setup-hooks/role.bash
|
||||
local role_post
|
||||
getHostRoleEnvHook
|
||||
|
||||
addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"
|
||||
addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig"
|
||||
}
|
||||
|
||||
# See ../setup-hooks/role.bash
|
||||
getTargetRole
|
||||
getTargetRoleWrapper
|
||||
|
||||
addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath
|
||||
|
||||
export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@
|
||||
|
||||
# No local scope in sourced file
|
||||
unset -v role_post
|
||||
Loading…
Add table
Add a link
Reference in a new issue