Merge pull request #55023 from matthewbauer/netbsd

NetBSD cross compiling
This commit is contained in:
Matthew Bauer 2019-02-26 16:39:20 -05:00 committed by GitHub
commit 51d6b8460a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 728 additions and 334 deletions

View File

@ -33,6 +33,7 @@ rec {
else if final.isAndroid then "bionic" else if final.isAndroid then "bionic"
else if final.isLinux /* default */ then "glibc" else if final.isLinux /* default */ then "glibc"
else if final.isAvr then "avrlibc" else if final.isAvr then "avrlibc"
else if final.isNetBSD then "nblibc"
# TODO(@Ericson2314) think more about other operating systems # TODO(@Ericson2314) think more about other operating systems
else "native/impure"; else "native/impure";
extensions = { extensions = {

View File

@ -212,4 +212,11 @@ rec {
libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
platform = {}; platform = {};
}; };
# BSDs
amd64-netbsd = {
config = "x86_64-unknown-netbsd";
libc = "nblibc";
};
} }

View File

@ -53,6 +53,7 @@ let
/**/ if libc == null then null /**/ if libc == null then null
else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*" else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*"
else if targetPlatform.libc == "bionic" then "/system/bin/linker" else if targetPlatform.libc == "bionic" then "/system/bin/linker"
else if targetPlatform.libc == "nblibc" then "${libc_lib}/libexec/ld.elf_so"
else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2"
else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2"
# ARM with a wildcard, which can be "" or "-armhf". # ARM with a wildcard, which can be "" or "-armhf".
@ -188,7 +189,7 @@ stdenv.mkDerivation {
else if targetPlatform.isSparc then "sparc" else if targetPlatform.isSparc then "sparc"
else if targetPlatform.isAvr then "avr" else if targetPlatform.isAvr then "avr"
else if targetPlatform.isAlpha then "alpha" else if targetPlatform.isAlpha then "alpha"
else throw "unknown emulation for platform: " + targetPlatform.config; else throw "unknown emulation for platform: ${targetPlatform.config}";
in targetPlatform.platform.bfdEmulation or (fmt + sep + arch); in targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
strictDeps = true; strictDeps = true;

View File

@ -291,6 +291,10 @@ stdenv.mkDerivation {
hardening_unsupported_flags+=" stackprotector pic" hardening_unsupported_flags+=" stackprotector pic"
'' ''
+ optionalString targetPlatform.isNetBSD ''
hardening_unsupported_flags+=" stackprotector fortify"
''
+ optionalString (targetPlatform.libc == "newlib") '' + optionalString (targetPlatform.libc == "newlib") ''
hardening_unsupported_flags+=" stackprotector fortify pie pic" hardening_unsupported_flags+=" stackprotector fortify pie pic"
'' ''

View File

@ -48,6 +48,9 @@ let version = "7.4.0";
./riscv-no-relax.patch ./riscv-no-relax.patch
] ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optionals targetPlatform.isNetBSD [
../libstdc++-netbsd-ctypes.patch
]
++ optional noSysDirs ../no-sys-dirs.patch ++ optional noSysDirs ../no-sys-dirs.patch
++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
@ -302,6 +305,7 @@ stdenv.mkDerivation ({
"--disable-gnu-indirect-function" "--disable-gnu-indirect-function"
] ]
++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419" ++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419"
++ optional targetPlatform.isNetBSD "--disable-libcilkrts"
; ;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null; targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;

View File

@ -0,0 +1,141 @@
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
index ff3ec893974..21eccf9fde1 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h
@@ -38,40 +38,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// @brief Base class for ctype.
struct ctype_base
{
- // Non-standard typedefs.
- typedef const unsigned char* __to_type;
// NB: Offsets into ctype<char>::_M_table force a particular size
// on the mask type. Because of this, we don't use an enum.
- typedef unsigned char mask;
#ifndef _CTYPE_U
- static const mask upper = _U;
- static const mask lower = _L;
- static const mask alpha = _U | _L;
- static const mask digit = _N;
- static const mask xdigit = _N | _X;
- static const mask space = _S;
- static const mask print = _P | _U | _L | _N | _B;
- static const mask graph = _P | _U | _L | _N;
- static const mask cntrl = _C;
- static const mask punct = _P;
- static const mask alnum = _U | _L | _N;
+ // Non-standard typedefs.
+ typedef const unsigned char* __to_type;
+
+ typedef unsigned char mask;
+
+ static const mask upper = _U;
+ static const mask lower = _L;
+ static const mask alpha = _U | _L;
+ static const mask digit = _N;
+ static const mask xdigit = _N | _X;
+ static const mask space = _S;
+ static const mask print = _P | _U | _L | _N | _B;
+ static const mask graph = _P | _U | _L | _N;
+ static const mask cntrl = _C;
+ static const mask punct = _P;
+ static const mask alnum = _U | _L | _N;
#else
- static const mask upper = _CTYPE_U;
- static const mask lower = _CTYPE_L;
- static const mask alpha = _CTYPE_U | _CTYPE_L;
- static const mask digit = _CTYPE_N;
- static const mask xdigit = _CTYPE_N | _CTYPE_X;
- static const mask space = _CTYPE_S;
- static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B;
- static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N;
- static const mask cntrl = _CTYPE_C;
- static const mask punct = _CTYPE_P;
- static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N;
+ typedef const unsigned short* __to_type;
+
+ typedef unsigned short mask;
+
+ static const mask upper = _CTYPE_U;
+ static const mask lower = _CTYPE_L;
+ static const mask alpha = _CTYPE_A;
+ static const mask digit = _CTYPE_D;
+ static const mask xdigit = _CTYPE_X;
+ static const mask space = _CTYPE_S;
+ static const mask print = _CTYPE_R;
+ static const mask graph = _CTYPE_G;
+ static const mask cntrl = _CTYPE_C;
+ static const mask punct = _CTYPE_P;
+ static const mask alnum = _CTYPE_A | _CTYPE_D;
#endif
#if __cplusplus >= 201103L
- static const mask blank = space;
+ static const mask blank = space;
#endif
};
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
index ed3b7cd0d6a..33358e8f5d8 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc
@@ -38,11 +38,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Information as gleaned from /usr/include/ctype.h
- extern "C" const u_int8_t _C_ctype_[];
-
const ctype_base::mask*
ctype<char>::classic_table() throw()
- { return _C_ctype_ + 1; }
+ { return _C_ctype_tab_ + 1; }
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs)
@@ -69,14 +67,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
char
ctype<char>::do_toupper(char __c) const
- { return ::toupper((int) __c); }
+ { return ::toupper((int)(unsigned char) __c); }
const char*
ctype<char>::do_toupper(char* __low, const char* __high) const
{
while (__low < __high)
{
- *__low = ::toupper((int) *__low);
+ *__low = ::toupper((int)(unsigned char) *__low);
++__low;
}
return __high;
@@ -84,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
char
ctype<char>::do_tolower(char __c) const
- { return ::tolower((int) __c); }
+ { return ::tolower((int)(unsigned char) __c); }
const char*
ctype<char>::do_tolower(char* __low, const char* __high) const
{
while (__low < __high)
{
- *__low = ::tolower((int) *__low);
+ *__low = ::tolower((int)(unsigned char) *__low);
++__low;
}
return __high;
diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
index ace1120fba2..3234ce17c70 100644
--- a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
+++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h
@@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
is(const char* __low, const char* __high, mask* __vec) const
{
while (__low < __high)
- *__vec++ = _M_table[*__low++];
+ *__vec++ = _M_table[(unsigned char)*__low++];
return __high;
}

View File

@ -0,0 +1,122 @@
source $stdenv/setup
# NetBSD makefiles should be able to detect this
# but without they end up using gcc on Darwin stdenv
addMakeFlags() {
export setOutputFlags=
export LIBCRT0=
export LIBCRTI=
export LIBCRTEND=
export LIBCRTBEGIN=
export LIBC=
export LIBUTIL=
export LIBSSL=
export LIBCRYPTO=
export LIBCRYPT=
export LIBCURSES=
export LIBTERMINFO=
export LIBM=
export LIBL=
export _GCC_CRTBEGIN=
export _GCC_CRTBEGINS=
export _GCC_CRTEND=
export _GCC_CRTENDS=
export _GCC_LIBGCCDIR=
export _GCC_CRTI=
export _GCC_CRTN=
export _GCC_CRTDIR=
# Definitions passed to share/mk/*.mk. Should be pretty simple -
# eventually maybe move it to a configure script.
export DESTDIR=
export USETOOLS=never
export NOCLANGERROR=yes
export NOGCCERROR=yes
export LEX=flex
export MKUNPRIVED=yes
export EXTERNAL_TOOLCHAIN=yes
export INSTALL_FILE="install -U -c"
export INSTALL_DIR="xinstall -U -d"
export INSTALL_LINK="install -U -l h"
export INSTALL_SYMLINK="install -U -l s"
makeFlags="MACHINE=$MACHINE $makeFlags"
makeFlags="MACHINE_ARCH=$MACHINE_ARCH $makeFlags"
makeFlags="AR=$AR $makeFlags"
makeFlags="CC=$CC $makeFlags"
makeFlags="CPP=$CPP $makeFlags"
makeFlags="CXX=$CXX $makeFlags"
makeFlags="LD=$LD $makeFlags"
makeFlags="STRIP=$STRIP $makeFlags"
makeFlags="BINDIR=${!outputBin}/bin $makeFlags"
makeFlags="LIBDIR=${!outputLib}/lib $makeFlags"
makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags"
makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags"
makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags"
makeFlags="LOCALEDIR=${!outputLib}/share/locale $makeFlags"
# Parallel building. Needs the space.
makeFlags="-j $NIX_BUILD_CORES $makeFlags"
}
setNetBSDSourceDir() {
# merge together all extra paths
# there should be a better way to do this
sourceRoot=$PWD/$sourceRoot
export NETBSDSRCDIR=$sourceRoot
export BSDSRCDIR=$NETBSDSRCDIR
export _SRC_TOP_=$NETBSDSRCDIR
chmod -R u+w $sourceRoot
for path in $extraPaths; do
cd $path
find . -type d -exec mkdir -p $sourceRoot/\{} \;
find . -type f -exec cp -pr \{} $sourceRoot/\{} \;
chmod -R u+w $sourceRoot
done
cd $sourceRoot
if [ -d "$NETBSD_PATH" ]
then sourceRoot=$sourceRoot/$NETBSD_PATH
fi
}
includesPhase() {
if [ -z "${skipIncludesPhase:-}" ]; then
local flagsArray=(
$makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
DESTDIR=${!outputInclude} includes
)
echoCmd 'includes flags' "${flagsArray[@]}"
make ${makefile:+-f $makefile} "${flagsArray[@]}"
moveUsrDir
fi
}
moveUsrDir() {
if [ -d $prefix ]; then
# Remove lingering /usr references
if [ -d $prefix/usr ]; then
cd $prefix/usr
find . -type d -exec mkdir -p $out/\{} \;
find . \( -type f -o -type l \) -exec mv \{} $out/\{} \;
fi
find $prefix -type d -empty -delete
fi
}
postUnpackHooks+=(setNetBSDSourceDir)
preConfigureHooks+=(addMakeFlags)
preInstallHooks+=(includesPhase)
fixupOutputHooks+=(moveUsrDir)
genericBuild

View File

@ -1,272 +1,83 @@
{ stdenv, fetchcvs, lib, groff, mandoc, zlib, buildPackages { stdenv, stdenvNoCC, fetchcvs, lib, groff, mandoc, zlib, yacc, flex, bash
, yacc, flex, libressl, bash, less, writeText }: , writeText, buildPackages, splicePackages, symlinkJoin }:
let let
inherit (lib) optionalString replaceStrings;
inherit (stdenv) hostPlatform;
fetchNetBSD = path: version: sha256: fetchcvs { fetchNetBSD = path: version: sha256: fetchcvs {
cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot"; cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
module = "src/${path}"; module = "src/${path}";
inherit sha256; inherit sha256;
tag = "netbsd-${builtins.replaceStrings ["."] ["-"] version}-RELEASE"; tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE";
}; };
# Needed to support cross correctly. Splicing only happens when we # Splice packages so we get the correct package when using
# do callPackage, but sense everything is here, it needs to be done # nativeBuildInputs...
# by hand. All native build inputs should come from here. nbSplicedPackages = splicePackages {
nbBuildPackages = buildPackages.netbsd; pkgsBuildBuild = buildPackages.buildPackages.netbsd;
pkgsBuildHost = buildPackages.netbsd;
pkgsBuildTarget = {};
pkgsHostHost = {};
pkgsHostTarget = netbsd;
pkgsTargetTarget = {};
};
MACHINE_ARCH = { netbsd = with nbSplicedPackages; {
"i686" = "i386";
}.${hostPlatform.parsed.cpu.name} or hostPlatform.parsed.cpu.name;
MACHINE = { mkDerivation = lib.makeOverridable (attrs: let
"x86_64" = "amd64"; stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
"aarch64" = "evbarm64"; in stdenv'.mkDerivation ({
"i686" = "i386"; name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}";
}.${hostPlatform.parsed.cpu.name} or hostPlatform.parsed.cpu.name;
netBSDDerivation = attrs: stdenv.mkDerivation ((rec {
name = "netbsd-${attrs.pname or (baseNameOf attrs.path)}-${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 = [ yacc flex mandoc groff nativeBuildInputs = [ makeMinimal install tsort lorder mandoc groff stat ];
nbBuildPackages.makeMinimal buildInputs = [ compat ];
nbBuildPackages.stat # depsBuildBuild = [ buildPackages.stdenv.cc ];
nbBuildPackages.install
nbBuildPackages.tsort
nbBuildPackages.lorder ];
buildInputs = [ nbPackages.compat ];
installFlags = [ "includes" ];
# TODO: eventually move this to a make.conf
makeFlags = [
"MACHINE=${MACHINE}"
"MACHINE_ARCH=${MACHINE_ARCH}"
"AR=${stdenv.cc.targetPrefix}ar"
"CC=${stdenv.cc.targetPrefix}cc"
"CPP=${stdenv.cc.targetPrefix}cpp"
"CXX=${stdenv.cc.targetPrefix}c++"
"LD=${stdenv.cc.targetPrefix}ld"
"STRIP=${stdenv.cc.targetPrefix}strip"
] ++ (attrs.makeFlags or []);
# Definitions passed to share/mk/*.mk. Should be pretty simple -
# eventually maybe move it to a configure script.
# TODO: dont rely on DESTDIR, instead use prefix
DESTDIR = "$(out)";
TOOLDIR = "$(out)";
USETOOLS = "never";
NOCLANGERROR = "yes";
NOGCCERROR = "yes";
LEX = "flex";
MKUNPRIVED = "yes";
HOST_SH = "${buildPackages.bash}/bin/sh";
OBJCOPY = if stdenv.isDarwin then "true" else "objcopy"; OBJCOPY = if stdenv.isDarwin then "true" else "objcopy";
RPCGEN_CPP = "${stdenv.cc.targetPrefix}cpp"; HOST_SH = "${buildPackages.bash}/bin/sh";
MKPIC = if stdenv.isDarwin then "no" else "yes"; MACHINE_ARCH = {
MKRELRO = if stdenv.isDarwin then "no" else "yes"; "i686" = "i386";
}.${stdenv'.hostPlatform.parsed.cpu.name}
or stdenv'.hostPlatform.parsed.cpu.name;
INSTALL_FILE = "install -U -c"; MACHINE = {
INSTALL_DIR = "xinstall -U -d"; "x86_64" = "amd64";
INSTALL_LINK = "install -U -l h"; "aarch64" = "evbarm64";
INSTALL_SYMLINK = "install -U -l s"; "i686" = "i386";
}.${stdenv'.hostPlatform.parsed.cpu.name}
or stdenv'.hostPlatform.parsed.cpu.name;
HOST_CC = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; AR = "${stdenv'.cc.targetPrefix or ""}ar";
HOST_CXX = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; CC = "${stdenv'.cc.targetPrefix or ""}cc";
CPP = if (stdenv'.cc.isClang or false) then "clang-cpp" else "cpp";
CXX = "${stdenv'.cc.targetPrefix or ""}c++";
LD = "${stdenv'.cc.targetPrefix or ""}ld";
STRIP = "${stdenv'.cc.targetPrefix or ""}strip";
# libs will be provided by cc-wrapper NETBSD_PATH = attrs.path;
LIBCRT0 = "";
LIBCRTI = "";
LIBCRTEND = "";
LIBCRTBEGIN = "";
LIBC = "";
LIBUTIL = "";
LIBSSL = "";
LIBCRYPTO = "";
LIBCRYPT = "";
LIBCURSES = "";
LIBTERMINFO = "";
LIBM = "";
LIBL = "";
_GCC_CRTBEGIN = "";
_GCC_CRTBEGINS = "";
_GCC_CRTEND = "";
_GCC_CRTENDS = "";
_GCC_LIBGCCDIR = "";
_GCC_CRTI = "";
_GCC_CRTDIR = "";
_GCC_CRTN = "";
"LIBDO.terminfo" = "_external"; builder = ./builder.sh;
"LIBDO.curses" = "_external";
# all dirs will be prefixed with DESTDIR
BINDIR = "/bin";
LIBDIR = "/lib";
SHLIBDIR = "/lib";
INCSDIR = "/include";
MANDIR = "/share/man";
INFODIR = "/share/info";
DOCDIR = "/share/doc";
LOCALEDIR = "/share/locale";
X11BINDIR = "/bin";
X11USRLIBDIR = "/lib";
X11MANDIR = "/share/man";
# NetBSD makefiles should be able to detect this
# but without they end up using gcc on Darwin stdenv
preConfigure = ''
export HAVE_${if stdenv.cc.isClang then "LLVM" else "GCC"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))}
# Parallel building. Needs the space.
export makeFlags+=" -j $NIX_BUILD_CORES"
'';
postUnpack = ''
# merge together all extra paths
# there should be a better way to do this
sourceRoot=$PWD/$sourceRoot
export NETBSDSRCDIR=$sourceRoot
export BSDSRCDIR=$NETBSDSRCDIR
export _SRC_TOP_=$NETBSDSRCDIR
chmod -R u+w $sourceRoot
for path in $extraPaths; do
cd $path
find . -type d -exec mkdir -p $sourceRoot/\{} \;
find . -type f -exec cp -pr \{} $sourceRoot/\{} \;
chmod -R u+w $sourceRoot
done
cd $sourceRoot
if [ -d ${attrs.path} ]
then sourceRoot=$sourceRoot/${attrs.path}
fi
'';
preFixup = ''
# Remove lingering /usr references
if [ -d $out/usr ]; then
cd $out/usr
find . -type d -exec mkdir -p $out/\{} \;
find . -type f -exec mv \{} $out/\{} \;
fi
find $out -type d -empty -delete
'';
meta = with lib; { meta = with lib; {
maintainers = with maintainers; [matthewbauer]; maintainers = with maintainers; [matthewbauer];
platforms = platforms.unix; platforms = platforms.unix;
license = licenses.bsd2; license = licenses.bsd2;
}; };
}) // (removeAttrs attrs ["makeFlags"])); } // lib.optionalAttrs (stdenv'.cc.isClang or false) {
HAVE_LLVM = lib.head (lib.splitString "." (lib.getVersion stdenv'.cc.cc));
libutil = netBSDDerivation { } // lib.optionalAttrs (stdenv'.cc.isGNU or false) {
path = "lib/libutil"; HAVE_GCC = lib.head (lib.splitString "." (lib.getVersion stdenv'.cc.cc));
version = "8.0"; } // lib.optionalAttrs (attrs.headersOnly or false) {
sha256 = "077syyxd303m4x7avs5nxzk4c9n13d5lyk5aicsacqjvx79qrk3i"; installPhase = "includesPhase";
extraPaths = [ dontBuild = true;
(fetchNetBSD "common/lib/libutil" "8.0" "0q3ixrf36lip1dx0gafs0a03qfs5cs7n0myqq7af4jpjd6kh1831") } // attrs));
];
};
libc = netBSDDerivation {
path = "lib/libc";
version = "8.0";
sha256 = "0lgbc58qgn8kwm3l011x1ml1kgcf7jsgq7hbf0hxhlbvxq5bljl3";
extraPaths = [
(fetchNetBSD "common/lib/libc" "8.0" "1kbhj0vxixvdy9fvsr5y70ri4mlkmim1v9m98sqjlzc1vdiqfqc8")
];
};
make = netBSDDerivation {
path = "usr.bin/make";
sha256 = "103643qs3w5kiahir6cca2rkm5ink81qbg071qyzk63qvspfq10c";
version = "8.0";
postPatch = ''
# make needs this to pick up our sys make files
export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \
--replace '-Wl,-dynamic-linker=''${_SHLINKER}' "" \
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
--replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.kinc.mk \
--replace /bin/rm rm
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
--replace '-Wl,--fatal-warnings' "" \
--replace '-Wl,--warn-shared-textrel' ""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
--replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \
--replace '-Wl,--whole-archive' "" \
--replace '-Wl,--no-whole-archive' "" \
--replace '-Wl,--warn-shared-textrel' "" \
--replace '-Wl,-Map=''${_LIB}.so.''${SHLIB_SOVERSION}.map' "" \
--replace '-Wl,-rpath,''${SHLIBDIR}' ""
'';
postInstall = ''
make -C $NETBSDSRCDIR/share/mk FILESDIR=/share/mk install
'';
extraPaths = [
(fetchNetBSD "share/mk" "8.0" "033q4w3rmvwznz6m7fn9xcf13chyhwwl8ijj3a9mrn80fkwm55qs")
];
};
libcurses = netBSDDerivation {
path = "lib/libcurses";
version = "8.0";
sha256 = "0azhzh1910v24dqx45zmh4z4dl63fgsykajrbikx5xfvvmkcq7xs";
buildInputs = [ nbPackages.libterminfo ];
makeFlags = [ "INCSDIR=/include" ];
NIX_CFLAGS_COMPILE = [
"-D__scanflike(a,b)="
"-D__va_list=va_list"
"-D__warn_references(a,b)="
] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
propagatedBuildInputs = [ nbPackages.compat ];
MKDOC = "no"; # missing vfontedpr
postPatch = ''
substituteInPlace printw.c \
--replace "funopen2(win, NULL, winwrite, NULL, NULL, NULL)" NULL \
--replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));'
substituteInPlace scanw.c \
--replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));'
'';
};
libedit = netBSDDerivation {
path = "lib/libedit";
buildInputs = [ nbPackages.libterminfo libcurses ];
propagatedBuildInputs = [ nbPackages.compat ];
makeFlags = [ "INCSDIR=/include" ];
postPatch = ''
sed -i '1i #undef bool_t' el.h
substituteInPlace config.h \
--replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
'';
NIX_CFLAGS_COMPILE = [
"-D__noinline="
"-D__scanflike(a,b)="
"-D__va_list=va_list"
];
version = "8.0";
sha256 = "0pmqh2mkfp70bwchiwyrkdyq9jcihx12g1awd6alqi9bpr3f9xmd";
};
nbPackages = rec {
## ##
## BOOTSTRAPPING ## START BOOTSTRAPPING
## ##
makeMinimal = netBSDDerivation rec { makeMinimal = mkDerivation rec {
path = "tools/make"; path = "tools/make";
sha256 = "1xbzfd4i7allrkk1if74a8ymgpizyj0gkvdigzzj37qar7la7nc1"; sha256 = "1xbzfd4i7allrkk1if74a8ymgpizyj0gkvdigzzj37qar7la7nc1";
version = "8.0"; version = "8.0";
@ -274,6 +85,8 @@ let
buildInputs = []; buildInputs = [];
nativeBuildInputs = []; nativeBuildInputs = [];
skipIncludesPhase = true;
postPatch = '' postPatch = ''
patchShebangs configure patchShebangs configure
${make.postPatch} ${make.postPatch}
@ -298,7 +111,7 @@ let
extraPaths = [ make.src ] ++ make.extraPaths; extraPaths = [ make.src ] ++ make.extraPaths;
}; };
compat = if hostPlatform.isNetBSD then null else netBSDDerivation rec { compat = if stdenv.hostPlatform.isNetBSD then stdenv else mkDerivation rec {
path = "tools/compat"; path = "tools/compat";
sha256 = "050449lq5gpxqsripdqip5ks49g5ypjga188nd3ss8dg1zf7ydz3"; sha256 = "050449lq5gpxqsripdqip5ks49g5ypjga188nd3ss8dg1zf7ydz3";
version = "8.0"; version = "8.0";
@ -309,13 +122,15 @@ let
]; ];
# override defaults to prevent infinite recursion # override defaults to prevent infinite recursion
nativeBuildInputs = [ nbBuildPackages.makeMinimal ]; nativeBuildInputs = [ makeMinimal ];
buildInputs = [ zlib ]; buildInputs = [ zlib ];
# temporarily use gnuinstall for bootstrapping # temporarily use gnuinstall for bootstrapping
# bsdinstall will be built later # bsdinstall will be built later
makeFlags = [ "INSTALL=${buildPackages.coreutils}/bin/install" ]; makeFlags = [
installFlags = []; "INSTALL=${buildPackages.coreutils}/bin/install"
"TOOLDIR=$(out)"
];
RENAME = "-D"; RENAME = "-D";
patches = [ ./compat.patch ]; patches = [ ./compat.patch ];
@ -352,15 +167,6 @@ let
substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \ substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \
--subst-var-by out $out \ --subst-var-by out $out \
--subst-var-by version ${version} --subst-var-by version ${version}
# Remove lingering /usr references
if [ -d $out/usr ]; then
cd $out/usr
find . -type d -exec mkdir -p $out/\{} \;
find . -type f -exec mv \{} $out/\{} \;
fi
find $out -type d -empty -delete
''; '';
extraPaths = [ libc.src libutil.src extraPaths = [ libc.src libutil.src
(fetchNetBSD "include" "8.0" "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq") (fetchNetBSD "include" "8.0" "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq")
@ -369,19 +175,20 @@ let
] ++ libutil.extraPaths ++ libc.extraPaths; ] ++ libutil.extraPaths ++ libc.extraPaths;
}; };
# HACK to ensure parent directories exist. This emulates GNU # HACK: to ensure parent directories exist. This emulates GNU
# installs -D option. No alternative seems to exist in BSD install. # installs -D option. No alternative seems to exist in BSD install.
install = let binstall = writeText "binstall" '' install = let binstall = writeText "binstall" ''
#!${stdenv.shell} #!${stdenv.shell}
for last in $@; do true; done for last in $@; do true; done
mkdir -p $(dirname $last) mkdir -p $(dirname $last)
xinstall "$@" xinstall "$@"
''; in netBSDDerivation { ''; in mkDerivation {
path = "usr.bin/xinstall"; path = "usr.bin/xinstall";
version = "8.0"; version = "8.0";
sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj"; sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj";
extraPaths = [ mtree.src make.src ]; extraPaths = [ mtree.src make.src ];
nativeBuildInputs = [ nbBuildPackages.makeMinimal mandoc groff ]; nativeBuildInputs = [ makeMinimal mandoc groff ];
skipIncludesPhase = true;
buildInputs = [ compat fts ]; buildInputs = [ compat fts ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -395,7 +202,7 @@ let
''; '';
}; };
fts = netBSDDerivation { fts = mkDerivation {
pname = "fts"; pname = "fts";
path = "include/fts.h"; path = "include/fts.h";
sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77"; sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77";
@ -407,6 +214,7 @@ let
(fetchNetBSD "lib/libc/include/namespace.h" "8.0" "1sjvh9nw3prnk4rmdwrfsxh6gdb9lmilkn46jcfh3q5c8glqzrd7") (fetchNetBSD "lib/libc/include/namespace.h" "8.0" "1sjvh9nw3prnk4rmdwrfsxh6gdb9lmilkn46jcfh3q5c8glqzrd7")
(fetchNetBSD "lib/libc/gen/fts.3" "8.0" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1") (fetchNetBSD "lib/libc/gen/fts.3" "8.0" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1")
]; ];
skipIncludesPhase = true;
buildPhase = '' buildPhase = ''
cc -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \ cc -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \
-o lib/libc/gen/fts.o -o lib/libc/gen/fts.o
@ -428,119 +236,85 @@ let
]; ];
}; };
stat = netBSDDerivation { stat = mkDerivation {
path = "usr.bin/stat"; path = "usr.bin/stat";
version = "8.0"; version = "8.0";
sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh"; sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh";
nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install nativeBuildInputs = [ makeMinimal install mandoc groff ];
mandoc groff ];
}; };
tsort = netBSDDerivation { tsort = mkDerivation {
path = "usr.bin/tsort"; path = "usr.bin/tsort";
version = "8.0"; version = "8.0";
sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq"; sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq";
nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install nativeBuildInputs = [ makeMinimal install mandoc groff ];
mandoc groff ];
}; };
lorder = netBSDDerivation { lorder = mkDerivation {
path = "usr.bin/lorder"; path = "usr.bin/lorder";
version = "8.0"; version = "8.0";
sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2"; sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2";
nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install nativeBuildInputs = [ makeMinimal install mandoc groff ];
mandoc groff ];
}; };
## ##
## END BOOTSTRAPPING ## END BOOTSTRAPPING
## ##
mtree = netBSDDerivation { ##
## START COMMAND LINE TOOLS
##
make = mkDerivation {
path = "usr.bin/make";
sha256 = "103643qs3w5kiahir6cca2rkm5ink81qbg071qyzk63qvspfq10c";
version = "8.0";
postPatch = ''
# make needs this to pick up our sys make files
export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\""
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \
--replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB='
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.kinc.mk \
--replace /bin/rm rm
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \
--replace '-Wl,--fatal-warnings' "" \
--replace '-Wl,--warn-shared-textrel' ""
'';
postInstall = ''
make -C $NETBSDSRCDIR/share/mk FILESDIR=$out/share/mk install
'';
extraPaths = [
(fetchNetBSD "share/mk" "8.0" "033q4w3rmvwznz6m7fn9xcf13chyhwwl8ijj3a9mrn80fkwm55qs")
];
};
mtree = mkDerivation {
path = "usr.sbin/mtree"; path = "usr.sbin/mtree";
version = "8.0"; version = "8.0";
sha256 = "0hanmzm8bgwz2bhsinmsgfmgy6nbdhprwmgwbyjm6bl17vgn7vid"; sha256 = "0hanmzm8bgwz2bhsinmsgfmgy6nbdhprwmgwbyjm6bl17vgn7vid";
extraPaths = [ mknod.src ]; extraPaths = [ mknod.src ];
}; };
mknod = netBSDDerivation { mknod = mkDerivation {
path = "sbin/mknod"; path = "sbin/mknod";
version = "8.0"; version = "8.0";
sha256 = "0vq66v0hj0r4z2r2z2d3l3c5vh48pvcdmddc8bhm8hzq2civ5df2"; sha256 = "0vq66v0hj0r4z2r2z2d3l3c5vh48pvcdmddc8bhm8hzq2civ5df2";
}; };
getent = netBSDDerivation { getent = mkDerivation {
path = "usr.bin/getent"; path = "usr.bin/getent";
sha256 = "1ylhw4dnpyrmcy8n5kjcxywm8qc9p124dqnm17x4magiqx1kh9iz"; sha256 = "1ylhw4dnpyrmcy8n5kjcxywm8qc9p124dqnm17x4magiqx1kh9iz";
version = "8.0"; version = "8.0";
patches = [ ./getent.patch ]; patches = [ ./getent.patch ];
}; };
getconf = netBSDDerivation { getconf = mkDerivation {
path = "usr.bin/getconf"; path = "usr.bin/getconf";
sha256 = "122vslz4j3h2mfs921nr2s6m078zcj697yrb75rwp2hnw3qz4s8q"; sha256 = "122vslz4j3h2mfs921nr2s6m078zcj697yrb75rwp2hnw3qz4s8q";
version = "8.0"; version = "8.0";
}; };
dict = netBSDDerivation { locale = mkDerivation {
path = "share/dict";
version = "8.0";
sha256 = "1pk0y3xc5ihc2k89wjkh33qqx3w9q34k03k2qcffvbqh1l6wm36l";
makeFlags = [ "BINDIR=/share" ];
};
fingerd = netBSDDerivation {
path = "libexec/fingerd";
sha256 = "0blcahhgyj1lm0mimrbvgmq3wkjvqk5wy85sdvbs99zxg7da1190";
version = "8.0";
};
libterminfo = netBSDDerivation {
path = "lib/libterminfo";
version = "8.0";
sha256 = "14gp0d6fh6zjnbac2yjhyq5m6rca7gm6q1s9gilhzpdgl9m7vb9r";
buildInputs = [ compat tic nbperf ];
makeFlags = [ "INCSDIR=/include" ];
postPatch = ''
substituteInPlace term.c --replace /usr/share $out/share
substituteInPlace setupterm.c --replace '#include <curses.h>' 'void use_env(bool);'
'';
postInstall = ''
make -C $NETBSDSRCDIR/share/terminfo BINDIR=/share
make -C $NETBSDSRCDIR/share/terminfo BINDIR=/share install
'';
extraPaths = [
(fetchNetBSD "share/terminfo" "8.0" "18db0fk1dw691vk6lsm6dksm4cf08g8kdm0gc4052ysdagg2m6sm")
];
};
nbperf = netBSDDerivation {
path = "usr.bin/nbperf";
version = "8.0";
sha256 = "0gzm0zv2400lasnsswnjw9bwzyizhxzdbrcjwcl1k65aj86aqyqb";
};
tic = netBSDDerivation {
path = "tools/tic";
version = "8.0";
sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz";
HOSTPROG = "tic";
buildInputs = [ compat nbperf ];
extraPaths = [
libterminfo.src
(fetchNetBSD "usr.bin/tic" "8.0" "0diirnzmdnpc5bixyb34c9rid9paw2a4zfczqrpqrfvjsf1nnljf")
(fetchNetBSD "tools/Makefile.host" "8.0" "1p23dsc4qrv93vc6gzid9w2479jwswry9qfn88505s0pdd7h6nvp")
];
};
misc = netBSDDerivation {
path = "share/misc";
version = "8.0";
sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch8";
makeFlags = [ "BINDIR=/share" ];
};
locale = netBSDDerivation {
path = "usr.bin/locale"; path = "usr.bin/locale";
version = "8.0"; version = "8.0";
sha256 = "0kk6v9k2bygq0wf9gbinliqzqpzs9bgxn0ndyl2wcv3hh2bmsr9p"; sha256 = "0kk6v9k2bygq0wf9gbinliqzqpzs9bgxn0ndyl2wcv3hh2bmsr9p";
@ -548,12 +322,348 @@ let
NIX_CFLAGS_COMPILE = "-DYESSTR=__YESSTR -DNOSTR=__NOSTR"; NIX_CFLAGS_COMPILE = "-DYESSTR=__YESSTR -DNOSTR=__NOSTR";
}; };
column = netBSDDerivation { rpcgen = mkDerivation {
path = "usr.bin/rpcgen";
version = "8.0";
sha256 = "1kfgfx54jg98wbg0d95p0rvf4w0302v8fz724b0bdackdsrd4988";
};
genassym = mkDerivation {
path = "usr.bin/genassym";
version = "8.0";
sha256 = "1acl1dz5kvh9h5806vkz2ap95rdsz7phmynh5i3x5y7agbki030c";
};
gencat = mkDerivation {
path = "usr.bin/gencat";
version = "8.0";
sha256 = "1696lgh2lhz93247lklvpvkd0f5asg6z27w2g4bmpfijlgw2h698";
};
nbperf = mkDerivation {
path = "usr.bin/nbperf";
version = "8.0";
sha256 = "0gzm0zv2400lasnsswnjw9bwzyizhxzdbrcjwcl1k65aj86aqyqb";
};
tic = mkDerivation {
path = "tools/tic";
version = "8.0";
sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz";
HOSTPROG = "tic";
buildInputs = [ compat ];
nativeBuildInputs = [ makeMinimal install mandoc groff nbperf ];
makeFlags = [ "TOOLDIR=$(out)" ];
extraPaths = [
libterminfo.src
(fetchNetBSD "usr.bin/tic" "8.0" "0diirnzmdnpc5bixyb34c9rid9paw2a4zfczqrpqrfvjsf1nnljf")
(fetchNetBSD "tools/Makefile.host" "8.0" "1p23dsc4qrv93vc6gzid9w2479jwswry9qfn88505s0pdd7h6nvp")
];
};
##
## END COMMAND LINE TOOLS
##
##
## START HEADERS
##
include = mkDerivation {
path = "include";
version = "8.0";
sha256 = "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq";
nativeBuildInputs = [ makeMinimal install mandoc groff nbperf rpcgen ];
extraPaths = [ common.src ];
headersOnly = true;
noCC = true;
# meta.platforms = lib.platforms.netbsd;
makeFlags = [ "RPCGEN_CPP=${buildPackages.gcc-unwrapped}/bin/cpp" ];
};
common = mkDerivation {
path = "common";
version = "8.0";
sha256 = "1fsm2b7p7zkhiz523jw75088cq2h39iknp0fp3di9a64bikwbhi1";
};
# The full kernel
sys = mkDerivation {
path = "sys";
version = "8.0";
sha256 = "123ilg8fqmp69bw6bs6nh98fpi1v2n9lamrzar61p27ji6sj7g0w";
propagatedBuildInputs = [ include ];
#meta.platforms = lib.platforms.netbsd;
extraPaths = [ common.src ];
MKKMOD = "no";
};
headers = symlinkJoin {
name = "netbsd-headers-8.0";
paths = [ include ] ++ map (pkg: pkg.override (_: {
installPhase = "includesPhase";
dontBuild = true;
noCC = true;
meta.platforms = lib.platforms.all;
})) [ sys libpthread ];
};
##
## END HEADERS
##
##
## START LIBRARIES
##
libutil = mkDerivation {
path = "lib/libutil";
version = "8.0";
sha256 = "077syyxd303m4x7avs5nxzk4c9n13d5lyk5aicsacqjvx79qrk3i";
extraPaths = [ common.src ];
};
libedit = mkDerivation {
path = "lib/libedit";
version = "8.0";
sha256 = "0pmqh2mkfp70bwchiwyrkdyq9jcihx12g1awd6alqi9bpr3f9xmd";
buildInputs = [ libterminfo libcurses ];
propagatedBuildInputs = [ compat ];
postPatch = ''
sed -i '1i #undef bool_t' el.h
substituteInPlace config.h \
--replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" ""
substituteInPlace readline/Makefile --replace /usr/include "$out/include"
'';
NIX_CFLAGS_COMPILE = [
"-D__noinline="
"-D__scanflike(a,b)="
"-D__va_list=va_list"
];
};
libterminfo = mkDerivation {
path = "lib/libterminfo";
version = "8.0";
sha256 = "14gp0d6fh6zjnbac2yjhyq5m6rca7gm6q1s9gilhzpdgl9m7vb9r";
buildInputs = [ compat ];
postPatch = ''
substituteInPlace term.c --replace /usr/share $out/share
substituteInPlace setupterm.c \
--replace '#include <curses.h>' 'void use_env(bool);'
'';
postInstall = ''
make -C $NETBSDSRCDIR/share/terminfo BINDIR=$out/share install
'';
extraPaths = [
(fetchNetBSD "share/terminfo" "8.0" "18db0fk1dw691vk6lsm6dksm4cf08g8kdm0gc4052ysdagg2m6sm")
];
};
libcurses = mkDerivation {
path = "lib/libcurses";
version = "8.0";
sha256 = "0azhzh1910v24dqx45zmh4z4dl63fgsykajrbikx5xfvvmkcq7xs";
buildInputs = [ libterminfo ];
NIX_CFLAGS_COMPILE = [
"-D__scanflike(a,b)="
"-D__va_list=va_list"
"-D__warn_references(a,b)="
] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)=";
propagatedBuildInputs = [ compat ];
MKDOC = "no"; # missing vfontedpr
postPatch = lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace printw.c \
--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")));'
substituteInPlace scanw.c \
--replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));'
'';
};
libkern = mkDerivation {
path = "lib/libkern";
version = "8.0";
sha256 = "1wirqr9bms69n4b5sr32g1b1k41hcamm7c9n7i8c440m73r92yv4";
meta.platforms = lib.platforms.netbsd;
};
column = mkDerivation {
path = "usr.bin/column"; path = "usr.bin/column";
version = "8.0"; version = "8.0";
sha256 = "0r6b0hjn5ls3j3sv6chibs44fs32yyk2cg8kh70kb4cwajs4ifyl"; sha256 = "0r6b0hjn5ls3j3sv6chibs44fs32yyk2cg8kh70kb4cwajs4ifyl";
}; };
libossaudio = mkDerivation {
path = "lib/libossaudio";
version = "8.0";
sha256 = "03azp5anavhjr15sinjlik9792lyf7w4zmkcihlkksrywhs05axh";
meta.platforms = lib.platforms.netbsd;
postPatch = ''
substituteInPlace rpc/Makefile --replace /usr $out
'';
}; };
in nbPackages librpcsvc = mkDerivation {
path = "lib/librpcsvc";
version = "8.0";
sha256 = "14ri9w6gdhsm4id5ck133syyvbmkbknfa8w0xkklm726nskhfkj7";
makeFlags = [ "INCSDIR=$(out)/include/rpcsvc" ];
meta.platforms = lib.platforms.netbsd;
};
librt = mkDerivation {
path = "lib/librt";
version = "8.0";
sha256 = "078qsi4mg1hyyxr1awvjs9b0c2gicg3zw4vl603g1m9vm8gfxw9l";
meta.platforms = lib.platforms.netbsd;
};
libcrypt = mkDerivation {
path = "lib/libcrypt";
version = "8.0";
sha256 = "0siqan1wdqmmhchh2n8w6a8x1abbff8n4yb6jrqxap3hqn8ay54g";
meta.platforms = lib.platforms.netbsd;
};
libpthread = mkDerivation {
path = "lib/libpthread";
version = "8.0";
sha256 = "0pcz61klc3ijf5z2zf8s78nj7bwjfblzjllx7vr4z5qv3m0sdb3j";
meta.platforms = lib.platforms.netbsd;
};
libresolv = mkDerivation {
path = "lib/libresolv";
version = "8.0";
sha256 = "11vpb3p2343wyrhw4v9gwz7i0lcpb9ysmfs9gsx56b5gkgipdy4v";
meta.platforms = lib.platforms.netbsd;
};
libm = mkDerivation {
path = "lib/libm";
version = "8.0";
sha256 = "0i22603cgj6n00gn2m446v4kn1pk109qs1g6ylrslmihfmiy2h1d";
meta.platforms = lib.platforms.netbsd;
};
i18n_module = mkDerivation {
path = "lib/i18n_module";
version = "8.0";
sha256 = "0w6y5v3binm7gf2kn7y9jja8k18rhnyl55cvvfnfipjqdxvxd9jd";
meta.platforms = lib.platforms.netbsd;
};
csu = mkDerivation {
path = "lib/csu";
version = "8.0";
sha256 = "0630lbvz6v4ic13bfg8ccwfhqkgcv76bfdw9f36rfsnwfgpxqsmq";
meta.platforms = lib.platforms.netbsd;
nativeBuildInputs = [ makeMinimal install mandoc groff flex
yacc genassym gencat lorder tsort stat ];
extraPaths = [ sys.src ld_elf_so.src ];
};
ld_elf_so = mkDerivation {
path = "libexec/ld.elf_so";
version = "8.0";
sha256 = "1jmqpi0kg2daiqnvpwdyfy8rpnszxsm70sxizz0r7wn53xjr5hva";
meta.platforms = lib.platforms.netbsd;
USE_FORT = "yes";
extraPaths = [ libc.src ] ++ libc.extraPaths;
};
libc = mkDerivation {
path = "lib/libc";
version = "8.0";
sha256 = "0lgbc58qgn8kwm3l011x1ml1kgcf7jsgq7hbf0hxhlbvxq5bljl3";
USE_FORT = "yes";
MKPROFILE = "no";
extraPaths = [ common.src i18n_module.src sys.src
ld_elf_so.src libpthread.src libm.src libresolv.src
librpcsvc.src libutil.src librt.src libcrypt.src ];
buildInputs = [ buildPackages.netbsd.headers csu ];
nativeBuildInputs = [ makeMinimal install mandoc groff flex
yacc genassym gencat lorder tsort stat ];
NIX_CFLAGS_COMPILE = "-B${csu}/lib";
meta.platforms = lib.platforms.netbsd;
SHLIBINSTALLDIR = "$(out)/lib";
NLSDIR = "$(out)/share/nls";
makeFlags = [ "FILESDIR=$(out)/var/db"];
postInstall = ''
pushd ${buildPackages.netbsd.headers}
find . -type d -exec mkdir -p $out/\{} \;
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
popd
pushd ${csu}
find . -type d -exec mkdir -p $out/\{} \;
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
popd
NIX_CFLAGS_COMPILE+=" -B$out/lib"
NIX_CFLAGS_COMPILE+=" -I$out/include"
NIX_LDFLAGS+=" -L$out/lib"
make -C $NETBSDSRCDIR/lib/libpthread $makeFlags
make -C $NETBSDSRCDIR/lib/libpthread $makeFlags install
make -C $NETBSDSRCDIR/lib/libm $makeFlags
make -C $NETBSDSRCDIR/lib/libm $makeFlags install
make -C $NETBSDSRCDIR/lib/libresolv $makeFlags
make -C $NETBSDSRCDIR/lib/libresolv $makeFlags install
make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags
make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags install
make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags
make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags install
make -C $NETBSDSRCDIR/lib/libutil $makeFlags
make -C $NETBSDSRCDIR/lib/libutil $makeFlags install
make -C $NETBSDSRCDIR/lib/librt $makeFlags
make -C $NETBSDSRCDIR/lib/librt $makeFlags install
make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags
make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags install
'';
postPatch = ''
substituteInPlace sys/Makefile.inc \
--replace /usr/include/sys/syscall.h ${buildPackages.netbsd.headers}/include/sys/syscall.h
'';
};
#
# END LIBRARIES
#
#
# START MISCELLANEOUS
#
dict = mkDerivation {
path = "share/dict";
noCC = true;
version = "8.0";
sha256 = "1pk0y3xc5ihc2k89wjkh33qqx3w9q34k03k2qcffvbqh1l6wm36l";
makeFlags = [ "BINDIR=$(out)/share" ];
};
misc = mkDerivation {
path = "share/misc";
noCC = true;
version = "8.0";
sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch8";
makeFlags = [ "BINDIR=$(out)/share" ];
};
man = mkDerivation {
path = "share/man";
noCC = true;
version = "8.0";
sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch0";
makeFlags = [ "FILESDIR=$(out)/share" ];
};
#
# END MISCELLANEOUS
#
};
in netbsd

