From f172d86a4e1bd84e6d2f4de3bceba36f58095484 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 31 Oct 2022 08:35:09 -0400 Subject: [PATCH 01/17] lib/systems: Simplify NetBSD examples The libc will be inferred. --- lib/systems/examples.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 0d9f67037764..61a67072a851 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -305,13 +305,11 @@ rec { x86_64-netbsd = { config = "x86_64-unknown-netbsd"; - libc = "nblibc"; }; # this is broken and never worked fully x86_64-netbsd-llvm = { config = "x86_64-unknown-netbsd"; - libc = "nblibc"; useLLVM = true; }; From 66aa02f190d17b4e7c4bf0f7f891984647a38234 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 31 Oct 2022 08:35:51 -0400 Subject: [PATCH 02/17] lib/systems: Support FreeBSD A tricky thing about FreeBSD is that there is no stable ABI across versions. That means that putting in the version as part of the config string is paramount. We have a parsed represenation that separates name versus version to accomplish this. We include FreeBSD versions 12 and 13 to demonstrate how it works. --- doc/stdenv/meta.chapter.md | 4 ++-- lib/systems/default.nix | 3 ++- lib/systems/doubles.nix | 2 +- lib/systems/examples.nix | 5 +++++ lib/systems/inspect.nix | 2 +- lib/systems/parse.nix | 15 ++++++++++++--- lib/tests/systems.nix | 6 +++--- 7 files changed, 26 insertions(+), 11 deletions(-) diff --git a/doc/stdenv/meta.chapter.md b/doc/stdenv/meta.chapter.md index a83aa0bd90f8..f4d8ed2919dd 100644 --- a/doc/stdenv/meta.chapter.md +++ b/doc/stdenv/meta.chapter.md @@ -44,8 +44,8 @@ $ nix-env -qa hello --json "mips32-linux", "x86_64-darwin", "i686-cygwin", - "i686-freebsd", - "x86_64-freebsd", + "i686-freebsd13", + "x86_64-freebsd13", "i686-openbsd", "x86_64-openbsd" ], diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 233174d40831..24f90b4565ef 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -47,9 +47,10 @@ rec { else if final.isUClibc then "uclibc" else if final.isAndroid then "bionic" else if final.isLinux /* default */ then "glibc" + else if final.isFreeBSD then "fblibc" + else if final.isNetBSD then "nblibc" else if final.isAvr then "avrlibc" else if final.isNone then "newlib" - else if final.isNetBSD then "nblibc" # TODO(@Ericson2314) think more about other operating systems else "native/impure"; # Choose what linker we wish to use by default. Someday we might also diff --git a/lib/systems/doubles.nix b/lib/systems/doubles.nix index 709b67607f7b..23a44d02e85e 100644 --- a/lib/systems/doubles.nix +++ b/lib/systems/doubles.nix @@ -13,7 +13,7 @@ let "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" # FreeBSD - "i686-freebsd" "x86_64-freebsd" + "i686-freebsd13" "x86_64-freebsd13" # Genode "aarch64-genode" "i686-genode" "x86_64-genode" diff --git a/lib/systems/examples.nix b/lib/systems/examples.nix index 61a67072a851..de5adad3ca52 100644 --- a/lib/systems/examples.nix +++ b/lib/systems/examples.nix @@ -303,6 +303,11 @@ rec { # BSDs + x86_64-freebsd = { + config = "x86_64-unknown-freebsd13"; + useLLVM = true; + }; + x86_64-netbsd = { config = "x86_64-unknown-netbsd"; }; diff --git a/lib/systems/inspect.nix b/lib/systems/inspect.nix index ee213438e048..4e0bb8e672e9 100644 --- a/lib/systems/inspect.nix +++ b/lib/systems/inspect.nix @@ -59,7 +59,7 @@ rec { isiOS = { kernel = kernels.ios; }; isLinux = { kernel = kernels.linux; }; isSunOS = { kernel = kernels.solaris; }; - isFreeBSD = { kernel = kernels.freebsd; }; + isFreeBSD = { kernel = { name = "freebsd"; }; }; isNetBSD = { kernel = kernels.netbsd; }; isOpenBSD = { kernel = kernels.openbsd; }; isWindows = { kernel = kernels.windows; }; diff --git a/lib/systems/parse.nix b/lib/systems/parse.nix index ac450534fe1e..d8ba251503a6 100644 --- a/lib/systems/parse.nix +++ b/lib/systems/parse.nix @@ -290,7 +290,11 @@ rec { # the normalized name for macOS. macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; }; ios = { execFormat = macho; families = { inherit darwin; }; }; - freebsd = { execFormat = elf; families = { inherit bsd; }; }; + # A tricky thing about FreeBSD is that there is no stable ABI across + # versions. That means that putting in the version as part of the + # config string is paramount. + freebsd12 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 12; }; + freebsd13 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 13; }; linux = { execFormat = elf; families = { }; }; netbsd = { execFormat = elf; families = { inherit bsd; }; }; none = { execFormat = unknown; families = { }; }; @@ -431,6 +435,8 @@ rec { then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "redox"; } else if (elemAt l 2 == "mmixware") then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = "mmixware"; } + else if hasPrefix "freebsd" (elemAt l 2) + then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } else if hasPrefix "netbsd" (elemAt l 2) then { cpu = elemAt l 0; vendor = elemAt l 1; kernel = elemAt l 2; } else if (elem (elemAt l 2) ["eabi" "eabihf" "elf"]) @@ -485,10 +491,13 @@ rec { mkSystemFromString = s: mkSystemFromSkeleton (mkSkeletonFromList (lib.splitString "-" s)); + kernelName = kernel: + kernel.name + toString (kernel.version or ""); + doubleFromSystem = { cpu, kernel, abi, ... }: /**/ if abi == abis.cygnus then "${cpu.name}-cygwin" else if kernel.families ? darwin then "${cpu.name}-darwin" - else "${cpu.name}-${kernel.name}"; + else "${cpu.name}-${kernelName kernel}"; tripleFromSystem = { cpu, vendor, kernel, abi, ... } @ sys: assert isSystem sys; let optExecFormat = @@ -496,7 +505,7 @@ rec { gnuNetBSDDefaultExecFormat cpu != kernel.execFormat) kernel.execFormat.name; optAbi = lib.optionalString (abi != abis.unknown) "-${abi.name}"; - in "${cpu.name}-${vendor.name}-${kernel.name}${optExecFormat}${optAbi}"; + in "${cpu.name}-${vendor.name}-${kernelName kernel}${optExecFormat}${optAbi}"; ################################################################################ diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix index 4175dc68841e..27c5ff565ca0 100644 --- a/lib/tests/systems.nix +++ b/lib/tests/systems.nix @@ -16,17 +16,17 @@ with lib.systems.doubles; lib.runTests { testall = mseteq all (linux ++ darwin ++ freebsd ++ openbsd ++ netbsd ++ illumos ++ wasi ++ windows ++ embedded ++ mmix ++ js ++ genode ++ redox); testarm = mseteq arm [ "armv5tel-linux" "armv6l-linux" "armv6l-netbsd" "armv6l-none" "armv7a-linux" "armv7a-netbsd" "armv7l-linux" "armv7l-netbsd" "arm-none" "armv7a-darwin" ]; - testi686 = mseteq i686 [ "i686-linux" "i686-freebsd" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; + testi686 = mseteq i686 [ "i686-linux" "i686-freebsd13" "i686-genode" "i686-netbsd" "i686-openbsd" "i686-cygwin" "i686-windows" "i686-none" "i686-darwin" ]; testmips = mseteq mips [ "mips64el-linux" "mipsel-linux" "mipsel-netbsd" ]; testmmix = mseteq mmix [ "mmix-mmixware" ]; testriscv = mseteq riscv [ "riscv32-linux" "riscv64-linux" "riscv32-netbsd" "riscv64-netbsd" "riscv32-none" "riscv64-none" ]; testriscv32 = mseteq riscv32 [ "riscv32-linux" "riscv32-netbsd" "riscv32-none" ]; testriscv64 = mseteq riscv64 [ "riscv64-linux" "riscv64-netbsd" "riscv64-none" ]; - 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" ]; + 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" ]; testcygwin = mseteq cygwin [ "i686-cygwin" "x86_64-cygwin" ]; testdarwin = mseteq darwin [ "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" ]; - testfreebsd = mseteq freebsd [ "i686-freebsd" "x86_64-freebsd" ]; + testfreebsd = mseteq freebsd [ "i686-freebsd13" "x86_64-freebsd13" ]; testgenode = mseteq genode [ "aarch64-genode" "i686-genode" "x86_64-genode" ]; testredox = mseteq redox [ "x86_64-redox" ]; testgnu = mseteq gnu (linux /* ++ kfreebsd ++ ... */); From 0afe9d1f70434c02b1efb84629b75385a57936cf Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 9 Mar 2020 02:10:06 -0400 Subject: [PATCH 03/17] freebsd packages: Init at 13.1 Always set `SRCTOP`, set it with abs path llvmPackages: Bump minimum version for FreeBSD llvmPackages_*, libgcc, compiler_rt: Hack in enough libs that one can compiler C freebsd.compat: Rename some things to work around cc-wrapper change 0bea4a194f7103fcedc0226a74e50657875a7c4d / #191724 in particular --- .../compilers/llvm/10/compiler-rt/default.nix | 6 +- .../development/compilers/llvm/10/default.nix | 2 +- .../compilers/llvm/10/libcxxabi/default.nix | 2 +- .../compilers/llvm/11/compiler-rt/default.nix | 6 +- .../development/compilers/llvm/11/default.nix | 2 +- .../compilers/llvm/11/libcxxabi/default.nix | 2 +- .../compilers/llvm/12/compiler-rt/default.nix | 6 +- .../development/compilers/llvm/12/default.nix | 2 +- .../compilers/llvm/12/libcxxabi/default.nix | 2 +- .../compilers/llvm/13/compiler-rt/default.nix | 6 +- .../development/compilers/llvm/13/default.nix | 2 +- .../compilers/llvm/13/libcxxabi/default.nix | 2 +- .../compilers/llvm/14/compiler-rt/default.nix | 3 + .../development/compilers/llvm/14/default.nix | 2 +- .../compilers/llvm/14/libcxxabi/default.nix | 2 +- .../compilers/llvm/5/compiler-rt/default.nix | 6 +- .../compilers/llvm/5/libcxxabi/default.nix | 2 +- .../compilers/llvm/6/compiler-rt/default.nix | 6 +- .../compilers/llvm/6/libcxxabi/default.nix | 2 +- .../compilers/llvm/7/compiler-rt/default.nix | 6 +- pkgs/development/compilers/llvm/7/default.nix | 2 +- .../compilers/llvm/7/libcxxabi/default.nix | 2 +- .../compilers/llvm/8/compiler-rt/default.nix | 6 +- pkgs/development/compilers/llvm/8/default.nix | 2 +- .../compilers/llvm/8/libcxxabi/default.nix | 2 +- .../compilers/llvm/9/compiler-rt/default.nix | 6 +- pkgs/development/compilers/llvm/9/default.nix | 2 +- .../compilers/llvm/9/libcxxabi/default.nix | 2 +- .../llvm/git/compiler-rt/default.nix | 3 + .../compilers/llvm/git/default.nix | 2 +- .../compilers/llvm/git/libcxxabi/default.nix | 2 +- .../compat-fix-typedefs-locations.patch | 32 + .../bsd/freebsd/compat-install-dirs.patch | 42 + .../bsd/freebsd/compat-setup-hook.sh | 6 + pkgs/os-specific/bsd/freebsd/default.nix | 900 ++++++++++++++++++ .../bsd/freebsd/libc-msun-arch-subdir.patch | 11 + .../freebsd/libc-no-force--lcompiler-rt.patch | 10 + .../bsd/freebsd/libnetbsd-do-install.patch | 32 + .../freebsd/librpcsvc-include-subdir.patch | 11 + .../freebsd/no-perms-BSD.include.dist.patch | 11 + .../bsd/freebsd/rpcgen-glibc-hack.patch | 15 + pkgs/os-specific/bsd/freebsd/setup-hook.sh | 12 + .../bsd/freebsd/sys-gnu-date.patch | 13 + .../sys-no-explicit-intrinsics-dep.patch | 45 + pkgs/os-specific/bsd/xargs-j.sh | 17 + pkgs/top-level/all-packages.nix | 8 +- 46 files changed, 1235 insertions(+), 30 deletions(-) create mode 100644 pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch create mode 100644 pkgs/os-specific/bsd/freebsd/compat-install-dirs.patch create mode 100644 pkgs/os-specific/bsd/freebsd/compat-setup-hook.sh create mode 100644 pkgs/os-specific/bsd/freebsd/default.nix create mode 100644 pkgs/os-specific/bsd/freebsd/libc-msun-arch-subdir.patch create mode 100644 pkgs/os-specific/bsd/freebsd/libc-no-force--lcompiler-rt.patch create mode 100644 pkgs/os-specific/bsd/freebsd/libnetbsd-do-install.patch create mode 100644 pkgs/os-specific/bsd/freebsd/librpcsvc-include-subdir.patch create mode 100644 pkgs/os-specific/bsd/freebsd/no-perms-BSD.include.dist.patch create mode 100644 pkgs/os-specific/bsd/freebsd/rpcgen-glibc-hack.patch create mode 100644 pkgs/os-specific/bsd/freebsd/setup-hook.sh create mode 100644 pkgs/os-specific/bsd/freebsd/sys-gnu-date.patch create mode 100644 pkgs/os-specific/bsd/freebsd/sys-no-explicit-intrinsics-dep.patch create mode 100644 pkgs/os-specific/bsd/xargs-j.sh diff --git a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix index 0302f2ad3092..8530e59d1215 100644 --- a/pkgs/development/compilers/llvm/10/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/10/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -99,6 +101,8 @@ stdenv.mkDerivation { for f in $out/lib/*/*builtins-i?86*; do ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/') done + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/10/default.nix b/pkgs/development/compilers/llvm/10/default.nix index 5cb6c278659d..84af7bcf3d77 100644 --- a/pkgs/development/compilers/llvm/10/default.nix +++ b/pkgs/development/compilers/llvm/10/default.nix @@ -156,7 +156,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix index c61f48485580..b046e627d831 100644 --- a/pkgs/development/compilers/llvm/10/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/10/libcxxabi/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix index e4ba52030ba4..c520eecc7cd7 100644 --- a/pkgs/development/compilers/llvm/11/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/11/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -108,6 +110,8 @@ stdenv.mkDerivation { for f in $out/lib/*/*builtins-i?86*; do ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/') done + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/11/default.nix b/pkgs/development/compilers/llvm/11/default.nix index c3abface37eb..a29df9051e7c 100644 --- a/pkgs/development/compilers/llvm/11/default.nix +++ b/pkgs/development/compilers/llvm/11/default.nix @@ -172,7 +172,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix index 2359820dddec..6b5cf85d1ec3 100644 --- a/pkgs/development/compilers/llvm/11/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/11/libcxxabi/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version , enableShared ? !stdenv.hostPlatform.isStatic , standalone ? stdenv.hostPlatform.useLLVM or false -, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm +, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm }: stdenv.mkDerivation { diff --git a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix index ed34d06ed986..65ea2ffa0fa5 100644 --- a/pkgs/development/compilers/llvm/12/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/12/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -94,6 +96,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 4a2a7ee87894..22c114ab4290 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -163,7 +163,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix index c130a6c1c311..3d9a92d9305d 100644 --- a/pkgs/development/compilers/llvm/12/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/12/libcxxabi/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version , enableShared ? !stdenv.hostPlatform.isStatic , standalone ? stdenv.hostPlatform.useLLVM or false -, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm +, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm }: stdenv.mkDerivation { diff --git a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix index 9124686705ae..10a571d8e2c6 100644 --- a/pkgs/development/compilers/llvm/13/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/13/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }: +{ lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -99,6 +101,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/13/default.nix b/pkgs/development/compilers/llvm/13/default.nix index 874be111ade0..fced8f7d2ae3 100644 --- a/pkgs/development/compilers/llvm/13/default.nix +++ b/pkgs/development/compilers/llvm/13/default.nix @@ -163,7 +163,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix index 5da86b96d5a7..9043c6bff25b 100644 --- a/pkgs/development/compilers/llvm/13/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/13/libcxxabi/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta, cmake, python3, src, cxx-headers, libunwind, version , enableShared ? !stdenv.hostPlatform.isStatic , standalone ? stdenv.hostPlatform.useLLVM or false -, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm +, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm }: stdenv.mkDerivation rec { diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix index ef2495714e45..ef05ecd81143 100644 --- a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, llvm_meta, version , monorepoSrc, runCommand , cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD }: let @@ -110,6 +111,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix index 3a1ba402ef67..7b7e57748879 100644 --- a/pkgs/development/compilers/llvm/14/default.nix +++ b/pkgs/development/compilers/llvm/14/default.nix @@ -166,7 +166,7 @@ let ] ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" ++ lib.optional - (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) + (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; }; diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix index 0487f1d0de83..26f4c4dba8e4 100644 --- a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = [ "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1" diff --git a/pkgs/development/compilers/llvm/5/compiler-rt/default.nix b/pkgs/development/compilers/llvm/5/compiler-rt/default.nix index f6f59bb6d99b..6a9aa416f47b 100644 --- a/pkgs/development/compilers/llvm/5/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/5/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -86,6 +88,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix index f2f707ec445d..925c8947ccf5 100644 --- a/pkgs/development/compilers/llvm/5/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/5/libcxxabi/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin) libunwind; preInstall = lib.optionalString stdenv.isDarwin '' for file in lib/*.dylib; do diff --git a/pkgs/development/compilers/llvm/6/compiler-rt/default.nix b/pkgs/development/compilers/llvm/6/compiler-rt/default.nix index 41442a2f1838..c8841b479d1f 100644 --- a/pkgs/development/compilers/llvm/6/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/6/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -86,6 +88,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix index 63e6eee6f596..3371a8ba1a15 100644 --- a/pkgs/development/compilers/llvm/6/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/6/libcxxabi/default.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin) libunwind; preInstall = lib.optionalString stdenv.isDarwin '' for file in lib/*.dylib; do diff --git a/pkgs/development/compilers/llvm/7/compiler-rt/default.nix b/pkgs/development/compilers/llvm/7/compiler-rt/default.nix index 4937577c7b1b..ff960c89a9c5 100644 --- a/pkgs/development/compilers/llvm/7/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/7/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -89,6 +91,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix index f0908f30775d..cf799d53f53b 100644 --- a/pkgs/development/compilers/llvm/7/default.nix +++ b/pkgs/development/compilers/llvm/7/default.nix @@ -163,7 +163,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix index 721200136a57..8be9690f5f40 100644 --- a/pkgs/development/compilers/llvm/7/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/7/libcxxabi/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version , fetchpatch , standalone ? stdenv.hostPlatform.useLLVM or false -, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm +, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm # on musl the shared objects don't build , enableShared ? !stdenv.hostPlatform.isStatic }: diff --git a/pkgs/development/compilers/llvm/8/compiler-rt/default.nix b/pkgs/development/compilers/llvm/8/compiler-rt/default.nix index 9ff81a32dbc6..209c70f83416 100644 --- a/pkgs/development/compilers/llvm/8/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/8/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -89,6 +91,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/8/default.nix b/pkgs/development/compilers/llvm/8/default.nix index 43050a72b922..d6f272337f9f 100644 --- a/pkgs/development/compilers/llvm/8/default.nix +++ b/pkgs/development/compilers/llvm/8/default.nix @@ -164,7 +164,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix index 5ade8a5ae66f..6b4de0786b98 100644 --- a/pkgs/development/compilers/llvm/8/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/8/libcxxabi/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/9/compiler-rt/default.nix b/pkgs/development/compilers/llvm/9/compiler-rt/default.nix index 7e13b7f6216c..b4e83d3c3014 100644 --- a/pkgs/development/compilers/llvm/9/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/9/compiler-rt/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }: +{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD +}: let @@ -88,6 +90,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/9/default.nix b/pkgs/development/compilers/llvm/9/default.nix index 7efe8486a387..eaa4641ea628 100644 --- a/pkgs/development/compilers/llvm/9/default.nix +++ b/pkgs/development/compilers/llvm/9/default.nix @@ -164,7 +164,7 @@ let echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags '' + lib.optionalString (!stdenv.targetPlatform.isWasm) '' echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags - '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) '' + '' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) '' echo "-lunwind" >> $out/nix-support/cc-ldflags '' + lib.optionalString stdenv.targetPlatform.isWasm '' echo "-fno-exceptions" >> $out/nix-support/cc-cflags diff --git a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix index 4a235f5c2ef7..b7c0c2b0475a 100644 --- a/pkgs/development/compilers/llvm/9/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/9/libcxxabi/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation { ]; nativeBuildInputs = [ cmake ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [ "-DLLVM_ENABLE_LIBCXX=ON" diff --git a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix index 9fabce1895a8..ae4a7f1244ef 100644 --- a/pkgs/development/compilers/llvm/git/compiler-rt/default.nix +++ b/pkgs/development/compilers/llvm/git/compiler-rt/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, llvm_meta, version , monorepoSrc, runCommand , cmake, python3, xcbuild, libllvm, libcxxabi +, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD }: let @@ -106,6 +107,8 @@ stdenv.mkDerivation { ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o + '' + lib.optionalString doFakeLibgcc '' + ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a ''; meta = llvm_meta // { diff --git a/pkgs/development/compilers/llvm/git/default.nix b/pkgs/development/compilers/llvm/git/default.nix index 1bb567df229b..c5567d2f2e2a 100644 --- a/pkgs/development/compilers/llvm/git/default.nix +++ b/pkgs/development/compilers/llvm/git/default.nix @@ -166,7 +166,7 @@ let ] ++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind" ++ lib.optional - (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) + (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) "-lunwind" ++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions"; }; diff --git a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix index b478668ebded..42a811e131b8 100644 --- a/pkgs/development/compilers/llvm/git/libcxxabi/default.nix +++ b/pkgs/development/compilers/llvm/git/libcxxabi/default.nix @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ cmake python3 ]; - buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind; + buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind; cmakeFlags = [ "-DLLVM_ENABLE_RUNTIMES=libcxxabi" diff --git a/pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch b/pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch new file mode 100644 index 000000000000..3336a2504e58 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch @@ -0,0 +1,32 @@ +--- a/tools/build/cross-build/include/common/sys/_types.h ++++ b/tools/build/cross-build/include/common/sys/_types.h +@@ -47,3 +47,6 @@ + * Neither GLibc nor macOS define __va_list but many FreeBSD headers require it. + */ + typedef __builtin_va_list __va_list; ++ ++typedef __UINTPTR_TYPE__ __uintptr_t; ++typedef __INTPTR_TYPE__ __intptr_t; +--- a/tools/build/cross-build/include/common/sys/types.h ++++ b/tools/build/cross-build/include/common/sys/types.h +@@ -49,9 +49,6 @@ + #include + #endif + +-typedef __UINTPTR_TYPE__ __uintptr_t; +-typedef __INTPTR_TYPE__ __intptr_t; +- + /* needed for gencat */ + typedef int __nl_item; + +--- a/tools/build/cross-build/include/linux/sys/types.h ++++ b/tools/build/cross-build/include/linux/sys/types.h +@@ -39,6 +39,8 @@ + + #include_next + ++#include ++ + #ifndef __size_t + typedef __SIZE_TYPE__ __size_t; + #endif diff --git a/pkgs/os-specific/bsd/freebsd/compat-install-dirs.patch b/pkgs/os-specific/bsd/freebsd/compat-install-dirs.patch new file mode 100644 index 000000000000..9bb2bea32ee9 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/compat-install-dirs.patch @@ -0,0 +1,42 @@ +diff --git a/tools/build/Makefile b/tools/build/Makefile +index 948a5f9dfdb..592af84eeae 100644 +--- a/tools/build/Makefile ++++ b/tools/build/Makefile +@@ -327,15 +327,15 @@ host-symlinks: + # and cross-tools stages. We do this here using mkdir since mtree may not exist + # yet (this happens if we are crossbuilding from Linux/Mac). + INSTALLDIR_LIST= \ +- bin \ +- lib/casper \ +- lib/geom \ +- usr/include/casper \ +- usr/include/private/ucl \ +- usr/include/private/zstd \ +- usr/lib \ +- usr/libdata/pkgconfig \ +- usr/libexec ++ ${BINDIR} \ ++ ${LIBDIR}/casper \ ++ ${LIBDIR}/geom \ ++ ${INCLUDEDIR}/casper \ ++ ${INCLUDEDIR}/private/ucl \ ++ ${INCLUDEDIR}/private/zstd \ ++ ${LIBDIR} \ ++ ${LIBDIR}/libdata/pkgconfig \ ++ ${LIBEXECDIR} + + installdirs: + mkdir -p ${INSTALLDIR_LIST:S,^,${DESTDIR}/,} +@@ -352,9 +352,9 @@ installdirs: + rm -rf "${DESTDIR}/${_dir}"; \ + fi + .endfor +- ln -sfn bin ${DESTDIR}/sbin +- ln -sfn ../bin ${DESTDIR}/usr/bin +- ln -sfn ../bin ${DESTDIR}/usr/sbin ++ ln -sfn bin ${DESTDIR}/${SBINDIR} ++ ln -sfn ../bin ${DESTDIR}/${BINDIR} ++ ln -sfn ../bin ${DESTDIR}/${SBINDIR} + .for _group in ${INCSGROUPS:NINCS} + mkdir -p "${DESTDIR}/${${_group}DIR}" + .endfor diff --git a/pkgs/os-specific/bsd/freebsd/compat-setup-hook.sh b/pkgs/os-specific/bsd/freebsd/compat-setup-hook.sh new file mode 100644 index 000000000000..6c3fda4e95ac --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/compat-setup-hook.sh @@ -0,0 +1,6 @@ +# See pkgs/build-support/setup-hooks/role.bash +getHostRole + +export NIX_LDFLAGS${role_post}+=" -legacy" +export NIX_CFLAGS_COMPILE${role_post}+=" -isystem @out@/0-include" +export NIX_CFLAGS_COMPILE${role_post}+=" -isystem @out@/1-include" diff --git a/pkgs/os-specific/bsd/freebsd/default.nix b/pkgs/os-specific/bsd/freebsd/default.nix new file mode 100644 index 000000000000..86c63fc50654 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/default.nix @@ -0,0 +1,900 @@ +{ stdenv, lib, stdenvNoCC +, pkgsBuildBuild, pkgsBuildHost, pkgsBuildTarget, pkgsHostHost, pkgsTargetTarget +, buildPackages, splicePackages, newScope +, bsdSetupHook, makeSetupHook +, fetchgit, fetchurl, coreutils, groff, mandoc, byacc, flex, which, m4, gawk, substituteAll, runtimeShell +, zlib, expat, libmd +, runCommand, writeShellScript, writeText, symlinkJoin +}: + +let + inherit (buildPackages.buildPackages) rsync; + + version = "13.1.0"; + + # `BuildPackages.fetchgit` avoids some probably splicing-caused infinite + # recursion. + freebsdSrc = buildPackages.fetchgit { + url = "https://git.FreeBSD.org/src.git"; + rev = "release/${version}"; + sha256 = "14nhk0kls83xfb64d5xy14vpi6k8laswjycjg80indq9pkcr2rlv"; + }; + + freebsdSetupHook = makeSetupHook { + name = "freebsd-setup-hook"; + } ./setup-hook.sh; + + otherSplices = { + selfBuildBuild = pkgsBuildBuild.freebsd; + selfBuildHost = pkgsBuildHost.freebsd; + selfBuildTarget = pkgsBuildTarget.freebsd; + selfHostHost = pkgsHostHost.freebsd; + selfTargetTarget = pkgsTargetTarget.freebsd or {}; # might be missing + }; + + mkBsdArch = stdenv': { + x86_64 = "amd64"; + aarch64 = "arm64"; + i486 = "i386"; + i586 = "i386"; + i686 = "i386"; + }.${stdenv'.hostPlatform.parsed.cpu.name} + or stdenv'.hostPlatform.parsed.cpu.name; + + install-wrapper = '' + set -eu + + args=() + declare -i path_args=0 + + while (( $# )); do + if (( $# == 1 )); then + if (( path_args > 1)) || [[ "$1" = */ ]]; then + mkdir -p "$1" + else + mkdir -p "$(dirname "$1")" + fi + fi + case $1 in + -C) ;; + -o | -g) shift ;; + -s) ;; + -m | -l) + # handle next arg so not counted as path arg + args+=("$1" "$2") + shift + ;; + -*) args+=("$1") ;; + *) + path_args+=1 + args+=("$1") + ;; + esac + shift + done + ''; + +in lib.makeScopeWithSplicing + splicePackages + newScope + otherSplices + (_: {}) + (_: {}) + (self: let + inherit (self) mkDerivation; + in { + inherit freebsdSrc; + + # Why do we have splicing and yet do `nativeBuildInputs = with self; ...`? + # See note in ../netbsd/default.nix. + + compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isFreeBSD) self.compat; + + mkDerivation = lib.makeOverridable (attrs: let + stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; + in stdenv'.mkDerivation (rec { + pname = "${attrs.pname or (baseNameOf attrs.path)}-freebsd"; + inherit version; + src = runCommand "${pname}-filtered-src" { + nativeBuildInputs = [ rsync ]; + } '' + for p in ${lib.concatStringsSep " " ([ attrs.path ] ++ attrs.extraPaths or [])}; do + set -x + path="$out/$p" + mkdir -p "$(dirname "$path")" + src_path="${freebsdSrc}/$p" + if [[ -d "$src_path" ]]; then src_path+=/; fi + rsync --chmod="+w" -r "$src_path" "$path" + set +x + done + ''; + + extraPaths = [ ]; + + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal + install tsort lorder mandoc groff #statHook + ]; + buildInputs = with self; compatIfNeeded; + + HOST_SH = stdenv'.shell; + + # Since STRIP below is the flag + STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip"; + + makeFlags = [ + "STRIP=-s" # flag to install, not command + ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no"; + + # amd64 not x86_64 for this on unlike NetBSD + MACHINE_ARCH = mkBsdArch stdenv'; + + MACHINE = mkBsdArch stdenv'; + + MACHINE_CPUARCH = MACHINE_ARCH; + + COMPONENT_PATH = attrs.path or null; + + strictDeps = true; + + meta = with lib; { + maintainers = with maintainers; [ ericson2314 ]; + platforms = platforms.unix; + license = licenses.bsd2; + }; + } // lib.optionalAttrs stdenv'.hasCC { + # TODO should CC wrapper set this? + CPP = "${stdenv'.cc.targetPrefix}cpp"; + } // lib.optionalAttrs stdenv'.isDarwin { + MKRELRO = "no"; + } // lib.optionalAttrs (stdenv'.cc.isClang or false) { + HAVE_LLVM = lib.versions.major (lib.getVersion stdenv'.cc.cc); + } // lib.optionalAttrs (stdenv'.cc.isGNU or false) { + HAVE_GCC = lib.versions.major (lib.getVersion stdenv'.cc.cc); + } // lib.optionalAttrs (stdenv'.isx86_32) { + USE_SSP = "no"; + } // lib.optionalAttrs (attrs.headersOnly or false) { + installPhase = "includesPhase"; + dontBuild = true; + } // attrs)); + + ## + ## START BOOTSTRAPPING + ## + makeMinimal = mkDerivation rec { + inherit (self.make) path; + + buildInputs = with self; []; + nativeBuildInputs = with buildPackages.netbsd; [ bsdSetupHook freebsdSetupHook ]; + + skipIncludesPhase = true; + + makeFlags = []; + + postPatch = '' + patchShebangs configure + ${self.make.postPatch} + ''; + + buildPhase = '' + runHook preBuild + + sh ./make-bootstrap.sh + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + install -D bmake "$out/bin/bmake" + ln -s "$out/bin/bmake" "$out/bin/make" + mkdir -p "$out/share" + cp -r "$BSDSRCDIR/share/mk" "$out/share/mk" + find "$out/share/mk" -type f -print0 | + while IFS= read -r -d "" f; do + substituteInPlace "$f" --replace 'usr/' "" + done + substituteInPlace "$out/share/mk/bsd.symver.mk" \ + --replace '/share/mk' "$out/share/mk" + + runHook postInstall + ''; + + postInstall = lib.optionalString (!stdenv.targetPlatform.isFreeBSD) '' + boot_mk="$BSDSRCDIR/tools/build/mk" + cp "$boot_mk"/Makefile.boot* "$out/share/mk" + replaced_mk="$out/share/mk.orig" + mkdir "$replaced_mk" + mv "$out"/share/mk/bsd.{lib,prog}.mk "$replaced_mk" + for m in bsd.{lib,prog}.mk; do + cp "$boot_mk/$m" "$out/share/mk" + substituteInPlace "$out/share/mk/$m" --replace '../../../share/mk' '../mk.orig' + done + ''; + + extraPaths = with self; make.extraPaths; + }; + + # Wrap NetBSD's install + boot-install = buildPackages.writeShellScriptBin "boot-install" (install-wrapper + '' + + ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}" + ''); + + compat = mkDerivation rec { + pname = "compat"; + path = "tools/build"; + extraPaths = [ + "lib/libc/db" + "lib/libc/stdlib" # getopt + "lib/libc/gen" # getcap + "lib/libc/locale" # rpmatch + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ + "lib/libc/string" # strlcpy + "lib/libutil" + ] ++ [ + "contrib/libc-pwcache" + "contrib/libc-vis" + "sys/libkern" + "sys/kern/subr_capability.c" + + # Take only individual headers, or else we will clobber native libc, etc. + + "sys/rpc/types.h" + + # Listed in Makekfile as INC + "include/mpool.h" + "include/ndbm.h" + "include/err.h" + "include/stringlist.h" + "include/a.out.h" + "include/nlist.h" + "include/db.h" + "include/getopt.h" + "include/nl_types.h" + "include/elf.h" + "sys/sys/ctf.h" + + # Listed in Makekfile as SYSINC + + "sys/sys/capsicum.h" + "sys/sys/caprights.h" + "sys/sys/imgact_aout.h" + "sys/sys/nlist_aout.h" + "sys/sys/nv.h" + "sys/sys/dnv.h" + "sys/sys/cnv.h" + + "sys/sys/elf32.h" + "sys/sys/elf64.h" + "sys/sys/elf_common.h" + "sys/sys/elf_generic.h" + "sys/${mkBsdArch stdenv}/include" + ] ++ lib.optionals stdenv.hostPlatform.isx86 [ + "sys/x86/include" + ] ++ [ + + "sys/sys/queue.h" + "sys/sys/md5.h" + "sys/sys/sbuf.h" + "sys/sys/tree.h" + "sys/sys/font.h" + "sys/sys/consio.h" + "sys/sys/fnv_hash.h" + + "sys/crypto/chacha20/_chacha.h" + "sys/crypto/chacha20/chacha.h" + # included too, despite ".c" + "sys/crypto/chacha20/chacha.c" + + "sys/fs" + "sys/ufs" + "sys/sys/disk" + + "lib/libcapsicum" + "lib/libcasper" + ]; + + patches = [ + ./compat-install-dirs.patch + ./compat-fix-typedefs-locations.patch + ]; + + preBuild = '' + NIX_CFLAGS_COMPILE+=' -I../../include -I../../sys' + + cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys + cp ../../sys/${mkBsdArch stdenv}/include/elf.h ../../sys/sys/${mkBsdArch stdenv} + '' + lib.optionalString stdenv.hostPlatform.isx86 '' + cp ../../sys/x86/include/elf.h ../../sys/x86 + ''; + + setupHooks = [ + ../../../build-support/setup-hooks/role.bash + ./compat-setup-hook.sh + ]; + + # This one has an ifdefed `#include_next` that makes it annoying. + postInstall = '' + rm ''${!outputDev}/0-include/libelf.h + ''; + + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal + boot-install + + which + ]; + buildInputs = [ expat zlib ]; + + makeFlags = [ + "STRIP=-s" # flag to install, not command + "MK_WERROR=no" + "HOST_INCLUDE_ROOT=${lib.getDev stdenv.cc.libc}/include" + "INSTALL=boot-install" + ]; + + preIncludes = '' + mkdir -p $out/{0,1}-include + cp --no-preserve=mode -r cross-build/include/common/* $out/0-include + '' + lib.optionalString stdenv.hostPlatform.isLinux '' + cp --no-preserve=mode -r cross-build/include/linux/* $out/1-include + '' + lib.optionalString stdenv.hostPlatform.isDarwin '' + cp --no-preserve=mode -r cross-build/include/darwin/* $out/1-include + ''; + }; + + libnetbsd = mkDerivation { + path = "lib/libnetbsd"; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal mandoc groff + (if stdenv.hostPlatform == stdenv.buildPlatform + then boot-install + else install) + ]; + patches = lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ + ./libnetbsd-do-install.patch + #./libnetbsd-define-__va_list.patch + ]; + makeFlags = [ + "STRIP=-s" # flag to install, not command + "MK_WERROR=no" + ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "INSTALL=boot-install"; + buildInputs = with self; compatIfNeeded; + }; + + # HACK: to ensure parent directories exist. This emulates GNU + # install’s -D option. No alternative seems to exist in BSD install. + install = let binstall = writeShellScript "binstall" (install-wrapper + '' + + @out@/bin/xinstall "''${args[@]}" + ''); in mkDerivation { + path = "usr.bin/xinstall"; + extraPaths = with self; [ mtree.path ]; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal mandoc groff + (if stdenv.hostPlatform == stdenv.buildPlatform + then boot-install + else install) + ]; + skipIncludesPhase = true; + buildInputs = with self; compatIfNeeded ++ [ libmd libnetbsd ]; + makeFlags = [ + "STRIP=-s" # flag to install, not command + "MK_WERROR=no" + "TESTSDIR=${builtins.placeholder "test"}" + ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "INSTALL=boot-install"; + postInstall = '' + install -D -m 0550 ${binstall} $out/bin/binstall + substituteInPlace $out/bin/binstall --subst-var out + mv $out/bin/install $out/bin/xinstall + ln -s ./binstall $out/bin/install + ''; + outputs = [ "out" "man" "test" ]; + }; + + # Don't add this to nativeBuildInputs directly. Use statHook instead. + stat = mkDerivation { + path = "usr.bin/stat"; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + ]; + }; + + # stat isn't in POSIX, and NetBSD stat supports a completely + # different range of flags than GNU stat, so including it in PATH + # breaks stdenv. Work around that with a hook that will point + # NetBSD's build system and NetBSD stat without including it in + # PATH. + statHook = makeSetupHook { + name = "netbsd-stat-hook"; + } (writeText "netbsd-stat-hook-impl" '' + makeFlagsArray+=(TOOL_STAT=${self.stat}/bin/stat) + ''); + + tsort = mkDerivation { + path = "usr.bin/tsort"; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + ]; + }; + + lorder = mkDerivation rec { + path = "usr.bin/lorder"; + noCC = true; + dontBuild = true; + installPhase = '' + mkdir -p "$out/bin" "$man/share/man" + mv "lorder.sh" "$out/bin/lorder" + chmod +x "$out/bin/lorder" + mv "lorder.1" "$man/share/man" + ''; + nativeBuildInputs = [ bsdSetupHook freebsdSetupHook ]; + buildInputs = []; + outputs = [ "out" "man" ]; + }; + + ## + ## END BOOTSTRAPPING + ## + + ## + ## START COMMAND LINE TOOLS + ## + make = mkDerivation { + path = "contrib/bmake"; + version = "9.2"; + postPatch = '' + # make needs this to pick up our sys make files + export NIX_CFLAGS_COMPILE+=" -D_PATH_DEFSYSPATH=\"$out/share/mk\"" + + '' + lib.optionalString stdenv.isDarwin '' + substituteInPlace $BSDSRCDIR/share/mk/bsd.sys.mk \ + --replace '-Wl,--fatal-warnings' "" \ + --replace '-Wl,--warn-shared-textrel' "" + ''; + postInstall = '' + make -C $BSDSRCDIR/share/mk FILESDIR=$out/share/mk install + ''; + extraPaths = [ "share/mk" ] + ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "tools/build/mk"; + }; + mtree = mkDerivation { + path = "contrib/mtree"; + extraPaths = with self; [ mknod.path ]; + }; + + mknod = mkDerivation { + path = "sbin/mknod"; + }; + + rpcgen = mkDerivation rec { + path = "usr.bin/rpcgen"; + patches = lib.optionals (stdenv.hostPlatform.libc == "glibc") [ + # `WUNTRACED` is defined privately `bits/waitflags.h` in glibc. + # But instead of having a regular header guard, it has some silly + # non-modular logic. `stdlib.h` will include it if `sys/wait.h` + # hasn't yet been included (for it would first), and vice versa. + # + # The problem is that with the FreeBSD compat headers, one of + # those headers ends up included other headers...which ends up + # including the other one, this means by the first time we reach + # `#include ``, both `_SYS_WAIT_H` and + # `_STDLIB_H` are already defined! Thus, we never ned up including + # `` and defining `WUNTRACED`. + # + # This hacks around this by manually including `WUNTRACED` until + # the problem is fixed properly in glibc. + ./rpcgen-glibc-hack.patch + ]; + }; + + gencat = mkDerivation { + path = "usr.bin/gencat"; + }; + + file2c = mkDerivation { + path = "usr.bin/file2c"; + MK_TESTS = "no"; + }; + + libnv = mkDerivation { + path = "lib/libnv"; + extraPaths = [ + "sys/contrib/libnv" + "sys/sys" + ]; + MK_TESTS = "no"; + }; + + libsbuf = mkDerivation { + path = "lib/libsbuf"; + extraPaths = [ + "sys/kern" + ]; + MK_TESTS = "no"; + }; + + libelf = mkDerivation { + path = "lib/libelf"; + extraPaths = [ + "contrib/elftoolchain/libelf" + "contrib/elftoolchain/common" + "sys/sys/elf32.h" + "sys/sys/elf64.h" + "sys/sys/elf_common.h" + ]; + BOOTSTRAPPING = !stdenv.isFreeBSD; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + + m4 + ]; + MK_TESTS = "no"; + }; + + libdwarf = mkDerivation { + path = "lib/libdwarf"; + extraPaths = [ + "contrib/elftoolchain/libdwarf" + "contrib/elftoolchain/common" + "sys/sys/elf32.h" + "sys/sys/elf64.h" + "sys/sys/elf_common.h" + ]; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + + m4 + ]; + buildInputs = with self; compatIfNeeded ++ [ + libelf + ]; + MK_TESTS = "no"; + }; + + uudecode = mkDerivation { + path = "usr.bin/uudecode"; + MK_TESTS = "no"; + }; + + config = mkDerivation { + path = "usr.sbin/config"; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + + flex byacc file2c + ]; + buildInputs = with self; compatIfNeeded ++ [ libnv libsbuf ]; + }; + ## + ## END COMMAND LINE TOOLS + ## + + ## + ## START HEADERS + ## + include = mkDerivation { + path = "include"; + + extraPaths = [ + "contrib/libc-vis" + "etc/mtree/BSD.include.dist" + "sys" + ]; + + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal + install + mandoc groff rsync /*nbperf*/ rpcgen + + # HACK use NetBSD's for now + buildPackages.netbsd.mtree + ]; + + patches = [ + ./no-perms-BSD.include.dist.patch + ]; + + # The makefiles define INCSDIR per subdirectory, so we have to set + # something else on the command line so those definitions aren't + # overridden. + postPatch = '' + find "$BSDSRCDIR" -name Makefile -exec \ + sed -i -E \ + -e 's_/usr/include_''${INCSDIR0}_' \ + {} \; + ''; + + makeFlags = [ + "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" + ]; + + # multiple header dirs, see above + postConfigure = '' + makeFlags=''${makeFlags/INCSDIR/INCSDIR0} + ''; + + headersOnly = true; + + MK_HESIOD = "yes"; + + meta.platforms = lib.platforms.freebsd; + }; + + ## + ## END HEADERS + ## + + csu = mkDerivation { + path = "lib/csu"; + extraPaths = with self; [ + "lib/Makefile.inc" + "lib/libc/include/libc_private.h" + ]; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal + install + + flex byacc gencat + ]; + buildInputs = with self; [ include ]; + MK_TESTS = "no"; + meta.platforms = lib.platforms.freebsd; + }; + + libc = mkDerivation rec { + pname = "libc"; + path = "lib/libc"; + extraPaths = [ + "etc/group" + "etc/master.passwd" + "etc/shells" + "lib/libmd" + "lib/libutil" + "lib/msun" + "sys/kern" + "sys/libkern" + "sys/sys" + "sys/crypto/chacha20" + "include/rpcsvc" + "contrib/jemalloc" + "contrib/gdtoa" + "contrib/libc-pwcache" + "contrib/libc-vis" + "contrib/tzcode/stdtime" + + # libthr + "lib/libthr" + "lib/libthread_db" + "libexec/rtld-elf" + + # librpcsvc + "lib/librpcsvc" + + # librt + "lib/librt" + + # libcrypt + "lib/libcrypt" + "lib/libmd" + "sys/crypto/sha2" + ]; + + patches = [ + # Hack around broken propogating MAKEFLAGS to submake, just inline logic + ./libc-msun-arch-subdir.patch + + # Don't force -lcompiler-rt, we don't actually call it that + ./libc-no-force--lcompiler-rt.patch + + # Fix extra include dir to get rpcsvc headers. + ./librpcsvc-include-subdir.patch + ]; + + postPatch = '' + substituteInPlace $COMPONENT_PATH/Makefile --replace '.include ' "" + ''; + + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal + install + + flex byacc gencat rpcgen + ]; + buildInputs = with self; [ include csu ]; + NIX_CFLAGS_COMPILE = "-B${self.csu}/lib"; + + makeFlags = [ + "STRIP=-s" # flag to install, not command + # lib/libc/gen/getgrent.c has sketchy cast from `void *` to enum + "MK_WERROR=no" + ]; + + MK_SYMVER = "yes"; + MK_SSP = "yes"; + MK_NLS = "yes"; + MK_ICONV = "no"; # TODO make srctop + MK_NS_CACHING = "yes"; + MK_INET6_SUPPORT = "yes"; + MK_HESIOD = "yes"; + MK_NIS = "yes"; + MK_HYPERV = "yes"; + MK_FP_LIBC = "yes"; + + MK_TCSH = "no"; + MK_MALLOC_PRODUCTION = "yes"; + + MK_TESTS = "no"; + + postInstall = '' + pushd ${self.include} + find . -type d -exec mkdir -p $out/\{} \; + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; + popd + + pushd ${self.csu} + find . -type d -exec mkdir -p $out/\{} \; + find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \; + popd + + sed -i -e 's| [^ ]*/libc_nonshared.a||' $out/lib/libc.so + + $CC -nodefaultlibs -lgcc -shared -o $out/lib/libgcc_s.so + + NIX_CFLAGS_COMPILE+=" -B$out/lib" + NIX_CFLAGS_COMPILE+=" -I$out/include" + NIX_LDFLAGS+=" -L$out/lib" + + make -C $BSDSRCDIR/lib/libthr $makeFlags + make -C $BSDSRCDIR/lib/libthr $makeFlags install + + make -C $BSDSRCDIR/lib/msun $makeFlags + make -C $BSDSRCDIR/lib/msun $makeFlags install + + make -C $BSDSRCDIR/lib/librpcsvc $makeFlags + make -C $BSDSRCDIR/lib/librpcsvc $makeFlags install + + make -C $BSDSRCDIR/lib/libutil $makeFlags + make -C $BSDSRCDIR/lib/libutil $makeFlags install + + make -C $BSDSRCDIR/lib/librt $makeFlags + make -C $BSDSRCDIR/lib/librt $makeFlags install + + make -C $BSDSRCDIR/lib/libcrypt $makeFlags + make -C $BSDSRCDIR/lib/libcrypt $makeFlags install + ''; + + meta.platforms = lib.platforms.freebsd; + }; + + ## + ## Kernel + ## + + libspl = mkDerivation { + path = "cddl/lib/libspl"; + extraPaths = [ + "sys/contrib/openzfs/lib/libspl" + "sys/contrib/openzfs/include" + + "cddl/compat/opensolaris/include" + "sys/contrib/openzfs/module/icp/include" + "sys/modules/zfs" + ]; + # nativeBuildInputs = with buildPackages.freebsd; [ + # bsdSetupHook freebsdSetupHook + # makeMinimal install mandoc groff + + # flex byacc file2c + # ]; + # buildInputs = with self; compatIfNeeded ++ [ libnv libsbuf ]; + meta.license = lib.licenses.cddl; + }; + + ctfconvert = mkDerivation { + path = "cddl/usr.bin/ctfconvert"; + extraPaths = [ + "cddl/compat/opensolaris" + "cddl/contrib/opensolaris" + "sys/cddl/compat/opensolaris" + "sys/cddl/contrib/opensolaris" + "sys/contrib/openzfs" + ]; + OPENSOLARIS_USR_DISTDIR = "$(SRCTOP)/cddl/contrib/opensolaris"; + OPENSOLARIS_SYS_DISTDIR = "$(SRCTOP)/sys/cddl/contrib/opensolaris"; + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + + # flex byacc file2c + ]; + buildInputs = with self; compatIfNeeded ++ [ + libelf libdwarf zlib libspl + ]; + meta.license = lib.licenses.cddl; + }; + + xargs-j = substituteAll { + name = "xargs-j"; + shell = runtimeShell; + src = ../xargs-j.sh; + dir = "bin"; + isExecutable = true; + }; + + sys = mkDerivation (let + cfg = "MINIMAL"; + in rec { + path = "sys"; + + nativeBuildInputs = with buildPackages.freebsd; [ + bsdSetupHook freebsdSetupHook + makeMinimal install mandoc groff + + config rpcgen file2c gawk uudecode xargs-j + #ctfconvert + ]; + + patches = [ + ./sys-gnu-date.patch + ./sys-no-explicit-intrinsics-dep.patch + ]; + + # --dynamic-linker /red/herring is used when building the kernel. + NIX_ENFORCE_PURITY = 0; + + AWK = "${buildPackages.gawk}/bin/awk"; + + CWARNEXTRA = "-Wno-error=shift-negative-value -Wno-address-of-packed-member"; + + MK_CTF = "no"; + + KODIR = "${builtins.placeholder "out"}/kernel"; + KMODDIR = "${builtins.placeholder "out"}/kernel"; + DTBDIR = "${builtins.placeholder"out"}/dbt"; + + KERN_DEBUGDIR = "${builtins.placeholder "out"}/debug"; + KERN_DEBUGDIR_KODIR = "${KERN_DEBUGDIR}/kernel"; + KERN_DEBUGDIR_KMODDIR = "${KERN_DEBUGDIR}/kernel"; + + skipIncludesPhase = true; + + configurePhase = '' + runHook preConfigure + + for f in conf/kmod.mk contrib/dev/acpica/acpica_prep.sh; do + substituteInPlace "$f" --replace 'xargs -J' 'xargs-j ' + done + + for f in conf/*.mk; do + substituteInPlace "$f" --replace 'KERN_DEBUGDIR}''${' 'KERN_DEBUGDIR_' + done + + cd ${mkBsdArch stdenv}/conf + sed -i ${cfg} \ + -e 's/WITH_CTF=1/WITH_CTF=0/' \ + -e '/KDTRACE/d' + config ${cfg} + + runHook postConfigure + ''; + preBuild = '' + cd ../compile/${cfg} + ''; + }); + +}) diff --git a/pkgs/os-specific/bsd/freebsd/libc-msun-arch-subdir.patch b/pkgs/os-specific/bsd/freebsd/libc-msun-arch-subdir.patch new file mode 100644 index 000000000000..4a69e85a986a --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/libc-msun-arch-subdir.patch @@ -0,0 +1,11 @@ +--- a/lib/libc/Makefile ++++ b/lib/libc/Makefile +@@ -194,7 +194,7 @@ SUBDIR.${MK_TESTS}+= tests + # recording a build dependency + CFLAGS+= -I${SRCTOP}/lib/libutil + # Same issue with libm +-MSUN_ARCH_SUBDIR != ${MAKE} -B -C ${SRCTOP}/lib/msun -V ARCH_SUBDIR ++MSUN_ARCH_SUBDIR = ${MACHINE_CPUARCH:S/i386/i387/} + # unfortunately msun/src contains both private and public headers + CFLAGS+= -I${SRCTOP}/lib/msun/${MSUN_ARCH_SUBDIR} + .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" diff --git a/pkgs/os-specific/bsd/freebsd/libc-no-force--lcompiler-rt.patch b/pkgs/os-specific/bsd/freebsd/libc-no-force--lcompiler-rt.patch new file mode 100644 index 000000000000..60176fb73cf7 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/libc-no-force--lcompiler-rt.patch @@ -0,0 +1,10 @@ +--- a/lib/libc/Makefile ++++ b/lib/libc/Makefile +@@ -58,7 +58,6 @@ CFLAGS+=${CANCELPOINTS_CFLAGS} + # Link with static libcompiler_rt.a. + # + LDFLAGS+= -nodefaultlibs +-LIBADD+= compiler_rt + + .if ${MK_SSP} != "no" && \ + (${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "") diff --git a/pkgs/os-specific/bsd/freebsd/libnetbsd-do-install.patch b/pkgs/os-specific/bsd/freebsd/libnetbsd-do-install.patch new file mode 100644 index 000000000000..a7bd032d2be5 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/libnetbsd-do-install.patch @@ -0,0 +1,32 @@ +diff --git a/Makefile b/Makefile +index 22710f3d933..22effc848cf 100644 +--- a/lib/libnetbsd/Makefile ++++ b/lib/libnetbsd/Makefile +@@ -9,6 +9,26 @@ CFLAGS+= -I${.CURDIR} + + SRCS+= efun.c sockaddr_snprintf.c strsuftoll.c util.c util.h + +-INTERNALLIB= ++INCSGROUPS= INCS SYSINCS NETINETINCS ++ ++INCS+= \ ++ glob.h \ ++ pthread.h \ ++ rmd160.h \ ++ sha1.h \ ++ sha2.h \ ++ stdlib.h \ ++ util.h ++ ++SYSINCSDIR= ${INCLUDEDIR}/sys ++SYSINCS+= \ ++ sys/cdefs.h \ ++ sys/event.h \ ++ sys/types.h \ ++ sys/wait.h ++ ++NETINETINCSDIR= ${INCLUDEDIR}/netinet ++NETINETINCS+= \ ++ netinet/in.h + + .include diff --git a/pkgs/os-specific/bsd/freebsd/librpcsvc-include-subdir.patch b/pkgs/os-specific/bsd/freebsd/librpcsvc-include-subdir.patch new file mode 100644 index 000000000000..38e06682869f --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/librpcsvc-include-subdir.patch @@ -0,0 +1,11 @@ +--- a/lib/librpcsvc/Makefile ++++ b/lib/librpcsvc/Makefile +@@ -20,7 +20,7 @@ OTHERSRCS+= yp_passwd.c yp_update.c + + RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C + +-INCDIRS= -I${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc ++INCDIRS= -I${INCLUDEDIR}/rpcsvc + + CFLAGS+= -DYP ${INCDIRS} + diff --git a/pkgs/os-specific/bsd/freebsd/no-perms-BSD.include.dist.patch b/pkgs/os-specific/bsd/freebsd/no-perms-BSD.include.dist.patch new file mode 100644 index 000000000000..985617ee0f45 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/no-perms-BSD.include.dist.patch @@ -0,0 +1,11 @@ +--- a/etc/mtree/BSD.include.dist ++++ b/etc/mtree/BSD.include.dist +@@ -3,7 +3,7 @@ + # Please see the file src/etc/mtree/README before making changes to this file. + # + +-/set type=dir uname=root gname=wheel mode=0755 ++/set type=dir + . + arpa + .. diff --git a/pkgs/os-specific/bsd/freebsd/rpcgen-glibc-hack.patch b/pkgs/os-specific/bsd/freebsd/rpcgen-glibc-hack.patch new file mode 100644 index 000000000000..3dde1a010651 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/rpcgen-glibc-hack.patch @@ -0,0 +1,15 @@ +--- a/usr.bin/rpcgen/rpc_scan.c ++++ b/usr.bin/rpcgen/rpc_scan.c +@@ -43,8 +43,12 @@ __FBSDID("$FreeBSD$"); + */ + + #include + ++// glibc + compat is broken from silly indirect header guard ++#define _SYS_WAIT_H ++# include ++#undef _SYS_WAIT_H + #include + #include + #include + #include diff --git a/pkgs/os-specific/bsd/freebsd/setup-hook.sh b/pkgs/os-specific/bsd/freebsd/setup-hook.sh new file mode 100644 index 000000000000..929782954ba7 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/setup-hook.sh @@ -0,0 +1,12 @@ +setFreeBSDSrcTop() { + makeFlags="SRCTOP=$BSDSRCDIR $makeFlags" +} + +addFreeBSDMakeFlags() { + makeFlags="SBINDIR=${!outputBin}/bin $makeFlags" + makeFlags="LIBEXECDIR=${!outputLib}/libexec $makeFlags" + makeFlags="INCLUDEDIR=${!outputDev}/include $makeFlags" +} + +postUnpackHooks+=(setFreeBSDSrcTop) +preConfigureHooks+=(addFreeBSDMakeFlags) diff --git a/pkgs/os-specific/bsd/freebsd/sys-gnu-date.patch b/pkgs/os-specific/bsd/freebsd/sys-gnu-date.patch new file mode 100644 index 000000000000..2356446baf85 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/sys-gnu-date.patch @@ -0,0 +1,13 @@ +diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh +index c594724d814..d5287c7b992 100644 +--- a/sys/conf/newvers.sh ++++ b/sys/conf/newvers.sh +@@ -177,7 +177,7 @@ u=${USER:-root} + d=$(pwd) + h=${HOSTNAME:-$(hostname)} + if [ -n "$SOURCE_DATE_EPOCH" ]; then +- if ! t=$(date -r $SOURCE_DATE_EPOCH 2>/dev/null); then ++ if ! t=$(date -d @$SOURCE_DATE_EPOCH 2>/dev/null); then + echo "Invalid SOURCE_DATE_EPOCH" >&2 + exit 1 + fi diff --git a/pkgs/os-specific/bsd/freebsd/sys-no-explicit-intrinsics-dep.patch b/pkgs/os-specific/bsd/freebsd/sys-no-explicit-intrinsics-dep.patch new file mode 100644 index 000000000000..edf44de5bb0d --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/sys-no-explicit-intrinsics-dep.patch @@ -0,0 +1,45 @@ +diff --git a/sys/modules/aesni/Makefile b/sys/modules/aesni/Makefile +index cb8c744adde..1c327331890 100644 +--- a/sys/modules/aesni/Makefile ++++ b/sys/modules/aesni/Makefile +@@ -1,7 +1,6 @@ + # $FreeBSD$ + + .PATH: ${SRCTOP}/sys/crypto/aesni +-.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers + + KMOD= aesni + SRCS= aesni.c +@@ -40,8 +39,8 @@ intel_sha256.o: intel_sha256.c + aesni_ghash.o: aesni.h + aesni_wrap.o: aesni.h + aesni_ccm.o: aesni.h +-intel_sha1.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h +-intel_sha256.o: sha_sse.h immintrin.h shaintrin.h tmmintrin.h xmmintrin.h ++intel_sha1.o: sha_sse.h ++intel_sha256.o: sha_sse.h + + .include + +diff --git a/sys/modules/blake2/Makefile b/sys/modules/blake2/Makefile +index e4b3fb9f126..5bfd9c2ae02 100644 +--- a/sys/modules/blake2/Makefile ++++ b/sys/modules/blake2/Makefile +@@ -3,7 +3,6 @@ + .PATH: ${SRCTOP}/sys/contrib/libb2 + .PATH: ${SRCTOP}/sys/crypto/blake2 + .PATH: ${SRCTOP}/sys/opencrypto +-.PATH: ${SRCTOP}/contrib/llvm-project/clang/lib/Headers + + KMOD = blake2 + +@@ -64,8 +63,7 @@ ${src:S/.c/.o/}: ${src} + -D_MM_MALLOC_H_INCLUDED -Wno-unused-function ${.IMPSRC} + ${CTFCONVERT_CMD} + +-${src:S/.c/.o/}: intrin.h emmintrin.h tmmintrin.h smmintrin.h immintrin.h \ +- x86intrin.h ${SRCS:M*.h} ++${src:S/.c/.o/}: ${SRCS:M*.h} + .endfor + + # FreeBSD-specific sources: diff --git a/pkgs/os-specific/bsd/xargs-j.sh b/pkgs/os-specific/bsd/xargs-j.sh new file mode 100644 index 000000000000..3dd27c2cd2cd --- /dev/null +++ b/pkgs/os-specific/bsd/xargs-j.sh @@ -0,0 +1,17 @@ +#! @shell@ + +declare -a args=() + +token=$1 +shift + +while (( $# )); do + if [[ "$1" = "$token" ]]; then + mapfile -t -O $(("${#args[@]}" + 1)) args + else + args+=("$1") + fi + shift +done + +exec "${args[@]}" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 93ddf1774edf..381df289cb72 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14586,7 +14586,7 @@ with pkgs; # assumption is that or any later version is good. choose = platform: /**/ if platform.isDarwin then 11 - else if platform.isFreeBSD then 7 + else if platform.isFreeBSD then 12 else if platform.isAndroid then 12 else if platform.system == "armv6l-linux" then 7 # This fixes armv6 cross-compilation else if platform.isLinux then 11 @@ -19024,6 +19024,7 @@ with pkgs; if stdenv.targetPlatform.useiOSPrebuilt then targetPackages.darwin.iosSdkPkgs.libraries or darwin.iosSdkPkgs.libraries else targetPackages.darwin.LibsystemCross or (throw "don't yet have a `targetPackages.darwin.LibsystemCross for ${stdenv.targetPlatform.config}`") + else if name == "fblibc" then targetPackages.freebsdCross.libc or freebsdCross.libc else if name == "nblibc" then targetPackages.netbsdCross.libc or netbsdCross.libc else if name == "wasilibc" then targetPackages.wasilibc or wasilibc else if name == "relibc" then targetPackages.relibc or relibc @@ -37728,6 +37729,11 @@ with pkgs; name = "bsd-setup-hook"; } ../os-specific/bsd/setup-hook.sh; + freebsd = callPackage ../os-specific/bsd/freebsd {}; + freebsdCross = callPackage ../os-specific/bsd/freebsd { + stdenv = crossLibcStdenv; + }; + netbsd = callPackage ../os-specific/bsd/netbsd {}; netbsdCross = callPackage ../os-specific/bsd/netbsd { stdenv = crossLibcStdenv; From cd74512c68203cdc2cb88188263785800d5c430b Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Sat, 12 Nov 2022 17:52:29 +0000 Subject: [PATCH 04/17] opentelemetry-collector: 0.64.0 -> 0.64.1 --- pkgs/tools/misc/opentelemetry-collector/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/opentelemetry-collector/default.nix b/pkgs/tools/misc/opentelemetry-collector/default.nix index bb2a6e5bed97..6db9e4c91e3f 100644 --- a/pkgs/tools/misc/opentelemetry-collector/default.nix +++ b/pkgs/tools/misc/opentelemetry-collector/default.nix @@ -12,17 +12,17 @@ let in buildGoModule rec { pname = "opentelemetry-collector"; - version = "0.64.0"; + version = "0.64.1"; src = fetchFromGitHub { owner = "open-telemetry"; repo = "opentelemetry-collector"; rev = "v${version}"; - sha256 = "sha256-4EXRmG8HAUybA9+kPNCvlfZf3bfREAqeis7YxmGn33c="; + sha256 = "sha256-qYQWPhvWVNUqsQLTLUd4SOfW0YiXPyGBrtX8AY15FNg="; }; # there is a nested go.mod sourceRoot = "source/cmd/otelcorecol"; - vendorSha256 = "sha256-i3pAK9ByXDdd2juenPooStgvhpcemcCOKLT9jjz0hL8="; + vendorSha256 = "sha256-uq5o/wtmgGMthUqK86x+uKV7jFAd9koKucnBCKGUJMo="; preBuild = '' # set the build version, can't be done via ldflags From a2bca8092c2cf0d0408c2af43d7652338a652a96 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 13 Nov 2022 20:01:44 -0300 Subject: [PATCH 05/17] wbg: rewrite mesonFeatureFlag This is merely cosmetical. --- pkgs/applications/misc/wbg/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/wbg/default.nix b/pkgs/applications/misc/wbg/default.nix index 57a1f55392aa..0febd846e024 100644 --- a/pkgs/applications/misc/wbg/default.nix +++ b/pkgs/applications/misc/wbg/default.nix @@ -18,7 +18,8 @@ let # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54 - mesonFeatureFlag = opt: b: "-D${opt}=${if b then "enabled" else "disabled"}"; + mesonFeatureFlag = feature: flag: + "-D${feature}=${if flag then "enabled" else "disabled"}"; in stdenv.mkDerivation rec { From 1405f8a944547109f1031a97c93c02ef96e590da Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 13 Nov 2022 20:02:45 -0300 Subject: [PATCH 06/17] fcft: rewrite mesonFeatureFlag This is merely cosmetical. --- pkgs/development/libraries/fcft/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/fcft/default.nix b/pkgs/development/libraries/fcft/default.nix index ecc99092a905..5090df411c2f 100644 --- a/pkgs/development/libraries/fcft/default.nix +++ b/pkgs/development/libraries/fcft/default.nix @@ -15,7 +15,8 @@ let ]; # Courtesy of sternenseemann and FRidh, commit c9a7fdfcfb420be8e0179214d0d91a34f5974c54 - mesonFeatureFlag = opt: b: "-D${opt}=${if b then "enabled" else "disabled"}"; + mesonFeatureFlag = feature: flag: + "-D${feature}=${if flag then "enabled" else "disabled"}"; in stdenv.mkDerivation rec { From 2f52d4fae237d03ac98718e9279c075fdf85e622 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 13 Nov 2022 20:03:19 -0300 Subject: [PATCH 07/17] harfbuzz: rewrite mesonFeatureFlag This is merely cosmetical. --- pkgs/development/libraries/harfbuzz/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix index 0bb6546543dc..5e892c1681c2 100644 --- a/pkgs/development/libraries/harfbuzz/default.nix +++ b/pkgs/development/libraries/harfbuzz/default.nix @@ -32,8 +32,8 @@ let version = "5.2.0"; inherit (lib) optional optionals optionalString; - mesonFeatureFlag = opt: b: - "-D${opt}=${if b then "enabled" else "disabled"}"; + mesonFeatureFlag = feature: flag: + "-D${feature}=${if flag then "enabled" else "disabled"}"; in stdenv.mkDerivation { From 92eaf16a759808cbb38a5b2deb5c8b50ac9c681b Mon Sep 17 00:00:00 2001 From: "Bryan A. S" Date: Sun, 13 Nov 2022 20:14:45 -0300 Subject: [PATCH 08/17] argocd: 2.5.1 -> 2.5.2 - also add proxy vendor to fix hash mismatch between linux and darwin --- pkgs/applications/networking/cluster/argocd/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/cluster/argocd/default.nix b/pkgs/applications/networking/cluster/argocd/default.nix index 2701a101b023..3885db4b30a8 100644 --- a/pkgs/applications/networking/cluster/argocd/default.nix +++ b/pkgs/applications/networking/cluster/argocd/default.nix @@ -2,16 +2,17 @@ buildGoModule rec { pname = "argocd"; - version = "2.5.1"; + version = "2.5.2"; src = fetchFromGitHub { owner = "argoproj"; repo = "argo-cd"; rev = "v${version}"; - sha256 = "sha256-UwMJnmvwcN/OuIbFJJEE7A5WFjzfvpe5ljMmbSLQsnA="; + sha256 = "sha256-xiqxCYGSpsREZyylWJCIbFPPr3jISxD0wS/L/P77BF8="; }; - vendorSha256 = "sha256-LmIvNenKV6ie2FZBj/jN70pKe1m8kFg/IQ8z5q8tO8A="; + proxyVendor = true; # darwin/linux hash mismatch + vendorSha256 = "sha256-F5EY1/WWRPBN5fqp2J2mdpIzL1gNKR0ltzSdarT6dFw="; # Set target as ./cmd per cli-local # https://github.com/argoproj/argo-cd/blob/master/Makefile#L227 From 766ad4f624a1bcffb8e4b0ef5f1a7ac16fd12a62 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Mon, 14 Nov 2022 01:31:01 +0000 Subject: [PATCH 09/17] python310Packages.pyosmium: 3.4.1 -> 3.5.0 --- pkgs/development/python-modules/pyosmium/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pyosmium/default.nix b/pkgs/development/python-modules/pyosmium/default.nix index 3d681c75daa8..22473af90282 100644 --- a/pkgs/development/python-modules/pyosmium/default.nix +++ b/pkgs/development/python-modules/pyosmium/default.nix @@ -5,7 +5,7 @@ buildPythonPackage rec { pname = "pyosmium"; - version = "3.4.1"; + version = "3.5.0"; disabled = pythonOlder "3.4" || isPyPy; @@ -13,7 +13,7 @@ buildPythonPackage rec { owner = "osmcode"; repo = pname; rev = "refs/tags/v${version}"; - sha256 = "sha256-PMQnQe699ZWRR2gevrSCTokyc9xr1TL9Ohuqn7NL8c8="; + sha256 = "sha256-dumTyca1nLPa6B3p5fmUGWa6jReHOeFPc9heTz/2zao="; }; nativeBuildInputs = [ cmake ]; From b016e85f39d5945c855df7cf7073f97c0e899a5e Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Mon, 14 Nov 2022 02:51:42 +0100 Subject: [PATCH 10/17] audacity: add x86_64-darwin support (#201104) --- pkgs/applications/audio/audacity/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix index 47bfcf8b8c06..c12cc30df26d 100644 --- a/pkgs/applications/audio/audacity/default.nix +++ b/pkgs/applications/audio/audacity/default.nix @@ -84,6 +84,10 @@ stdenv.mkDerivation rec { '' + lib.optionalString stdenv.isLinux '' substituteInPlace libraries/lib-files/FileNames.cpp \ --replace /usr/include/linux/magic.h ${linuxHeaders}/include/linux/magic.h + '' + # error: unknown type name 'NSAppearanceName' + + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' + sed -z -i "s/if (@available(macOS 10.14, \*)).*}/}/g" src/AudacityApp.mm ''; nativeBuildInputs = [ @@ -199,7 +203,5 @@ stdenv.mkDerivation rec { ]; maintainers = with maintainers; [ lheckemann veprbl wegank ]; platforms = platforms.unix; - # error: unknown type name 'NSAppearanceName' - broken = stdenv.isDarwin && stdenv.isx86_64; }; } From 92ad187a934f82e5a38e7959bd22104ee10fd73f Mon Sep 17 00:00:00 2001 From: happysalada Date: Sun, 13 Nov 2022 16:30:01 -0500 Subject: [PATCH 11/17] influxdb2: 2.4.0 -> 2.5.1 --- pkgs/servers/nosql/influxdb2/cli.nix | 6 ++--- pkgs/servers/nosql/influxdb2/default.nix | 34 +++++++++--------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/pkgs/servers/nosql/influxdb2/cli.nix b/pkgs/servers/nosql/influxdb2/cli.nix index 63e4f9f4557f..37b95a16b166 100644 --- a/pkgs/servers/nosql/influxdb2/cli.nix +++ b/pkgs/servers/nosql/influxdb2/cli.nix @@ -5,19 +5,19 @@ }: let - version = "2.4.0"; + version = "2.5.0"; src = fetchFromGitHub { owner = "influxdata"; repo = "influx-cli"; rev = "v${version}"; - sha256 = "sha256-l27BAHQtMA4kE7VEZLdOPFnSXtyWUOrcUFitaWqwvTw="; + sha256 = "sha256-gztLANO42VbgA6LxiuVh8ESF20JqjC+7znYhmWJKxVA="; }; in buildGoModule { pname = "influx-cli"; version = version; - src = src; + inherit src; vendorSha256 = "sha256-GnVLr9mWehgw8vs4RiOrFHVlPpPT/LP6XvCq94aJxJQ="; subPackages = [ "cmd/influx" ]; diff --git a/pkgs/servers/nosql/influxdb2/default.nix b/pkgs/servers/nosql/influxdb2/default.nix index ce010f306221..41bba89996bf 100644 --- a/pkgs/servers/nosql/influxdb2/default.nix +++ b/pkgs/servers/nosql/influxdb2/default.nix @@ -13,22 +13,22 @@ }: let - version = "2.4.0"; + version = "2.5.1"; # Despite the name, this is not a rolling release. This is the - # version of the UI assets for 2.4.0, as specified in - # scripts/fetch-ui-assets.sh in the 2.4.0 tag of influxdb. - ui_version = "Master"; - libflux_version = "0.179.0"; + # version of the UI assets for 2.5.1, as specified in + # scripts/fetch-ui-assets.sh in the 2.5.1 tag of influxdb. + ui_version = "OSS-2022-09-16"; + libflux_version = "0.188.1"; src = fetchFromGitHub { owner = "influxdata"; repo = "influxdb"; rev = "v${version}"; - sha256 = "sha256-ufJnrVWVfia2/xLRmFkauCw8ktdSJUybJkv42Gd0npg="; + sha256 = "sha256-AKyuFBja06BuWYliqIGKOb4PIc5G8S9S+cf/dLrEATY="; }; ui = fetchurl { - url = "https://github.com/influxdata/ui/releases/download/OSS-${ui_version}/build.tar.gz"; + url = "https://github.com/influxdata/ui/releases/download/${ui_version}/build.tar.gz"; sha256 = "sha256-YKDp1jLyo4n+YTeMaWl8dhN4Lr3H8FXV7stJ3p3zFe8="; }; @@ -39,20 +39,10 @@ let owner = "influxdata"; repo = "flux"; rev = "v${libflux_version}"; - sha256 = "sha256-xcsmvT8Ve1WbfwrdVPnJcj7RAvrk795N3C95ubbGig0="; + sha256 = "sha256-Xmh7V/o1Gje62kcnTeB9h/fySljhfu+tjbyvryvIGRc="; }; - patches = [ - # https://github.com/influxdata/flux/pull/5273 - # fix compile error with Rust 1.64 - (fetchpatch { - url = "https://github.com/influxdata/flux/commit/20ca62138a0669f2760dd469ca41fc333e04b8f2.patch"; - stripLen = 2; - extraPrefix = ""; - sha256 = "sha256-Fb4CuH9ZvrPha249dmLLI8MqSNQRKqKPxPbw2pjqwfY="; - }) - ]; sourceRoot = "source/libflux"; - cargoSha256 = "sha256-+hJQFV0tWeTQDN560DzROUNpdkcZ5h2sc13akHCgqPc="; + cargoSha256 = "sha256-9rPW0lgi3lXJARa1KXgSY8LVJsoFjppok5ODGlqYeYw="; nativeBuildInputs = [ llvmPackages.libclang ]; buildInputs = lib.optional stdenv.isDarwin libiconv; LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; @@ -77,11 +67,11 @@ let in buildGoModule { pname = "influxdb"; version = version; - src = src; + inherit src; nativeBuildInputs = [ go-bindata pkg-config perl ]; - vendorSha256 = "sha256-DZsd6qPKfRbnvz0UAww+ubaeTEqQxLeil1S3SZAmmJk="; + vendorSha256 = "sha256-02x+HsWkng7OnKVSfkQR8LL1Qk42Bdrw0IMtBpS7xQc="; subPackages = [ "cmd/influxd" "cmd/telemetryd" ]; PKG_CONFIG_PATH = "${flux}/pkgconfig"; @@ -102,7 +92,7 @@ in buildGoModule { exit 1 fi - ui_ver=$(egrep 'influxdata/ui/releases/.*/sha256.txt' scripts/fetch-ui-assets.sh | perl -pe 's#.*/OSS-([^/]+)/.*#$1#') + ui_ver=$(egrep 'UI_RELEASE=".*"' scripts/fetch-ui-assets.sh | cut -d'"' -f2) if [ "$ui_ver" != "${ui_version}" ]; then echo "scripts/fetch-ui-assets.sh wants UI $ui_ver, but nix derivation provides ${ui_version}" exit 1 From 41eb952bbbe1558dc44a5f801443a73770a4c5bd Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Sun, 13 Nov 2022 22:18:16 +0000 Subject: [PATCH 12/17] python310Packages.prefixed: 0.4.0 -> 0.4.2 --- pkgs/development/python-modules/prefixed/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/prefixed/default.nix b/pkgs/development/python-modules/prefixed/default.nix index 848f50fe62f5..5f6cf56465a1 100644 --- a/pkgs/development/python-modules/prefixed/default.nix +++ b/pkgs/development/python-modules/prefixed/default.nix @@ -6,11 +6,11 @@ buildPythonPackage rec { pname = "prefixed"; - version = "0.4.0"; + version = "0.4.2"; src = fetchPypi { inherit pname version; - sha256 = "sha256-z5awVvmKubphXQMR7Kg3s9oBIBXNxZTz/uJIyvcCKLc="; + sha256 = "sha256-gfTjvBUEbncnE6uA8IaQ5hxSzOsgFBQldU6rWwCxMMk="; }; checkInputs = [ pytestCheckHook ]; From 47728c4392cd05839d01037beeac7f6104e77ee2 Mon Sep 17 00:00:00 2001 From: Chuang Zhu Date: Mon, 14 Nov 2022 09:39:28 +0800 Subject: [PATCH 13/17] manim: fix build --- pkgs/applications/video/manim/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/video/manim/default.nix b/pkgs/applications/video/manim/default.nix index 62a17d9c1dc8..3f1d5ecb81b9 100644 --- a/pkgs/applications/video/manim/default.nix +++ b/pkgs/applications/video/manim/default.nix @@ -64,6 +64,7 @@ in python3.pkgs.buildPythonApplication rec { --replace "--no-cov-on-fail --cov=manim --cov-report xml --cov-report term" "" \ --replace 'cloup = "^0.13.0"' 'cloup = "*"' \ --replace 'mapbox-earcut = "^0.12.10"' 'mapbox-earcut = "*"' \ + --replace 'click = ">=7.2<=9.0"' 'click = ">=7.2,<=9.0"' # https://github.com/ManimCommunity/manim/pull/2954 ''; buildInputs = [ cairo ]; From a3bd01822330f9cdc25c62f061ac088d5d35a1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 12 Nov 2022 09:11:21 -0800 Subject: [PATCH 14/17] python310Packages.safety: 2.2.1 -> 2.3.1 https://github.com/pyupio/safety/blob/2.3.1/CHANGELOG.md --- pkgs/development/python-modules/safety/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/safety/default.nix b/pkgs/development/python-modules/safety/default.nix index 20f0beecb70f..fdd0c975272f 100644 --- a/pkgs/development/python-modules/safety/default.nix +++ b/pkgs/development/python-modules/safety/default.nix @@ -13,7 +13,7 @@ buildPythonPackage rec { pname = "safety"; - version = "2.2.1"; + version = "2.3.1"; disabled = pythonOlder "3.6"; @@ -21,12 +21,14 @@ buildPythonPackage rec { src = fetchPypi { inherit pname version; - hash = "sha256-2LSMRqxmKLuDRBt93cR1bP4lgqvhOhEu5uTvGjSq0DI="; + hash = "sha256-bm/LfU6DIQmM8on1m2UFHK/TRn8InG5XyfiUrjLCO3E="; }; postPatch = '' substituteInPlace safety/safety.py \ --replace "telemetry=True" "telemetry=False" + substituteInPlace safety/util.py \ + --replace "telemetry=True" "telemetry=False" substituteInPlace safety/cli.py \ --replace "telemetry', default=True" "telemetry', default=False" ''; From a0bf7e251c9e830157475684e19ca6ae129102a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 12 Nov 2022 10:26:20 -0800 Subject: [PATCH 15/17] python310Packages.xsdata: 22.9 -> 22.11 https://github.com/tefra/xsdata/blob/v22.11/CHANGES.rst --- pkgs/development/python-modules/xsdata/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/xsdata/default.nix b/pkgs/development/python-modules/xsdata/default.nix index e87b07b89fa4..ab8881827394 100644 --- a/pkgs/development/python-modules/xsdata/default.nix +++ b/pkgs/development/python-modules/xsdata/default.nix @@ -14,7 +14,7 @@ buildPythonPackage rec { pname = "xsdata"; - version = "22.9"; + version = "22.11"; disabled = pythonOlder "3.7"; @@ -22,7 +22,7 @@ buildPythonPackage rec { src = fetchPypi { inherit pname version; - hash = "sha256-xi1QArTeWbrKTE6p7f3Aj7d1lxPsIROaruv/IMw+fPw="; + hash = "sha256-3A2vyK6UdelWSzcN7pzPz6xKnU3X+rum7dKzl6OfWoc="; }; postPatch = '' @@ -74,6 +74,7 @@ buildPythonPackage rec { meta = { description = "Python XML Binding"; homepage = "https://github.com/tefra/xsdata"; + changelog = "https://github.com/tefra/xsdata/blob/v${version}/CHANGES.rst"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ dotlambda ]; }; From 2c09426bcb544db300410dbb1bf8fefd3e498587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 12 Nov 2022 09:21:12 -0800 Subject: [PATCH 16/17] python310Packages.ua-parser: 0.15.0 -> 0.16.1 --- .../python-modules/ua-parser/default.nix | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/ua-parser/default.nix b/pkgs/development/python-modules/ua-parser/default.nix index 6a232cfbe55c..e324459e9810 100644 --- a/pkgs/development/python-modules/ua-parser/default.nix +++ b/pkgs/development/python-modules/ua-parser/default.nix @@ -7,7 +7,7 @@ buildPythonPackage rec { pname = "ua-parser"; - version = "0.15.0"; + version = "0.16.1"; format = "setuptools"; @@ -16,26 +16,17 @@ buildPythonPackage rec { repo = "uap-python"; rev = version; fetchSubmodules = true; - hash = "sha256-TtOj1ZL8+4T95AgF9ErvI+0W35WQ23snFhCyCbuRjxM="; + hash = "sha256-vyzeRi/wYEyezSU+EigJATgrNvABGCWVWlSFhKGipLE="; }; patches = [ ./dont-fetch-submodule.patch ]; - postPatch = '' - substituteInPlace setup.py \ - --replace "pyyaml ~= 5.4.0" pyyaml - ''; - nativeBuildInputs = [ pyyaml ]; - preBuild = '' - mkdir -p build/lib/ua_parser - ''; - checkInputs = [ pytestCheckHook ]; From b0b258544faf3843a97db362bc28b2f3f3fbcc1d Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Mon, 14 Nov 2022 04:51:20 +0000 Subject: [PATCH 17/17] python310Packages.pytorch-pfn-extras: 0.6.1 -> 0.6.2 --- .../development/python-modules/pytorch-pfn-extras/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/pytorch-pfn-extras/default.nix b/pkgs/development/python-modules/pytorch-pfn-extras/default.nix index e3c27eda9ef1..8fc3b2eae037 100644 --- a/pkgs/development/python-modules/pytorch-pfn-extras/default.nix +++ b/pkgs/development/python-modules/pytorch-pfn-extras/default.nix @@ -12,13 +12,13 @@ buildPythonPackage rec { pname = "pytorch-pfn-extras"; - version = "0.6.1"; + version = "0.6.2"; src = fetchFromGitHub { owner = "pfnet"; repo = pname; rev = "refs/tags/v${version}"; - sha256 = "sha256-wxTs/hfgqJn4DCxZj87V/zDKZc+thx3o5bWAvZe7EJU="; + sha256 = "sha256-J1+y5hHMKC31rIYeWI3Ca8Hdx0FF+MnCOAp0ejHzX/Y="; }; propagatedBuildInputs = [ numpy packaging torch typing-extensions ];