diff options
Diffstat (limited to 'pkgs/os-specific/bsd/freebsd/pkgs/compat')
3 files changed, 140 insertions, 175 deletions
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-fix-typedefs-locations.patch b/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-fix-typedefs-locations.patch deleted file mode 100644 index 3336a2504e584..0000000000000 --- a/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-fix-typedefs-locations.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- 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 <sys/sysmacros.h> - #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 <sys/types.h> - -+#include <sys/_types.h> -+ - #ifndef __size_t - typedef __SIZE_TYPE__ __size_t; - #endif diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-install-dirs.patch b/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-install-dirs.patch deleted file mode 100644 index 9bb2bea32ee98..0000000000000 --- a/pkgs/os-specific/bsd/freebsd/pkgs/compat/compat-install-dirs.patch +++ /dev/null @@ -1,42 +0,0 @@ -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/pkgs/compat/package.nix b/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix index 5e4528fbf46a1..f597d6e3705b4 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix @@ -1,102 +1,129 @@ -{ lib, stdenv, mkDerivation -, bsdSetupHook, freebsdSetupHook -, makeMinimal, boot-install -, which -, freebsd-lib -, expat, zlib, +{ + lib, + stdenv, + mkDerivation, + versionData, + bsdSetupHook, + freebsdSetupHook, + makeMinimal, + boot-install, + which, + freebsd-lib, + expat, + zlib, }: let inherit (freebsd-lib) mkBsdArch; in -mkDerivation rec { +mkDerivation { 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 - ''; + 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" + ] + ++ lib.optionals (versionData.major == 14) [ "sys/sys/bitcount.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" + ] + ++ lib.optionals (versionData.major == 14) [ + "include/bitstring.h" + "sys/sys/bitstring.h" + "sys/sys/nv_namespace.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/sys/cdefs.h" + #"sys/sys/param.h" + "sys/sys/_null.h" + #"sys/sys/types.h" + "sys/sys/_pthreadtypes.h" + "sys/sys/_stdint.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" + "lib/libmd" + + # idk bro + "sys/sys/kbio.h" + ]; + + 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 @@ -109,13 +136,17 @@ mkDerivation rec { ''; nativeBuildInputs = [ - bsdSetupHook freebsdSetupHook + bsdSetupHook + freebsdSetupHook makeMinimal boot-install which ]; - buildInputs = [ expat zlib ]; + buildInputs = [ + expat + zlib + ]; makeFlags = [ "STRIP=-s" # flag to install, not command @@ -124,12 +155,20 @@ mkDerivation rec { "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 - ''; + 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 + ''; + + # Compat is for making other platforms look like FreeBSD (e.g. to + # build build-time dependencies for building FreeBSD packages). It is + # not needed when building for FreeBSD. + meta.broken = stdenv.hostPlatform.isFreeBSD; } |