View File

@ -6838,6 +6838,7 @@ in
libcCross1 = libcCross1 =
if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode
else if stdenv.targetPlatform.libc == "nblibc" then netbsd.headers
else null; else null;
binutils1 = wrapBintoolsWith { binutils1 = wrapBintoolsWith {
bintools = binutils-unwrapped; bintools = binutils-unwrapped;
@ -10025,6 +10026,7 @@ in
else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64
else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries
else if name == "libSystem" then targetPackages.darwin.xcode else if name == "libSystem" then targetPackages.darwin.xcode
else if name == "nblibc" then targetPackages.netbsdCross.libc
else throw "Unknown libc"; else throw "Unknown libc";
libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc; libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;
@ -23258,8 +23260,10 @@ in
fts = if stdenv.hostPlatform.isMusl then netbsd.fts else null; fts = if stdenv.hostPlatform.isMusl then netbsd.fts else null;
inherit (recurseIntoAttrs (callPackages ../os-specific/bsd { })) netbsd = callPackages ../os-specific/bsd/netbsd {};
netbsd; netbsdCross = callPackages ../os-specific/bsd/netbsd {
stdenv = crossLibcStdenv;
};
yrd = callPackage ../tools/networking/yrd { }; yrd = callPackage ../tools/networking/yrd { };