diff options
Diffstat (limited to 'pkgs/os-specific')
34 files changed, 655 insertions, 74 deletions
diff --git a/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch b/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch index 9bb2bea32ee98..4bc21cf8eb147 100644 --- a/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch +++ b/pkgs/os-specific/bsd/freebsd/patches/13.1/compat-install-dirs.patch @@ -2,12 +2,11 @@ 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: +@@ -327,14 +327,14 @@ 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 \ @@ -16,7 +15,6 @@ index 948a5f9dfdb..592af84eeae 100644 - usr/libdata/pkgconfig \ - usr/libexec + ${BINDIR} \ -+ ${LIBDIR}/casper \ + ${LIBDIR}/geom \ + ${INCLUDEDIR}/casper \ + ${INCLUDEDIR}/private/ucl \ diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch new file mode 100644 index 0000000000000..256db9e2d9cf4 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/libcxxrt-headers.patch @@ -0,0 +1,11 @@ +--- freebsd/lib/libcxxrt/Makefile 2024-05-30 14:27:42.328086005 -0700 ++++ freebsd/lib/libcxxrt/Makefile.mod 2024-05-30 14:27:48.048014581 -0700 +@@ -19,6 +19,8 @@ + SRCS+= terminate.cc + SRCS+= typeinfo.cc + ++INCS+=cxxabi.h unwind.h unwind-arm.h unwind-itanium.h ++ + WARNS?= 0 + CFLAGS+= -isystem ${SRCDIR} -nostdinc++ + CXXSTD?= c++14 diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch new file mode 100644 index 0000000000000..73a0341bd3240 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/localedef.patch @@ -0,0 +1,158 @@ +diff --git a/include/_ctype.h b/include/_ctype.h +index 91e6b1d14f6b..a6896b598da3 100644 +--- a/include/_ctype.h ++++ b/include/_ctype.h +@@ -44,7 +44,7 @@ + #define __CTYPE_H_ + + #include <sys/cdefs.h> +-#include <sys/_types.h> ++#include <sys/types.h> + + #define _CTYPE_A 0x00000100L /* Alpha */ + #define _CTYPE_C 0x00000200L /* Control */ +diff --git a/lib/libc/locale/collate.h b/lib/libc/locale/collate.h +index 2d3723b49f5b..6bbff732b9d7 100644 +--- a/lib/libc/locale/collate.h ++++ b/lib/libc/locale/collate.h +@@ -36,6 +36,7 @@ + #ifndef _COLLATE_H_ + #define _COLLATE_H_ + ++#include <stdint.h> + #include <sys/cdefs.h> + #include <sys/types.h> + #include <limits.h> +diff --git a/usr.bin/localedef/charmap.c b/usr.bin/localedef/charmap.c +index 44b7e3292eae..79c30b7cf372 100644 +--- a/usr.bin/localedef/charmap.c ++++ b/usr.bin/localedef/charmap.c +@@ -31,6 +31,7 @@ + /* + * CHARMAP file handling for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <sys/types.h> + #include <sys/tree.h> +diff --git a/usr.bin/localedef/collate.c b/usr.bin/localedef/collate.c +index 2a080773a95e..3f0030c638f5 100644 +--- a/usr.bin/localedef/collate.c ++++ b/usr.bin/localedef/collate.c +@@ -31,6 +31,7 @@ + /* + * LC_COLLATE database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <sys/types.h> + #include <sys/tree.h> +diff --git a/usr.bin/localedef/ctype.c b/usr.bin/localedef/ctype.c +index ab7b76e57b2d..846c6d6480a8 100644 +--- a/usr.bin/localedef/ctype.c ++++ b/usr.bin/localedef/ctype.c +@@ -32,6 +32,7 @@ + /* + * LC_CTYPE database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <sys/tree.h> + +diff --git a/usr.bin/localedef/localedef.c b/usr.bin/localedef/localedef.c +index 5ff146d6f655..ed69aa1f0c0e 100644 +--- a/usr.bin/localedef/localedef.c ++++ b/usr.bin/localedef/localedef.c +@@ -32,7 +32,7 @@ + * POSIX localedef. + */ + #include <sys/cdefs.h> +-#include <sys/endian.h> ++#include <endian.h> + #include <sys/stat.h> + #include <sys/types.h> + +diff --git a/usr.bin/localedef/messages.c b/usr.bin/localedef/messages.c +index 6b8eb9d684dd..0155821d0e56 100644 +--- a/usr.bin/localedef/messages.c ++++ b/usr.bin/localedef/messages.c +@@ -31,6 +31,7 @@ + /* + * LC_MESSAGES database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/usr.bin/localedef/monetary.c b/usr.bin/localedef/monetary.c +index 7a77ac7e256c..7636c4deca1f 100644 +--- a/usr.bin/localedef/monetary.c ++++ b/usr.bin/localedef/monetary.c +@@ -31,6 +31,7 @@ + /* + * LC_MONETARY database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/usr.bin/localedef/numeric.c b/usr.bin/localedef/numeric.c +index 5533b7c10e1a..9c47494f815c 100644 +--- a/usr.bin/localedef/numeric.c ++++ b/usr.bin/localedef/numeric.c +@@ -31,6 +31,7 @@ + /* + * LC_NUMERIC database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/usr.bin/localedef/parser.y b/usr.bin/localedef/parser.y +index 23b3b54f8a6e..e01330f0152d 100644 +--- a/usr.bin/localedef/parser.y ++++ b/usr.bin/localedef/parser.y +@@ -33,6 +33,7 @@ + * POSIX localedef grammar. + */ + ++#include <stdint.h> + #include <wchar.h> + #include <stdio.h> + #include <limits.h> +diff --git a/usr.bin/localedef/scanner.c b/usr.bin/localedef/scanner.c +index c6d45a993f28..b17670ef4b4a 100644 +--- a/usr.bin/localedef/scanner.c ++++ b/usr.bin/localedef/scanner.c +@@ -32,6 +32,7 @@ + * This file contains the "scanner", which tokenizes the input files + * for localedef for processing by the higher level grammar processor. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/usr.bin/localedef/time.c b/usr.bin/localedef/time.c +index 7a56e244c921..0e409a742d0a 100644 +--- a/usr.bin/localedef/time.c ++++ b/usr.bin/localedef/time.c +@@ -31,6 +31,7 @@ + /* + * LC_TIME database generation routines for localedef. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <stdio.h> + #include <stdlib.h> +diff --git a/usr.bin/localedef/wide.c b/usr.bin/localedef/wide.c +index 062e120e6912..a199cddb198d 100644 +--- a/usr.bin/localedef/wide.c ++++ b/usr.bin/localedef/wide.c +@@ -34,6 +34,7 @@ + * to the wide character forms used internally by libc. Unfortunately, + * this approach means that we need a method for each and every encoding. + */ ++#include <stdint.h> + #include <sys/cdefs.h> + #include <ctype.h> + #include <stdlib.h> diff --git a/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch b/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch new file mode 100644 index 0000000000000..6446322a8a0a3 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/patches/14.0/tinfo-host-cc.patch @@ -0,0 +1,15 @@ +--- a/lib/ncurses/tinfo/Makefile 2023-12-26 23:02:07.827892619 -0800 ++++ b/lib/ncurses/tinfo/Makefile 2023-12-26 23:01:24.175546100 -0800 +@@ -282,10 +282,10 @@ + build-tools: make_hash make_keys + + make_keys: make_keys.c names.c ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} +- ${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c ++ ${CC_HOST:N${CCACHE_BIN}} -o $@ ${CFLAGS} ${NCURSES_DIR}/ncurses/tinfo/make_keys.c + + make_hash: make_hash.c hashsize.h ncurses_def.h ${HEADERS} ${BUILD_TOOLS_META} +- ${CC:N${CCACHE_BIN}} -o $@ ${CFLAGS} -DMAIN_PROGRAM \ ++ ${CC_HOST:N${CCACHE_BIN}} -o $@ ${CFLAGS} -DMAIN_PROGRAM \ + ${NCURSES_DIR}/ncurses/tinfo/make_hash.c + .endif + .if ${MK_DIRDEPS_BUILD} == "yes" && ${MACHINE} != "host" diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix new file mode 100644 index 0000000000000..2b2738ec5794a --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix @@ -0,0 +1,92 @@ +{ + mkDerivation, + pkgsBuildBuild, + libjail, + libmd, + libnetbsd, + libcapsicum, + libcasper, + libelf, + libxo, + libncurses-tinfo, + libedit, + lib, + stdenv, + bsdSetupHook, + freebsdSetupHook, + makeMinimal, + install, + tsort, + lorder, + mandoc, + groff, + byacc, + gencat, +}: +mkDerivation { + pname = "bins"; + path = "bin"; + extraPaths = [ + "sys/conf" + "sys/sys/param.h" + "contrib/sendmail" + "contrib/tcsh" + "usr.bin/printf" + "lib/libsm" + ]; + buildInputs = [ + libjail + libmd + libnetbsd + libcapsicum + libcasper + libelf + libxo + libncurses-tinfo + libedit + ]; + nativeBuildInputs = [ + bsdSetupHook + freebsdSetupHook + makeMinimal + install + tsort + lorder + mandoc + groff + + byacc + gencat + ]; + + MK_TESTS = "no"; + + postPatch = '' + sed -E -i -e '/#define\tBSD.*/d' $BSDSRCDIR/sys/sys/param.h + sed -E -i -e '/^SYMLINKS.*/d' $BSDSRCDIR/bin/*/Makefile + sed -E -i -e 's/mktemp -t ka/mktemp -t kaXXXXXX/' $BSDSRCDIR/bin/sh/mkbuiltins $BSDSRCDIR/bin/sh/mktokens + ''; + + preBuild = '' + export NIX_CFLAGS_COMPILE="-I$BSDSRCDIR/sys $NIX_CFLAGS_COMPILE" + + make -C $BSDSRCDIR/lib/libsm $makeFlags + + make -C $BSDSRCDIR/bin/sh $makeFlags "CC=${pkgsBuildBuild.stdenv.cc}/bin/cc" CFLAGS="-D__unused= -D__printf0like\(a,b\)= -D__dead2=" ${ + lib.optionalString (!stdenv.buildPlatform.isFreeBSD) "MK_PIE=no " + }mkbuiltins mksyntax mktokens mknodes + make -C $BSDSRCDIR/bin/csh $makeFlags "CC=${pkgsBuildBuild.stdenv.cc}/bin/cc" CFLAGS="-D__unused= -D__printf0like\(a,b\)= -D__dead2= -I$BSDSRCDIR/contrib/tcsh -I." ${ + lib.optionalString (!stdenv.buildPlatform.isFreeBSD) "MK_PIE=no " + }gethost + ''; + + preInstall = '' + makeFlags="$makeFlags ROOTDIR=$out/root" + ''; + + outputs = [ + "out" + "man" + "debug" + ]; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix index 966489d9aef36..79dab282e3f3f 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/boot-install.nix @@ -1,10 +1,23 @@ { buildPackages, freebsd-lib }: -# Wrap NetBSD's install +# Wrap GNU coreutils' install +# The -l flag causes a symlink instead of a copy to be installed, so +# it is safe to discard during bootstrap since coreutils does not support it. + buildPackages.writeShellScriptBin "boot-install" ( freebsd-lib.install-wrapper + '' + fixed_args=() + while [[ ''${#args[0]} > 0 ]]; do + case "''${args[0]}" in + -l) + args=("''${args[@]:2}") + continue + esac + fixed_args+=("''${args[0]}") + args=("''${args[@]:1}") + done - ${buildPackages.netbsd.install}/bin/xinstall "''${args[@]}" + ${buildPackages.coreutils}/bin/install "''${fixed_args[@]}" '' ) diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix b/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix new file mode 100644 index 0000000000000..3ebfd91a4e153 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/cp.nix @@ -0,0 +1,10 @@ +{ mkDerivation }: +mkDerivation { + path = "bin/cp"; + + extraPaths = [ "sys" ]; + + postPatch = '' + substituteInPlace $BSDSRCDIR/bin/cp/Makefile --replace 'tests' "" + ''; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix index 0f74d78b1d13d..020a08c1d01ef 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/csu.nix @@ -12,7 +12,7 @@ }: mkDerivation { - isStatic = true; + noLibc = true; path = "lib/csu"; extraPaths = [ "lib/Makefile.inc" diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix b/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix index dc215c18aecb7..09674056d9cd8 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix @@ -18,6 +18,17 @@ let lib.concatMapStringsSep "\n" (path: "/${path}") sortedPaths ); in -runCommand "${pname}-filtered-src" { nativeBuildInputs = [ pkgsBuildBuild.rsync ]; } '' - rsync -a -r --files-from=${filterText} ${source}/ $out -'' +runCommand "${pname}-filtered-src" + { + nativeBuildInputs = [ + (pkgsBuildBuild.rsync.override { + enableZstd = false; + enableXXHash = false; + enableOpenSSL = false; + enableLZ4 = false; + }) + ]; + } + '' + rsync -a -r --files-from=${filterText} ${source}/ $out + '' diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix b/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix new file mode 100644 index 0000000000000..9c1ba1835c145 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/iconv.nix @@ -0,0 +1,12 @@ +{ + mkDerivation, + libcapsicum, + libcasper, +}: +mkDerivation { + path = "usr.bin/iconv"; + buildInputs = [ + libcapsicum + libcasper + ]; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix index 70734226a54f5..a7ceb0cdf384f 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix @@ -7,7 +7,7 @@ }: mkDerivation { - isStatic = true; + noLibc = true; path = "include"; extraPaths = [ diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix b/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix new file mode 100644 index 0000000000000..406e37402b2bb --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix @@ -0,0 +1,21 @@ +{ + lib, + stdenv, + mkDerivation, + libelf, +}: +mkDerivation { + path = "usr.bin/ldd"; + extraPaths = [ + "libexec/rtld-elf" + "contrib/elftoolchain/libelf" + ]; + + buildInputs = [ libelf ]; + + env = { + NIX_CFLAGS_COMPILE = "-D_RTLD_PATH=${lib.getLib stdenv.cc.libc}/libexec/ld-elf.so.1"; + }; + + meta.platforms = lib.platforms.freebsd; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix index 8f2cc976463e4..a991e69265823 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix @@ -21,7 +21,7 @@ }: mkDerivation { - isStatic = true; + noLibc = true; pname = "libc"; path = "lib/libc"; extraPaths = diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix new file mode 100644 index 0000000000000..3cb1560df77aa --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcapsicum.nix @@ -0,0 +1 @@ +{ mkDerivation }: mkDerivation { path = "lib/libcapsicum"; } diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix new file mode 100644 index 0000000000000..df27f72bc8cb0 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcasper.nix @@ -0,0 +1,26 @@ +{ + lib, + stdenv, + mkDerivation, + libnv, +}: +mkDerivation { + path = "lib/libcasper/libcasper"; + extraPaths = [ + "lib/Makefile.inc" + "lib/libcasper" + ]; + buildInputs = [ libnv ]; + + MK_TESTS = "no"; + + makeFlags = [ + "STRIP=-s" # flag to install, not command + "CFLAGS=-DWITH_CASPER" + ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no"; + + postInstall = '' + make -C $BSDSRCDIR/lib/libcasper/services $makeFlags CFLAGS="-DWITH_CASPER -I$out/include" + make -C $BSDSRCDIR/lib/libcasper/services $makeFlags install + ''; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix index 0640d2292d491..fd5591c0ffb8a 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix @@ -1,4 +1,4 @@ -{ mkDerivation, ... }: +{ mkDerivation }: # this package is quite different from stock libcxxrt. # as of FreeBSD 14.0, it is vendored from APPROXIMATELY libcxxrt # 5d8a15823a103bbc27f1bfdcf2b5aa008fab57dd, though the vendoring mechanism is @@ -8,4 +8,11 @@ mkDerivation { pname = "libcxxrt"; path = "lib/libcxxrt"; extraPaths = [ "contrib/libcxxrt" ]; + outputs = [ + "out" + "dev" + "debug" + ]; + noLibcxx = true; + libName = "cxxrt"; } diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix new file mode 100644 index 0000000000000..2b77a0f716624 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix @@ -0,0 +1,9 @@ +{ mkDerivation, ... }: +mkDerivation { + path = "lib/libdl"; + extraPaths = [ + "lib/libc" + "libexec/rtld-elf" + ]; + buildInputs = [ ]; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix new file mode 100644 index 0000000000000..50b1c9f58333f --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libedit.nix @@ -0,0 +1,7 @@ +{ mkDerivation, libncurses-tinfo }: +mkDerivation { + path = "lib/libedit"; + extraPaths = [ "contrib/libedit" ]; + buildInputs = [ libncurses-tinfo ]; + MK_TESTS = "no"; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix new file mode 100644 index 0000000000000..a116aff81f397 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix @@ -0,0 +1,29 @@ +{ + mkDerivation, + lib, + bsdSetupHook, + freebsdSetupHook, + makeMinimal, + install, + m4, +}: +mkDerivation { + path = "lib/libelf"; + extraPaths = [ + "lib/libc" + "contrib/elftoolchain" + "sys/sys/elf32.h" + "sys/sys/elf64.h" + "sys/sys/elf_common.h" + ]; + buildInputs = [ ]; + nativeBuildInputs = [ + bsdSetupHook + freebsdSetupHook + makeMinimal + install + m4 + ]; + + meta.platforms = lib.platforms.freebsd; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix new file mode 100644 index 0000000000000..9150be559c650 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libjail.nix @@ -0,0 +1,5 @@ +{ mkDerivation }: +mkDerivation { + path = "lib/libjail"; + MK_TESTS = "no"; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix new file mode 100644 index 0000000000000..f86f78dbc2914 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses-tinfo.nix @@ -0,0 +1,15 @@ +{ mkDerivation, pkgsBuildBuild }: +mkDerivation { + path = "lib/ncurses/tinfo"; + extraPaths = [ + "lib/ncurses" + "contrib/ncurses" + "lib/Makefile.inc" + ]; + CC_HOST = "${pkgsBuildBuild.stdenv.cc}/bin/cc"; + MK_TESTS = "no"; + preBuild = '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -D_SIZE_T -D_WCHAR_T" + make $makeFlags "CFLAGS=-D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -I$BSDSRCDIR/contrib/ncurses/ncurses -I$BSDSRCDIR/contrib/ncurses/include -I." ncurses_dll.h make_hash make_keys + ''; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix new file mode 100644 index 0000000000000..2dd1ee2fe57de --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libncurses.nix @@ -0,0 +1,25 @@ +{ + lib, + versionData, + mkDerivation, + libncurses-tinfo, + ... +}: +mkDerivation { + path = "lib/ncurses/ncurses"; + extraPaths = [ + "lib/ncurses" + "contrib/ncurses" + "lib/Makefile.inc" + ]; + MK_TESTS = "no"; + preBuild = lib.optionalString (versionData.major == 14) '' + make -C ../tinfo $makeFlags curses.h ncurses_dll.h ncurses_def.h + ''; + buildInputs = lib.optionals (versionData.major == 14) [ libncurses-tinfo ]; + + # some packages depend on libncursesw.so.8 + postInstall = '' + ln -s $out/lib/libncursesw.so.9 $out/lib/libncursesw.so.8 + ''; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix b/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix new file mode 100644 index 0000000000000..a4882ea1970c3 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/libxo.nix @@ -0,0 +1,6 @@ +{ mkDerivation }: +mkDerivation { + path = "lib/libxo"; + extraPaths = [ "contrib/libxo" ]; + MK_TESTS = "no"; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix b/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix new file mode 100644 index 0000000000000..b661a7cee853f --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/locale.nix @@ -0,0 +1,7 @@ +{ mkDerivation, libsbuf }: +mkDerivation { + path = "usr.bin/locale"; + buildInputs = [ libsbuf ]; + extraPaths = [ "lib/libc/locale" ]; + MK_TESTS = "no"; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix b/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix new file mode 100644 index 0000000000000..2e4902860c8d9 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/localedef.nix @@ -0,0 +1,39 @@ +{ + mkDerivation, + lib, + stdenv, + compat, + bsdSetupHook, + byacc, + freebsdSetupHook, + makeMinimal, + install, +}: +mkDerivation ( + { + path = "usr.bin/localedef"; + + extraPaths = [ + "lib/libc/locale" + "lib/libc/stdtime" + ] ++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ "." ]; + + nativeBuildInputs = [ + bsdSetupHook + byacc + freebsdSetupHook + makeMinimal + install + ]; + + buildInputs = [ ]; + + preBuild = lib.optionalString (!stdenv.hostPlatform.isFreeBSD) '' + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${compat}/include -D__unused= -D__pure= -Wno-strict-aliasing" + export NIX_LDFLAGS="$NIX_LDFLAGS -L${compat}/lib" + ''; + + MK_TESTS = "no"; + } + // lib.optionalAttrs (!stdenv.hostPlatform.isFreeBSD) { BOOTSTRAPPING = 1; } +) diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix b/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix new file mode 100644 index 0000000000000..d8d3de93d5ec7 --- /dev/null +++ b/pkgs/os-specific/bsd/freebsd/pkgs/locales.nix @@ -0,0 +1,51 @@ +{ + mkDerivation, + lib, + symlinkJoin, + bsdSetupHook, + freebsdSetupHook, + makeMinimal, + install, + tsort, + lorder, + mandoc, + groff, + localedef, + allLocales ? true, + locales ? [ "en_US.UTF-8" ], +}: +let + build = + name: needsLocaledef: + mkDerivation { + path = "share/${name}"; + + extraPaths = lib.optional needsLocaledef "tools/tools/locale/etc/final-maps"; + nativeBuildInputs = [ + bsdSetupHook + freebsdSetupHook + makeMinimal + install + tsort + lorder + mandoc + groff + ] ++ lib.optional needsLocaledef localedef; + }; + directories = { + colldef = true; + colldef_unicode = true; + ctypedef = true; + monetdef = false; + monetdef_unicode = false; + msgdef = false; + msgdef_unicode = false; + numericdef = false; + numericdef_unicode = false; + timedef = false; + }; +in +symlinkJoin { + name = "freebsd-locales"; + paths = lib.mapAttrsToList build directories; +} diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix index be195b3bc6fa5..12f2c9407e3c2 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix @@ -2,6 +2,9 @@ lib, stdenv, stdenvNoCC, + stdenvNoLibs, + overrideCC, + buildPackages, versionData, writeText, patches, @@ -21,7 +24,15 @@ lib.makeOverridable ( attrs: let - stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv; + stdenv' = + if attrs.noCC or false then + stdenvNoCC + else if attrs.noLibc or false then + stdenvNoLibs + else if attrs.noLibcxx or false then + overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx + else + stdenv; in stdenv'.mkDerivation ( rec { @@ -128,15 +139,17 @@ lib.makeOverridable ( splitPatch = patchFile: let + allLines' = lib.strings.splitString "\n" (builtins.readFile patchFile); + allLines = builtins.filter ( + line: !((lib.strings.hasPrefix "diff --git" line) || (lib.strings.hasPrefix "index " line)) + ) allLines'; foldFunc = a: b: - if (lib.strings.hasPrefix "--- " b) then + if ((lib.strings.hasPrefix "--- " b) || (lib.strings.hasPrefix "diff --git " b)) then (a ++ [ [ b ] ]) else ((lib.lists.init a) ++ (lib.lists.singleton ((lib.lists.last a) ++ [ b ]))); - partitionedPatches' = lib.lists.foldl foldFunc [ [ ] ] ( - lib.strings.splitString "\n" (builtins.readFile patchFile) - ); + partitionedPatches' = lib.lists.foldl foldFunc [ [ ] ] allLines; partitionedPatches = if (builtins.length partitionedPatches' > 1) then (lib.lists.drop 1 partitionedPatches') diff --git a/pkgs/os-specific/darwin/macfuse/default.nix b/pkgs/os-specific/darwin/macfuse/default.nix index c63b536f248b5..4de9600e79108 100644 --- a/pkgs/os-specific/darwin/macfuse/default.nix +++ b/pkgs/os-specific/darwin/macfuse/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "macfuse-stubs"; - version = "4.4.1"; + version = "4.8.0"; src = fetchurl { url = "https://github.com/osxfuse/osxfuse/releases/download/macfuse-${version}/macfuse-${version}.dmg"; - sha256 = "2a2d0f37ec5fcff547c5efa7d08539103a0b46bc16080c2b41a7e749f6e65c61"; + hash = "sha256-ucTzO2qdN4QkowMVvC3+4pjEVjbwMsB0xFk+bvQxwtQ="; }; nativeBuildInputs = [ cpio xar undmg libtapi ]; diff --git a/pkgs/os-specific/darwin/raycast/default.nix b/pkgs/os-specific/darwin/raycast/default.nix index 5df4990b59f2c..4b8ef7031d07d 100644 --- a/pkgs/os-specific/darwin/raycast/default.nix +++ b/pkgs/os-specific/darwin/raycast/default.nix @@ -11,12 +11,12 @@ stdenvNoCC.mkDerivation (finalAttrs: { pname = "raycast"; - version = "1.76.0"; + version = "1.76.1"; src = fetchurl { name = "Raycast.dmg"; url = "https://releases.raycast.com/releases/${finalAttrs.version}/download?build=universal"; - hash = "sha256-9qvXUmCATwugK8lB1LeSnjfr5MNCjF9QTKR29LmbKes="; + hash = "sha256-dZshCh1MSHf7ywwmNOvYNCXfSqC6C8vTCNsh/+klomk="; }; dontPatch = true; diff --git a/pkgs/os-specific/linux/bpftune/default.nix b/pkgs/os-specific/linux/bpftune/default.nix index 8747ef3d928f2..cc97ed16faea1 100644 --- a/pkgs/os-specific/linux/bpftune/default.nix +++ b/pkgs/os-specific/linux/bpftune/default.nix @@ -12,31 +12,28 @@ stdenv.mkDerivation rec { pname = "bpftune"; - version = "0-unstable-2024-05-17"; + version = "0-unstable-2024-06-07"; src = fetchFromGitHub { owner = "oracle"; repo = "bpftune"; - rev = "83115c56cf9620fe5669f4a3be67ab779d8f4536"; - hash = "sha256-er2i7CEUXF3BpWTG//s8C0xfIk5gSVOHB8nE1r7PX78="; + rev = "04bab5dd306b55b3e4e13e261af2480b7ccff9fc"; + hash = "sha256-kVjvupZ6HxJocwXWOrxUNqEGl0welJRlZwvOmMKqeBA="; }; postPatch = '' # otherwise shrink rpath would drop $out/lib from rpath substituteInPlace src/Makefile \ - --replace /lib64 /lib \ - --replace /sbin /bin \ - --replace ldconfig true + --replace-fail /lib64 /lib \ + --replace-fail /sbin /bin \ + --replace-fail ldconfig true substituteInPlace src/bpftune.service \ - --replace /usr/sbin/bpftune "$out/bin/bpftune" + --replace-fail /usr/sbin/bpftune "$out/bin/bpftune" substituteInPlace include/bpftune/libbpftune.h \ - --replace /usr/lib64/bpftune/ "$out/lib/bpftune/" \ - --replace /usr/local/lib64/bpftune/ "$out/lib/bpftune/" + --replace-fail /usr/lib64/bpftune/ "$out/lib/bpftune/" \ + --replace-fail /usr/local/lib64/bpftune/ "$out/lib/bpftune/" substituteInPlace src/libbpftune.c \ - --replace /lib/modules /run/booted-system/kernel-modules/lib/modules - - substituteInPlace src/Makefile sample_tuner/Makefile \ - --replace 'BPF_INCLUDE := /usr/include' 'BPF_INCLUDE := ${lib.getDev libbpf}/include' \ + --replace-fail /lib/modules /run/booted-system/kernel-modules/lib/modules ''; nativeBuildInputs = [ @@ -56,6 +53,7 @@ stdenv.mkDerivation rec { "confprefix=${placeholder "out"}/etc" "BPFTUNE_VERSION=${version}" "NL_INCLUDE=${lib.getDev libnl}/include/libnl3" + "BPF_INCLUDE=${lib.getDev libbpf}/include" ]; hardeningDisable = [ diff --git a/pkgs/os-specific/linux/ksmbd-tools/default.nix b/pkgs/os-specific/linux/ksmbd-tools/default.nix index b81f581c07aaa..de5d15a0c75aa 100644 --- a/pkgs/os-specific/linux/ksmbd-tools/default.nix +++ b/pkgs/os-specific/linux/ksmbd-tools/default.nix @@ -37,6 +37,5 @@ stdenv.mkDerivation rec { homepage = "https://www.kernel.org/doc/html/latest/filesystems/cifs/ksmbd.html"; license = licenses.gpl2; platforms = platforms.linux; - maintainers = with maintainers; [ elohmeier ]; }; } diff --git a/pkgs/os-specific/linux/nsncd/default.nix b/pkgs/os-specific/linux/nsncd/default.nix index 9491c4887fce6..80dfdb5457fa7 100644 --- a/pkgs/os-specific/linux/nsncd/default.nix +++ b/pkgs/os-specific/linux/nsncd/default.nix @@ -7,16 +7,16 @@ rustPlatform.buildRustPackage rec { pname = "nsncd"; - version = "unstable-2024-01-16"; + version = "unstable-2024-03-18"; src = fetchFromGitHub { owner = "twosigma"; repo = "nsncd"; - rev = "f4706786f26d12c533035fb2916be9be5751150b"; - hash = "sha256-GbKDWW00eZZwmslkaGIO8hjCyD5xi7h+S2WP6q5ekOQ="; + rev = "7605e330d5a313a8656e6fcaf1c10cd6b5cdd427"; + hash = "sha256-Bd7qE9MP5coBCkr70TdoJfwYhQpdrn/zmN4KoARcaMI="; }; - cargoSha256 = "sha256-jAxcyMPDTBFBrG0cuKm0Tm5p/UEnUgTPQKDgqY2yK7w="; + cargoHash = "sha256-i1rmc5wxtc631hZy2oM4d6r7od0w8GrG7+/pdM6Gqco="; checkFlags = [ # Relies on the test environment to be able to resolve "localhost" # on IPv4. That's not the case in the Nix sandbox somehow. Works diff --git a/pkgs/os-specific/linux/tuna/default.nix b/pkgs/os-specific/linux/tuna/default.nix index 3b527c8b534fe..634680dc318c2 100644 --- a/pkgs/os-specific/linux/tuna/default.nix +++ b/pkgs/os-specific/linux/tuna/default.nix @@ -57,6 +57,5 @@ buildPythonApplication rec { homepage = "https://git.kernel.org/pub/scm/utils/tuna/tuna.git"; license = licenses.gpl2Plus; platforms = platforms.linux; - maintainers = with maintainers; [ elohmeier ]; }; } diff --git a/pkgs/os-specific/linux/wiringpi/default.nix b/pkgs/os-specific/linux/wiringpi/default.nix index bc80e2a33543b..a8eb74217a4f9 100644 --- a/pkgs/os-specific/linux/wiringpi/default.nix +++ b/pkgs/os-specific/linux/wiringpi/default.nix @@ -1,50 +1,54 @@ -{ lib -, stdenv -, symlinkJoin -, fetchFromGitHub -, libxcrypt +{ + lib, + stdenv, + symlinkJoin, + fetchFromGitHub, + libxcrypt, }: let - version = "2.61-1"; - mkSubProject = { subprj # The only mandatory argument - , buildInputs ? [] - , src ? fetchFromGitHub { + version = "3.6"; + srcAll = fetchFromGitHub { owner = "WiringPi"; repo = "WiringPi"; rev = version; - sha256 = "sha256-VxAaPhaPXd9xYt663Ju6SLblqiSLizauhhuFqCqbO5M="; - } - }: stdenv.mkDerivation (finalAttrs: { - pname = "wiringpi-${subprj}"; - inherit version src; - sourceRoot = "${src.name}/${subprj}"; - inherit buildInputs; - # Remove (meant for other OSs) lines from Makefiles - preInstall = '' - sed -i "/chown root/d" Makefile - sed -i "/chmod/d" Makefile - ''; - makeFlags = [ - "DESTDIR=${placeholder "out"}" - "PREFIX=/." - # On NixOS we don't need to run ldconfig during build: - "LDCONFIG=echo" - ]; - }); + sha256 = "sha256-Hw81Ua9LTb/9l3Js1rx8TfCOF59MrrvH6AGsAsG1SoE="; + }; + mkSubProject = + { + subprj, # The only mandatory argument + buildInputs ? [ ], + src ? srcAll, + }: + stdenv.mkDerivation (finalAttrs: { + pname = "wiringpi-${subprj}"; + inherit version src; + sourceRoot = "${src.name}/${subprj}"; + inherit buildInputs; + # Remove (meant for other OSs) lines from Makefiles + preInstall = '' + sed -i "/chown root/d" Makefile + sed -i "/chmod/d" Makefile + ''; + makeFlags = [ + "DESTDIR=${placeholder "out"}" + "PREFIX=/." + # On NixOS we don't need to run ldconfig during build: + "LDCONFIG=echo" + ]; + }); passthru = { + # Helps nix-update and probably nixpkgs-update find the src of this package + # automatically. + src = srcAll; inherit mkSubProject; wiringPi = mkSubProject { subprj = "wiringPi"; - buildInputs = [ - libxcrypt - ]; + buildInputs = [ libxcrypt ]; }; devLib = mkSubProject { subprj = "devLib"; - buildInputs = [ - passthru.wiringPi - ]; + buildInputs = [ passthru.wiringPi ]; }; wiringPiD = mkSubProject { subprj = "wiringPiD"; |