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
102
pkgs/tools/archivers/7zz/default.nix
Normal file
102
pkgs/tools/archivers/7zz/default.nix
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchurl
|
||||
|
||||
# Only used for x86/x86_64
|
||||
, uasm
|
||||
, useUasm ? stdenv.hostPlatform.isx86
|
||||
|
||||
# RAR code is under non-free unRAR license
|
||||
# see the meta.license section below for more details
|
||||
, enableUnfree ? false
|
||||
|
||||
# For tests
|
||||
, _7zz
|
||||
, testers
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
platformSuffix = {
|
||||
aarch64-linux = "_arm64";
|
||||
i686-linux = "_x86";
|
||||
x86_64-linux = "_x64";
|
||||
}.${system} or
|
||||
(builtins.trace "`platformSuffix` not available for `${system}.` Making a generic `7zz` build." "");
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "7zz";
|
||||
version = "21.07";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] version}-src.tar.xz";
|
||||
sha256 = {
|
||||
free = "sha256-SMM6kQ6AZ05s4miJjMoE4NnsXQ0tlkdWx0q2HKjhaM8=";
|
||||
unfree = "sha256-IT1ZRAfLjvy6NmELFSykkh7aFBYzELQ5A9E+aDE+Hjk=";
|
||||
}.${if enableUnfree then "unfree" else "free"};
|
||||
downloadToTemp = (!enableUnfree);
|
||||
# remove the unRAR related code from the src drv
|
||||
# > the license requires that you agree to these use restrictions,
|
||||
# > or you must remove the software (source and binary) from your hard disks
|
||||
# https://fedoraproject.org/wiki/Licensing:Unrar
|
||||
postFetch = lib.optionalString (!enableUnfree) ''
|
||||
mkdir tmp
|
||||
tar xf $downloadedFile -C ./tmp
|
||||
rm -r ./tmp/CPP/7zip/Compress/Rar*
|
||||
tar cfJ $out -C ./tmp . \
|
||||
--sort=name \
|
||||
--mtime="@$SOURCE_DATE_EPOCH" \
|
||||
--owner=0 --group=0 --numeric-owner \
|
||||
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
|
||||
'';
|
||||
};
|
||||
|
||||
sourceRoot = "CPP/7zip/Bundles/Alone2";
|
||||
|
||||
makeFlags =
|
||||
[
|
||||
"CC=${stdenv.cc.targetPrefix}cc"
|
||||
"CXX=${stdenv.cc.targetPrefix}c++"
|
||||
] ++
|
||||
lib.optionals useUasm [ "MY_ASM=uasm" ] ++
|
||||
# it's the compression code with the restriction, see DOC/License.txt
|
||||
lib.optionals (!enableUnfree) [ "DISABLE_RAR_COMPRESS=true" ];
|
||||
|
||||
makefile = "../../cmpl_gcc${platformSuffix}.mak";
|
||||
|
||||
nativeBuildInputs = lib.optionals useUasm [ uasm ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm555 -t $out/bin b/g${platformSuffix}/7zz
|
||||
install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = ./update.sh;
|
||||
tests.version = testers.testVersion {
|
||||
package = _7zz;
|
||||
command = "7zz --help";
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Command line archiver utility";
|
||||
homepage = "https://7-zip.org";
|
||||
license = with licenses;
|
||||
# 7zip code is largely lgpl2Plus
|
||||
# CPP/7zip/Compress/LzfseDecoder.cpp is bsd3
|
||||
[ lgpl2Plus /* and */ bsd3 ] ++
|
||||
# and CPP/7zip/Compress/Rar* are unfree with the unRAR license restriction
|
||||
# the unRAR compression code is disabled by default
|
||||
lib.optionals enableUnfree [ unfree ];
|
||||
maintainers = with maintainers; [ anna328p peterhoeg jk ];
|
||||
platforms = platforms.linux;
|
||||
mainProgram = "7zz";
|
||||
};
|
||||
}
|
||||
50
pkgs/tools/archivers/7zz/update.sh
Executable file
50
pkgs/tools/archivers/7zz/update.sh
Executable file
|
|
@ -0,0 +1,50 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p coreutils gnused curl jq
|
||||
set -euo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
DRV_DIR="$PWD"
|
||||
|
||||
OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
|
||||
|
||||
NEW_VERSION="$(curl "https://sourceforge.net/projects/sevenzip/best_release.json" | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)"
|
||||
|
||||
echo "comparing versions $OLD_VERSION => $NEW_VERSION"
|
||||
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
|
||||
echo "Already up to date! Doing nothing"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
NIXPKGS_ROOT="$(realpath "$DRV_DIR/../../../..")"
|
||||
|
||||
echo "getting free source hash"
|
||||
OLD_FREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; _7zz.src.drvAttrs.outputHash" | tr -d '"')"
|
||||
echo "getting unfree source hash"
|
||||
OLD_UNFREE_HASH="$(nix-instantiate --eval --strict -E "with import $NIXPKGS_ROOT {}; (_7zz.override { enableUnfree = true; }).src.drvAttrs.outputHash" | tr -d '"')"
|
||||
|
||||
NEW_VERSION_FORMATTED="$(echo "$NEW_VERSION" | tr -d '.')"
|
||||
URL="https://7-zip.org/a/7z${NEW_VERSION_FORMATTED}-src.tar.xz"
|
||||
|
||||
|
||||
NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL")
|
||||
|
||||
NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path)
|
||||
# first line of raw output is the hash
|
||||
NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)"
|
||||
# second line of raw output is the src path
|
||||
NEW_UNFREE_SRC="$(echo "$NEW_UNFREE_OUT" | sed -n 2p)"
|
||||
# make sure to nuke the unfree src from the updater's machine
|
||||
# > the license requires that you agree to these use restrictions, or you must remove the software (source and binary) from your hard disks
|
||||
# https://fedoraproject.org/wiki/Licensing:Unrar
|
||||
nix-store --delete "$NEW_UNFREE_SRC"
|
||||
|
||||
|
||||
echo "updating version"
|
||||
sed -i "s/version = \"$OLD_VERSION\";/version = \"$NEW_VERSION\";/" "$DRV_DIR/default.nix"
|
||||
|
||||
echo "updating free hash"
|
||||
sed -i "s@free = \"$OLD_FREE_HASH\";@free = \"$NEW_FREE_HASH\";@" "$DRV_DIR/default.nix"
|
||||
echo "updating unfree hash"
|
||||
sed -i "s@unfree = \"$OLD_UNFREE_HASH\";@unfree = \"$NEW_UNFREE_HASH\";@" "$DRV_DIR/default.nix"
|
||||
|
||||
echo "done"
|
||||
Loading…
Add table
Add a link
Reference in a new issue