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,71 @@
source $stdenv/setup
export PLAN9=$out/plan9
export PLAN9_TARGET=$PLAN9
plan9portLinkFlags()
{
eval set -- "$NIX_LDFLAGS"
local flag
for flag in "$@"; do
printf ' -Wl,%s' "$flag"
done
}
configurePhase()
{
(
echo CC9=\"$(command -v $CC)\"
echo CFLAGS=\"$NIX_CFLAGS_COMPILE\"
echo LDFLAGS=\"$(plan9portLinkFlags)\"
echo X11=\"${libXt_dev}/include\"
case "$system" in
x86_64-*) echo OBJTYPE=x86_64;;
i?86-*) echo OBJTYPE=386;;
*power*) echo OBJTYPE=power;;
*sparc*) echo OBJTYPE=sparc;;
esac
if [[ $system =~ .*linux.* ]]; then
echo SYSVERSION=2.6.x
fi
) >config
for f in `grep -l -r /usr/local/plan9`; do
sed "s,/usr/local/plan9,${PLAN9},g" -i $f
done
}
buildPhase()
{
mkdir -p $PLAN9
# Copy sources, some necessary bin scripts
cp -R * $PLAN9
local originalPath="$PATH"
export PATH="$PLAN9/bin:$PATH"
export NPROC=$NIX_BUILD_CORES
pushd src
../dist/buildmk
mk clean
mk libs-nuke
mk all
mk -k install
if [[ -f $PLAN9/bin/quote1 ]]; then
cp $PLAN9/bin/quote1 $PLAN9/bin/'"'
cp $PLAN9/bin/quote2 $PLAN9/bin/'""'
fi
popd
export PATH="$originalPath"
}
installPhase()
{
# Copy the `9' utility. This way you can use
# $ 9 awk
# to use the plan 9 awk
mkdir $out/bin
ln -s $PLAN9/bin/9 $out/bin
}
genericBuild

View file

@ -0,0 +1,110 @@
{ lib
, stdenv
, fetchFromGitHub
, darwin ? null
, fontconfig ? null
, freetype ? null
, libX11
, libXext ? null
, libXt ? null
, perl ? null # For building web manuals
, which
, xorgproto ? null
}:
stdenv.mkDerivation {
pname = "plan9port";
version = "2021-10-19";
src = fetchFromGitHub {
owner = "9fans";
repo = "plan9port";
rev = "d0d440860f2000a1560abb3f593cdc325fcead4c";
hash = "sha256-2aYXqPGwrReyFPrLDtEjgQd/RJjpOfI3ge/tDocYpRQ=";
};
postPatch = ''
#hardcoded path
substituteInPlace src/cmd/acme/acme.c \
--replace /lib/font/bit $out/plan9/font
#deprecated flags
find . -type f \
-exec sed -i -e 's/_SVID_SOURCE/_DEFAULT_SOURCE/g' {} \; \
-exec sed -i -e 's/_BSD_SOURCE/_DEFAULT_SOURCE/g' {} \;
substituteInPlace bin/9c \
--replace 'which uniq' '${which}/bin/which uniq'
'' + lib.optionalString (!stdenv.isDarwin) ''
#add missing ctrl+c\z\x\v keybind for non-Darwin
substituteInPlace src/cmd/acme/text.c \
--replace "case Kcmd+'c':" "case 0x03: case Kcmd+'c':" \
--replace "case Kcmd+'z':" "case 0x1a: case Kcmd+'z':" \
--replace "case Kcmd+'x':" "case 0x18: case Kcmd+'x':" \
--replace "case Kcmd+'v':" "case 0x16: case Kcmd+'v':"
'';
buildInputs = [
perl
] ++ lib.optionals (!stdenv.isDarwin) [
fontconfig
freetype # fontsrv wants ft2build.h provides system fonts for acme and sam
libX11
libXext
libXt
xorgproto
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
Carbon
Cocoa
IOKit
Metal
QuartzCore
darwin.DarwinTools
]);
builder = ./builder.sh;
libXt_dev = libXt.dev;
doInstallCheck = true;
installCheckPhase = ''
$out/bin/9 rc -c 'echo rc is working.'
# 9l can find and use its libs
cd $TMP
cat >test.c <<EOF
#include <u.h>
#include <libc.h>
#include <thread.h>
void
threadmain(int argc, char **argv)
{
threadexitsall(nil);
}
EOF
$out/bin/9 9c -o test.o test.c
$out/bin/9 9l -o test test.o
./test
'';
meta = with lib; {
homepage = "https://9fans.github.io/plan9port/";
description = "Plan 9 from User Space";
longDescription = ''
Plan 9 from User Space (aka plan9port) is a port of many Plan 9 programs
from their native Plan 9 environment to Unix-like operating systems.
'';
license = licenses.mit;
maintainers = with maintainers; [
AndersonTorres
bbarker
ehmry
ftrvxmtrx
kovirobi
];
mainProgram = "9";
platforms = platforms.unix;
# TODO: revisit this when the sdk situation on x86_64-darwin changes
broken = stdenv.isDarwin && stdenv.isx86_64;
};
}
# TODO: investigate the mouse chording support patch