nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix

netbsd: add cross target

authored by

Matthew Bauer and committed by
Matthew Bauer
aab8c7ba 1b267521

+727 -333
+1
lib/systems/default.nix
··· 33 33 else if final.isAndroid then "bionic" 34 34 else if final.isLinux /* default */ then "glibc" 35 35 else if final.isAvr then "avrlibc" 36 + else if final.isNetBSD then "nblibc" 36 37 # TODO(@Ericson2314) think more about other operating systems 37 38 else "native/impure"; 38 39 extensions = {
+7
lib/systems/examples.nix
··· 212 212 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain 213 213 platform = {}; 214 214 }; 215 + 216 + # BSDs 217 + 218 + amd64-netbsd = { 219 + config = "x86_64-unknown-netbsd"; 220 + libc = "nblibc"; 221 + }; 215 222 }
+1
pkgs/build-support/bintools-wrapper/default.nix
··· 53 53 /**/ if libc == null then null 54 54 else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*" 55 55 else if targetPlatform.libc == "bionic" then "/system/bin/linker" 56 + else if targetPlatform.libc == "nblibc" then "${libc_lib}/libexec/ld.elf_so" 56 57 else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" 57 58 else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" 58 59 # ARM with a wildcard, which can be "" or "-armhf".
+4
pkgs/build-support/cc-wrapper/default.nix
··· 291 291 hardening_unsupported_flags+=" stackprotector pic" 292 292 '' 293 293 294 + + optionalString targetPlatform.isNetBSD '' 295 + hardening_unsupported_flags+=" stackprotector fortify" 296 + '' 297 + 294 298 + optionalString (targetPlatform.libc == "newlib") '' 295 299 hardening_unsupported_flags+=" stackprotector fortify pie pic" 296 300 ''
+4
pkgs/development/compilers/gcc/7/default.nix
··· 48 48 ./riscv-no-relax.patch 49 49 ] 50 50 ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch 51 + ++ optionals targetPlatform.isNetBSD [ 52 + ../libstdc++-netbsd-ctypes.patch 53 + ] 51 54 ++ optional noSysDirs ../no-sys-dirs.patch 52 55 ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied 53 56 url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02"; ··· 305 302 "--disable-gnu-indirect-function" 306 303 ] 307 304 ++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419" 305 + ++ optional targetPlatform.isNetBSD "--disable-libcilkrts" 308 306 ; 309 307 310 308 targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
+141
pkgs/development/compilers/gcc/libstdc++-netbsd-ctypes.patch
··· 1 + diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h 2 + index ff3ec893974..21eccf9fde1 100644 3 + --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h 4 + +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_base.h 5 + @@ -38,40 +38,46 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 6 + /// @brief Base class for ctype. 7 + struct ctype_base 8 + { 9 + - // Non-standard typedefs. 10 + - typedef const unsigned char* __to_type; 11 + 12 + // NB: Offsets into ctype<char>::_M_table force a particular size 13 + // on the mask type. Because of this, we don't use an enum. 14 + - typedef unsigned char mask; 15 + 16 + #ifndef _CTYPE_U 17 + - static const mask upper = _U; 18 + - static const mask lower = _L; 19 + - static const mask alpha = _U | _L; 20 + - static const mask digit = _N; 21 + - static const mask xdigit = _N | _X; 22 + - static const mask space = _S; 23 + - static const mask print = _P | _U | _L | _N | _B; 24 + - static const mask graph = _P | _U | _L | _N; 25 + - static const mask cntrl = _C; 26 + - static const mask punct = _P; 27 + - static const mask alnum = _U | _L | _N; 28 + + // Non-standard typedefs. 29 + + typedef const unsigned char* __to_type; 30 + + 31 + + typedef unsigned char mask; 32 + + 33 + + static const mask upper = _U; 34 + + static const mask lower = _L; 35 + + static const mask alpha = _U | _L; 36 + + static const mask digit = _N; 37 + + static const mask xdigit = _N | _X; 38 + + static const mask space = _S; 39 + + static const mask print = _P | _U | _L | _N | _B; 40 + + static const mask graph = _P | _U | _L | _N; 41 + + static const mask cntrl = _C; 42 + + static const mask punct = _P; 43 + + static const mask alnum = _U | _L | _N; 44 + #else 45 + - static const mask upper = _CTYPE_U; 46 + - static const mask lower = _CTYPE_L; 47 + - static const mask alpha = _CTYPE_U | _CTYPE_L; 48 + - static const mask digit = _CTYPE_N; 49 + - static const mask xdigit = _CTYPE_N | _CTYPE_X; 50 + - static const mask space = _CTYPE_S; 51 + - static const mask print = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N | _CTYPE_B; 52 + - static const mask graph = _CTYPE_P | _CTYPE_U | _CTYPE_L | _CTYPE_N; 53 + - static const mask cntrl = _CTYPE_C; 54 + - static const mask punct = _CTYPE_P; 55 + - static const mask alnum = _CTYPE_U | _CTYPE_L | _CTYPE_N; 56 + + typedef const unsigned short* __to_type; 57 + + 58 + + typedef unsigned short mask; 59 + + 60 + + static const mask upper = _CTYPE_U; 61 + + static const mask lower = _CTYPE_L; 62 + + static const mask alpha = _CTYPE_A; 63 + + static const mask digit = _CTYPE_D; 64 + + static const mask xdigit = _CTYPE_X; 65 + + static const mask space = _CTYPE_S; 66 + + static const mask print = _CTYPE_R; 67 + + static const mask graph = _CTYPE_G; 68 + + static const mask cntrl = _CTYPE_C; 69 + + static const mask punct = _CTYPE_P; 70 + + static const mask alnum = _CTYPE_A | _CTYPE_D; 71 + #endif 72 + #if __cplusplus >= 201103L 73 + - static const mask blank = space; 74 + + static const mask blank = space; 75 + #endif 76 + }; 77 + 78 + diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc 79 + index ed3b7cd0d6a..33358e8f5d8 100644 80 + --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc 81 + +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_configure_char.cc 82 + @@ -38,11 +38,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 83 + 84 + // Information as gleaned from /usr/include/ctype.h 85 + 86 + - extern "C" const u_int8_t _C_ctype_[]; 87 + - 88 + const ctype_base::mask* 89 + ctype<char>::classic_table() throw() 90 + - { return _C_ctype_ + 1; } 91 + + { return _C_ctype_tab_ + 1; } 92 + 93 + ctype<char>::ctype(__c_locale, const mask* __table, bool __del, 94 + size_t __refs) 95 + @@ -69,14 +67,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 96 + 97 + char 98 + ctype<char>::do_toupper(char __c) const 99 + - { return ::toupper((int) __c); } 100 + + { return ::toupper((int)(unsigned char) __c); } 101 + 102 + const char* 103 + ctype<char>::do_toupper(char* __low, const char* __high) const 104 + { 105 + while (__low < __high) 106 + { 107 + - *__low = ::toupper((int) *__low); 108 + + *__low = ::toupper((int)(unsigned char) *__low); 109 + ++__low; 110 + } 111 + return __high; 112 + @@ -84,14 +82,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 113 + 114 + char 115 + ctype<char>::do_tolower(char __c) const 116 + - { return ::tolower((int) __c); } 117 + + { return ::tolower((int)(unsigned char) __c); } 118 + 119 + const char* 120 + ctype<char>::do_tolower(char* __low, const char* __high) const 121 + { 122 + while (__low < __high) 123 + { 124 + - *__low = ::tolower((int) *__low); 125 + + *__low = ::tolower((int)(unsigned char) *__low); 126 + ++__low; 127 + } 128 + return __high; 129 + diff --git a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h 130 + index ace1120fba2..3234ce17c70 100644 131 + --- a/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h 132 + +++ b/libstdc++-v3/config/os/bsd/netbsd/ctype_inline.h 133 + @@ -48,7 +48,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION 134 + is(const char* __low, const char* __high, mask* __vec) const 135 + { 136 + while (__low < __high) 137 + - *__vec++ = _M_table[*__low++]; 138 + + *__vec++ = _M_table[(unsigned char)*__low++]; 139 + return __high; 140 + } 141 +
+122
pkgs/os-specific/bsd/netbsd/builder.sh
··· 1 + source $stdenv/setup 2 + 3 + # NetBSD makefiles should be able to detect this 4 + # but without they end up using gcc on Darwin stdenv 5 + addMakeFlags() { 6 + export setOutputFlags= 7 + 8 + export LIBCRT0= 9 + export LIBCRTI= 10 + export LIBCRTEND= 11 + export LIBCRTBEGIN= 12 + export LIBC= 13 + export LIBUTIL= 14 + export LIBSSL= 15 + export LIBCRYPTO= 16 + export LIBCRYPT= 17 + export LIBCURSES= 18 + export LIBTERMINFO= 19 + export LIBM= 20 + export LIBL= 21 + 22 + export _GCC_CRTBEGIN= 23 + export _GCC_CRTBEGINS= 24 + export _GCC_CRTEND= 25 + export _GCC_CRTENDS= 26 + export _GCC_LIBGCCDIR= 27 + export _GCC_CRTI= 28 + export _GCC_CRTN= 29 + export _GCC_CRTDIR= 30 + 31 + # Definitions passed to share/mk/*.mk. Should be pretty simple - 32 + # eventually maybe move it to a configure script. 33 + export DESTDIR= 34 + export USETOOLS=never 35 + export NOCLANGERROR=yes 36 + export NOGCCERROR=yes 37 + export LEX=flex 38 + export MKUNPRIVED=yes 39 + export EXTERNAL_TOOLCHAIN=yes 40 + 41 + export INSTALL_FILE="install -U -c" 42 + export INSTALL_DIR="xinstall -U -d" 43 + export INSTALL_LINK="install -U -l h" 44 + export INSTALL_SYMLINK="install -U -l s" 45 + 46 + makeFlags="MACHINE=$MACHINE $makeFlags" 47 + makeFlags="MACHINE_ARCH=$MACHINE_ARCH $makeFlags" 48 + makeFlags="AR=$AR $makeFlags" 49 + makeFlags="CC=$CC $makeFlags" 50 + makeFlags="CPP=$CPP $makeFlags" 51 + makeFlags="CXX=$CXX $makeFlags" 52 + makeFlags="LD=$LD $makeFlags" 53 + makeFlags="STRIP=$STRIP $makeFlags" 54 + 55 + makeFlags="BINDIR=${!outputBin}/bin $makeFlags" 56 + makeFlags="LIBDIR=${!outputLib}/lib $makeFlags" 57 + makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags" 58 + makeFlags="MANDIR=${!outputMan}/share/man $makeFlags" 59 + makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags" 60 + makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags" 61 + makeFlags="LOCALEDIR=${!outputLib}/share/locale $makeFlags" 62 + 63 + # Parallel building. Needs the space. 64 + makeFlags="-j $NIX_BUILD_CORES $makeFlags" 65 + } 66 + 67 + setNetBSDSourceDir() { 68 + # merge together all extra paths 69 + # there should be a better way to do this 70 + sourceRoot=$PWD/$sourceRoot 71 + export NETBSDSRCDIR=$sourceRoot 72 + export BSDSRCDIR=$NETBSDSRCDIR 73 + export _SRC_TOP_=$NETBSDSRCDIR 74 + chmod -R u+w $sourceRoot 75 + for path in $extraPaths; do 76 + cd $path 77 + find . -type d -exec mkdir -p $sourceRoot/\{} \; 78 + find . -type f -exec cp -pr \{} $sourceRoot/\{} \; 79 + chmod -R u+w $sourceRoot 80 + done 81 + 82 + cd $sourceRoot 83 + if [ -d "$NETBSD_PATH" ] 84 + then sourceRoot=$sourceRoot/$NETBSD_PATH 85 + fi 86 + } 87 + 88 + includesPhase() { 89 + if [ -z "${skipIncludesPhase:-}" ]; then 90 + 91 + local flagsArray=( 92 + $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"} 93 + DESTDIR=${!outputInclude} includes 94 + ) 95 + 96 + echoCmd 'includes flags' "${flagsArray[@]}" 97 + make ${makefile:+-f $makefile} "${flagsArray[@]}" 98 + 99 + moveUsrDir 100 + 101 + fi 102 + } 103 + 104 + moveUsrDir() { 105 + if [ -d $prefix ]; then 106 + # Remove lingering /usr references 107 + if [ -d $prefix/usr ]; then 108 + cd $prefix/usr 109 + find . -type d -exec mkdir -p $out/\{} \; 110 + find . \( -type f -o -type l \) -exec mv \{} $out/\{} \; 111 + fi 112 + 113 + find $prefix -type d -empty -delete 114 + fi 115 + } 116 + 117 + postUnpackHooks+=(setNetBSDSourceDir) 118 + preConfigureHooks+=(addMakeFlags) 119 + preInstallHooks+=(includesPhase) 120 + fixupOutputHooks+=(moveUsrDir) 121 + 122 + genericBuild
+441 -331
pkgs/os-specific/bsd/netbsd/default.nix
··· 1 - { stdenv, fetchcvs, lib, groff, mandoc, zlib, buildPackages 2 - , yacc, flex, libressl, bash, less, writeText }: 1 + { stdenv, stdenvNoCC, fetchcvs, lib, groff, mandoc, zlib, yacc, flex, bash 2 + , writeText, buildPackages, splicePackages, symlinkJoin }: 3 3 4 4 let 5 - inherit (lib) optionalString replaceStrings; 6 - inherit (stdenv) hostPlatform; 7 - 8 5 fetchNetBSD = path: version: sha256: fetchcvs { 9 6 cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot"; 10 7 module = "src/${path}"; 11 8 inherit sha256; 12 - tag = "netbsd-${builtins.replaceStrings ["."] ["-"] version}-RELEASE"; 9 + tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE"; 13 10 }; 14 11 15 - # Needed to support cross correctly. Splicing only happens when we 16 - # do callPackage, but sense everything is here, it needs to be done 17 - # by hand. All native build inputs should come from here. 18 - nbBuildPackages = buildPackages.netbsd; 12 + # Splice packages so we get the correct package when using 13 + # nativeBuildInputs... 14 + nbSplicedPackages = splicePackages { 15 + pkgsBuildBuild = buildPackages.buildPackages.netbsd; 16 + pkgsBuildHost = buildPackages.netbsd; 17 + pkgsBuildTarget = {}; 18 + pkgsHostHost = {}; 19 + pkgsHostTarget = netbsd; 20 + pkgsTargetTarget = {}; 21 + }; 19 22 20 - MACHINE_ARCH = { 21 - "i686" = "i386"; 22 - }.${hostPlatform.parsed.cpu.name} or hostPlatform.parsed.cpu.name; 23 + netbsd = with nbSplicedPackages; { 23 24 24 - MACHINE = { 25 - "x86_64" = "amd64"; 26 - "aarch64" = "evbarm64"; 27 - "i686" = "i386"; 28 - }.${hostPlatform.parsed.cpu.name} or hostPlatform.parsed.cpu.name; 29 - 30 - netBSDDerivation = attrs: stdenv.mkDerivation ((rec { 31 - name = "netbsd-${attrs.pname or (baseNameOf attrs.path)}-${attrs.version}"; 25 + mkDerivation = lib.makeOverridable (attrs: let 26 + stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; 27 + in stdenv'.mkDerivation ({ 28 + name = "${attrs.pname or (baseNameOf attrs.path)}-netbsd-${attrs.version}"; 32 29 src = attrs.src or fetchNetBSD attrs.path attrs.version attrs.sha256; 33 30 34 31 extraPaths = [ ]; 35 - setOutputFlags = false; 36 32 37 - nativeBuildInputs = [ yacc flex mandoc groff 38 - nbBuildPackages.makeMinimal 39 - nbBuildPackages.stat 40 - nbBuildPackages.install 41 - nbBuildPackages.tsort 42 - nbBuildPackages.lorder ]; 43 - buildInputs = [ nbPackages.compat ]; 44 - installFlags = [ "includes" ]; 45 - # TODO: eventually move this to a make.conf 46 - makeFlags = [ 47 - "MACHINE=${MACHINE}" 48 - "MACHINE_ARCH=${MACHINE_ARCH}" 33 + nativeBuildInputs = [ makeMinimal install tsort lorder mandoc groff stat ]; 34 + buildInputs = [ compat ]; 35 + # depsBuildBuild = [ buildPackages.stdenv.cc ]; 49 36 50 - "AR=${stdenv.cc.targetPrefix}ar" 51 - "CC=${stdenv.cc.targetPrefix}cc" 52 - "CPP=${stdenv.cc.targetPrefix}cpp" 53 - "CXX=${stdenv.cc.targetPrefix}c++" 54 - "LD=${stdenv.cc.targetPrefix}ld" 55 - "STRIP=${stdenv.cc.targetPrefix}strip" 56 - ] ++ (attrs.makeFlags or []); 57 - 58 - # Definitions passed to share/mk/*.mk. Should be pretty simple - 59 - # eventually maybe move it to a configure script. 60 - # TODO: don’t rely on DESTDIR, instead use prefix 61 - DESTDIR = "$(out)"; 62 - TOOLDIR = "$(out)"; 63 - USETOOLS = "never"; 64 - NOCLANGERROR = "yes"; 65 - NOGCCERROR = "yes"; 66 - LEX = "flex"; 67 - MKUNPRIVED = "yes"; 68 - HOST_SH = "${buildPackages.bash}/bin/sh"; 69 37 OBJCOPY = if stdenv.isDarwin then "true" else "objcopy"; 70 - RPCGEN_CPP = "${stdenv.cc.targetPrefix}cpp"; 38 + HOST_SH = "${buildPackages.bash}/bin/sh"; 71 39 72 - MKPIC = if stdenv.isDarwin then "no" else "yes"; 73 - MKRELRO = if stdenv.isDarwin then "no" else "yes"; 40 + MACHINE_ARCH = { 41 + "i686" = "i386"; 42 + }.${stdenv'.hostPlatform.parsed.cpu.name} 43 + or stdenv'.hostPlatform.parsed.cpu.name; 74 44 75 - INSTALL_FILE = "install -U -c"; 76 - INSTALL_DIR = "xinstall -U -d"; 77 - INSTALL_LINK = "install -U -l h"; 78 - INSTALL_SYMLINK = "install -U -l s"; 45 + MACHINE = { 46 + "x86_64" = "amd64"; 47 + "aarch64" = "evbarm64"; 48 + "i686" = "i386"; 49 + }.${stdenv'.hostPlatform.parsed.cpu.name} 50 + or stdenv'.hostPlatform.parsed.cpu.name; 79 51 80 - HOST_CC = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"; 81 - HOST_CXX = "${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}c++"; 52 + AR = "${stdenv'.cc.targetPrefix or ""}ar"; 53 + CC = "${stdenv'.cc.targetPrefix or ""}cc"; 54 + CPP = if (stdenv'.cc.isClang or false) then "clang-cpp" else "cpp"; 55 + CXX = "${stdenv'.cc.targetPrefix or ""}c++"; 56 + LD = "${stdenv'.cc.targetPrefix or ""}ld"; 57 + STRIP = "${stdenv'.cc.targetPrefix or ""}strip"; 82 58 83 - # libs will be provided by cc-wrapper 84 - LIBCRT0 = ""; 85 - LIBCRTI = ""; 86 - LIBCRTEND = ""; 87 - LIBCRTBEGIN = ""; 88 - LIBC = ""; 89 - LIBUTIL = ""; 90 - LIBSSL = ""; 91 - LIBCRYPTO = ""; 92 - LIBCRYPT = ""; 93 - LIBCURSES = ""; 94 - LIBTERMINFO = ""; 95 - LIBM = ""; 96 - LIBL = ""; 97 - _GCC_CRTBEGIN = ""; 98 - _GCC_CRTBEGINS = ""; 99 - _GCC_CRTEND = ""; 100 - _GCC_CRTENDS = ""; 101 - _GCC_LIBGCCDIR = ""; 102 - _GCC_CRTI = ""; 103 - _GCC_CRTDIR = ""; 104 - _GCC_CRTN = ""; 59 + NETBSD_PATH = attrs.path; 105 60 106 - "LIBDO.terminfo" = "_external"; 107 - "LIBDO.curses" = "_external"; 108 - 109 - # all dirs will be prefixed with DESTDIR 110 - BINDIR = "/bin"; 111 - LIBDIR = "/lib"; 112 - SHLIBDIR = "/lib"; 113 - INCSDIR = "/include"; 114 - MANDIR = "/share/man"; 115 - INFODIR = "/share/info"; 116 - DOCDIR = "/share/doc"; 117 - LOCALEDIR = "/share/locale"; 118 - X11BINDIR = "/bin"; 119 - X11USRLIBDIR = "/lib"; 120 - X11MANDIR = "/share/man"; 121 - 122 - # NetBSD makefiles should be able to detect this 123 - # but without they end up using gcc on Darwin stdenv 124 - preConfigure = '' 125 - export HAVE_${if stdenv.cc.isClang then "LLVM" else "GCC"}=${lib.head (lib.splitString "." (lib.getVersion stdenv.cc.cc))} 126 - 127 - # Parallel building. Needs the space. 128 - export makeFlags+=" -j $NIX_BUILD_CORES" 129 - ''; 130 - 131 - postUnpack = '' 132 - # merge together all extra paths 133 - # there should be a better way to do this 134 - sourceRoot=$PWD/$sourceRoot 135 - export NETBSDSRCDIR=$sourceRoot 136 - export BSDSRCDIR=$NETBSDSRCDIR 137 - export _SRC_TOP_=$NETBSDSRCDIR 138 - chmod -R u+w $sourceRoot 139 - for path in $extraPaths; do 140 - cd $path 141 - find . -type d -exec mkdir -p $sourceRoot/\{} \; 142 - find . -type f -exec cp -pr \{} $sourceRoot/\{} \; 143 - chmod -R u+w $sourceRoot 144 - done 145 - 146 - cd $sourceRoot 147 - if [ -d ${attrs.path} ] 148 - then sourceRoot=$sourceRoot/${attrs.path} 149 - fi 150 - ''; 151 - 152 - preFixup = '' 153 - # Remove lingering /usr references 154 - if [ -d $out/usr ]; then 155 - cd $out/usr 156 - find . -type d -exec mkdir -p $out/\{} \; 157 - find . -type f -exec mv \{} $out/\{} \; 158 - fi 159 - 160 - find $out -type d -empty -delete 161 - ''; 61 + builder = ./builder.sh; 162 62 163 63 meta = with lib; { 164 64 maintainers = with maintainers; [matthewbauer]; 165 65 platforms = platforms.unix; 166 66 license = licenses.bsd2; 167 67 }; 168 - }) // (removeAttrs attrs ["makeFlags"])); 169 - 170 - libutil = netBSDDerivation { 171 - path = "lib/libutil"; 172 - version = "8.0"; 173 - sha256 = "077syyxd303m4x7avs5nxzk4c9n13d5lyk5aicsacqjvx79qrk3i"; 174 - extraPaths = [ 175 - (fetchNetBSD "common/lib/libutil" "8.0" "0q3ixrf36lip1dx0gafs0a03qfs5cs7n0myqq7af4jpjd6kh1831") 176 - ]; 177 - }; 178 - 179 - libc = netBSDDerivation { 180 - path = "lib/libc"; 181 - version = "8.0"; 182 - sha256 = "0lgbc58qgn8kwm3l011x1ml1kgcf7jsgq7hbf0hxhlbvxq5bljl3"; 183 - extraPaths = [ 184 - (fetchNetBSD "common/lib/libc" "8.0" "1kbhj0vxixvdy9fvsr5y70ri4mlkmim1v9m98sqjlzc1vdiqfqc8") 185 - ]; 186 - }; 187 - 188 - make = netBSDDerivation { 189 - path = "usr.bin/make"; 190 - sha256 = "103643qs3w5kiahir6cca2rkm5ink81qbg071qyzk63qvspfq10c"; 191 - version = "8.0"; 192 - postPatch = '' 193 - # make needs this to pick up our sys make files 194 - export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\"" 195 - 196 - substituteInPlace $NETBSDSRCDIR/share/mk/bsd.prog.mk \ 197 - --replace '-Wl,-dynamic-linker=''${_SHLINKER}' "" \ 198 - --replace '-Wl,-rpath,''${SHLIBDIR}' "" 199 - substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \ 200 - --replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB=' 201 - substituteInPlace $NETBSDSRCDIR/share/mk/bsd.kinc.mk \ 202 - --replace /bin/rm rm 203 - '' + lib.optionalString stdenv.isDarwin '' 204 - substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \ 205 - --replace '-Wl,--fatal-warnings' "" \ 206 - --replace '-Wl,--warn-shared-textrel' "" 207 - substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \ 208 - --replace '-Wl,-soname,''${_LIB}.so.''${SHLIB_SOVERSION}' "" \ 209 - --replace '-Wl,--whole-archive' "" \ 210 - --replace '-Wl,--no-whole-archive' "" \ 211 - --replace '-Wl,--warn-shared-textrel' "" \ 212 - --replace '-Wl,-Map=''${_LIB}.so.''${SHLIB_SOVERSION}.map' "" \ 213 - --replace '-Wl,-rpath,''${SHLIBDIR}' "" 214 - ''; 215 - postInstall = '' 216 - make -C $NETBSDSRCDIR/share/mk FILESDIR=/share/mk install 217 - ''; 218 - extraPaths = [ 219 - (fetchNetBSD "share/mk" "8.0" "033q4w3rmvwznz6m7fn9xcf13chyhwwl8ijj3a9mrn80fkwm55qs") 220 - ]; 221 - }; 222 - 223 - libcurses = netBSDDerivation { 224 - path = "lib/libcurses"; 225 - version = "8.0"; 226 - sha256 = "0azhzh1910v24dqx45zmh4z4dl63fgsykajrbikx5xfvvmkcq7xs"; 227 - buildInputs = [ nbPackages.libterminfo ]; 228 - makeFlags = [ "INCSDIR=/include" ]; 229 - NIX_CFLAGS_COMPILE = [ 230 - "-D__scanflike(a,b)=" 231 - "-D__va_list=va_list" 232 - "-D__warn_references(a,b)=" 233 - ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)="; 234 - propagatedBuildInputs = [ nbPackages.compat ]; 235 - MKDOC = "no"; # missing vfontedpr 236 - postPatch = '' 237 - substituteInPlace printw.c \ 238 - --replace "funopen2(win, NULL, winwrite, NULL, NULL, NULL)" NULL \ 239 - --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));' 240 - substituteInPlace scanw.c \ 241 - --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));' 242 - ''; 243 - }; 244 - 245 - libedit = netBSDDerivation { 246 - path = "lib/libedit"; 247 - buildInputs = [ nbPackages.libterminfo libcurses ]; 248 - propagatedBuildInputs = [ nbPackages.compat ]; 249 - makeFlags = [ "INCSDIR=/include" ]; 250 - postPatch = '' 251 - sed -i '1i #undef bool_t' el.h 252 - substituteInPlace config.h \ 253 - --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" "" 254 - ''; 255 - NIX_CFLAGS_COMPILE = [ 256 - "-D__noinline=" 257 - "-D__scanflike(a,b)=" 258 - "-D__va_list=va_list" 259 - ]; 260 - version = "8.0"; 261 - sha256 = "0pmqh2mkfp70bwchiwyrkdyq9jcihx12g1awd6alqi9bpr3f9xmd"; 262 - }; 263 - 264 - nbPackages = rec { 68 + } // lib.optionalAttrs (stdenv'.cc.isClang or false) { 69 + HAVE_LLVM = lib.head (lib.splitString "." (lib.getVersion stdenv'.cc.cc)); 70 + } // lib.optionalAttrs (stdenv'.cc.isGNU or false) { 71 + HAVE_GCC = lib.head (lib.splitString "." (lib.getVersion stdenv'.cc.cc)); 72 + } // lib.optionalAttrs (attrs.headersOnly or false) { 73 + installPhase = "includesPhase"; 74 + dontBuild = true; 75 + } // attrs)); 265 76 266 77 ## 267 - ## BOOTSTRAPPING 78 + ## START BOOTSTRAPPING 268 79 ## 269 - makeMinimal = netBSDDerivation rec { 80 + makeMinimal = mkDerivation rec { 270 81 path = "tools/make"; 271 82 sha256 = "1xbzfd4i7allrkk1if74a8ymgpizyj0gkvdigzzj37qar7la7nc1"; 272 83 version = "8.0"; 273 84 274 85 buildInputs = []; 275 86 nativeBuildInputs = []; 87 + 88 + skipIncludesPhase = true; 276 89 277 90 postPatch = '' 278 91 patchShebangs configure ··· 111 298 extraPaths = [ make.src ] ++ make.extraPaths; 112 299 }; 113 300 114 - compat = if hostPlatform.isNetBSD then null else netBSDDerivation rec { 301 + compat = if stdenv.hostPlatform.isNetBSD then stdenv else mkDerivation rec { 115 302 path = "tools/compat"; 116 303 sha256 = "050449lq5gpxqsripdqip5ks49g5ypjga188nd3ss8dg1zf7ydz3"; 117 304 version = "8.0"; ··· 122 309 ]; 123 310 124 311 # override defaults to prevent infinite recursion 125 - nativeBuildInputs = [ nbBuildPackages.makeMinimal ]; 312 + nativeBuildInputs = [ makeMinimal ]; 126 313 buildInputs = [ zlib ]; 127 314 128 315 # temporarily use gnuinstall for bootstrapping 129 316 # bsdinstall will be built later 130 - makeFlags = [ "INSTALL=${buildPackages.coreutils}/bin/install" ]; 131 - installFlags = []; 317 + makeFlags = [ 318 + "INSTALL=${buildPackages.coreutils}/bin/install" 319 + "TOOLDIR=$(out)" 320 + ]; 132 321 RENAME = "-D"; 133 322 134 323 patches = [ ./compat.patch ]; ··· 167 352 substitute ${./libbsd-overlay.pc} $out/lib/pkgconfig/libbsd-overlay.pc \ 168 353 --subst-var-by out $out \ 169 354 --subst-var-by version ${version} 170 - 171 - # Remove lingering /usr references 172 - if [ -d $out/usr ]; then 173 - cd $out/usr 174 - find . -type d -exec mkdir -p $out/\{} \; 175 - find . -type f -exec mv \{} $out/\{} \; 176 - fi 177 - 178 - find $out -type d -empty -delete 179 355 ''; 180 356 extraPaths = [ libc.src libutil.src 181 357 (fetchNetBSD "include" "8.0" "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq") ··· 175 369 ] ++ libutil.extraPaths ++ libc.extraPaths; 176 370 }; 177 371 178 - # HACK to ensure parent directories exist. This emulates GNU 372 + # HACK: to ensure parent directories exist. This emulates GNU 179 373 # install’s -D option. No alternative seems to exist in BSD install. 180 374 install = let binstall = writeText "binstall" '' 181 375 #!${stdenv.shell} 182 376 for last in $@; do true; done 183 377 mkdir -p $(dirname $last) 184 378 xinstall "$@" 185 - ''; in netBSDDerivation { 379 + ''; in mkDerivation { 186 380 path = "usr.bin/xinstall"; 187 381 version = "8.0"; 188 382 sha256 = "1f6pbz3qv1qcrchdxif8p5lbmnwl8b9nq615hsd3cyl4avd5bfqj"; 189 383 extraPaths = [ mtree.src make.src ]; 190 - nativeBuildInputs = [ nbBuildPackages.makeMinimal mandoc groff ]; 384 + nativeBuildInputs = [ makeMinimal mandoc groff ]; 385 + skipIncludesPhase = true; 191 386 buildInputs = [ compat fts ]; 192 387 installPhase = '' 193 388 runHook preInstall ··· 202 395 ''; 203 396 }; 204 397 205 - fts = netBSDDerivation { 398 + fts = mkDerivation { 206 399 pname = "fts"; 207 400 path = "include/fts.h"; 208 401 sha256 = "01d4fpxvz1pgzfk5xznz5dcm0x0gdzwcsfm1h3d0xc9kc6hj2q77"; ··· 214 407 (fetchNetBSD "lib/libc/include/namespace.h" "8.0" "1sjvh9nw3prnk4rmdwrfsxh6gdb9lmilkn46jcfh3q5c8glqzrd7") 215 408 (fetchNetBSD "lib/libc/gen/fts.3" "8.0" "1asxw0n3fhjdadwkkq3xplfgqgl3q32w1lyrvbakfa3gs0wz5zc1") 216 409 ]; 410 + skipIncludesPhase = true; 217 411 buildPhase = '' 218 412 cc -c -Iinclude -Ilib/libc/include lib/libc/gen/fts.c \ 219 413 -o lib/libc/gen/fts.o ··· 236 428 ]; 237 429 }; 238 430 239 - stat = netBSDDerivation { 431 + stat = mkDerivation { 240 432 path = "usr.bin/stat"; 241 433 version = "8.0"; 242 434 sha256 = "0z4r96id2r4cfy443rw2s1n52n186xm0lqvs8s3qjf4314z7r7yh"; 243 - nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install 244 - mandoc groff ]; 435 + nativeBuildInputs = [ makeMinimal install mandoc groff ]; 245 436 }; 246 437 247 - tsort = netBSDDerivation { 438 + tsort = mkDerivation { 248 439 path = "usr.bin/tsort"; 249 440 version = "8.0"; 250 441 sha256 = "1dqvf9gin29nnq3c4byxc7lfd062pg7m84843zdy6n0z63hnnwiq"; 251 - nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install 252 - mandoc groff ]; 442 + nativeBuildInputs = [ makeMinimal install mandoc groff ]; 253 443 }; 254 444 255 - lorder = netBSDDerivation { 445 + lorder = mkDerivation { 256 446 path = "usr.bin/lorder"; 257 447 version = "8.0"; 258 448 sha256 = "0rjf9blihhm0n699vr2bg88m4yjhkbxh6fxliaay3wxkgnydjwn2"; 259 - nativeBuildInputs = [ nbBuildPackages.makeMinimal nbBuildPackages.install 260 - mandoc groff ]; 449 + nativeBuildInputs = [ makeMinimal install mandoc groff ]; 261 450 }; 262 451 ## 263 452 ## END BOOTSTRAPPING 264 453 ## 265 454 266 - mtree = netBSDDerivation { 455 + ## 456 + ## START COMMAND LINE TOOLS 457 + ## 458 + make = mkDerivation { 459 + path = "usr.bin/make"; 460 + sha256 = "103643qs3w5kiahir6cca2rkm5ink81qbg071qyzk63qvspfq10c"; 461 + version = "8.0"; 462 + postPatch = '' 463 + # make needs this to pick up our sys make files 464 + export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\"" 465 + 466 + substituteInPlace $NETBSDSRCDIR/share/mk/bsd.lib.mk \ 467 + --replace '_INSTRANLIB=''${empty(PRESERVE):?-a "''${RANLIB} -t":}' '_INSTRANLIB=' 468 + substituteInPlace $NETBSDSRCDIR/share/mk/bsd.kinc.mk \ 469 + --replace /bin/rm rm 470 + '' + lib.optionalString stdenv.isDarwin '' 471 + substituteInPlace $NETBSDSRCDIR/share/mk/bsd.sys.mk \ 472 + --replace '-Wl,--fatal-warnings' "" \ 473 + --replace '-Wl,--warn-shared-textrel' "" 474 + ''; 475 + postInstall = '' 476 + make -C $NETBSDSRCDIR/share/mk FILESDIR=$out/share/mk install 477 + ''; 478 + extraPaths = [ 479 + (fetchNetBSD "share/mk" "8.0" "033q4w3rmvwznz6m7fn9xcf13chyhwwl8ijj3a9mrn80fkwm55qs") 480 + ]; 481 + }; 482 + 483 + mtree = mkDerivation { 267 484 path = "usr.sbin/mtree"; 268 485 version = "8.0"; 269 486 sha256 = "0hanmzm8bgwz2bhsinmsgfmgy6nbdhprwmgwbyjm6bl17vgn7vid"; 270 487 extraPaths = [ mknod.src ]; 271 488 }; 272 489 273 - mknod = netBSDDerivation { 490 + mknod = mkDerivation { 274 491 path = "sbin/mknod"; 275 492 version = "8.0"; 276 493 sha256 = "0vq66v0hj0r4z2r2z2d3l3c5vh48pvcdmddc8bhm8hzq2civ5df2"; 277 494 }; 278 495 279 - getent = netBSDDerivation { 496 + getent = mkDerivation { 280 497 path = "usr.bin/getent"; 281 498 sha256 = "1ylhw4dnpyrmcy8n5kjcxywm8qc9p124dqnm17x4magiqx1kh9iz"; 282 499 version = "8.0"; 283 500 patches = [ ./getent.patch ]; 284 501 }; 285 502 286 - getconf = netBSDDerivation { 503 + getconf = mkDerivation { 287 504 path = "usr.bin/getconf"; 288 505 sha256 = "122vslz4j3h2mfs921nr2s6m078zcj697yrb75rwp2hnw3qz4s8q"; 289 506 version = "8.0"; 290 507 }; 291 508 292 - dict = netBSDDerivation { 293 - path = "share/dict"; 294 - version = "8.0"; 295 - sha256 = "1pk0y3xc5ihc2k89wjkh33qqx3w9q34k03k2qcffvbqh1l6wm36l"; 296 - makeFlags = [ "BINDIR=/share" ]; 297 - }; 298 - 299 - fingerd = netBSDDerivation { 300 - path = "libexec/fingerd"; 301 - sha256 = "0blcahhgyj1lm0mimrbvgmq3wkjvqk5wy85sdvbs99zxg7da1190"; 302 - version = "8.0"; 303 - }; 304 - 305 - libterminfo = netBSDDerivation { 306 - path = "lib/libterminfo"; 307 - version = "8.0"; 308 - sha256 = "14gp0d6fh6zjnbac2yjhyq5m6rca7gm6q1s9gilhzpdgl9m7vb9r"; 309 - buildInputs = [ compat tic nbperf ]; 310 - makeFlags = [ "INCSDIR=/include" ]; 311 - postPatch = '' 312 - substituteInPlace term.c --replace /usr/share $out/share 313 - substituteInPlace setupterm.c --replace '#include <curses.h>' 'void use_env(bool);' 314 - 315 - ''; 316 - postInstall = '' 317 - make -C $NETBSDSRCDIR/share/terminfo BINDIR=/share 318 - make -C $NETBSDSRCDIR/share/terminfo BINDIR=/share install 319 - ''; 320 - extraPaths = [ 321 - (fetchNetBSD "share/terminfo" "8.0" "18db0fk1dw691vk6lsm6dksm4cf08g8kdm0gc4052ysdagg2m6sm") 322 - ]; 323 - }; 324 - 325 - nbperf = netBSDDerivation { 326 - path = "usr.bin/nbperf"; 327 - version = "8.0"; 328 - sha256 = "0gzm0zv2400lasnsswnjw9bwzyizhxzdbrcjwcl1k65aj86aqyqb"; 329 - }; 330 - 331 - tic = netBSDDerivation { 332 - path = "tools/tic"; 333 - version = "8.0"; 334 - sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz"; 335 - HOSTPROG = "tic"; 336 - buildInputs = [ compat nbperf ]; 337 - extraPaths = [ 338 - libterminfo.src 339 - (fetchNetBSD "usr.bin/tic" "8.0" "0diirnzmdnpc5bixyb34c9rid9paw2a4zfczqrpqrfvjsf1nnljf") 340 - (fetchNetBSD "tools/Makefile.host" "8.0" "1p23dsc4qrv93vc6gzid9w2479jwswry9qfn88505s0pdd7h6nvp") 341 - ]; 342 - }; 343 - 344 - misc = netBSDDerivation { 345 - path = "share/misc"; 346 - version = "8.0"; 347 - sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch8"; 348 - makeFlags = [ "BINDIR=/share" ]; 349 - }; 350 - 351 - locale = netBSDDerivation { 509 + locale = mkDerivation { 352 510 path = "usr.bin/locale"; 353 511 version = "8.0"; 354 512 sha256 = "0kk6v9k2bygq0wf9gbinliqzqpzs9bgxn0ndyl2wcv3hh2bmsr9p"; ··· 322 548 NIX_CFLAGS_COMPILE = "-DYESSTR=__YESSTR -DNOSTR=__NOSTR"; 323 549 }; 324 550 325 - column = netBSDDerivation { 551 + rpcgen = mkDerivation { 552 + path = "usr.bin/rpcgen"; 553 + version = "8.0"; 554 + sha256 = "1kfgfx54jg98wbg0d95p0rvf4w0302v8fz724b0bdackdsrd4988"; 555 + }; 556 + 557 + genassym = mkDerivation { 558 + path = "usr.bin/genassym"; 559 + version = "8.0"; 560 + sha256 = "1acl1dz5kvh9h5806vkz2ap95rdsz7phmynh5i3x5y7agbki030c"; 561 + }; 562 + 563 + gencat = mkDerivation { 564 + path = "usr.bin/gencat"; 565 + version = "8.0"; 566 + sha256 = "1696lgh2lhz93247lklvpvkd0f5asg6z27w2g4bmpfijlgw2h698"; 567 + }; 568 + 569 + nbperf = mkDerivation { 570 + path = "usr.bin/nbperf"; 571 + version = "8.0"; 572 + sha256 = "0gzm0zv2400lasnsswnjw9bwzyizhxzdbrcjwcl1k65aj86aqyqb"; 573 + }; 574 + 575 + tic = mkDerivation { 576 + path = "tools/tic"; 577 + version = "8.0"; 578 + sha256 = "092y7db7k4kh2jq8qc55126r5qqvlb8lq8mhmy5ipbi36hwb4zrz"; 579 + HOSTPROG = "tic"; 580 + buildInputs = [ compat ]; 581 + nativeBuildInputs = [ makeMinimal install mandoc groff nbperf ]; 582 + makeFlags = [ "TOOLDIR=$(out)" ]; 583 + extraPaths = [ 584 + libterminfo.src 585 + (fetchNetBSD "usr.bin/tic" "8.0" "0diirnzmdnpc5bixyb34c9rid9paw2a4zfczqrpqrfvjsf1nnljf") 586 + (fetchNetBSD "tools/Makefile.host" "8.0" "1p23dsc4qrv93vc6gzid9w2479jwswry9qfn88505s0pdd7h6nvp") 587 + ]; 588 + }; 589 + ## 590 + ## END COMMAND LINE TOOLS 591 + ## 592 + 593 + ## 594 + ## START HEADERS 595 + ## 596 + include = mkDerivation { 597 + path = "include"; 598 + version = "8.0"; 599 + sha256 = "128m77k16i7frvk8kifhmxzk7a37m7z1s0bbmja3ywga6sx6v6sq"; 600 + nativeBuildInputs = [ makeMinimal install mandoc groff nbperf rpcgen ]; 601 + extraPaths = [ common.src ]; 602 + headersOnly = true; 603 + noCC = true; 604 + # meta.platforms = lib.platforms.netbsd; 605 + makeFlags = [ "RPCGEN_CPP=${buildPackages.gcc-unwrapped}/bin/cpp" ]; 606 + }; 607 + 608 + common = mkDerivation { 609 + path = "common"; 610 + version = "8.0"; 611 + sha256 = "1fsm2b7p7zkhiz523jw75088cq2h39iknp0fp3di9a64bikwbhi1"; 612 + }; 613 + 614 + # The full kernel 615 + sys = mkDerivation { 616 + path = "sys"; 617 + version = "8.0"; 618 + sha256 = "123ilg8fqmp69bw6bs6nh98fpi1v2n9lamrzar61p27ji6sj7g0w"; 619 + propagatedBuildInputs = [ include ]; 620 + #meta.platforms = lib.platforms.netbsd; 621 + extraPaths = [ common.src ]; 622 + MKKMOD = "no"; 623 + }; 624 + 625 + headers = symlinkJoin { 626 + name = "netbsd-headers-8.0"; 627 + paths = [ include ] ++ map (pkg: pkg.override (_: { 628 + installPhase = "includesPhase"; 629 + dontBuild = true; 630 + noCC = true; 631 + meta.platforms = lib.platforms.all; 632 + })) [ sys libpthread ]; 633 + }; 634 + ## 635 + ## END HEADERS 636 + ## 637 + 638 + ## 639 + ## START LIBRARIES 640 + ## 641 + libutil = mkDerivation { 642 + path = "lib/libutil"; 643 + version = "8.0"; 644 + sha256 = "077syyxd303m4x7avs5nxzk4c9n13d5lyk5aicsacqjvx79qrk3i"; 645 + extraPaths = [ common.src ]; 646 + }; 647 + 648 + libedit = mkDerivation { 649 + path = "lib/libedit"; 650 + version = "8.0"; 651 + sha256 = "0pmqh2mkfp70bwchiwyrkdyq9jcihx12g1awd6alqi9bpr3f9xmd"; 652 + buildInputs = [ libterminfo libcurses ]; 653 + propagatedBuildInputs = [ compat ]; 654 + postPatch = '' 655 + sed -i '1i #undef bool_t' el.h 656 + substituteInPlace config.h \ 657 + --replace "#define HAVE_STRUCT_DIRENT_D_NAMLEN 1" "" 658 + substituteInPlace readline/Makefile --replace /usr/include "$out/include" 659 + ''; 660 + NIX_CFLAGS_COMPILE = [ 661 + "-D__noinline=" 662 + "-D__scanflike(a,b)=" 663 + "-D__va_list=va_list" 664 + ]; 665 + }; 666 + 667 + libterminfo = mkDerivation { 668 + path = "lib/libterminfo"; 669 + version = "8.0"; 670 + sha256 = "14gp0d6fh6zjnbac2yjhyq5m6rca7gm6q1s9gilhzpdgl9m7vb9r"; 671 + buildInputs = [ compat ]; 672 + postPatch = '' 673 + substituteInPlace term.c --replace /usr/share $out/share 674 + substituteInPlace setupterm.c \ 675 + --replace '#include <curses.h>' 'void use_env(bool);' 676 + ''; 677 + postInstall = '' 678 + make -C $NETBSDSRCDIR/share/terminfo BINDIR=$out/share install 679 + ''; 680 + extraPaths = [ 681 + (fetchNetBSD "share/terminfo" "8.0" "18db0fk1dw691vk6lsm6dksm4cf08g8kdm0gc4052ysdagg2m6sm") 682 + ]; 683 + }; 684 + 685 + libcurses = mkDerivation { 686 + path = "lib/libcurses"; 687 + version = "8.0"; 688 + sha256 = "0azhzh1910v24dqx45zmh4z4dl63fgsykajrbikx5xfvvmkcq7xs"; 689 + buildInputs = [ libterminfo ]; 690 + NIX_CFLAGS_COMPILE = [ 691 + "-D__scanflike(a,b)=" 692 + "-D__va_list=va_list" 693 + "-D__warn_references(a,b)=" 694 + ] ++ lib.optional stdenv.isDarwin "-D__strong_alias(a,b)="; 695 + propagatedBuildInputs = [ compat ]; 696 + MKDOC = "no"; # missing vfontedpr 697 + postPatch = lib.optionalString (!stdenv.isDarwin) '' 698 + substituteInPlace printw.c \ 699 + --replace "funopen(win, NULL, __winwrite, NULL, NULL)" NULL \ 700 + --replace "__strong_alias(vwprintw, vw_printw)" 'extern int vwprintw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_printw")));' 701 + substituteInPlace scanw.c \ 702 + --replace "__strong_alias(vwscanw, vw_scanw)" 'extern int vwscanw(WINDOW*, const char*, va_list) __attribute__ ((alias ("vw_scanw")));' 703 + ''; 704 + }; 705 + 706 + libkern = mkDerivation { 707 + path = "lib/libkern"; 708 + version = "8.0"; 709 + sha256 = "1wirqr9bms69n4b5sr32g1b1k41hcamm7c9n7i8c440m73r92yv4"; 710 + meta.platforms = lib.platforms.netbsd; 711 + }; 712 + 713 + column = mkDerivation { 326 714 path = "usr.bin/column"; 327 715 version = "8.0"; 328 716 sha256 = "0r6b0hjn5ls3j3sv6chibs44fs32yyk2cg8kh70kb4cwajs4ifyl"; 329 717 }; 330 718 719 + libossaudio = mkDerivation { 720 + path = "lib/libossaudio"; 721 + version = "8.0"; 722 + sha256 = "03azp5anavhjr15sinjlik9792lyf7w4zmkcihlkksrywhs05axh"; 723 + meta.platforms = lib.platforms.netbsd; 724 + postPatch = '' 725 + substituteInPlace rpc/Makefile --replace /usr $out 726 + ''; 331 727 }; 332 728 333 - in nbPackages 729 + librpcsvc = mkDerivation { 730 + path = "lib/librpcsvc"; 731 + version = "8.0"; 732 + sha256 = "14ri9w6gdhsm4id5ck133syyvbmkbknfa8w0xkklm726nskhfkj7"; 733 + makeFlags = [ "INCSDIR=$(out)/include/rpcsvc" ]; 734 + meta.platforms = lib.platforms.netbsd; 735 + }; 736 + 737 + librt = mkDerivation { 738 + path = "lib/librt"; 739 + version = "8.0"; 740 + sha256 = "078qsi4mg1hyyxr1awvjs9b0c2gicg3zw4vl603g1m9vm8gfxw9l"; 741 + meta.platforms = lib.platforms.netbsd; 742 + }; 743 + 744 + libcrypt = mkDerivation { 745 + path = "lib/libcrypt"; 746 + version = "8.0"; 747 + sha256 = "0siqan1wdqmmhchh2n8w6a8x1abbff8n4yb6jrqxap3hqn8ay54g"; 748 + meta.platforms = lib.platforms.netbsd; 749 + }; 750 + 751 + libpthread = mkDerivation { 752 + path = "lib/libpthread"; 753 + version = "8.0"; 754 + sha256 = "0pcz61klc3ijf5z2zf8s78nj7bwjfblzjllx7vr4z5qv3m0sdb3j"; 755 + meta.platforms = lib.platforms.netbsd; 756 + }; 757 + 758 + libresolv = mkDerivation { 759 + path = "lib/libresolv"; 760 + version = "8.0"; 761 + sha256 = "11vpb3p2343wyrhw4v9gwz7i0lcpb9ysmfs9gsx56b5gkgipdy4v"; 762 + meta.platforms = lib.platforms.netbsd; 763 + }; 764 + 765 + libm = mkDerivation { 766 + path = "lib/libm"; 767 + version = "8.0"; 768 + sha256 = "0i22603cgj6n00gn2m446v4kn1pk109qs1g6ylrslmihfmiy2h1d"; 769 + meta.platforms = lib.platforms.netbsd; 770 + }; 771 + 772 + i18n_module = mkDerivation { 773 + path = "lib/i18n_module"; 774 + version = "8.0"; 775 + sha256 = "0w6y5v3binm7gf2kn7y9jja8k18rhnyl55cvvfnfipjqdxvxd9jd"; 776 + meta.platforms = lib.platforms.netbsd; 777 + }; 778 + 779 + csu = mkDerivation { 780 + path = "lib/csu"; 781 + version = "8.0"; 782 + sha256 = "0630lbvz6v4ic13bfg8ccwfhqkgcv76bfdw9f36rfsnwfgpxqsmq"; 783 + meta.platforms = lib.platforms.netbsd; 784 + nativeBuildInputs = [ makeMinimal install mandoc groff flex 785 + yacc genassym gencat lorder tsort stat ]; 786 + extraPaths = [ sys.src ld_elf_so.src ]; 787 + }; 788 + 789 + ld_elf_so = mkDerivation { 790 + path = "libexec/ld.elf_so"; 791 + version = "8.0"; 792 + sha256 = "1jmqpi0kg2daiqnvpwdyfy8rpnszxsm70sxizz0r7wn53xjr5hva"; 793 + meta.platforms = lib.platforms.netbsd; 794 + USE_FORT = "yes"; 795 + extraPaths = [ libc.src ] ++ libc.extraPaths; 796 + }; 797 + 798 + libc = mkDerivation { 799 + path = "lib/libc"; 800 + version = "8.0"; 801 + sha256 = "0lgbc58qgn8kwm3l011x1ml1kgcf7jsgq7hbf0hxhlbvxq5bljl3"; 802 + USE_FORT = "yes"; 803 + MKPROFILE = "no"; 804 + extraPaths = [ common.src i18n_module.src sys.src 805 + ld_elf_so.src libpthread.src libm.src libresolv.src 806 + librpcsvc.src libutil.src librt.src libcrypt.src ]; 807 + buildInputs = [ buildPackages.netbsd.headers csu ]; 808 + nativeBuildInputs = [ makeMinimal install mandoc groff flex 809 + yacc genassym gencat lorder tsort stat ]; 810 + NIX_CFLAGS_COMPILE = "-B${csu}/lib"; 811 + meta.platforms = lib.platforms.netbsd; 812 + SHLIBINSTALLDIR = "$(out)/lib"; 813 + NLSDIR = "$(out)/share/nls"; 814 + makeFlags = [ "FILESDIR=$(out)/var/db"]; 815 + postInstall = '' 816 + pushd ${buildPackages.netbsd.headers} 817 + find . -type d -exec mkdir -p $out/\{} \; 818 + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; 819 + popd 820 + 821 + pushd ${csu} 822 + find . -type d -exec mkdir -p $out/\{} \; 823 + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; 824 + popd 825 + 826 + NIX_CFLAGS_COMPILE+=" -B$out/lib" 827 + NIX_CFLAGS_COMPILE+=" -I$out/include" 828 + NIX_LDFLAGS+=" -L$out/lib" 829 + 830 + make -C $NETBSDSRCDIR/lib/libpthread $makeFlags 831 + make -C $NETBSDSRCDIR/lib/libpthread $makeFlags install 832 + 833 + make -C $NETBSDSRCDIR/lib/libm $makeFlags 834 + make -C $NETBSDSRCDIR/lib/libm $makeFlags install 835 + 836 + make -C $NETBSDSRCDIR/lib/libresolv $makeFlags 837 + make -C $NETBSDSRCDIR/lib/libresolv $makeFlags install 838 + 839 + make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags 840 + make -C $NETBSDSRCDIR/lib/librpcsv $makeFlags install 841 + 842 + make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags 843 + make -C $NETBSDSRCDIR/lib/i18n_module $makeFlags install 844 + 845 + make -C $NETBSDSRCDIR/lib/libutil $makeFlags 846 + make -C $NETBSDSRCDIR/lib/libutil $makeFlags install 847 + 848 + make -C $NETBSDSRCDIR/lib/librt $makeFlags 849 + make -C $NETBSDSRCDIR/lib/librt $makeFlags install 850 + 851 + make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags 852 + make -C $NETBSDSRCDIR/lib/libcrypt $makeFlags install 853 + ''; 854 + postPatch = '' 855 + substituteInPlace sys/Makefile.inc \ 856 + --replace /usr/include/sys/syscall.h ${buildPackages.netbsd.headers}/include/sys/syscall.h 857 + ''; 858 + }; 859 + # 860 + # END LIBRARIES 861 + # 862 + 863 + # 864 + # START MISCELLANEOUS 865 + # 866 + dict = mkDerivation { 867 + path = "share/dict"; 868 + noCC = true; 869 + version = "8.0"; 870 + sha256 = "1pk0y3xc5ihc2k89wjkh33qqx3w9q34k03k2qcffvbqh1l6wm36l"; 871 + makeFlags = [ "BINDIR=$(out)/share" ]; 872 + }; 873 + 874 + misc = mkDerivation { 875 + path = "share/misc"; 876 + noCC = true; 877 + version = "8.0"; 878 + sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch8"; 879 + makeFlags = [ "BINDIR=$(out)/share" ]; 880 + }; 881 + 882 + man = mkDerivation { 883 + path = "share/man"; 884 + noCC = true; 885 + version = "8.0"; 886 + sha256 = "0d34b3irjbqsqfk8v8aaj36fjyvwyx410igl26jcx2ryh3ispch0"; 887 + makeFlags = [ "FILESDIR=$(out)/share" ]; 888 + }; 889 + # 890 + # END MISCELLANEOUS 891 + # 892 + 893 + }; 894 + 895 + in netbsd
+6 -2
pkgs/top-level/all-packages.nix
··· 6838 6838 libcCross1 = 6839 6839 if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers 6840 6840 else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode 6841 + else if stdenv.targetPlatform.libc == "nblibc" then netbsd.headers 6841 6842 else null; 6842 6843 binutils1 = wrapBintoolsWith { 6843 6844 bintools = binutils-unwrapped; ··· 10026 10025 else if name == "msvcrt" then targetPackages.windows.mingw_w64 or windows.mingw_w64 10027 10026 else if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries 10028 10027 else if name == "libSystem" then targetPackages.darwin.xcode 10028 + else if name == "nblibc" then targetPackages.netbsdCross.libc 10029 10029 else throw "Unknown libc"; 10030 10030 10031 10031 libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc; ··· 23260 23258 23261 23259 fts = if stdenv.hostPlatform.isMusl then netbsd.fts else null; 23262 23260 23263 - inherit (recurseIntoAttrs (callPackages ../os-specific/bsd { })) 23264 - netbsd; 23261 + netbsd = callPackages ../os-specific/bsd/netbsd {}; 23262 + netbsdCross = callPackages ../os-specific/bsd/netbsd { 23263 + stdenv = crossLibcStdenv; 23264 + }; 23265 23265 23266 23266 yrd = callPackage ../tools/networking/yrd { }; 23267 23267