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,49 @@
{ stdenvNoCC, lib, type }:
assert lib.elem type [
"mod"
"soundpack"
"tileset"
];
{ modName, version, src, ... } @ args:
stdenvNoCC.mkDerivation (args // rec {
pname = args.pname or "cataclysm-dda-${type}-${modName}";
modRoot = args.modRoot or ".";
configurePhase = args.configurePhase or ''
runHook preConfigure
runHook postConfigure
'';
buildPhase = args.buildPhase or ''
runHook preBuild
runHook postBuild
'';
checkPhase = args.checkPhase or ''
runHook preCheck
runHook postCheck
'';
installPhase = let
baseDir = {
mod = "mods";
soundpack = "sound";
tileset = "gfx";
}.${type};
in args.installPhase or ''
runHook preInstall
destdir="$out/share/cataclysm-dda/${baseDir}"
mkdir -p "$destdir"
cp -R "${modRoot}" "$destdir/${modName}"
runHook postInstall
'';
passthru = {
forTiles = true;
forCurses = type == "mod";
};
})

View file

@ -0,0 +1,108 @@
{ lib, stdenv, runtimeShell, pkg-config, gettext, ncurses, CoreFoundation
, tiles, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, freetype, Cocoa
, debug
, useXdgDir
}:
let
inherit (lib) optionals optionalString;
cursesDeps = [ gettext ncurses ]
++ optionals stdenv.isDarwin [ CoreFoundation ];
tilesDeps = [ SDL2 SDL2_image SDL2_mixer SDL2_ttf freetype ]
++ optionals stdenv.isDarwin [ Cocoa ];
patchDesktopFile = ''
substituteInPlace $out/share/applications/org.cataclysmdda.CataclysmDDA.desktop \
--replace "Exec=cataclysm-tiles" "Exec=$out/bin/cataclysm-tiles"
'';
installMacOSAppLauncher = ''
app=$out/Applications/Cataclysm.app
install -D -m 444 build-data/osx/Info.plist -t $app/Contents
install -D -m 444 build-data/osx/AppIcon.icns -t $app/Contents/Resources
mkdir $app/Contents/MacOS
launcher=$app/Contents/MacOS/Cataclysm.sh
cat << EOF > $launcher
#!${runtimeShell}
$out/bin/cataclysm-tiles
EOF
chmod 555 $launcher
'';
in
stdenv.mkDerivation {
pname = "cataclysm-dda";
nativeBuildInputs = [ pkg-config ];
buildInputs = cursesDeps ++ optionals tiles tilesDeps;
postPatch = ''
patchShebangs .
# Locale patch required for Darwin builds, see:
# https://github.com/NixOS/nixpkgs/pull/74064#issuecomment-560083970
sed -i src/translations.cpp \
-e 's@#elif (defined(__linux__) || (defined(MACOSX) && !defined(TILES)))@#elif 1@'
'';
makeFlags = [
"PREFIX=$(out)" "LANGUAGES=all" "RUNTESTS=0"
(if useXdgDir then "USE_XDG_DIR=1" else "USE_HOME_DIR=1")
] ++ optionals (!debug) [
"RELEASE=1"
] ++ optionals tiles [
"TILES=1" "SOUND=1"
] ++ optionals stdenv.isDarwin [
"NATIVE=osx"
"CLANG=1"
"OSX_MIN=${stdenv.targetPlatform.darwinMinVersion}"
];
postInstall = optionalString tiles
( if !stdenv.isDarwin
then patchDesktopFile
else installMacOSAppLauncher
);
dontStrip = debug;
enableParallelBuilding = true;
passthru = {
isTiles = tiles;
isCurses = !tiles;
};
meta = with lib; {
description = "A free, post apocalyptic, zombie infested rogue-like";
longDescription = ''
Cataclysm: Dark Days Ahead is a roguelike set in a post-apocalyptic world.
Surviving is difficult: you have been thrown, ill-equipped, into a
landscape now riddled with monstrosities of which flesh eating zombies are
neither the strangest nor the deadliest.
Yet with care and a little luck, many things are possible. You may try to
eke out an existence in the forests silently executing threats and
providing sustenance with your longbow. You can ride into town in a
jerry-rigged vehicle, all guns blazing, to settle matters in a fug of
smoke from your molotovs. You could take a more measured approach and
construct an impregnable fortress, surrounded by traps to protect you from
the horrors without. The longer you survive, the more skilled and adapted
you will get and the better equipped and armed to deal with the threats
you are presented with.
In the course of your ordeal there will be opportunities and temptations
to improve or change your very nature. There are tales of survivors fitted
with extraordinary cybernetics giving great power and stories too of
gravely mutated survivors who, warped by their ingestion of exotic
substances or radiation, now more closely resemble insects, birds or fish
than their original form.
'';
homepage = "https://cataclysmdda.org/";
license = licenses.cc-by-sa-30;
maintainers = with maintainers; [ mnacamura DeeUnderscore ];
platforms = platforms.unix;
};
}

