Merge pull request #82131 from Ericson2314/bsd-cross

FreeBSD packages: Init at 13.1

authored by

John Ericson and committed by
GitHub
cd27a5b4 92ad187a

+1261 -43
+2 -2
doc/stdenv/meta.chapter.md
··· 44 44 "mips32-linux", 45 45 "x86_64-darwin", 46 46 "i686-cygwin", 47 - "i686-freebsd", 48 - "x86_64-freebsd", 47 + "i686-freebsd13", 48 + "x86_64-freebsd13", 49 49 "i686-openbsd", 50 50 "x86_64-openbsd" 51 51 ],
+2 -1
lib/systems/default.nix
··· 47 47 else if final.isUClibc then "uclibc" 48 48 else if final.isAndroid then "bionic" 49 49 else if final.isLinux /* default */ then "glibc" 50 + else if final.isFreeBSD then "fblibc" 51 + else if final.isNetBSD then "nblibc" 50 52 else if final.isAvr then "avrlibc" 51 53 else if final.isNone then "newlib" 52 - else if final.isNetBSD then "nblibc" 53 54 # TODO(@Ericson2314) think more about other operating systems 54 55 else "native/impure"; 55 56 # Choose what linker we wish to use by default. Someday we might also
+1 -1
lib/systems/doubles.nix
··· 13 13 "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" 14 14 15 15 # FreeBSD 16 - "i686-freebsd" "x86_64-freebsd" 16 + "i686-freebsd13" "x86_64-freebsd13" 17 17 18 18 # Genode 19 19 "aarch64-genode" "i686-genode" "x86_64-genode"
+5 -2
lib/systems/examples.nix
··· 303 303 304 304 # BSDs 305 305 306 + x86_64-freebsd = { 307 + config = "x86_64-unknown-freebsd13"; 308 + useLLVM = true; 309 + }; 310 + 306 311 x86_64-netbsd = { 307 312 config = "x86_64-unknown-netbsd"; 308 - libc = "nblibc"; 309 313 }; 310 314 311 315 # this is broken and never worked fully 312 316 x86_64-netbsd-llvm = { 313 317 config = "x86_64-unknown-netbsd"; 314 - libc = "nblibc"; 315 318 useLLVM = true; 316 319 }; 317 320
+1 -1
lib/systems/inspect.nix
··· 59 59 isiOS = { kernel = kernels.ios; }; 60 60 isLinux = { kernel = kernels.linux; }; 61 61 isSunOS = { kernel = kernels.solaris; }; 62 - isFreeBSD = { kernel = kernels.freebsd; }; 62 + isFreeBSD = { kernel = { name = "freebsd"; }; }; 63 63 isNetBSD = { kernel = kernels.netbsd; }; 64 64 isOpenBSD = { kernel = kernels.openbsd; }; 65 65 isWindows = { kernel = kernels.windows; };
+12 -3
lib/systems/parse.nix
··· 290 290 # the normalized name for macOS. 291 291 macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; 292 292 ios = { execFormat = macho; families = { inherit darwin; }; }; 293 - freebsd = { execFormat = elf; families = { inherit bsd; }; }; 293 + # A tricky thing about FreeBSD is that there is no stable ABI across 294 + # versions. That means that putting in the version as part of the 295 + # config string is paramount. 296 + freebsd12 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 12; }; 297 + freebsd13 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 13; }; 294 298 linux = { execFormat = elf; families = { }; }; 295 299 netbsd = { execFormat = elf; families = { inherit bsd; }; }; 296 300 none = { execFormat = unknown; families = { }; }; ··· 431 435 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "redox"; } 432 436 else if (elemAt l 2 == "mmixware") 433 437 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "mmixware"; } 438 + else if hasPrefix "freebsd" (elemAt l 2) 439 + then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } 434 440 else if hasPrefix "netbsd" (elemAt l 2) 435 441 then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } 436 442 else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"]) ··· 485 491 486 492 mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s)); 487 493 494 + kernelName = kernel: 495 + kernel.name + toString (kernel.version or ""); 496 + 488 497 doubleFromSystem = { cpu, kernel, abi, ... }: 489 498 /**/ if abi == abis.cygnus then "${cpu.name}-cygwin" 490 499 else if kernel.families ? darwin then "${cpu.name}-darwin" 491 - else "${cpu.name}-${kernel.name}"; 500 + else "${cpu.name}-${kernelName kernel}"; 492 501 493 502 tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let 494 503 optExecFormat = ··· 496 505 gnuNetBSDDefaultExecFormat cpu != kernel.execFormat) 497 506 kernel.execFormat.name; 498 507 optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}"; 499 - in "${cpu.name}-${vendor.name}-${kernel.name}${optExecFormat}${optAbi}"; 508 + in "${cpu.name}-${vendor.name}-${kernelName kernel}${optExecFormat}${optAbi}"; 500 509 501 510 ################################################################################ 502 511
+3 -3
lib/tests/systems.nix
··· 16 16 testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox); 17 17 18 18 testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ]; 19 - testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; 19 + testi686 = mseteq i686 [ "i686-linux" "i686-freebsd13" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; 20 20 testmips = mseteq mips [ "mips64el-linux" "mipsel-linux" "mipsel-netbsd" ]; 21 21 testmmix = mseteq mmix [ "mmix-mmixware" ]; 22 22 testriscv = mseteq riscv [ "riscv32-linux" "riscv64-linux" "riscv32-netbsd" "riscv64-netbsd" "riscv32-none" "riscv64-none" ]; 23 23 testriscv32 = mseteq riscv32 [ "riscv32-linux" "riscv32-netbsd" "riscv32-none" ]; 24 24 testriscv64 = mseteq riscv64 [ "riscv64-linux" "riscv64-netbsd" "riscv64-none" ]; 25 - testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; 25 + testx86_64 = mseteq x86_64 [ "x86_64-linux" "x86_64-darwin" "x86_64-freebsd13" "x86_64-genode" "x86_64-redox" "x86_64-openbsd" "x86_64-netbsd" "x86_64-cygwin" "x86_64-solaris" "x86_64-windows" "x86_64-none" ]; 26 26 27 27 testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]; 28 28 testdarwin = mseteq darwin [ "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" ]; 29 - testfreebsd = mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]; 29 + testfreebsd = mseteq freebsd [ "i686-freebsd13" "x86_64-freebsd13" ]; 30 30 testgenode = mseteq genode [ "aarch64-genode" "i686-genode" "x86_64-genode" ]; 31 31 testredox = mseteq redox [ "x86_64-redox" ]; 32 32 testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */);
+5 -1
pkgs/development/compilers/llvm/10/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 99 101 for f in $out/lib/*/*builtins-i?86*; do 100 102 ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/') 101 103 done 104 + '' + lib.optionalString doFakeLibgcc '' 105 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 102 106 ''; 103 107 104 108 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/10/default.nix
··· 156 156 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 157 157 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 158 158 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 159 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 159 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 160 160 echo "-lunwind" >> $out/nix-support/cc-ldflags 161 161 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 162 162 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/10/libcxxabi/default.nix
··· 28 28 ]; 29 29 30 30 nativeBuildInputs = [ cmake ]; 31 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 31 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; 32 32 33 33 cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 34 34 "-DLLVM_ENABLE_LIBCXX=ON"
+5 -1
pkgs/development/compilers/llvm/11/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 108 110 for f in $out/lib/*/*builtins-i?86*; do 109 111 ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/') 110 112 done 113 + '' + lib.optionalString doFakeLibgcc '' 114 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 111 115 ''; 112 116 113 117 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/11/default.nix
··· 172 172 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 173 173 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 174 174 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 175 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 175 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 176 176 echo "-lunwind" >> $out/nix-support/cc-ldflags 177 177 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 178 178 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/11/libcxxabi/default.nix
··· 1 1 { lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version 2 2 , enableShared ? !stdenv.hostPlatform.isStatic 3 3 , standalone ? stdenv.hostPlatform.useLLVM or false 4 - , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm 4 + , withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm 5 5 }: 6 6 7 7 stdenv.mkDerivation {
+5 -1
pkgs/development/compilers/llvm/12/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 94 96 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 95 97 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 96 98 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 99 + '' + lib.optionalString doFakeLibgcc '' 100 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 97 101 ''; 98 102 99 103 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/12/default.nix
··· 163 163 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 164 164 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 165 165 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 166 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 166 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 167 167 echo "-lunwind" >> $out/nix-support/cc-ldflags 168 168 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 169 169 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/12/libcxxabi/default.nix
··· 1 1 { lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version 2 2 , enableShared ? !stdenv.hostPlatform.isStatic 3 3 , standalone ? stdenv.hostPlatform.useLLVM or false 4 - , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm 4 + , withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm 5 5 }: 6 6 7 7 stdenv.mkDerivation {
+5 -1
pkgs/development/compilers/llvm/13/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: 1 + { lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 99 101 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 100 102 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 101 103 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 104 + '' + lib.optionalString doFakeLibgcc '' 105 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 102 106 ''; 103 107 104 108 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/13/default.nix
··· 163 163 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 164 164 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 165 165 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 166 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 166 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 167 167 echo "-lunwind" >> $out/nix-support/cc-ldflags 168 168 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 169 169 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/13/libcxxabi/default.nix
··· 1 1 { lib, stdenv, llvm_meta, cmake, python3, src, cxx-headers, libunwind, version 2 2 , enableShared ? !stdenv.hostPlatform.isStatic 3 3 , standalone ? stdenv.hostPlatform.useLLVM or false 4 - , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm 4 + , withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm 5 5 }: 6 6 7 7 stdenv.mkDerivation rec {
+3
pkgs/development/compilers/llvm/14/compiler-rt/default.nix
··· 1 1 { lib, stdenv, llvm_meta, version 2 2 , monorepoSrc, runCommand 3 3 , cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt 4 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 4 5 }: 5 6 6 7 let ··· 110 111 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 111 112 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 112 113 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 114 + '' + lib.optionalString doFakeLibgcc '' 115 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 113 116 ''; 114 117 115 118 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/14/default.nix
··· 166 166 ] 167 167 ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" 168 168 ++ lib.optional 169 - (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) 169 + (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) 170 170 "-lunwind" 171 171 ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 172 172 };
+1 -1
pkgs/development/compilers/llvm/14/libcxxabi/default.nix
··· 35 35 ]; 36 36 37 37 nativeBuildInputs = [ cmake python3 ]; 38 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 38 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; 39 39 40 40 cmakeFlags = [ 41 41 "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
+5 -1
pkgs/development/compilers/llvm/5/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 86 88 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o 87 89 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o 88 90 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o 91 + '' + lib.optionalString doFakeLibgcc '' 92 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a 89 93 ''; 90 94 91 95 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/5/libcxxabi/default.nix
··· 23 23 ]; 24 24 25 25 nativeBuildInputs = [ cmake ]; 26 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; 26 + buildInputs = lib.optional (!stdenv.isDarwin) libunwind; 27 27 28 28 preInstall = lib.optionalString stdenv.isDarwin '' 29 29 for file in lib/*.dylib; do
+5 -1
pkgs/development/compilers/llvm/6/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 86 88 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o 87 89 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o 88 90 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o 91 + '' + lib.optionalString doFakeLibgcc '' 92 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a 89 93 ''; 90 94 91 95 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/6/libcxxabi/default.nix
··· 23 23 ]; 24 24 25 25 nativeBuildInputs = [ cmake ]; 26 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; 26 + buildInputs = lib.optional (!stdenv.isDarwin) libunwind; 27 27 28 28 preInstall = lib.optionalString stdenv.isDarwin '' 29 29 for file in lib/*.dylib; do
+5 -1
pkgs/development/compilers/llvm/7/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 89 91 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 90 92 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 91 93 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 94 + '' + lib.optionalString doFakeLibgcc '' 95 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 92 96 ''; 93 97 94 98 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/7/default.nix
··· 163 163 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 164 164 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 165 165 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 166 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 166 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 167 167 echo "-lunwind" >> $out/nix-support/cc-ldflags 168 168 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 169 169 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/7/libcxxabi/default.nix
··· 1 1 { lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version 2 2 , fetchpatch 3 3 , standalone ? stdenv.hostPlatform.useLLVM or false 4 - , withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm 4 + , withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm 5 5 # on musl the shared objects don't build 6 6 , enableShared ? !stdenv.hostPlatform.isStatic 7 7 }:
+5 -1
pkgs/development/compilers/llvm/8/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 89 91 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 90 92 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 91 93 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 94 + '' + lib.optionalString doFakeLibgcc '' 95 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 92 96 ''; 93 97 94 98 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/8/default.nix
··· 164 164 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 165 165 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 166 166 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 167 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 167 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 168 168 echo "-lunwind" >> $out/nix-support/cc-ldflags 169 169 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 170 170 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/8/libcxxabi/default.nix
··· 28 28 ]; 29 29 30 30 nativeBuildInputs = [ cmake ]; 31 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 31 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; 32 32 33 33 cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 34 34 "-DLLVM_ENABLE_LIBCXX=ON"
+5 -1
pkgs/development/compilers/llvm/9/compiler-rt/default.nix
··· 1 - { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: 1 + { lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi 2 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 3 + }: 2 4 3 5 let 4 6 ··· 88 90 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 89 91 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 90 92 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 93 + '' + lib.optionalString doFakeLibgcc '' 94 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 91 95 ''; 92 96 93 97 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/9/default.nix
··· 164 164 echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags 165 165 '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' 166 166 echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags 167 - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' 167 + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' 168 168 echo "-lunwind" >> $out/nix-support/cc-ldflags 169 169 '' + lib.optionalString stdenv.targetPlatform.isWasm '' 170 170 echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+1 -1
pkgs/development/compilers/llvm/9/libcxxabi/default.nix
··· 28 28 ]; 29 29 30 30 nativeBuildInputs = [ cmake ]; 31 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 31 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; 32 32 33 33 cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ 34 34 "-DLLVM_ENABLE_LIBCXX=ON"
+3
pkgs/development/compilers/llvm/git/compiler-rt/default.nix
··· 1 1 { lib, stdenv, llvm_meta, version 2 2 , monorepoSrc, runCommand 3 3 , cmake, python3, xcbuild, libllvm, libcxxabi 4 + , doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD 4 5 }: 5 6 6 7 let ··· 106 107 ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o 107 108 ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o 108 109 ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o 110 + '' + lib.optionalString doFakeLibgcc '' 111 + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a 109 112 ''; 110 113 111 114 meta = llvm_meta // {
+1 -1
pkgs/development/compilers/llvm/git/default.nix
··· 166 166 ] 167 167 ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" 168 168 ++ lib.optional 169 - (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) 169 + (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) 170 170 "-lunwind" 171 171 ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; 172 172 };
+1 -1
pkgs/development/compilers/llvm/git/libcxxabi/default.nix
··· 53 53 ''; 54 54 55 55 nativeBuildInputs = [ cmake python3 ]; 56 - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; 56 + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; 57 57 58 58 cmakeFlags = [ 59 59 "-DLLVM_ENABLE_RUNTIMES=libcxxabi"
+32
pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch
··· 1 + --- a/tools/build/cross-build/include/common/sys/_types.h 2 + +++ b/tools/build/cross-build/include/common/sys/_types.h 3 + @@ -47,3 +47,6 @@ 4 + * Neither GLibc nor macOS define __va_list but many FreeBSD headers require it. 5 + */ 6 + typedef __builtin_va_list __va_list; 7 + + 8 + +typedef __UINTPTR_TYPE__ __uintptr_t; 9 + +typedef __INTPTR_TYPE__ __intptr_t; 10 + --- a/tools/build/cross-build/include/common/sys/types.h 11 + +++ b/tools/build/cross-build/include/common/sys/types.h 12 + @@ -49,9 +49,6 @@ 13 + #include <sys/sysmacros.h> 14 + #endif 15 + 16 + -typedef __UINTPTR_TYPE__ __uintptr_t; 17 + -typedef __INTPTR_TYPE__ __intptr_t; 18 + - 19 + /* needed for gencat */ 20 + typedef int __nl_item; 21 + 22 + --- a/tools/build/cross-build/include/linux/sys/types.h 23 + +++ b/tools/build/cross-build/include/linux/sys/types.h 24 + @@ -39,6 +39,8 @@ 25 + 26 + #include_next <sys/types.h> 27 + 28 + +#include <sys/_types.h> 29 + + 30 + #ifndef __size_t 31 + typedef __SIZE_TYPE__ __size_t; 32 + #endif
+42
pkgs/os-specific/bsd/freebsd/compat-install-dirs.patch
··· 1 + diff --git a/tools/build/Makefile b/tools/build/Makefile 2 + index 948a5f9dfdb..592af84eeae 100644 3 + --- a/tools/build/Makefile 4 + +++ b/tools/build/Makefile 5 + @@ -327,15 +327,15 @@ host-symlinks: 6 + # and cross-tools stages. We do this here using mkdir since mtree may not exist 7 + # yet (this happens if we are crossbuilding from Linux/Mac). 8 + INSTALLDIR_LIST= \ 9 + - bin \ 10 + - lib/casper \ 11 + - lib/geom \ 12 + - usr/include/casper \ 13 + - usr/include/private/ucl \ 14 + - usr/include/private/zstd \ 15 + - usr/lib \ 16 + - usr/libdata/pkgconfig \ 17 + - usr/libexec 18 + + ${BINDIR} \ 19 + + ${LIBDIR}/casper \ 20 + + ${LIBDIR}/geom \ 21 + + ${INCLUDEDIR}/casper \ 22 + + ${INCLUDEDIR}/private/ucl \ 23 + + ${INCLUDEDIR}/private/zstd \ 24 + + ${LIBDIR} \ 25 + + ${LIBDIR}/libdata/pkgconfig \ 26 + + ${LIBEXECDIR} 27 + 28 + installdirs: 29 + mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,} 30 + @@ -352,9 +352,9 @@ installdirs: 31 + rm -rf "${DESTDIR}/${_dir}"; \ 32 + fi 33 + .endfor 34 + - ln -sfn bin ${DESTDIR}/sbin 35 + - ln -sfn ../bin ${DESTDIR}/usr/bin 36 + - ln -sfn ../bin ${DESTDIR}/usr/sbin 37 + + ln -sfn bin ${DESTDIR}/${SBINDIR} 38 + + ln -sfn ../bin ${DESTDIR}/${BINDIR} 39 + + ln -sfn ../bin ${DESTDIR}/${SBINDIR} 40 + .for _group in ${INCSGROUPS:NINCS} 41 + mkdir -p "${DESTDIR}/${${_group}DIR}" 42 + .endfor
+6
pkgs/os-specific/bsd/freebsd/compat-setup-hook.sh
··· 1 + # See pkgs/build-support/setup-hooks/role.bash 2 + getHostRole 3 + 4 + export NIX_LDFLAGS${role_post}+=" -legacy" 5 + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem @out@/0-include" 6 + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem @out@/1-include"
+900
pkgs/os-specific/bsd/freebsd/default.nix
··· 1 + { stdenv, lib, stdenvNoCC 2 + , pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget 3 + , buildPackages, splicePackages, newScope 4 + , bsdSetupHook, makeSetupHook 5 + , fetchgit, fetchurl, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell 6 + , zlib, expat, libmd 7 + , runCommand, writeShellScript, writeText, symlinkJoin 8 + }: 9 + 10 + let 11 + inherit (buildPackages.buildPackages) rsync; 12 + 13 + version = "13.1.0"; 14 + 15 + # `BuildPackages.fetchgit` avoids some probably splicing-caused infinite 16 + # recursion. 17 + freebsdSrc = buildPackages.fetchgit { 18 + url = "https://git.FreeBSD.org/src.git"; 19 + rev = "release/${version}"; 20 + sha256 = "14nhk0kls83xfb64d5xy14vpi6k8laswjycjg80indq9pkcr2rlv"; 21 + }; 22 + 23 + freebsdSetupHook = makeSetupHook { 24 + name = "freebsd-setup-hook"; 25 + } ./setup-hook.sh; 26 + 27 + otherSplices = { 28 + selfBuildBuild = pkgsBuildBuild.freebsd; 29 + selfBuildHost = pkgsBuildHost.freebsd; 30 + selfBuildTarget = pkgsBuildTarget.freebsd; 31 + selfHostHost = pkgsHostHost.freebsd; 32 + selfTargetTarget = pkgsTargetTarget.freebsd or {}; # might be missing 33 + }; 34 + 35 + mkBsdArch = stdenv': { 36 + x86_64 = "amd64"; 37 + aarch64 = "arm64"; 38 + i486 = "i386"; 39 + i586 = "i386"; 40 + i686 = "i386"; 41 + }.${stdenv'.hostPlatform.parsed.cpu.name} 42 + or stdenv'.hostPlatform.parsed.cpu.name; 43 + 44 + install-wrapper = '' 45 + set -eu 46 + 47 + args=() 48 + declare -i path_args=0 49 + 50 + while (( $# )); do 51 + if (( $# == 1 )); then 52 + if (( path_args > 1)) || [[ "$1" = */ ]]; then 53 + mkdir -p "$1" 54 + else 55 + mkdir -p "$(dirname "$1")" 56 + fi 57 + fi 58 + case $1 in 59 + -C) ;; 60 + -o | -g) shift ;; 61 + -s) ;; 62 + -m | -l) 63 + # handle next arg so not counted as path arg 64 + args+=("$1" "$2") 65 + shift 66 + ;; 67 + -*) args+=("$1") ;; 68 + *) 69 + path_args+=1 70 + args+=("$1") 71 + ;; 72 + esac 73 + shift 74 + done 75 + ''; 76 + 77 + in lib.makeScopeWithSplicing 78 + splicePackages 79 + newScope 80 + otherSplices 81 + (_: {}) 82 + (_: {}) 83 + (self: let 84 + inherit (self) mkDerivation; 85 + in { 86 + inherit freebsdSrc; 87 + 88 + # Why do we have splicing and yet do `nativeBuildInputs = with self; ...`? 89 + # See note in ../netbsd/default.nix. 90 + 91 + compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isFreeBSD) self.compat; 92 + 93 + mkDerivation = lib.makeOverridable (attrs: let 94 + stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; 95 + in stdenv'.mkDerivation (rec { 96 + pname = "${attrs.pname or (baseNameOf attrs.path)}-freebsd"; 97 + inherit version; 98 + src = runCommand "${pname}-filtered-src" { 99 + nativeBuildInputs = [ rsync ]; 100 + } '' 101 + for p in ${lib.concatStringsSep " " ([ attrs.path ] ++ attrs.extraPaths or [])}; do 102 + set -x 103 + path="$out/$p" 104 + mkdir -p "$(dirname "$path")" 105 + src_path="${freebsdSrc}/$p" 106 + if [[ -d "$src_path" ]]; then src_path+=/; fi 107 + rsync --chmod="+w" -r "$src_path" "$path" 108 + set +x 109 + done 110 + ''; 111 + 112 + extraPaths = [ ]; 113 + 114 + nativeBuildInputs = with buildPackages.freebsd; [ 115 + bsdSetupHook freebsdSetupHook 116 + makeMinimal 117 + install tsort lorder mandoc groff #statHook 118 + ]; 119 + buildInputs = with self; compatIfNeeded; 120 + 121 + HOST_SH = stdenv'.shell; 122 + 123 + # Since STRIP below is the flag 124 + STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip"; 125 + 126 + makeFlags = [ 127 + "STRIP=-s" # flag to install, not command 128 + ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no"; 129 + 130 + # amd64 not x86_64 for this on unlike NetBSD 131 + MACHINE_ARCH = mkBsdArch stdenv'; 132 + 133 + MACHINE = mkBsdArch stdenv'; 134 + 135 + MACHINE_CPUARCH = MACHINE_ARCH; 136 + 137 + COMPONENT_PATH = attrs.path or null; 138 + 139 + strictDeps = true; 140 + 141 + meta = with lib; { 142 + maintainers = with maintainers; [ ericson2314 ]; 143 + platforms = platforms.unix; 144 + license = licenses.bsd2; 145 + }; 146 + } // lib.optionalAttrs stdenv'.hasCC { 147 + # TODO should CC wrapper set this? 148 + CPP = "${stdenv'.cc.targetPrefix}cpp"; 149 + } // lib.optionalAttrs stdenv'.isDarwin { 150 + MKRELRO = "no"; 151 + } // lib.optionalAttrs (stdenv'.cc.isClang or false) { 152 + HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc); 153 + } // lib.optionalAttrs (stdenv'.cc.isGNU or false) { 154 + HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc); 155 + } // lib.optionalAttrs (stdenv'.isx86_32) { 156 + USE_SSP = "no"; 157 + } // lib.optionalAttrs (attrs.headersOnly or false) { 158 + installPhase = "includesPhase"; 159 + dontBuild = true; 160 + } // attrs)); 161 + 162 + ## 163 + ## START BOOTSTRAPPING 164 + ## 165 + makeMinimal = mkDerivation rec { 166 + inherit (self.make) path; 167 + 168 + buildInputs = with self; []; 169 + nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook freebsdSetupHook ]; 170 + 171 + skipIncludesPhase = true; 172 + 173 + makeFlags = []; 174 + 175 + postPatch = '' 176 + patchShebangs configure 177 + ${self.make.postPatch} 178 + ''; 179 + 180 + buildPhase = '' 181 + runHook preBuild 182 + 183 + sh ./make-bootstrap.sh 184 + 185 + runHook postBuild 186 + ''; 187 + 188 + installPhase = '' 189 + runHook preInstall 190 + 191 + install -D bmake "$out/bin/bmake" 192 + ln -s "$out/bin/bmake" "$out/bin/make" 193 + mkdir -p "$out/share" 194 + cp -r "$BSDSRCDIR/share/mk" "$out/share/mk" 195 + find "$out/share/mk" -type f -print0 | 196 + while IFS= read -r -d "" f; do 197 + substituteInPlace "$f" --replace 'usr/' "" 198 + done 199 + substituteInPlace "$out/share/mk/bsd.symver.mk" \ 200 + --replace '/share/mk' "$out/share/mk" 201 + 202 + runHook postInstall 203 + ''; 204 + 205 + postInstall = lib.optionalString (!stdenv.targetPlatform.isFreeBSD) '' 206 + boot_mk="$BSDSRCDIR/tools/build/mk" 207 + cp "$boot_mk"/Makefile.boot* "$out/share/mk" 208 + replaced_mk="$out/share/mk.orig" 209 + mkdir "$replaced_mk" 210 + mv "$out"/share/mk/bsd.{lib,prog}.mk "$replaced_mk" 211 + for m in bsd.{lib,prog}.mk; do 212 + cp "$boot_mk/$m" "$out/share/mk" 213 + substituteInPlace "$out/share/mk/$m" --replace '../../../share/mk' '../mk.orig' 214 + done 215 + ''; 216 + 217 + extraPaths = with self; make.extraPaths; 218 + }; 219 + 220 + # Wrap NetBSD's install 221 + boot-install = buildPackages.writeShellScriptBin "boot-install" (install-wrapper + '' 222 + 223 + ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}" 224 + ''); 225 + 226 + compat = mkDerivation rec { 227 + pname = "compat"; 228 + path = "tools/build"; 229 + extraPaths = [ 230 + "lib/libc/db" 231 + "lib/libc/stdlib" # getopt 232 + "lib/libc/gen" # getcap 233 + "lib/libc/locale" # rpmatch 234 + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ 235 + "lib/libc/string" # strlcpy 236 + "lib/libutil" 237 + ] ++ [ 238 + "contrib/libc-pwcache" 239 + "contrib/libc-vis" 240 + "sys/libkern" 241 + "sys/kern/subr_capability.c" 242 + 243 + # Take only individual headers, or else we will clobber native libc, etc. 244 + 245 + "sys/rpc/types.h" 246 + 247 + # Listed in Makekfile as INC 248 + "include/mpool.h" 249 + "include/ndbm.h" 250 + "include/err.h" 251 + "include/stringlist.h" 252 + "include/a.out.h" 253 + "include/nlist.h" 254 + "include/db.h" 255 + "include/getopt.h" 256 + "include/nl_types.h" 257 + "include/elf.h" 258 + "sys/sys/ctf.h" 259 + 260 + # Listed in Makekfile as SYSINC 261 + 262 + "sys/sys/capsicum.h" 263 + "sys/sys/caprights.h" 264 + "sys/sys/imgact_aout.h" 265 + "sys/sys/nlist_aout.h" 266 + "sys/sys/nv.h" 267 + "sys/sys/dnv.h" 268 + "sys/sys/cnv.h" 269 + 270 + "sys/sys/elf32.h" 271 + "sys/sys/elf64.h" 272 + "sys/sys/elf_common.h" 273 + "sys/sys/elf_generic.h" 274 + "sys/${mkBsdArch stdenv}/include" 275 + ] ++ lib.optionals stdenv.hostPlatform.isx86 [ 276 + "sys/x86/include" 277 + ] ++ [ 278 + 279 + "sys/sys/queue.h" 280 + "sys/sys/md5.h" 281 + "sys/sys/sbuf.h" 282 + "sys/sys/tree.h" 283 + "sys/sys/font.h" 284 + "sys/sys/consio.h" 285 + "sys/sys/fnv_hash.h" 286 + 287 + "sys/crypto/chacha20/_chacha.h" 288 + "sys/crypto/chacha20/chacha.h" 289 + # included too, despite ".c" 290 + "sys/crypto/chacha20/chacha.c" 291 + 292 + "sys/fs" 293 + "sys/ufs" 294 + "sys/sys/disk" 295 + 296 + "lib/libcapsicum" 297 + "lib/libcasper" 298 + ]; 299 + 300 + patches = [ 301 + ./compat-install-dirs.patch 302 + ./compat-fix-typedefs-locations.patch 303 + ]; 304 + 305 + preBuild = '' 306 + NIX_CFLAGS_COMPILE+=' -I../../include -I../../sys' 307 + 308 + cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys 309 + cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys/${mkBsdArch stdenv} 310 + '' + lib.optionalString stdenv.hostPlatform.isx86 '' 311 + cp ../../sys/x86/include/elf.h ../../sys/x86 312 + ''; 313 + 314 + setupHooks = [ 315 + ../../../build-support/setup-hooks/role.bash 316 + ./compat-setup-hook.sh 317 + ]; 318 + 319 + # This one has an ifdefed `#include_next` that makes it annoying. 320 + postInstall = '' 321 + rm ''${!outputDev}/0-include/libelf.h 322 + ''; 323 + 324 + nativeBuildInputs = with buildPackages.freebsd; [ 325 + bsdSetupHook freebsdSetupHook 326 + makeMinimal 327 + boot-install 328 + 329 + which 330 + ]; 331 + buildInputs = [ expat zlib ]; 332 + 333 + makeFlags = [ 334 + "STRIP=-s" # flag to install, not command 335 + "MK_WERROR=no" 336 + "HOST_INCLUDE_ROOT=${lib.getDev stdenv.cc.libc}/include" 337 + "INSTALL=boot-install" 338 + ]; 339 + 340 + preIncludes = '' 341 + mkdir -p $out/{0,1}-include 342 + cp --no-preserve=mode -r cross-build/include/common/* $out/0-include 343 + '' + lib.optionalString stdenv.hostPlatform.isLinux '' 344 + cp --no-preserve=mode -r cross-build/include/linux/* $out/1-include 345 + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' 346 + cp --no-preserve=mode -r cross-build/include/darwin/* $out/1-include 347 + ''; 348 + }; 349 + 350 + libnetbsd = mkDerivation { 351 + path = "lib/libnetbsd"; 352 + nativeBuildInputs = with buildPackages.freebsd; [ 353 + bsdSetupHook freebsdSetupHook 354 + makeMinimal mandoc groff 355 + (if stdenv.hostPlatform == stdenv.buildPlatform 356 + then boot-install 357 + else install) 358 + ]; 359 + patches = lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ 360 + ./libnetbsd-do-install.patch 361 + #./libnetbsd-define-__va_list.patch 362 + ]; 363 + makeFlags = [ 364 + "STRIP=-s" # flag to install, not command 365 + "MK_WERROR=no" 366 + ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "INSTALL=boot-install"; 367 + buildInputs = with self; compatIfNeeded; 368 + }; 369 + 370 + # HACK: to ensure parent directories exist. This emulates GNU 371 + # install’s -D option. No alternative seems to exist in BSD install. 372 + install = let binstall = writeShellScript "binstall" (install-wrapper + '' 373 + 374 + @out@/bin/xinstall "''${args[@]}" 375 + ''); in mkDerivation { 376 + path = "usr.bin/xinstall"; 377 + extraPaths = with self; [ mtree.path ]; 378 + nativeBuildInputs = with buildPackages.freebsd; [ 379 + bsdSetupHook freebsdSetupHook 380 + makeMinimal mandoc groff 381 + (if stdenv.hostPlatform == stdenv.buildPlatform 382 + then boot-install 383 + else install) 384 + ]; 385 + skipIncludesPhase = true; 386 + buildInputs = with self; compatIfNeeded ++ [ libmd libnetbsd ]; 387 + makeFlags = [ 388 + "STRIP=-s" # flag to install, not command 389 + "MK_WERROR=no" 390 + "TESTSDIR=${builtins.placeholder "test"}" 391 + ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "INSTALL=boot-install"; 392 + postInstall = '' 393 + install -D -m 0550 ${binstall} $out/bin/binstall 394 + substituteInPlace $out/bin/binstall --subst-var out 395 + mv $out/bin/install $out/bin/xinstall 396 + ln -s ./binstall $out/bin/install 397 + ''; 398 + outputs = [ "out" "man" "test" ]; 399 + }; 400 + 401 + # Don't add this to nativeBuildInputs directly. Use statHook instead. 402 + stat = mkDerivation { 403 + path = "usr.bin/stat"; 404 + nativeBuildInputs = with buildPackages.freebsd; [ 405 + bsdSetupHook freebsdSetupHook 406 + makeMinimal install mandoc groff 407 + ]; 408 + }; 409 + 410 + # stat isn't in POSIX, and NetBSD stat supports a completely 411 + # different range of flags than GNU stat, so including it in PATH 412 + # breaks stdenv. Work around that with a hook that will point 413 + # NetBSD's build system and NetBSD stat without including it in 414 + # PATH. 415 + statHook = makeSetupHook { 416 + name = "netbsd-stat-hook"; 417 + } (writeText "netbsd-stat-hook-impl" '' 418 + makeFlagsArray+=(TOOL_STAT=${self.stat}/bin/stat) 419 + ''); 420 + 421 + tsort = mkDerivation { 422 + path = "usr.bin/tsort"; 423 + nativeBuildInputs = with buildPackages.freebsd; [ 424 + bsdSetupHook freebsdSetupHook 425 + makeMinimal install mandoc groff 426 + ]; 427 + }; 428 + 429 + lorder = mkDerivation rec { 430 + path = "usr.bin/lorder"; 431 + noCC = true; 432 + dontBuild = true; 433 + installPhase = '' 434 + mkdir -p "$out/bin" "$man/share/man" 435 + mv "lorder.sh" "$out/bin/lorder" 436 + chmod +x "$out/bin/lorder" 437 + mv "lorder.1" "$man/share/man" 438 + ''; 439 + nativeBuildInputs = [ bsdSetupHook freebsdSetupHook ]; 440 + buildInputs = []; 441 + outputs = [ "out" "man" ]; 442 + }; 443 + 444 + ## 445 + ## END BOOTSTRAPPING 446 + ## 447 + 448 + ## 449 + ## START COMMAND LINE TOOLS 450 + ## 451 + make = mkDerivation { 452 + path = "contrib/bmake"; 453 + version = "9.2"; 454 + postPatch = '' 455 + # make needs this to pick up our sys make files 456 + export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\"" 457 + 458 + '' + lib.optionalString stdenv.isDarwin '' 459 + substituteInPlace $BSDSRCDIR/share/mk/bsd.sys.mk \ 460 + --replace '-Wl,--fatal-warnings' "" \ 461 + --replace '-Wl,--warn-shared-textrel' "" 462 + ''; 463 + postInstall = '' 464 + make -C $BSDSRCDIR/share/mk FILESDIR=$out/share/mk install 465 + ''; 466 + extraPaths = [ "share/mk" ] 467 + ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "tools/build/mk"; 468 + }; 469 + mtree = mkDerivation { 470 + path = "contrib/mtree"; 471 + extraPaths = with self; [ mknod.path ]; 472 + }; 473 + 474 + mknod = mkDerivation { 475 + path = "sbin/mknod"; 476 + }; 477 + 478 + rpcgen = mkDerivation rec { 479 + path = "usr.bin/rpcgen"; 480 + patches = lib.optionals (stdenv.hostPlatform.libc == "glibc") [ 481 + # `WUNTRACED` is defined privately `bits/waitflags.h` in glibc. 482 + # But instead of having a regular header guard, it has some silly 483 + # non-modular logic. `stdlib.h` will include it if `sys/wait.h` 484 + # hasn't yet been included (for it would first), and vice versa. 485 + # 486 + # The problem is that with the FreeBSD compat headers, one of 487 + # those headers ends up included other headers...which ends up 488 + # including the other one, this means by the first time we reach 489 + # `#include `<bits/waitflags.h>`, both `_SYS_WAIT_H` and 490 + # `_STDLIB_H` are already defined! Thus, we never ned up including 491 + # `<bits/waitflags.h>` and defining `WUNTRACED`. 492 + # 493 + # This hacks around this by manually including `WUNTRACED` until 494 + # the problem is fixed properly in glibc. 495 + ./rpcgen-glibc-hack.patch 496 + ]; 497 + }; 498 + 499 + gencat = mkDerivation { 500 + path = "usr.bin/gencat"; 501 + }; 502 + 503 + file2c = mkDerivation { 504 + path = "usr.bin/file2c"; 505 + MK_TESTS = "no"; 506 + }; 507 + 508 + libnv = mkDerivation { 509 + path = "lib/libnv"; 510 + extraPaths = [ 511 + "sys/contrib/libnv" 512 + "sys/sys" 513 + ]; 514 + MK_TESTS = "no"; 515 + }; 516 + 517 + libsbuf = mkDerivation { 518 + path = "lib/libsbuf"; 519 + extraPaths = [ 520 + "sys/kern" 521 + ]; 522 + MK_TESTS = "no"; 523 + }; 524 + 525 + libelf = mkDerivation { 526 + path = "lib/libelf"; 527 + extraPaths = [ 528 + "contrib/elftoolchain/libelf" 529 + "contrib/elftoolchain/common" 530 + "sys/sys/elf32.h" 531 + "sys/sys/elf64.h" 532 + "sys/sys/elf_common.h" 533 + ]; 534 + BOOTSTRAPPING = !stdenv.isFreeBSD; 535 + nativeBuildInputs = with buildPackages.freebsd; [ 536 + bsdSetupHook freebsdSetupHook 537 + makeMinimal install mandoc groff 538 + 539 + m4 540 + ]; 541 + MK_TESTS = "no"; 542 + }; 543 + 544 + libdwarf = mkDerivation { 545 + path = "lib/libdwarf"; 546 + extraPaths = [ 547 + "contrib/elftoolchain/libdwarf" 548 + "contrib/elftoolchain/common" 549 + "sys/sys/elf32.h" 550 + "sys/sys/elf64.h" 551 + "sys/sys/elf_common.h" 552 + ]; 553 + nativeBuildInputs = with buildPackages.freebsd; [ 554 + bsdSetupHook freebsdSetupHook 555 + makeMinimal install mandoc groff 556 + 557 + m4 558 + ]; 559 + buildInputs = with self; compatIfNeeded ++ [ 560 + libelf 561 + ]; 562 + MK_TESTS = "no"; 563 + }; 564 + 565 + uudecode = mkDerivation { 566 + path = "usr.bin/uudecode"; 567 + MK_TESTS = "no"; 568 + }; 569 + 570 + config = mkDerivation { 571 + path = "usr.sbin/config"; 572 + nativeBuildInputs = with buildPackages.freebsd; [ 573 + bsdSetupHook freebsdSetupHook 574 + makeMinimal install mandoc groff 575 + 576 + flex byacc file2c 577 + ]; 578 + buildInputs = with self; compatIfNeeded ++ [ libnv libsbuf ]; 579 + }; 580 + ## 581 + ## END COMMAND LINE TOOLS 582 + ## 583 + 584 + ## 585 + ## START HEADERS 586 + ## 587 + include = mkDerivation { 588 + path = "include"; 589 + 590 + extraPaths = [ 591 + "contrib/libc-vis" 592 + "etc/mtree/BSD.include.dist" 593 + "sys" 594 + ]; 595 + 596 + nativeBuildInputs = with buildPackages.freebsd; [ 597 + bsdSetupHook freebsdSetupHook 598 + makeMinimal 599 + install 600 + mandoc groff rsync /*nbperf*/ rpcgen 601 + 602 + # HACK use NetBSD's for now 603 + buildPackages.netbsd.mtree 604 + ]; 605 + 606 + patches = [ 607 + ./no-perms-BSD.include.dist.patch 608 + ]; 609 + 610 + # The makefiles define INCSDIR per subdirectory, so we have to set 611 + # something else on the command line so those definitions aren't 612 + # overridden. 613 + postPatch = '' 614 + find "$BSDSRCDIR" -name Makefile -exec \ 615 + sed -i -E \ 616 + -e 's_/usr/include_''${INCSDIR0}_' \ 617 + {} \; 618 + ''; 619 + 620 + makeFlags = [ 621 + "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" 622 + ]; 623 + 624 + # multiple header dirs, see above 625 + postConfigure = '' 626 + makeFlags=''${makeFlags/INCSDIR/INCSDIR0} 627 + ''; 628 + 629 + headersOnly = true; 630 + 631 + MK_HESIOD = "yes"; 632 + 633 + meta.platforms = lib.platforms.freebsd; 634 + }; 635 + 636 + ## 637 + ## END HEADERS 638 + ## 639 + 640 + csu = mkDerivation { 641 + path = "lib/csu"; 642 + extraPaths = with self; [ 643 + "lib/Makefile.inc" 644 + "lib/libc/include/libc_private.h" 645 + ]; 646 + nativeBuildInputs = with buildPackages.freebsd; [ 647 + bsdSetupHook freebsdSetupHook 648 + makeMinimal 649 + install 650 + 651 + flex byacc gencat 652 + ]; 653 + buildInputs = with self; [ include ]; 654 + MK_TESTS = "no"; 655 + meta.platforms = lib.platforms.freebsd; 656 + }; 657 + 658 + libc = mkDerivation rec { 659 + pname = "libc"; 660 + path = "lib/libc"; 661 + extraPaths = [ 662 + "etc/group" 663 + "etc/master.passwd" 664 + "etc/shells" 665 + "lib/libmd" 666 + "lib/libutil" 667 + "lib/msun" 668 + "sys/kern" 669 + "sys/libkern" 670 + "sys/sys" 671 + "sys/crypto/chacha20" 672 + "include/rpcsvc" 673 + "contrib/jemalloc" 674 + "contrib/gdtoa" 675 + "contrib/libc-pwcache" 676 + "contrib/libc-vis" 677 + "contrib/tzcode/stdtime" 678 + 679 + # libthr 680 + "lib/libthr" 681 + "lib/libthread_db" 682 + "libexec/rtld-elf" 683 + 684 + # librpcsvc 685 + "lib/librpcsvc" 686 + 687 + # librt 688 + "lib/librt" 689 + 690 + # libcrypt 691 + "lib/libcrypt" 692 + "lib/libmd" 693 + "sys/crypto/sha2" 694 + ]; 695 + 696 + patches = [ 697 + # Hack around broken propogating MAKEFLAGS to submake, just inline logic 698 + ./libc-msun-arch-subdir.patch 699 + 700 + # Don't force -lcompiler-rt, we don't actually call it that 701 + ./libc-no-force--lcompiler-rt.patch 702 + 703 + # Fix extra include dir to get rpcsvc headers. 704 + ./librpcsvc-include-subdir.patch 705 + ]; 706 + 707 + postPatch = '' 708 + substituteInPlace $COMPONENT_PATH/Makefile --replace '.include <src.opts.mk>' "" 709 + ''; 710 + 711 + nativeBuildInputs = with buildPackages.freebsd; [ 712 + bsdSetupHook freebsdSetupHook 713 + makeMinimal 714 + install 715 + 716 + flex byacc gencat rpcgen 717 + ]; 718 + buildInputs = with self; [ include csu ]; 719 + NIX_CFLAGS_COMPILE = "-B${self.csu}/lib"; 720 + 721 + makeFlags = [ 722 + "STRIP=-s" # flag to install, not command 723 + # lib/libc/gen/getgrent.c has sketchy cast from `void *` to enum 724 + "MK_WERROR=no" 725 + ]; 726 + 727 + MK_SYMVER = "yes"; 728 + MK_SSP = "yes"; 729 + MK_NLS = "yes"; 730 + MK_ICONV = "no"; # TODO make srctop 731 + MK_NS_CACHING = "yes"; 732 + MK_INET6_SUPPORT = "yes"; 733 + MK_HESIOD = "yes"; 734 + MK_NIS = "yes"; 735 + MK_HYPERV = "yes"; 736 + MK_FP_LIBC = "yes"; 737 + 738 + MK_TCSH = "no"; 739 + MK_MALLOC_PRODUCTION = "yes"; 740 + 741 + MK_TESTS = "no"; 742 + 743 + postInstall = '' 744 + pushd ${self.include} 745 + find . -type d -exec mkdir -p $out/\{} \; 746 + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; 747 + popd 748 + 749 + pushd ${self.csu} 750 + find . -type d -exec mkdir -p $out/\{} \; 751 + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; 752 + popd 753 + 754 + sed -i -e 's| [^ ]*/libc_nonshared.a||' $out/lib/libc.so 755 + 756 + $CC -nodefaultlibs -lgcc -shared -o $out/lib/libgcc_s.so 757 + 758 + NIX_CFLAGS_COMPILE+=" -B$out/lib" 759 + NIX_CFLAGS_COMPILE+=" -I$out/include" 760 + NIX_LDFLAGS+=" -L$out/lib" 761 + 762 + make -C $BSDSRCDIR/lib/libthr $makeFlags 763 + make -C $BSDSRCDIR/lib/libthr $makeFlags install 764 + 765 + make -C $BSDSRCDIR/lib/msun $makeFlags 766 + make -C $BSDSRCDIR/lib/msun $makeFlags install 767 + 768 + make -C $BSDSRCDIR/lib/librpcsvc $makeFlags 769 + make -C $BSDSRCDIR/lib/librpcsvc $makeFlags install 770 + 771 + make -C $BSDSRCDIR/lib/libutil $makeFlags 772 + make -C $BSDSRCDIR/lib/libutil $makeFlags install 773 + 774 + make -C $BSDSRCDIR/lib/librt $makeFlags 775 + make -C $BSDSRCDIR/lib/librt $makeFlags install 776 + 777 + make -C $BSDSRCDIR/lib/libcrypt $makeFlags 778 + make -C $BSDSRCDIR/lib/libcrypt $makeFlags install 779 + ''; 780 + 781 + meta.platforms = lib.platforms.freebsd; 782 + }; 783 + 784 + ## 785 + ## Kernel 786 + ## 787 + 788 + libspl = mkDerivation { 789 + path = "cddl/lib/libspl"; 790 + extraPaths = [ 791 + "sys/contrib/openzfs/lib/libspl" 792 + "sys/contrib/openzfs/include" 793 + 794 + "cddl/compat/opensolaris/include" 795 + "sys/contrib/openzfs/module/icp/include" 796 + "sys/modules/zfs" 797 + ]; 798 + # nativeBuildInputs = with buildPackages.freebsd; [ 799 + # bsdSetupHook freebsdSetupHook 800 + # makeMinimal install mandoc groff 801 + 802 + # flex byacc file2c 803 + # ]; 804 + # buildInputs = with self; compatIfNeeded ++ [ libnv libsbuf ]; 805 + meta.license = lib.licenses.cddl; 806 + }; 807 + 808 + ctfconvert = mkDerivation { 809 + path = "cddl/usr.bin/ctfconvert"; 810 + extraPaths = [ 811 + "cddl/compat/opensolaris" 812 + "cddl/contrib/opensolaris" 813 + "sys/cddl/compat/opensolaris" 814 + "sys/cddl/contrib/opensolaris" 815 + "sys/contrib/openzfs" 816 + ]; 817 + OPENSOLARIS_USR_DISTDIR = "$(SRCTOP)/cddl/contrib/opensolaris"; 818 + OPENSOLARIS_SYS_DISTDIR = "$(SRCTOP)/sys/cddl/contrib/opensolaris"; 819 + nativeBuildInputs = with buildPackages.freebsd; [ 820 + bsdSetupHook freebsdSetupHook 821 + makeMinimal install mandoc groff 822 + 823 + # flex byacc file2c 824 + ]; 825 + buildInputs = with self; compatIfNeeded ++ [ 826 + libelf libdwarf zlib libspl 827 + ]; 828 + meta.license = lib.licenses.cddl; 829 + }; 830 + 831 + xargs-j = substituteAll { 832 + name = "xargs-j"; 833 + shell = runtimeShell; 834 + src = ../xargs-j.sh; 835 + dir = "bin"; 836 + isExecutable = true; 837 + }; 838 + 839 + sys = mkDerivation (let 840 + cfg = "MINIMAL"; 841 + in rec { 842 + path = "sys"; 843 + 844 + nativeBuildInputs = with buildPackages.freebsd; [ 845 + bsdSetupHook freebsdSetupHook 846 + makeMinimal install mandoc groff 847 + 848 + config rpcgen file2c gawk uudecode xargs-j 849 + #ctfconvert 850 + ]; 851 + 852 + patches = [ 853 + ./sys-gnu-date.patch 854 + ./sys-no-explicit-intrinsics-dep.patch 855 + ]; 856 + 857 + # --dynamic-linker /red/herring is used when building the kernel. 858 + NIX_ENFORCE_PURITY = 0; 859 + 860 + AWK = "${buildPackages.gawk}/bin/awk"; 861 + 862 + CWARNEXTRA = "-Wno-error=shift-negative-value -Wno-address-of-packed-member"; 863 + 864 + MK_CTF = "no"; 865 + 866 + KODIR = "${builtins.placeholder "out"}/kernel"; 867 + KMODDIR = "${builtins.placeholder "out"}/kernel"; 868 + DTBDIR = "${builtins.placeholder"out"}/dbt"; 869 + 870 + KERN_DEBUGDIR = "${builtins.placeholder "out"}/debug"; 871 + KERN_DEBUGDIR_KODIR = "${KERN_DEBUGDIR}/kernel"; 872 + KERN_DEBUGDIR_KMODDIR = "${KERN_DEBUGDIR}/kernel"; 873 + 874 + skipIncludesPhase = true; 875 + 876 + configurePhase = '' 877 + runHook preConfigure 878 + 879 + for f in conf/kmod.mk contrib/dev/acpica/acpica_prep.sh; do 880 + substituteInPlace "$f" --replace 'xargs -J' 'xargs-j ' 881 + done 882 + 883 + for f in conf/*.mk; do 884 + substituteInPlace "$f" --replace 'KERN_DEBUGDIR}''${' 'KERN_DEBUGDIR_' 885 + done 886 + 887 + cd ${mkBsdArch stdenv}/conf 888 + sed -i ${cfg} \ 889 + -e 's/WITH_CTF=1/WITH_CTF=0/' \ 890 + -e '/KDTRACE/d' 891 + config ${cfg} 892 + 893 + runHook postConfigure 894 + ''; 895 + preBuild = '' 896 + cd ../compile/${cfg} 897 + ''; 898 + }); 899 + 900 + })
+11
pkgs/os-specific/bsd/freebsd/libc-msun-arch-subdir.patch
··· 1 + --- a/lib/libc/Makefile 2 + +++ b/lib/libc/Makefile 3 + @@ -194,7 +194,7 @@ SUBDIR.${MK_TESTS}+= tests 4 + # recording a build dependency 5 + CFLAGS+= -I${SRCTOP}/lib/libutil 6 + # Same issue with libm 7 + -MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR 8 + +MSUN_ARCH_SUBDIR = ${MACHINE_CPUARCH:S/i386/i387/} 9 + # unfortunately msun/src contains both private and public headers 10 + CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR} 11 + .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+10
pkgs/os-specific/bsd/freebsd/libc-no-force--lcompiler-rt.patch
··· 1 + --- a/lib/libc/Makefile 2 + +++ b/lib/libc/Makefile 3 + @@ -58,7 +58,6 @@ CFLAGS+=${CANCELPOINTS_CFLAGS} 4 + # Link with static libcompiler_rt.a. 5 + # 6 + LDFLAGS+= -nodefaultlibs 7 + -LIBADD+= compiler_rt 8 + 9 + .if ${MK_SSP} != "no" && \ 10 + (${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
+32
pkgs/os-specific/bsd/freebsd/libnetbsd-do-install.patch
··· 1 + diff --git a/Makefile b/Makefile 2 + index 22710f3d933..22effc848cf 100644 3 + --- a/lib/libnetbsd/Makefile 4 + +++ b/lib/libnetbsd/Makefile 5 + @@ -9,6 +9,26 @@ CFLAGS+= -I${.CURDIR} 6 + 7 + SRCS+= efun.c sockaddr_snprintf.c strsuftoll.c util.c util.h 8 + 9 + -INTERNALLIB= 10 + +INCSGROUPS= INCS SYSINCS NETINETINCS 11 + + 12 + +INCS+= \ 13 + + glob.h \ 14 + + pthread.h \ 15 + + rmd160.h \ 16 + + sha1.h \ 17 + + sha2.h \ 18 + + stdlib.h \ 19 + + util.h 20 + + 21 + +SYSINCSDIR= ${INCLUDEDIR}/sys 22 + +SYSINCS+= \ 23 + + sys/cdefs.h \ 24 + + sys/event.h \ 25 + + sys/types.h \ 26 + + sys/wait.h 27 + + 28 + +NETINETINCSDIR= ${INCLUDEDIR}/netinet 29 + +NETINETINCS+= \ 30 + + netinet/in.h 31 + 32 + .include <bsd.lib.mk>
+11
pkgs/os-specific/bsd/freebsd/librpcsvc-include-subdir.patch
··· 1 + --- a/lib/librpcsvc/Makefile 2 + +++ b/lib/librpcsvc/Makefile 3 + @@ -20,7 +20,7 @@ OTHERSRCS+= yp_passwd.c yp_update.c 4 + 5 + RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C 6 + 7 + -INCDIRS= -I${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc 8 + +INCDIRS= -I${INCLUDEDIR}/rpcsvc 9 + 10 + CFLAGS+= -DYP ${INCDIRS} 11 +
+11
pkgs/os-specific/bsd/freebsd/no-perms-BSD.include.dist.patch
··· 1 + --- a/etc/mtree/BSD.include.dist 2 + +++ b/etc/mtree/BSD.include.dist 3 + @@ -3,7 +3,7 @@ 4 + # Please see the file src/etc/mtree/README before making changes to this file. 5 + # 6 + 7 + -/set type=dir uname=root gname=wheel mode=0755 8 + +/set type=dir 9 + . 10 + arpa 11 + ..
+15
pkgs/os-specific/bsd/freebsd/rpcgen-glibc-hack.patch
··· 1 + --- a/usr.bin/rpcgen/rpc_scan.c 2 + +++ b/usr.bin/rpcgen/rpc_scan.c 3 + @@ -43,8 +43,12 @@ __FBSDID("$FreeBSD$"); 4 + */ 5 + 6 + #include <sys/types.h> 7 + 8 + +// glibc + compat is broken from silly indirect header guard 9 + +#define _SYS_WAIT_H 10 + +# include <bits/waitflags.h> 11 + +#undef _SYS_WAIT_H 12 + #include <sys/wait.h> 13 + #include <stdio.h> 14 + #include <ctype.h> 15 + #include <string.h>
+12
pkgs/os-specific/bsd/freebsd/setup-hook.sh
··· 1 + setFreeBSDSrcTop() { 2 + makeFlags="SRCTOP=$BSDSRCDIR $makeFlags" 3 + } 4 + 5 + addFreeBSDMakeFlags() { 6 + makeFlags="SBINDIR=${!outputBin}/bin $makeFlags" 7 + makeFlags="LIBEXECDIR=${!outputLib}/libexec $makeFlags" 8 + makeFlags="INCLUDEDIR=${!outputDev}/include $makeFlags" 9 + } 10 + 11 + postUnpackHooks+=(setFreeBSDSrcTop) 12 + preConfigureHooks+=(addFreeBSDMakeFlags)
+13
pkgs/os-specific/bsd/freebsd/sys-gnu-date.patch
··· 1 + diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh 2 + index c594724d814..d5287c7b992 100644 3 + --- a/sys/conf/newvers.sh 4 + +++ b/sys/conf/newvers.sh 5 + @@ -177,7 +177,7 @@ u=${USER:-root} 6 + d=$(pwd) 7 + h=${HOSTNAME:-$(hostname)} 8 + if [ -n "$SOURCE_DATE_EPOCH" ]; then 9 + - if ! t=$(date -r $SOURCE_DATE_EPOCH 2>/dev/null); then 10 + + if ! t=$(date -d @$SOURCE_DATE_EPOCH 2>/dev/null); then 11 + echo "Invalid SOURCE_DATE_EPOCH" >&2 12 + exit 1 13 + fi
+45
pkgs/os-specific/bsd/freebsd/sys-no-explicit-intrinsics-dep.patch
··· 1 + diff --git a/sys/modules/aesni/Makefile b/sys/modules/aesni/Makefile 2 + index cb8c744adde..1c327331890 100644 3 + --- a/sys/modules/aesni/Makefile 4 + +++ b/sys/modules/aesni/Makefile 5 + @@ -1,7 +1,6 @@ 6 + # $FreeBSD$ 7 + 8 + .PATH: ${SRCTOP}/sys/crypto/aesni 9 + -.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers 10 + 11 + KMOD= aesni 12 + SRCS= aesni.c 13 + @@ -40,8 +39,8 @@ intel_sha256.o: intel_sha256.c 14 + aesni_ghash.o: aesni.h 15 + aesni_wrap.o: aesni.h 16 + aesni_ccm.o: aesni.h 17 + -intel_sha1.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h 18 + -intel_sha256.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h 19 + +intel_sha1.o: sha_sse.h 20 + +intel_sha256.o: sha_sse.h 21 + 22 + .include <bsd.kmod.mk> 23 + 24 + diff --git a/sys/modules/blake2/Makefile b/sys/modules/blake2/Makefile 25 + index e4b3fb9f126..5bfd9c2ae02 100644 26 + --- a/sys/modules/blake2/Makefile 27 + +++ b/sys/modules/blake2/Makefile 28 + @@ -3,7 +3,6 @@ 29 + .PATH: ${SRCTOP}/sys/contrib/libb2 30 + .PATH: ${SRCTOP}/sys/crypto/blake2 31 + .PATH: ${SRCTOP}/sys/opencrypto 32 + -.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers 33 + 34 + KMOD = blake2 35 + 36 + @@ -64,8 +63,7 @@ ${src:S/.c/.o/}: ${src} 37 + -D_MM_MALLOC_H_INCLUDED -Wno-unused-function ${.IMPSRC} 38 + ${CTFCONVERT_CMD} 39 + 40 + -${src:S/.c/.o/}: intrin.h emmintrin.h tmmintrin.h smmintrin.h immintrin.h \ 41 + - x86intrin.h ${SRCS:M*.h} 42 + +${src:S/.c/.o/}: ${SRCS:M*.h} 43 + .endfor 44 + 45 + # FreeBSD-specific sources:
+17
pkgs/os-specific/bsd/xargs-j.sh
··· 1 + #! @shell@ 2 + 3 + declare -a args=() 4 + 5 + token=$1 6 + shift 7 + 8 + while (( $# )); do 9 + if [[ "$1" = "$token" ]]; then 10 + mapfile -t -O $(("${#args[@]}" + 1)) args 11 + else 12 + args+=("$1") 13 + fi 14 + shift 15 + done 16 + 17 + exec "${args[@]}"
+7 -1
pkgs/top-level/all-packages.nix
··· 14638 14638 # assumption is that or any later version is good. 14639 14639 choose = platform: 14640 14640 /**/ if platform.isDarwin then 11 14641 - else if platform.isFreeBSD then 7 14641 + else if platform.isFreeBSD then 12 14642 14642 else if platform.isAndroid then 12 14643 14643 else if platform.system == "armv6l-linux" then 7 # This fixes armv6 cross-compilation 14644 14644 else if platform.isLinux then 11 ··· 19131 19131 if stdenv.targetPlatform.useiOSPrebuilt 19132 19132 then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries 19133 19133 else targetPackages.darwin.LibsystemCross or (throw "don't yet have a `targetPackages.darwin.LibsystemCross for ${stdenv.targetPlatform.config}`") 19134 + else if name == "fblibc" then targetPackages.freebsdCross.libc or freebsdCross.libc 19134 19135 else if name == "nblibc" then targetPackages.netbsdCross.libc or netbsdCross.libc 19135 19136 else if name == "wasilibc" then targetPackages.wasilibc or wasilibc 19136 19137 else if name == "relibc" then targetPackages.relibc or relibc ··· 37855 37856 bsdSetupHook = makeSetupHook { 37856 37857 name = "bsd-setup-hook"; 37857 37858 } ../os-specific/bsd/setup-hook.sh; 37859 + 37860 + freebsd = callPackage ../os-specific/bsd/freebsd {}; 37861 + freebsdCross = callPackage ../os-specific/bsd/freebsd { 37862 + stdenv = crossLibcStdenv; 37863 + }; 37858 37864 37859 37865 netbsd = callPackage ../os-specific/bsd/netbsd {}; 37860 37866 netbsdCross = callPackage ../os-specific/bsd/netbsd {