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:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,45 @@
{ lib, stdenv, fetchFromGitHub }:
{
# : string
pname
# : string
, version
# : string
, sha256
# : string
, description
# : list Maintainer
, maintainers
# : license
, license ? lib.licenses.isc
# : string
, owner ? "flexibeast"
# : string
, rev ? "v${version}"
}:
let
manDir = "${placeholder "out"}/share/man";
src = fetchFromGitHub {
inherit owner rev sha256;
repo = pname;
};
in
stdenv.mkDerivation {
inherit pname version src;
makeFlags = [
"MANPATH=${manDir}"
];
dontBuild = true;
meta = with lib; {
inherit description license maintainers;
inherit (src.meta) homepage;
platforms = platforms.all;
};
}

View file

@ -0,0 +1,117 @@
{ lib, stdenv, cleanPackaging, fetchurl }:
{
# : string
pname
# : string
, version
# : string
, sha256
# : string
, description
# : list Platform
, platforms ? lib.platforms.all
# : list string
, outputs ? [ "bin" "lib" "dev" "doc" "out" ]
# TODO(Profpatsch): automatically infer most of these
# : list string
, configureFlags
# : string
, postConfigure ? null
# mostly for moving and deleting files from the build directory
# : lines
, postInstall
# : list Maintainer
, maintainers ? [ ]
# : passthru arguments (e.g. tests)
, passthru ? { }
}:
let
# File globs that can always be deleted
commonNoiseFiles = [
".gitignore"
"Makefile"
"INSTALL"
"configure"
"patch-for-solaris"
"src/**/*"
"tools/**/*"
"package/**/*"
"config.mak"
];
# File globs that should be moved to $doc
commonMetaFiles = [
"COPYING"
"AUTHORS"
"NEWS"
"CHANGELOG"
"README"
"README.*"
"DCO"
"CONTRIBUTING"
];
in
stdenv.mkDerivation {
inherit pname version;
src = fetchurl {
url = "https://skarnet.org/software/${pname}/${pname}-${version}.tar.gz";
inherit sha256;
};
inherit outputs;
dontDisableStatic = true;
enableParallelBuilding = true;
configureFlags = configureFlags ++ [
"--enable-absolute-paths"
# We assume every nix-based cross target has urandom.
# This might not hold for e.g. BSD.
"--with-sysdep-devurandom=yes"
(if stdenv.isDarwin
then "--disable-shared"
else "--enable-shared")
]
# On darwin, the target triplet from -dumpmachine includes version number,
# but skarnet.org software uses the triplet to test binary compatibility.
# Explicitly setting target ensures code can be compiled against a skalibs
# binary built on a different version of darwin.
# http://www.skarnet.org/cgi-bin/archive.cgi?1:mss:623:heiodchokfjdkonfhdph
++ (lib.optional stdenv.isDarwin
"--build=${stdenv.hostPlatform.system}");
inherit postConfigure;
makeFlags = lib.optional stdenv.cc.isClang [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
# TODO(Profpatsch): ensure that there is always a $doc output!
postInstall = ''
echo "Cleaning & moving common files"
${cleanPackaging.commonFileActions {
noiseFiles = commonNoiseFiles;
docFiles = commonMetaFiles;
}} $doc/share/doc/${pname}
${postInstall}
'';
postFixup = ''
${cleanPackaging.checkForRemainingFiles}
'';
meta = {
homepage = "https://skarnet.org/software/${pname}/";
inherit description platforms;
license = lib.licenses.isc;
maintainers = with lib.maintainers;
[ pmahoney Profpatsch qyliss ] ++ maintainers;
};
inherit passthru;
}

View file

@ -0,0 +1,53 @@
# set of utilities that assure the cwd of a build
# is completely clean after the build, meaning all
# files were either discarded or moved to outputs.
# This ensures nothing is forgotten and new files
# are correctly handled on update.
{ lib, stdenv, file, writeScript }:
let
globWith = lib.concatMapStringsSep "\n";
rmNoise = noiseGlobs: globWith (f:
"rm -rf ${f}") noiseGlobs;
mvDoc = docGlobs: globWith
(f: ''mv ${f} "$DOCDIR" 2>/dev/null || true'')
docGlobs;
# Shell script that implements common move & remove actions
# $1 is the doc directory (will be created).
# Best used in conjunction with checkForRemainingFiles
commonFileActions =
{ # list of fileglobs that are removed from the source dir
noiseFiles
# files that are moved to the doc directory ($1)
# TODO(Profpatsch): allow to set target dir with
# { glob = …; to = "html" } (relative to docdir)
, docFiles }:
writeScript "common-file-actions.sh" ''
#!${stdenv.shell}
set -e
DOCDIR="''${1?commonFileActions: DOCDIR as argv[1] required}"
shopt -s globstar extglob nullglob
mkdir -p "$DOCDIR"
${mvDoc docFiles}
${rmNoise noiseFiles}
'';
# Shell script to check whether the build directory is empty.
# If there are still files remaining, exit 1 with a helpful
# listing of all remaining files and their types.
checkForRemainingFiles = writeScript "check-for-remaining-files.sh" ''
#!${stdenv.shell}
echo "Checking for remaining source files"
rem=$(find -mindepth 1 -xtype f -print0 \
| tee $TMP/remaining-files)
if [[ "$rem" != "" ]]; then
echo "ERROR: These files should be either moved or deleted:"
cat $TMP/remaining-files | xargs -0 ${file}/bin/file
exit 1
fi
'';
in {
inherit commonFileActions checkForRemainingFiles;
}