netbsd: remove mkdir -p calls
install is now hacked to ensure the parent directory exists before running.
This commit is contained in:
parent
e53b92247f
commit
0943b76dc8
@ -1,5 +1,5 @@
|
|||||||
{ stdenv, hostPlatform, fetchcvs, lib, groff, mandoc, zlib, coreutils
|
{ stdenv, hostPlatform, fetchcvs, lib, groff, mandoc, zlib, coreutils
|
||||||
, yacc, flex, libressl, bash, more }:
|
, yacc, flex, libressl, bash, less, writeText }:
|
||||||
|
|
||||||
let
|
let
|
||||||
fetchNetBSD = path: version: sha256: fetchcvs {
|
fetchNetBSD = path: version: sha256: fetchcvs {
|
||||||
@ -30,13 +30,16 @@ let
|
|||||||
NOGCCERROR = "yes";
|
NOGCCERROR = "yes";
|
||||||
LEX = "flex";
|
LEX = "flex";
|
||||||
MKUNPRIVED = "yes";
|
MKUNPRIVED = "yes";
|
||||||
INSTPRIV = '' ''${INSTPRIV.unpriv}'';
|
|
||||||
HOST_SH = "${bash}/bin/sh";
|
HOST_SH = "${bash}/bin/sh";
|
||||||
OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
|
OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
|
||||||
PRESERVE = "-p";
|
|
||||||
MACHINE_ARCH = hostPlatform.parsed.cpu.name;
|
MACHINE_ARCH = hostPlatform.parsed.cpu.name;
|
||||||
MACHINE_CPU = hostPlatform.parsed.cpu.name;
|
MACHINE_CPU = hostPlatform.parsed.cpu.name;
|
||||||
|
|
||||||
|
INSTALL_FILE = "install -U -c";
|
||||||
|
INSTALL_DIR = "xinstall -U -d";
|
||||||
|
INSTALL_LINK = "install -U -l h";
|
||||||
|
INSTALL_SYMLINK = "install -U -l s";
|
||||||
|
|
||||||
# libs will be provided by cc-wrapper
|
# libs will be provided by cc-wrapper
|
||||||
LIBCRT0 = "";
|
LIBCRT0 = "";
|
||||||
LIBCRTI = "";
|
LIBCRTI = "";
|
||||||
@ -106,17 +109,6 @@ let
|
|||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Need to create directories for xinstall to work. Unused ones
|
|
||||||
# will be removed in the postInstall.
|
|
||||||
preInstall = ''
|
|
||||||
mkdir -p $out$BINDIR $out$LIBDIR $out$INFODIR \
|
|
||||||
$out$DOCDIR $out$LOCALEDIR $out$INCSDIR
|
|
||||||
for i in 1 2 3 4 5 6 7 8 9; do
|
|
||||||
mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i \
|
|
||||||
$out$DOCDIR/reference/ref$i
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
preFixup = ''
|
preFixup = ''
|
||||||
# Remove lingering /usr references
|
# Remove lingering /usr references
|
||||||
if [ -d $out/usr ]; then
|
if [ -d $out/usr ]; then
|
||||||
@ -125,10 +117,6 @@ let
|
|||||||
find . -type f -exec mv \{} $out/\{} \;
|
find . -type f -exec mv \{} $out/\{} \;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $out/METALOG ]; then
|
|
||||||
rm $out/METALOG
|
|
||||||
fi
|
|
||||||
|
|
||||||
find $out -type d -empty -delete
|
find $out -type d -empty -delete
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -155,11 +143,11 @@ let
|
|||||||
${make.postPatch}
|
${make.postPatch}
|
||||||
'';
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook prePatch
|
runHook preBuild
|
||||||
|
|
||||||
sh ./buildmake.sh
|
sh ./buildmake.sh
|
||||||
|
|
||||||
runHook postPatch
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
@ -229,7 +217,14 @@ let
|
|||||||
] ++ libutil.extraPaths ++ libc.extraPaths;
|
] ++ libutil.extraPaths ++ libc.extraPaths;
|
||||||
};
|
};
|
||||||
|
|
||||||
install = netBSDDerivation {
|
# HACK to ensure parent directories exist. This emulates GNU
|
||||||
|
# install’s -D option. No alternative seems to exist in BSD install.
|
||||||
|
install = let binstall = writeText "binstall" ''
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
for last in $@; do true; done
|
||||||
|
mkdir -p $(dirname $last)
|
||||||
|
xinstall "$@"
|
||||||
|
''; in netBSDDerivation {
|
||||||
path = "usr.bin/xinstall";
|
path = "usr.bin/xinstall";
|
||||||
version = "7.1.2";
|
version = "7.1.2";
|
||||||
sha256 = "0nzhyh714m19h61m45gzc5dszkbafp5iaphbp5mza6w020fzf2y8";
|
sha256 = "0nzhyh714m19h61m45gzc5dszkbafp5iaphbp5mza6w020fzf2y8";
|
||||||
@ -240,13 +235,12 @@ let
|
|||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
install -D install.1 $out/share/man/man1/install.1
|
install -D install.1 $out/share/man/man1/install.1
|
||||||
install -D xinstall $out/bin/install
|
install -D xinstall $out/bin/xinstall
|
||||||
ln -s $out/bin/install $out/bin/xinstall
|
install -D -m 0550 ${binstall} $out/bin/binstall
|
||||||
ln -s $out/bin/install $out/bin/binstall
|
ln -s $out/bin/binstall $out/bin/install
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
# INSTALL_FILE = "install -D";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
fts = netBSDDerivation {
|
fts = netBSDDerivation {
|
||||||
@ -332,6 +326,8 @@ let
|
|||||||
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \
|
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \
|
||||||
--replace '-Wl,-dynamic-linker=''${_SHLINKER}' "" \
|
--replace '-Wl,-dynamic-linker=''${_SHLINKER}' "" \
|
||||||
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
|
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
|
||||||
|
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
|
||||||
|
--replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
|
||||||
'' + lib.optionalString stdenv.isDarwin ''
|
'' + lib.optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
|
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
|
||||||
--replace '-Wl,--fatal-warnings' "" \
|
--replace '-Wl,--fatal-warnings' "" \
|
||||||
@ -344,10 +340,6 @@ let
|
|||||||
--replace '-Wl,-Map=''${_LIB}.so.''${SHLIB_SOVERSION}.map' "" \
|
--replace '-Wl,-Map=''${_LIB}.so.''${SHLIB_SOVERSION}.map' "" \
|
||||||
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
|
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
|
||||||
'';
|
'';
|
||||||
preInstall = ''
|
|
||||||
mkdir -p $out$BINDIR $out$DOCDIR/reference/ref1/make \
|
|
||||||
$out$MANDIR/man1 $out$MANDIR/html1 $out/share/mk
|
|
||||||
'';
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
(cd $NETBSDSRCDIR/share/mk && make FILESDIR=/share/mk install)
|
(cd $NETBSDSRCDIR/share/mk && make FILESDIR=/share/mk install)
|
||||||
'';
|
'';
|
||||||
@ -402,7 +394,6 @@ in rec {
|
|||||||
version = "7.1.2";
|
version = "7.1.2";
|
||||||
sha256 = "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4";
|
sha256 = "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4";
|
||||||
makeFlags = [ "BINDIR=/share" ];
|
makeFlags = [ "BINDIR=/share" ];
|
||||||
preInstall = "mkdir -p $out/share/dict";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
games = netBSDDerivation {
|
games = netBSDDerivation {
|
||||||
@ -410,20 +401,20 @@ in rec {
|
|||||||
sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1";
|
sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1";
|
||||||
version = "7.1.2";
|
version = "7.1.2";
|
||||||
makeFlags = [ "BINDIR=/bin"
|
makeFlags = [ "BINDIR=/bin"
|
||||||
"SCRIPTSDIR=/bin"
|
"SCRIPTSDIR=/bin" ];
|
||||||
"FILESDIR=/share/games" ];
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i '1i #include <time.h>' adventure/save.c
|
sed -i '1i #include <time.h>' adventure/save.c
|
||||||
|
|
||||||
for f in $(find . -name pathnames.h); do
|
for f in $(find . -name pathnames.h); do
|
||||||
substituteInPlace $f \
|
substituteInPlace $f \
|
||||||
--replace /usr/share/games/fortune $out/share/games \
|
|
||||||
--replace /usr/share/games $out/share/games \
|
--replace /usr/share/games $out/share/games \
|
||||||
--replace /usr/games $out/bin \
|
--replace /usr/games $out/bin \
|
||||||
--replace /usr/libexec $out/libexec \
|
--replace /usr/libexec $out/libexec \
|
||||||
--replace /usr/bin/more ${more}/bin/more \
|
--replace /usr/bin/more ${less}/bin/less \
|
||||||
--replace /usr/share/dict ${dict}/share/dict
|
--replace /usr/share/dict ${dict}/share/dict
|
||||||
done
|
done
|
||||||
|
substituteInPlace boggle/boggle/bog.h \
|
||||||
|
--replace /usr/share/games $out/share/games
|
||||||
substituteInPlace ching/ching/ching.sh \
|
substituteInPlace ching/ching/ching.sh \
|
||||||
--replace /usr/share $out/share \
|
--replace /usr/share $out/share \
|
||||||
--replace /usr/libexec $out/libexec
|
--replace /usr/libexec $out/libexec
|
||||||
@ -457,7 +448,6 @@ in rec {
|
|||||||
# HACK strfile needs to be installed first & in the path. The
|
# HACK strfile needs to be installed first & in the path. The
|
||||||
# Makefile should do this for us but haven't gotten it to work
|
# Makefile should do this for us but haven't gotten it to work
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
mkdir -p $out/bin $out/share/man/man8 $out/share/man/html8
|
|
||||||
(cd fortune/strfile && make && make BINDIR=/bin install)
|
(cd fortune/strfile && make && make BINDIR=/bin install)
|
||||||
export PATH=$out/bin:$PATH
|
export PATH=$out/bin:$PATH
|
||||||
'';
|
'';
|
||||||
@ -475,14 +465,6 @@ in rec {
|
|||||||
"-D__c99inline=__inline"
|
"-D__c99inline=__inline"
|
||||||
];
|
];
|
||||||
|
|
||||||
preInstall = ''
|
|
||||||
mkdir -p $out/var/games/hackdir \
|
|
||||||
$out/share/games \
|
|
||||||
$out$DOCDIR/reference/ref6/rogue \
|
|
||||||
$out$MANDIR/man6 $out$MANDIR/html6
|
|
||||||
touch $out/var/games/hackdir/perm
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildInputs = [ compat libcurses libterminfo libressl ];
|
buildInputs = [ compat libcurses libterminfo libressl ];
|
||||||
extraPaths = [ dict.src who.src ];
|
extraPaths = [ dict.src who.src ];
|
||||||
};
|
};
|
||||||
@ -543,7 +525,6 @@ in rec {
|
|||||||
substituteInPlace term.c --replace /usr/share $out/share
|
substituteInPlace term.c --replace /usr/share $out/share
|
||||||
'';
|
'';
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
mkdir -p $out/share/misc
|
|
||||||
(cd $NETBSDSRCDIR/share/terminfo && make && make BINDIR=/share install)
|
(cd $NETBSDSRCDIR/share/terminfo && make && make BINDIR=/share install)
|
||||||
'';
|
'';
|
||||||
extraPaths = [
|
extraPaths = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user