View file

@ -0,0 +1,43 @@
{ newScope, darwin }:
let
callPackage = newScope self;
stable = rec {
tiles = callPackage ./stable.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
};
curses = tiles.override { tiles = false; };
};
git = rec {
tiles = callPackage ./git.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Cocoa;
};
curses = tiles.override { tiles = false; };
};
lib = callPackage ./lib.nix {};
pkgs = callPackage ./pkgs {};
self = {
inherit
callPackage
stable
git;
inherit (lib)
buildMod
buildSoundPack
buildTileSet
wrapCDDA
attachPkgs;
inherit pkgs;
};
in
self

View file

@ -0,0 +1,38 @@
{ stdenv, lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA, attachPkgs
, tiles ? true, Cocoa
, debug ? false
, useXdgDir ? false
, version ? "2021-07-03"
, rev ? "9017808252e1e149446c8f8bd7a6582ce0f95285"
, sha256 ? "0qrvkbyg098jb9hv69sg5093b1vj8f4n75p73v01jnmyxlz3ax28"
}:
let
common = callPackage ./common.nix {
inherit CoreFoundation tiles Cocoa debug useXdgDir;
};
self = common.overrideAttrs (common: rec {
pname = common.pname + "-git";
inherit version;
src = fetchFromGitHub {
owner = "CleverRaven";
repo = "Cataclysm-DDA";
inherit rev sha256;
};
makeFlags = common.makeFlags ++ [
"VERSION=git-${version}-${lib.substring 0 8 src.rev}"
];
meta = common.meta // {
maintainers = with lib.maintainers;
common.meta.maintainers ++ [ rardiol ];
# /nix/store/s8xaq3x7mcysvd752in2nihb1nr6svsl-SDL2-2.0.20-dev/include/SDL2/SDL_events.h:645:65: error: use of old-style cast [-Werror,-Wold-style-cast]
broken = (stdenv.isDarwin && stdenv.isx86_64);
};
});
in
attachPkgs pkgs self

View file

@ -0,0 +1,46 @@
{ callPackage }:
rec {
buildMod = callPackage ./builder.nix {
type = "mod";
};
buildSoundPack = callPackage ./builder.nix {
type = "soundpack";
};
buildTileSet = callPackage ./builder.nix {
type = "tileset";
};
wrapCDDA = callPackage ./wrapper.nix {};
# Required to fix `pkgs` and `withMods` attrs after applying `overrideAttrs`.
#
# Example:
# let
# myBuild = cataclysmDDA.jenkins.latest.tiles.overrideAttrs (_: {
# x = "hello";
# });
#
# # This refers to the derivation before overriding! So, `badExample.x` is not accessible.
# badExample = myBuild.withMods (_: []);
#
# # `myBuild` is correctly referred by `withMods` and `goodExample.x` is accessible.
# goodExample = let
# inherit (cataclysmDDA) attachPkgs pkgs;
# in
# (attachPkgs pkgs myBuild).withMods (_: []);
# in
# goodExample.x # returns "hello"
attachPkgs = pkgs: super:
let
self = super.overrideAttrs (old: {
passthru = old.passthru // {
pkgs = pkgs.override { build = self; };
withMods = wrapCDDA self;
};
});
in
self;
}

