mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-20 00:53:12 +03:00
plan9port: use built-in ./INSTALL
This commit is contained in:
parent
f8ad219dd2
commit
c9186a15a5
@ -1,71 +0,0 @@
|
||||
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
|
@ -2,7 +2,7 @@
|
||||
, fontconfig, freetype, libX11, libXext, libXt, xorgproto
|
||||
, Carbon, Cocoa, IOKit, Metal, QuartzCore, DarwinTools
|
||||
, perl # For building web manuals
|
||||
, which
|
||||
, which, ed
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
@ -19,26 +19,69 @@ stdenv.mkDerivation rec {
|
||||
postPatch = ''
|
||||
substituteInPlace bin/9c \
|
||||
--replace 'which uniq' '${which}/bin/which uniq'
|
||||
|
||||
ed -sE INSTALL <<EOF
|
||||
# get /bin:/usr/bin out of PATH
|
||||
/^PATH=[^ ]*/s,,PATH=\$PATH:\$PLAN9/bin,
|
||||
# no xcbuild nonsense
|
||||
/^if.* = Darwin/+;/^fi/-c
|
||||
${"\t"}export NPROC=$NIX_BUILD_CORES
|
||||
.
|
||||
# remove absolute include paths from fontsrv test
|
||||
/cc -o a.out -c -I.*freetype2/;/x11.c/j
|
||||
s/(-Iinclude).*-I[^ ]*/\1/
|
||||
wq
|
||||
EOF
|
||||
'';
|
||||
|
||||
buildInputs = [ perl ] ++ (if !stdenv.isDarwin then [
|
||||
fontconfig
|
||||
freetype # fontsrv wants ft2build.h
|
||||
libX11
|
||||
libXext
|
||||
libXt
|
||||
xorgproto
|
||||
nativeBuildInputs = [ ed ];
|
||||
buildInputs = [ perl which ] ++ (if !stdenv.isDarwin then [
|
||||
fontconfig freetype # fontsrv uses these
|
||||
libX11 libXext libXt xorgproto
|
||||
] else [
|
||||
Carbon
|
||||
Cocoa
|
||||
IOKit
|
||||
Metal
|
||||
QuartzCore
|
||||
Carbon Cocoa IOKit Metal QuartzCore
|
||||
DarwinTools
|
||||
]);
|
||||
|
||||
builder = ./builder.sh;
|
||||
libXt_dev = libXt.dev;
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
cat >LOCAL.config <<EOF
|
||||
CC9='$(command -v $CC)'
|
||||
CFLAGS='$NIX_CFLAGS_COMPILE'
|
||||
LDFLAGS='$(for f in $NIX_LDFLAGS; do echo "-Wl,$f"; done | xargs echo)'
|
||||
${lib.optionalString (!stdenv.isDarwin) "X11='${libXt.dev}/include'"}
|
||||
EOF
|
||||
|
||||
# make '9' available in the path so there's some way to find out $PLAN9
|
||||
cat >LOCAL.INSTALL <<EOF
|
||||
#!$out/plan9/bin/rc
|
||||
mkdir $out/bin
|
||||
ln -s $out/plan9/bin/9 $out/bin/
|
||||
EOF
|
||||
chmod +x LOCAL.INSTALL
|
||||
|
||||
# now, not in fixupPhase, so ./INSTALL works
|
||||
patchShebangs .
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
./INSTALL -b
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir $out
|
||||
cp -r . $out/plan9
|
||||
cd $out/plan9
|
||||
|
||||
./INSTALL -c
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontPatchShebangs = true;
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
@ -70,12 +113,7 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [
|
||||
AndersonTorres
|
||||
bbarker
|
||||
ehmry
|
||||
ftrvxmtrx
|
||||
kovirobi
|
||||
ylh
|
||||
AndersonTorres bbarker ehmry ftrvxmtrx kovirobi ylh
|
||||
];
|
||||
mainProgram = "9";
|
||||
platforms = platforms.unix;
|
||||
|
Loading…
Reference in New Issue
Block a user