Merge branch 'netbsd'

This commit is contained in:
Matthew Bauer
2018-04-30 22:16:44 -05:00
+177 -107
View File
@@ -1,5 +1,5 @@
{ stdenv, hostPlatform, fetchcvs, lib, groff, mandoc, zlib, coreutils { stdenv, hostPlatform, fetchcvs, lib, groff, mandoc, zlib, coreutils
, yacc, flex, libressl, bash }: , yacc, flex, libressl, bash, more }:
let let
fetchNetBSD = path: version: sha256: fetchcvs { fetchNetBSD = path: version: sha256: fetchcvs {
@@ -10,10 +10,11 @@ let
}; };
netBSDDerivation = attrs: stdenv.mkDerivation ((rec { netBSDDerivation = attrs: stdenv.mkDerivation ((rec {
name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}"; name = "bsd-${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}";
src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256; src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256;
extraPaths = [ ]; extraPaths = [ ];
setOutputFlags = false;
nativeBuildInputs = [ makeMinimal mandoc groff install stat nativeBuildInputs = [ makeMinimal mandoc groff install stat
yacc flex tsort lorder ]; yacc flex tsort lorder ];
@@ -25,25 +26,31 @@ let
DESTDIR = "$(out)"; DESTDIR = "$(out)";
TOOLDIR = "$(out)"; TOOLDIR = "$(out)";
USETOOLS = "never"; USETOOLS = "never";
NOCLANGERROR="yes"; NOCLANGERROR = "yes";
NOGCCERROR="yes"; NOGCCERROR = "yes";
LEX = "flex"; LEX = "flex";
MKUNPRIVED = "yes";
INSTPRIV = '' ''${INSTPRIV.unpriv}'';
HOST_SH = "${bash}/bin/sh";
OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
PRESERVE = "-p";
MACHINE_ARCH = hostPlatform.parsed.cpu.name;
MACHINE_CPU = hostPlatform.parsed.cpu.name;
# libs will be provided by cc-wrapper # libs will be provided by cc-wrapper
LIBCRT0=""; LIBCRT0 = "";
LIBCRTI=""; LIBCRTI = "";
LIBCRTEND=""; LIBCRTEND = "";
LIBCRTBEGIN=""; LIBCRTBEGIN = "";
LIBC=""; LIBC = "";
LIBUTIL=""; LIBUTIL = "";
LIBSSL = ""; LIBSSL = "";
LIBCRYPTO = ""; LIBCRYPTO = "";
LIBCRYPT = ""; LIBCRYPT = "";
LIBCURSES = ""; LIBCURSES = "";
LIBTERMINFO = ""; LIBTERMINFO = "";
LIBM = ""; LIBM = "";
"LIBDO.terminfo" = "_external"; LIBL = "";
"LIBDO.curses" = "_external";
_GCC_CRTBEGIN = ""; _GCC_CRTBEGIN = "";
_GCC_CRTBEGINS = ""; _GCC_CRTBEGINS = "";
_GCC_CRTEND = ""; _GCC_CRTEND = "";
@@ -53,10 +60,14 @@ let
_GCC_CRTDIR = ""; _GCC_CRTDIR = "";
_GCC_CRTN = ""; _GCC_CRTN = "";
"LIBDO.terminfo" = "_external";
"LIBDO.curses" = "_external";
# all dirs will be prefixed with DESTDIR # all dirs will be prefixed with DESTDIR
BINDIR = "/bin"; BINDIR = "/bin";
LIBDIR = "/lib"; LIBDIR = "/lib";
SHLIBDIR = "/lib"; SHLIBDIR = "/lib";
INCSDIR = "/include";
MANDIR = "/share/man"; MANDIR = "/share/man";
INFODIR = "/share/info"; INFODIR = "/share/info";
DOCDIR = "/share/doc"; DOCDIR = "/share/doc";
@@ -64,22 +75,12 @@ let
X11BINDIR = "/bin"; X11BINDIR = "/bin";
X11USRLIBDIR = "/lib"; X11USRLIBDIR = "/lib";
X11MANDIR = "/share/man"; X11MANDIR = "/share/man";
SHLINKDIR = "/usr/libexec";
HOST_SH = "${bash}/bin/sh";
SHLIB_WARNTEXTREL = "no";
SHLIB_MKMAP = "no";
PRESERVE = "-p";
OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
MACHINE_ARCH = hostPlatform.parsed.cpu.name;
MACHINE_CPU = hostPlatform.parsed.cpu.name;
# NetBSD makefiles should be able to detect this # NetBSD makefiles should be able to detect this
# but without they end up using gcc on Darwin stdenv # but without they end up using gcc on Darwin stdenv
preConfigure = '' preConfigure = ''
export HAVE_${if stdenv.cc.isGNU then "GCC" else "LLVM"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))} export HAVE_${if stdenv.cc.isGNU then "GCC" else "LLVM"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))}
# Parallel building. Needs the space. # Parallel building. Needs the space.
export makeFlags+=" -j $NIX_BUILD_CORES" export makeFlags+=" -j $NIX_BUILD_CORES"
''; '';
@@ -90,6 +91,7 @@ let
sourceRoot=$PWD/$sourceRoot sourceRoot=$PWD/$sourceRoot
export NETBSDSRCDIR=$sourceRoot export NETBSDSRCDIR=$sourceRoot
export BSDSRCDIR=$NETBSDSRCDIR export BSDSRCDIR=$NETBSDSRCDIR
export _SRC_TOP_=$NETBSDSRCDIR
chmod -R u+w $sourceRoot chmod -R u+w $sourceRoot
for path in $extraPaths; do for path in $extraPaths; do
cd $path cd $path
@@ -108,15 +110,14 @@ let
# will be removed in the postInstall. # will be removed in the postInstall.
preInstall = '' preInstall = ''
mkdir -p $out$BINDIR $out$LIBDIR $out$INFODIR \ mkdir -p $out$BINDIR $out$LIBDIR $out$INFODIR \
$out$DOCDIR $out$LOCALEDIR $out$DOCDIR $out$LOCALEDIR $out$INCSDIR
for i in 1 2 3 4 5 6 7 8 9; do for i in 1 2 3 4 5 6 7 8 9; do
mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i \ mkdir -p $out$MANDIR/man$i $out$MANDIR/html$i \
$out$DOCDIR/reference/ref$i $out$DOCDIR/reference/ref$i
done done
mkdir -p $out/usr/include
''; '';
postInstall = '' preFixup = ''
# Remove lingering /usr references # Remove lingering /usr references
if [ -d $out/usr ]; then if [ -d $out/usr ]; then
cd $out/usr cd $out/usr
@@ -124,6 +125,10 @@ 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
''; '';
@@ -134,7 +139,9 @@ let
}; };
}) // attrs); }) // attrs);
# BOOTSTRAPPING ##
## BOOTSTRAPPING
##
makeMinimal = netBSDDerivation rec { makeMinimal = netBSDDerivation rec {
path = "tools/make"; path = "tools/make";
sha256 = "0l4794zwj2haark3azf9xwcwqlkbrifhb2glaa9iba4dkg2mklsb"; sha256 = "0l4794zwj2haark3azf9xwcwqlkbrifhb2glaa9iba4dkg2mklsb";
@@ -143,16 +150,26 @@ let
buildInputs = []; buildInputs = [];
nativeBuildInputs = []; nativeBuildInputs = [];
patchPhase = '' postPatch = ''
patchShebangs configure patchShebangs configure
${make.patchPhase} ${make.postPatch}
'';
buildPhase = ''
runHook prePatch
sh ./buildmake.sh
runHook postPatch
''; '';
buildPhase = "sh ./buildmake.sh";
installPhase = '' installPhase = ''
runHook preInstall
install -D nbmake $out/bin/nbmake install -D nbmake $out/bin/nbmake
ln -s $out/bin/nbmake $out/bin/make ln -s $out/bin/nbmake $out/bin/make
mkdir -p $out/share mkdir -p $out/share
cp -r ../../share/mk $out/share/mk cp -r $NETBSDSRCDIR/share/mk $out/share/mk
runHook postInstall
''; '';
extraPaths = [ make.src ] ++ make.extraPaths; extraPaths = [ make.src ] ++ make.extraPaths;
}; };
@@ -170,7 +187,8 @@ let
# temporarily use gnuinstall for bootstrapping # temporarily use gnuinstall for bootstrapping
# bsdinstall will be built later # bsdinstall will be built later
makeFlags = "INSTALL=${coreutils}/bin/install"; makeFlags = [ "INSTALL=${coreutils}/bin/install" ];
installFlags = [];
RENAME = "-D"; RENAME = "-D";
postInstall = '' postInstall = ''
@@ -218,7 +236,17 @@ let
extraPaths = [ mtree.src make.src ]; extraPaths = [ mtree.src make.src ];
nativeBuildInputs = [ makeMinimal mandoc groff ]; nativeBuildInputs = [ makeMinimal mandoc groff ];
buildInputs = [ compat fts ]; buildInputs = [ compat fts ];
RENAME = "-D"; installPhase = ''
runHook preInstall
install -D install.1 $out/share/man/man1/install.1
install -D xinstall $out/bin/install
ln -s $out/bin/install $out/bin/xinstall
ln -s $out/bin/install $out/bin/binstall
runHook postInstall
'';
# INSTALL_FILE = "install -D";
}; };
fts = netBSDDerivation { fts = netBSDDerivation {
@@ -239,10 +267,14 @@ let
ar -rsc libfts.a lib/libc/gen/fts.o ar -rsc libfts.a lib/libc/gen/fts.o
''; '';
installPhase = '' installPhase = ''
runHook preInstall
install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3 install -D lib/libc/gen/fts.3 $out/share/man/man3/fts.3
install -D include/fts.h $out/include/fts.h install -D include/fts.h $out/include/fts.h
install -D lib/libc/include/namespace.h $out/include/namespace.h install -D lib/libc/include/namespace.h $out/include/namespace.h
install -D libfts.a $out/lib/libfts.a install -D libfts.a $out/lib/libfts.a
runHook postInstall
''; '';
setupHook = ./fts-setup-hook.sh; setupHook = ./fts-setup-hook.sh;
}; };
@@ -267,7 +299,9 @@ let
sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2"; sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
nativeBuildInputs = [ makeMinimal mandoc groff install ]; nativeBuildInputs = [ makeMinimal mandoc groff install ];
}; };
# END BOOTSTRAPPING ##
## END BOOTSTRAPPING
##
libutil = netBSDDerivation { libutil = netBSDDerivation {
path = "lib/libutil"; path = "lib/libutil";
@@ -291,44 +325,31 @@ let
path = "usr.bin/make"; path = "usr.bin/make";
sha256 = "0srkkg6qdzqlccfi4xh19gl766ks6hpss76bnfvwmd0zg4q4zdar"; sha256 = "0srkkg6qdzqlccfi4xh19gl766ks6hpss76bnfvwmd0zg4q4zdar";
version = "7.1.2"; version = "7.1.2";
patchPhase = '' postPatch = ''
# make needs this to pick up our sys make files # make needs this to pick up our sys make files
export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\"" export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
# can't set owner or group in Nix build
# maybe there is a better way to trick it?
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \ substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \
--replace '-o ''${SCRIPTSOWN_''${.ALLSRC:T}:U''${SCRIPTSOWN}}' "" \ --replace '-Wl,-dynamic-linker=''${_SHLINKER}' "" \
--replace '-g ''${SCRIPTSGRP_''${.ALLSRC:T}:U''${SCRIPTSGRP}}' "" \ --replace '-Wl,-rpath,''${SHLIBDIR}' ""
--replace '-o ''${RUMPBINOWN} -g ''${RUMPBINGRP}' "" \
--replace '-o ''${BINOWN} -g ''${BINGRP}' "" \
--replace '-o ''${RUMPBINOWN} -g ''${RUMPBINGRP}' "" \
--replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.doc.mk \
--replace '-o ''${DOCOWN} -g ''${DOCGRP}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.links.mk \
--replace '-o ''${LINKSOWN_''${.ALLSRC:T}:U''${LINKSOWN}}' "" \
--replace '-g ''${LINKSGRP_''${.ALLSRC:T}:U''${LINKSGRP}}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.man.mk \
--replace '-o ''${MANOWN} -g ''${MANGRP}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.files.mk \
--replace '-o ''${FILESOWN_''${.ALLSRC:T}:U''${FILESOWN}}' "" \
--replace '-g ''${FILESGRP_''${.ALLSRC:T}:U''${FILESGRP}}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.inc.mk \
--replace '-o ''${BINOWN} -g ''${BINGRP}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
--replace '-o ''${DEBUGOWN} -g ''${DEBUGGRP}' "" \
--replace '-o ''${LIBOWN} -g ''${LIBGRP}' ""
'' + 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' "" \
--replace '-Wl,--warn-shared-textrel' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \ substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
--replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \ --replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \
--replace '-Wl,--whole-archive' "" \ --replace '-Wl,--whole-archive' "" \
--replace '-Wl,--no-whole-archive' "" --replace '-Wl,--no-whole-archive' "" \
--replace '-Wl,--warn-shared-textrel' "" \
--replace '-Wl,-Map=''${_LIB}.so.''${SHLIB_SOVERSION}.map' "" \
--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 install) (cd $NETBSDSRCDIR/share/mk && make FILESDIR=/share/mk install)
''; '';
extraPaths = [ extraPaths = [
(fetchNetBSD "share/mk" "7.1.2" "0570v0siv0wygn8ygs1yy9pgk9xjw9x1axr5qg4xrddv3lskf9xa") (fetchNetBSD "share/mk" "7.1.2" "0570v0siv0wygn8ygs1yy9pgk9xjw9x1axr5qg4xrddv3lskf9xa")
@@ -345,12 +366,18 @@ let
path = "usr.bin/who"; path = "usr.bin/who";
version = "7.1.2"; version = "7.1.2";
sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88"; sha256 = "17ffwww957m3qw0b6fkgjpp12pd5ydg2hs9dxkkw0qpv11j00d88";
patchPhase = '' postPatch = lib.optionalString stdenv.isLinux ''
substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \
--replace "utmptime = st.st_mtimespec" "utmptime = st.st_mtim" \
--replace "timespeccmp(&st.st_mtimespec, &utmptime, >)" "st.st_mtim.tv_sec == utmptime.tv_sec ? st.st_mtim.tv_nsec > utmptime.tv_nsec : st.st_mtim.tv_sec > utmptime.tv_sec"
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \
--replace "timespeccmp(&st.st_mtimespec, &utmpxtime, >)" "st.st_mtimespec.tv_sec == utmpxtime.tv_sec ? st.st_mtimespec.tv_nsec > utmpxtime.tv_nsec : st.st_mtimespec.tv_sec > utmpxtime.tv_sec"
'' + ''
substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \ substituteInPlace $NETBSDSRCDIR/usr.bin/who/utmpentry.c \
--replace "strncpy(e->name, up->ut_name, sizeof(up->ut_name))" "strncpy(e->name, up->ut_user, sizeof(up->ut_user))" \ --replace "strncpy(e->name, up->ut_name, sizeof(up->ut_name))" "strncpy(e->name, up->ut_user, sizeof(up->ut_user))" \
--replace "utmptime = st.st_mtimespec" "utmptime = st.st_mtim" \ --replace "timespecclear(&utmptime)" "utmptime.tv_sec = utmptime.tv_nsec = 0" \
--replace "timespeccmp(&st.st_mtimespec, &utmptime, >)" "st.st_mtim.tv_sec == utmptime.tv_sec ? st.st_mtim.tv_nsec > utmptime.tv_nsec : st.st_mtim.tv_sec > utmptime.tv_sec" \ --replace "timespecclear(&utmpxtime)" "utmpxtime.tv_sec = utmpxtime.tv_nsec = 0"
--replace "timespecclear(&utmptime)" "utmptime.tv_sec = utmptime.tv_nsec = 0"
''; '';
}; };
@@ -370,13 +397,39 @@ in rec {
version = "7.1.2"; version = "7.1.2";
}; };
dict = netBSDDerivation {
path = "share/dict";
version = "7.1.2";
sha256 = "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4";
makeFlags = [ "BINDIR=/share" ];
preInstall = "mkdir -p $out/share/dict";
};
games = netBSDDerivation { games = netBSDDerivation {
path = "games"; path = "games";
sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1"; sha256 = "04wjsang8f8kxsifiayklbxaaxmm3vx9rfr91hfbxj4hk8gkqzy1";
version = "7.1.2"; version = "7.1.2";
patchPhase = '' makeFlags = [ "BINDIR=/bin"
"SCRIPTSDIR=/bin"
"FILESDIR=/share/games" ];
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
substituteInPlace $f \
--replace /usr/share/games/fortune $out/share/games \
--replace /usr/share/games $out/share/games \
--replace /usr/games $out/bin \
--replace /usr/libexec $out/libexec \
--replace /usr/bin/more ${more}/bin/more \
--replace /usr/share/dict ${dict}/share/dict
done
substituteInPlace ching/ching/ching.sh \
--replace /usr/share $out/share \
--replace /usr/libexec $out/libexec
substituteInPlace hunt/huntd/driver.c \
--replace "(void) setpgrp(getpid(), getpid());" ""
# Disable some games that don't build. They should be possible # Disable some games that don't build. They should be possible
# to build but need to look at how to implement stuff in # to build but need to look at how to implement stuff in
# Linux. macOS is missing gettime. TODO try to get these # Linux. macOS is missing gettime. TODO try to get these
@@ -386,25 +439,29 @@ in rec {
} }
disableGame atc disableGame atc
disableGame boggle
disableGame dm disableGame dm
disableGame fortune disableGame dab
disableGame hunt
disableGame larn
disableGame phantasia
disableGame rogue
disableGame sail disableGame sail
disableGame trek disableGame trek
disableGame dab ${lib.optionalString stdenv.isLinux "disableGame boggle"}
${lib.optionalString stdenv.isLinux "disableGame hunt"}
${lib.optionalString stdenv.isLinux "disableGame larn"}
${lib.optionalString stdenv.isLinux "disableGame phantasia"}
${lib.optionalString stdenv.isLinux "disableGame rogue"}
${lib.optionalString stdenv.isDarwin "disableGame adventure"} ${lib.optionalString stdenv.isDarwin "disableGame adventure"}
${lib.optionalString stdenv.isDarwin "disableGame factor"} ${lib.optionalString stdenv.isDarwin "disableGame factor"}
${lib.optionalString stdenv.isDarwin "disableGame gomoku"} ${lib.optionalString stdenv.isDarwin "disableGame gomoku"}
${lib.optionalString stdenv.isDarwin "disableGame mille"} ${lib.optionalString stdenv.isDarwin "disableGame mille"}
substituteInPlace Makefile.inc \
--replace 2555 555 \
--replace 2550 550
''; '';
# HACK strfile needs to be installed first & in the path. The
# Makefile should do this for us but haven't gotten it to work
preBuild = ''
mkdir -p $out/bin $out/share/man/man8 $out/share/man/html8
(cd fortune/strfile && make && make BINDIR=/bin install)
export PATH=$out/bin:$PATH
'';
NIX_CFLAGS_COMPILE = [ NIX_CFLAGS_COMPILE = [
"-D__noinline=" "-D__noinline="
"-D__scanflike(a,b)=" "-D__scanflike(a,b)="
@@ -412,39 +469,43 @@ in rec {
"-DOXTABS=XTABS" "-DOXTABS=XTABS"
"-DRANDOM_MAX=RAND_MAX" "-DRANDOM_MAX=RAND_MAX"
"-DINFTIM=-1" "-DINFTIM=-1"
(if hostPlatform.isMusl then "-include sys/ttydefaults.h -include sys/file.h" else "") (lib.optionalString hostPlatform.isMusl "-include sys/ttydefaults.h -include sys/file.h")
"-DBE32TOH(x)=((void)0)"
"-DBE64TOH(x)=((void)0)"
"-D__c99inline=__inline"
]; ];
postBuild = ''
mkdir -p $out/usr/games $out/usr/share/games/ching \ preInstall = ''
$out/usr/share/games/quiz.db \ mkdir -p $out/var/games/hackdir \
$out/usr/libexec/ching $out/var/games/hackdir $out/share/games \
$out$DOCDIR/reference/ref6/rogue \
$out$MANDIR/man6 $out$MANDIR/html6
touch $out/var/games/hackdir/perm touch $out/var/games/hackdir/perm
''; '';
preFixup = ''
mkdir -p $out/bin
mv $out/games/* $out/bin
rmdir $out/games
'';
buildInputs = [ compat libcurses libterminfo libressl ]; buildInputs = [ compat libcurses libterminfo libressl ];
extraPaths = [ extraPaths = [ dict.src who.src ];
(fetchNetBSD "share/dict" "7.1.2" "0nickhsjwgnr2h9nvwflvgfz93kqms5hzdnpyq02crpj35w98bh4")
who.src
];
}; };
# finger = netBSDDerivation { finger = netBSDDerivation {
# path = "usr.bin/finger"; path = "usr.bin/finger";
# sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi"; sha256 = "0jl672z50f2yf7ikp682b3xrarm6bnrrx9vi94xnp2fav8m8zfyi";
# version = "7.1.2"; version = "7.1.2";
# extraPaths = [ who.src ]; NIX_CFLAGS_COMPILE = [
# NIX_CFLAGS_COMPILE = [ (if stdenv.isLinux then "-DSUPPORT_UTMP" else "-USUPPORT_UTMP")
# "-DSUPPORT_UTMP" (if stdenv.isDarwin then "-DSUPPORT_UTMPX" else "-USUPPORT_UTMPX")
# "-USUPPORT_UTMPX" ];
# ]; postPatch = ''
# patchPhase = '' NIX_CFLAGS_COMPILE+=" -I$NETBSDSRCDIR/include"
# ${who.patchPhase}
# ''; substituteInPlace extern.h \
# }; --replace psort _psort
${who.postPatch}
'';
extraPaths = [ who.src ]
++ lib.optional stdenv.isDarwin (fetchNetBSD "include/utmp.h" "7.1.2" "05690fzz0825p2bq0sfyb00mxwd0wa06qryqgqkwpqk9y2xzc7px");
};
fingerd = netBSDDerivation { fingerd = netBSDDerivation {
path = "libexec/fingerd"; path = "libexec/fingerd";
@@ -456,8 +517,8 @@ in rec {
path = "lib/libedit"; path = "lib/libedit";
buildInputs = [ libterminfo libcurses ]; buildInputs = [ libterminfo libcurses ];
propagatedBuildInputs = [ compat ]; propagatedBuildInputs = [ compat ];
postBuild = "mkdir -p $out/usr/include/readline"; makeFlags = [ "INCSDIR=/include" ];
patchPhase = '' postPatch = ''
sed -i '1i #undef bool_t' el.h sed -i '1i #undef bool_t' el.h
substituteInPlace config.h \ substituteInPlace config.h \
--replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" "" --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
@@ -477,6 +538,14 @@ in rec {
sha256 = "06plg0bjqgbb0aghpb9qlk8wkp1l2izdlr64vbr5laqyw8jg84zq"; sha256 = "06plg0bjqgbb0aghpb9qlk8wkp1l2izdlr64vbr5laqyw8jg84zq";
buildInputs = [ compat tic nbperf ]; buildInputs = [ compat tic nbperf ];
MKPIC = if stdenv.isDarwin then "no" else "yes"; MKPIC = if stdenv.isDarwin then "no" else "yes";
makeFlags = [ "INCSDIR=/include" ];
postPatch = ''
substituteInPlace term.c --replace /usr/share $out/share
'';
postInstall = ''
mkdir -p $out/share/misc
(cd $NETBSDSRCDIR/share/terminfo && make && make BINDIR=/share install)
'';
extraPaths = [ extraPaths = [
(fetchNetBSD "share/terminfo" "7.1.2" "1z5vzq8cw24j05r6df4vd6r57cvdbv7vbm4h962kplp14xrbg2h3") (fetchNetBSD "share/terminfo" "7.1.2" "1z5vzq8cw24j05r6df4vd6r57cvdbv7vbm4h962kplp14xrbg2h3")
]; ];
@@ -487,6 +556,7 @@ in rec {
version = "7.1.2"; version = "7.1.2";
sha256 = "04djah9dadzw74nswn0xydkxn900kav8xdvxlxdl50nbrynxg9yf"; sha256 = "04djah9dadzw74nswn0xydkxn900kav8xdvxlxdl50nbrynxg9yf";
buildInputs = [ libterminfo ]; buildInputs = [ libterminfo ];
makeFlags = [ "INCSDIR=/include" ];
NIX_CFLAGS_COMPILE = [ NIX_CFLAGS_COMPILE = [
"-D__scanflike(a,b)=" "-D__scanflike(a,b)="
"-D__va_list=va_list" "-D__va_list=va_list"
@@ -495,7 +565,7 @@ in rec {
propagatedBuildInputs = [ compat ]; propagatedBuildInputs = [ compat ];
MKDOC = "no"; # missing vfontedpr MKDOC = "no"; # missing vfontedpr
MKPIC = if stdenv.isDarwin then "no" else "yes"; MKPIC = if stdenv.isDarwin then "no" else "yes";
patchPhase = lib.optionalString (!stdenv.isDarwin) '' postPatch = lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace printw.c \ substituteInPlace printw.c \
--replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \ --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \
--replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));' --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));'