View file

@ -0,0 +1,29 @@
{ lib, callPackage, build ? null }:
let
pkgs = {
mod = {
};
soundpack = {
};
tileset = {
UndeadPeople = callPackage ./tilesets/UndeadPeople {};
};
};
pkgs' = lib.mapAttrs (_: mods: lib.filterAttrs isAvailable mods) pkgs;
isAvailable = _: mod:
if isNull build then
true
else if build.isTiles then
mod.forTiles or false
else if build.isCurses then
mod.forCurses or false
else
false;
in
lib.makeExtensible (_: pkgs')

View file

@ -0,0 +1,23 @@
{ lib, buildTileSet, fetchFromGitHub }:
buildTileSet {
modName = "UndeadPeople";
version = "2020-07-08";
src = fetchFromGitHub {
owner = "SomeDeadGuy";
repo = "UndeadPeopleTileset";
rev = "f7f13b850fafe2261deee051f45d9c611a661534";
sha256 = "0r06srjr7rq51jk9yfyxz80nfgb98mkn86cbcjfxpibgbqvcp0zm";
};
modRoot = "MSX++UnDeadPeopleEdition";
meta = with lib; {
description = "Cataclysm DDA tileset based on MSX++ tileset";
homepage = "https://github.com/SomeDeadGuy/UndeadPeopleTileset";
license = licenses.unfree;
maintainers = with maintainers; [ mnacamura ];
platforms = platforms.all;
};
}

View file

@ -0,0 +1,34 @@
{ lib, callPackage, CoreFoundation, fetchFromGitHub, pkgs, wrapCDDA, attachPkgs
, tiles ? true, Cocoa
, debug ? false
, useXdgDir ? false
}:
let
common = callPackage ./common.nix {
inherit CoreFoundation tiles Cocoa debug useXdgDir;
};
self = common.overrideAttrs (common: rec {
version = "0.F-3";
src = fetchFromGitHub {
owner = "CleverRaven";
repo = "Cataclysm-DDA";
rev = version;
sha256 = "sha256-2su1uQaWl9WG41207dRvOTdVKcQsEz/y0uTi9JX52uI=";
};
makeFlags = common.makeFlags ++ [
# Makefile declares version as 0.F, with no minor release number
"VERSION=${version}"
];
meta = common.meta // {
maintainers = with lib.maintainers;
common.meta.maintainers ++ [ skeidel ];
};
});
in
attachPkgs pkgs self

View file

@ -0,0 +1,47 @@
{ lib, symlinkJoin, makeWrapper }:
unwrapped:
pkgsSpec:
let
mods = if lib.isFunction pkgsSpec
then pkgsSpec unwrapped.pkgs
else pkgsSpec;
in
if builtins.length mods == 0
then unwrapped
else symlinkJoin {
name = unwrapped.name + "-with-mods";
paths = [ unwrapped ] ++ mods;
nativeBuildInputs = [ makeWrapper ];
postBuild = ''
if [ -x $out/bin/cataclysm ]; then
wrapProgram $out/bin/cataclysm \
--add-flags "--datadir $out/share/cataclysm-dda/"
fi
if [ -x $out/bin/cataclysm-tiles ]; then
wrapProgram $out/bin/cataclysm-tiles \
--add-flags "--datadir $out/share/cataclysm-dda/"
fi
# Launch the wrapped program
replaceProgram() {
cp "$1" "''${1}.bk"
unlink "$1"
mv "''${1}.bk" "$1"
sed -i "$1" -e "s,/nix/store/.\+\(/bin/cataclysm-tiles\),$out\1,"
}
for script in "$out/share/applications/cataclysm-dda.desktop" \
"$out/Applications/Cataclysm.app/Contents/MacOS/Cataclysm.sh"
do
if [ -e "$script" ]; then
replaceProgram "$script"
fi
done
'';
}