mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-09-29 15:43:00 +00:00
freebsd: Cleanup, get ready to support version 14
* Extend libc Include non-libc core libraries in the libc package. Many of these mirror libraries present in glibc on linux, such as libgcc, libraries used for iconv, and libraries used for reading kernel info (libkvm, libprocstat, libmemstat). Without this many packages outside the freebsd tree would need to be modified to include standard dependencies which would already be on the system for other packages. * Mark FreeBSD as using LLVM * Update default LLVM version FreeBSD * Use patch monolith The patchesRoot system combined with the fact that each derivation will Request specific names of patches makes it very annoying to use other FreeBSD source trees with nixpkgs. This new system allows providing one Or more entire trees of patches whose contents will be dynamically Parsed and only the relevant patches will be applied for any one Derivation. With this commit, the following knobs are available for specifying the FreeBSD source: - overriding `freebsd.versionInfo`, for picking another official supported FreeBSD release. - overriding `freebsd.source` for specifying a specific unpatched FreeBSD source tree. - overriding `freebsd.patches`, for specifying the patches to apply. Co-Authored-by: Audrey Dutcher <audrey@rhelmot.io> Co-Authored-by: John Ericson <John.Ericson@Obsidian.Systems>
This commit is contained in:
parent
f571081899
commit
06b05d2289
@ -81,6 +81,8 @@ let
|
||||
&& final.parsed.kernel == platform.parsed.kernel;
|
||||
isCompatible = _: throw "2022-05-23: isCompatible has been removed in favor of canExecute, refer to the 22.11 changelog for details";
|
||||
# Derived meta-data
|
||||
useLLVM = final.isFreeBSD;
|
||||
|
||||
libc =
|
||||
/**/ if final.isDarwin then "libSystem"
|
||||
else if final.isMinGW then "msvcrt"
|
||||
|
@ -17,6 +17,7 @@ lib.packagesFromDirectoryRecursive {
|
||||
}
|
||||
// {
|
||||
inherit sourceData patchesRoot versionData;
|
||||
patches = ./patches/${self.versionData.revision};
|
||||
|
||||
# Keep the crawled portion of Nixpkgs finite.
|
||||
buildFreebsd = lib.dontRecurseIntoAttrs buildFreebsd;
|
||||
@ -26,7 +27,8 @@ lib.packagesFromDirectoryRecursive {
|
||||
sha256 = "BpHqJfnGOeTE7tkFJBx0Wk8ryalmf4KNTit/Coh026E=";
|
||||
};
|
||||
|
||||
compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isFreeBSD) self.compat;
|
||||
compatIsNeeded = !stdenvNoCC.hostPlatform.isFreeBSD;
|
||||
compatIfNeeded = lib.optional self.compatIsNeeded self.compat;
|
||||
freebsd-lib = import ./lib {
|
||||
version = lib.concatStringsSep "." (
|
||||
map toString (
|
||||
@ -44,7 +46,7 @@ lib.packagesFromDirectoryRecursive {
|
||||
|
||||
compat = self.callPackage ./pkgs/compat/package.nix {
|
||||
inherit stdenv;
|
||||
inherit (buildFreebsd) makeMinimal boot-install;
|
||||
inherit (buildFreebsd) makeMinimal;
|
||||
};
|
||||
|
||||
csu = self.callPackage ./pkgs/csu.nix {
|
||||
@ -52,13 +54,11 @@ lib.packagesFromDirectoryRecursive {
|
||||
inherit (self) include;
|
||||
};
|
||||
|
||||
include = self.callPackage ./pkgs/include/package.nix {
|
||||
inherit (buildFreebsd) makeMinimal install rpcgen;
|
||||
};
|
||||
include = self.callPackage ./pkgs/include/package.nix { inherit (buildFreebsd) rpcgen mtree; };
|
||||
|
||||
install = self.callPackage ./pkgs/install.nix {
|
||||
inherit (buildFreebsd) makeMinimal;
|
||||
inherit (self) mtree libnetbsd;
|
||||
inherit (self) libmd libnetbsd;
|
||||
};
|
||||
|
||||
libc = self.callPackage ./pkgs/libc/package.nix {
|
||||
@ -67,16 +67,30 @@ lib.packagesFromDirectoryRecursive {
|
||||
install
|
||||
gencat
|
||||
rpcgen
|
||||
mkcsmapper
|
||||
mkesdb
|
||||
;
|
||||
inherit (self) csu include;
|
||||
};
|
||||
|
||||
libnetbsd = self.callPackage ./pkgs/libnetbsd/package.nix { inherit (buildFreebsd) makeMinimal; };
|
||||
|
||||
libmd = self.callPackage ./pkgs/libmd.nix { inherit (buildFreebsd) makeMinimal; };
|
||||
|
||||
mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
|
||||
inherit stdenv;
|
||||
inherit (buildFreebsd) makeMinimal install tsort;
|
||||
inherit (buildFreebsd)
|
||||
freebsdSetupHook
|
||||
makeMinimal
|
||||
install
|
||||
tsort
|
||||
lorder
|
||||
;
|
||||
};
|
||||
|
||||
makeMinimal = self.callPackage ./pkgs/makeMinimal.nix { inherit (self) make; };
|
||||
|
||||
mtree = self.callPackage ./pkgs/mtree.nix { inherit (self) libnetbsd libmd; };
|
||||
|
||||
tsort = self.callPackage ./pkgs/tsort.nix { inherit (buildFreebsd) makeMinimal install; };
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
--- a/contrib/mtree/Makefile 2023-12-04 23:02:13.919144141 -0700
|
||||
+++ b/contrib/mtree/Makefile 2023-12-04 23:02:58.371810109 -0700
|
||||
@@ -10,8 +10,8 @@
|
||||
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \
|
||||
verify.c getid.c pack_dev.c only.c
|
||||
.if (${HOSTPROG:U} == "")
|
||||
-DPADD+= ${LIBUTIL}
|
||||
-LDADD+= -lutil
|
||||
+LIBADD+= ${LIBUTIL}
|
||||
+#LIBADD+= -lutil
|
||||
.endif
|
||||
|
||||
CPPFLAGS+= -I${NETBSDSRCDIR}/sbin/mknod
|
@ -2,7 +2,7 @@
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
patchesRoot,
|
||||
versionData,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
@ -17,7 +17,7 @@ let
|
||||
inherit (freebsd-lib) mkBsdArch;
|
||||
in
|
||||
|
||||
mkDerivation rec {
|
||||
mkDerivation {
|
||||
pname = "compat";
|
||||
path = "tools/build";
|
||||
extraPaths =
|
||||
@ -80,6 +80,12 @@ mkDerivation rec {
|
||||
"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"
|
||||
@ -92,12 +98,11 @@ mkDerivation rec {
|
||||
|
||||
"lib/libcapsicum"
|
||||
"lib/libcasper"
|
||||
];
|
||||
"lib/libmd"
|
||||
|
||||
patches = [
|
||||
/${patchesRoot}/compat-install-dirs.patch
|
||||
/${patchesRoot}/compat-fix-typedefs-locations.patch
|
||||
];
|
||||
# idk bro
|
||||
"sys/sys/kbio.h"
|
||||
];
|
||||
|
||||
preBuild =
|
||||
''
|
||||
@ -151,4 +156,9 @@ mkDerivation rec {
|
||||
+ 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;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
isStatic = true;
|
||||
path = "lib/csu";
|
||||
extraPaths = [
|
||||
"lib/Makefile.inc"
|
||||
|
@ -1,15 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
install,
|
||||
mandoc,
|
||||
groff,
|
||||
compatIfNeeded,
|
||||
libelf,
|
||||
libdwarf,
|
||||
zlib,
|
||||
libspl,
|
||||
@ -26,21 +18,18 @@ mkDerivation {
|
||||
];
|
||||
OPENSOLARIS_USR_DISTDIR = "$(SRCTOP)/cddl/contrib/opensolaris";
|
||||
OPENSOLARIS_SYS_DISTDIR = "$(SRCTOP)/sys/cddl/contrib/opensolaris";
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
makeMinimal
|
||||
install
|
||||
mandoc
|
||||
groff
|
||||
|
||||
# flex byacc file2c
|
||||
makeFlags = [
|
||||
"STRIP=-s"
|
||||
"MK_WERROR=no"
|
||||
"MK_TESTS=no"
|
||||
];
|
||||
|
||||
buildInputs = compatIfNeeded ++ [
|
||||
libelf
|
||||
libdwarf
|
||||
zlib
|
||||
libspl
|
||||
];
|
||||
|
||||
meta.license = lib.licenses.cddl;
|
||||
}
|
||||
|
23
pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix
Normal file
23
pkgs/os-specific/bsd/freebsd/pkgs/filterSource.nix
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
lib,
|
||||
pkgsBuildBuild,
|
||||
runCommand,
|
||||
writeText,
|
||||
source,
|
||||
}:
|
||||
|
||||
{
|
||||
pname,
|
||||
path,
|
||||
extraPaths ? [ ],
|
||||
}:
|
||||
|
||||
let
|
||||
sortedPaths = lib.naturalSort ([ path ] ++ extraPaths);
|
||||
filterText = writeText "${pname}-src-include" (
|
||||
lib.concatMapStringsSep "\n" (path: "/${path}") sortedPaths
|
||||
);
|
||||
in
|
||||
runCommand "${pname}-filtered-src" { nativeBuildInputs = [ pkgsBuildBuild.rsync ]; } ''
|
||||
rsync -a -r --files-from=${filterText} ${source}/ $out
|
||||
''
|
@ -5,7 +5,18 @@ setFreeBSDSrcTop() {
|
||||
addFreeBSDMakeFlags() {
|
||||
makeFlags="SBINDIR=${!outputBin}/bin $makeFlags"
|
||||
makeFlags="LIBEXECDIR=${!outputLib}/libexec $makeFlags"
|
||||
makeFlags="LIBDATADIR=${!outputLib}/data $makeFlags"
|
||||
makeFlags="INCLUDEDIR=${!outputDev}/include $makeFlags"
|
||||
makeFlags="CONFDIR=${!outputBin}/etc $makeFlags"
|
||||
makeFlags="MANDIR=${!outputMan}/share/man/man $makeFlags"
|
||||
|
||||
if [ -n "$debug" ]; then
|
||||
makeFlags="DEBUGFILEDIR=${debug}/lib/debug $makeFlags"
|
||||
else
|
||||
makeFlags="DEBUGFILEDIR=${out}/lib/debug $makeFlags"
|
||||
fi
|
||||
|
||||
echo $makeFlags
|
||||
}
|
||||
|
||||
postUnpackHooks+=(setFreeBSDSrcTop)
|
||||
|
@ -1,19 +1,13 @@
|
||||
{
|
||||
lib,
|
||||
mkDerivation,
|
||||
patchesRoot,
|
||||
buildPackages,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
install,
|
||||
mandoc,
|
||||
groff,
|
||||
rsync, # , nbperf
|
||||
rpcgen,
|
||||
mtree,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
isStatic = true;
|
||||
path = "include";
|
||||
|
||||
extraPaths = [
|
||||
@ -22,22 +16,11 @@ mkDerivation {
|
||||
"sys"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
makeMinimal
|
||||
install
|
||||
mandoc
|
||||
groff
|
||||
rsync # nbperf
|
||||
extraNativeBuildInputs = [
|
||||
rpcgen
|
||||
|
||||
# HACK use NetBSD's for now
|
||||
buildPackages.netbsd.mtree
|
||||
mtree
|
||||
];
|
||||
|
||||
patches = [ /${patchesRoot}/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.
|
||||
@ -46,6 +29,7 @@ mkDerivation {
|
||||
sed -i -E \
|
||||
-e 's_/usr/include_''${INCSDIR0}_' \
|
||||
{} \;
|
||||
sed -E -i -e "/_PATH_LOGIN/d" $BSDSRCDIR/include/paths.h
|
||||
'';
|
||||
|
||||
makeFlags = [ "RPCGEN_CPP=${buildPackages.stdenv.cc.cc}/bin/cpp" ];
|
||||
|
@ -4,7 +4,6 @@
|
||||
mkDerivation,
|
||||
writeShellScript,
|
||||
freebsd-lib,
|
||||
mtree,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
@ -30,7 +29,7 @@ let
|
||||
in
|
||||
mkDerivation {
|
||||
path = "usr.bin/xinstall";
|
||||
extraPaths = [ mtree.path ];
|
||||
extraPaths = [ "contrib/mtree" ];
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
@ -44,13 +43,18 @@ mkDerivation {
|
||||
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";
|
||||
makeFlags =
|
||||
[
|
||||
"STRIP=-s" # flag to install, not command
|
||||
"MK_WERROR=no"
|
||||
"TESTSDIR=${builtins.placeholder "test"}"
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [
|
||||
"BOOTSTRAPPING=1"
|
||||
"INSTALL=boot-install"
|
||||
];
|
||||
postInstall = ''
|
||||
install -D -m 0550 ${binstall} $out/bin/binstall
|
||||
install -C -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
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
lib,
|
||||
buildPackages,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
patchesRoot,
|
||||
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
@ -12,62 +12,105 @@
|
||||
byacc,
|
||||
gencat,
|
||||
rpcgen,
|
||||
mkcsmapper,
|
||||
mkesdb,
|
||||
|
||||
csu,
|
||||
include,
|
||||
versionData,
|
||||
}:
|
||||
|
||||
mkDerivation rec {
|
||||
mkDerivation {
|
||||
isStatic = true;
|
||||
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"
|
||||
extraPaths =
|
||||
[
|
||||
"lib/libc_nonshared"
|
||||
"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"
|
||||
# libthr
|
||||
"lib/libthr"
|
||||
"lib/libthread_db"
|
||||
"libexec/rtld-elf"
|
||||
"lib/csu/common/crtbrand.S"
|
||||
"lib/csu/common/notes.h"
|
||||
|
||||
# librpcsvc
|
||||
"lib/librpcsvc"
|
||||
# librpcsvc
|
||||
"lib/librpcsvc"
|
||||
|
||||
# librt
|
||||
"lib/librt"
|
||||
# librt
|
||||
"lib/librt"
|
||||
|
||||
# libcrypt
|
||||
"lib/libcrypt"
|
||||
"lib/libmd"
|
||||
"sys/crypto/sha2"
|
||||
];
|
||||
# libcrypt
|
||||
"lib/libcrypt"
|
||||
"lib/libmd"
|
||||
"sys/crypto/sha2"
|
||||
"sys/crypto/skein"
|
||||
|
||||
patches = [
|
||||
# Hack around broken propogating MAKEFLAGS to submake, just inline logic
|
||||
/${patchesRoot}/libc-msun-arch-subdir.patch
|
||||
# libgcc and friends
|
||||
"lib/libgcc_eh"
|
||||
"lib/libgcc_s"
|
||||
"lib/libcompiler_rt"
|
||||
"contrib/llvm-project/libunwind"
|
||||
"contrib/llvm-project/compiler-rt"
|
||||
#"contrib/llvm-project/libcxx"
|
||||
|
||||
# Don't force -lcompiler-rt, we don't actually call it that
|
||||
/${patchesRoot}/libc-no-force--lcompiler-rt.patch
|
||||
# terminfo
|
||||
"lib/ncurses"
|
||||
"contrib/ncurses"
|
||||
"lib/Makefile.inc"
|
||||
]
|
||||
++ lib.optionals (stdenv.hostPlatform.isx86_32) [ "lib/libssp_nonshared" ]
|
||||
++ [
|
||||
"lib/libexecinfo"
|
||||
"contrib/libexecinfo"
|
||||
|
||||
# Fix extra include dir to get rpcsvc headers.
|
||||
/${patchesRoot}/librpcsvc-include-subdir.patch
|
||||
];
|
||||
"lib/libkvm"
|
||||
"sys" # ummmmmmmmmm libkvm wants arch-specific headers from the kernel tree
|
||||
|
||||
"lib/libmemstat"
|
||||
|
||||
"lib/libprocstat"
|
||||
"sys/contrib/openzfs"
|
||||
"sys/contrib/pcg-c"
|
||||
"sys/opencrypto"
|
||||
"sys/contrib/ck"
|
||||
"sys/crypto"
|
||||
|
||||
"lib/libdevstat"
|
||||
|
||||
"lib/libelf"
|
||||
"contrib/elftoolchain"
|
||||
|
||||
"lib/libiconv_modules"
|
||||
"share/i18n"
|
||||
"include/paths.h"
|
||||
|
||||
"lib/libdl"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace $COMPONENT_PATH/Makefile --replace '.include <src.opts.mk>' ""
|
||||
|
||||
substituteInPlace $BSDSRCDIR/include/paths.h \
|
||||
--replace '/usr/lib/i18n' '${builtins.placeholder "out"}/lib/i18n' \
|
||||
--replace '/usr/share/i18n' '${builtins.placeholder "out"}/share/i18n'
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
@ -80,16 +123,20 @@ mkDerivation rec {
|
||||
byacc
|
||||
gencat
|
||||
rpcgen
|
||||
mkcsmapper
|
||||
mkesdb
|
||||
];
|
||||
buildInputs = [
|
||||
include
|
||||
csu
|
||||
];
|
||||
env.NIX_CFLAGS_COMPILE = "-B${csu}/lib";
|
||||
|
||||
# Suppress lld >= 16 undefined version errors
|
||||
# https://github.com/freebsd/freebsd-src/commit/2ba84b4bcdd6012e8cfbf8a0d060a4438623a638
|
||||
env.NIX_LDFLAGS = lib.optionalString (stdenv.targetPlatform.linker == "lld") "--undefined-version";
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-B${csu}/lib"
|
||||
# These are supposed to have _RTLD_COMPAT_LIB_SUFFIX so we can get things like "lib32"
|
||||
# but that's unnecessary
|
||||
"-DSTANDARD_LIBRARY_PATH=\"${builtins.placeholder "out"}/lib\""
|
||||
"-D_PATH_RTLD=\"${builtins.placeholder "out"}/libexec/ld-elf.so.1\""
|
||||
];
|
||||
|
||||
makeFlags = [
|
||||
"STRIP=-s" # flag to install, not command
|
||||
@ -100,7 +147,7 @@ mkDerivation rec {
|
||||
MK_SYMVER = "yes";
|
||||
MK_SSP = "yes";
|
||||
MK_NLS = "yes";
|
||||
MK_ICONV = "no"; # TODO make srctop
|
||||
MK_ICONV = "yes";
|
||||
MK_NS_CACHING = "yes";
|
||||
MK_INET6_SUPPORT = "yes";
|
||||
MK_HESIOD = "yes";
|
||||
@ -112,44 +159,125 @@ mkDerivation rec {
|
||||
MK_MALLOC_PRODUCTION = "yes";
|
||||
|
||||
MK_TESTS = "no";
|
||||
MACHINE_ABI = "";
|
||||
MK_DETECT_TZ_CHANGES = "no";
|
||||
MK_MACHDEP_OPTIMIZATIONS = "yes";
|
||||
MK_ASAN = "no";
|
||||
MK_UBSAN = "no";
|
||||
|
||||
postInstall = ''
|
||||
pushd ${include}
|
||||
find . -type d -exec mkdir -p $out/\{} \;
|
||||
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
|
||||
popd
|
||||
NO_FSCHG = "yes";
|
||||
|
||||
pushd ${csu}
|
||||
find . -type d -exec mkdir -p $out/\{} \;
|
||||
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
|
||||
popd
|
||||
preBuild = lib.optionalString (stdenv.hostPlatform.isx86_32) ''
|
||||
make -C $BSDSRCDIR/lib/libssp_nonshared $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libssp_nonshared $makeFlags install
|
||||
'';
|
||||
|
||||
sed -i -e 's| [^ ]*/libc_nonshared.a||' $out/lib/libc.so
|
||||
postInstall =
|
||||
''
|
||||
pushd ${include}
|
||||
find . -type d -exec mkdir -p $out/\{} \;
|
||||
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
|
||||
popd
|
||||
|
||||
$CC -nodefaultlibs -lgcc -shared -o $out/lib/libgcc_s.so
|
||||
pushd ${csu}
|
||||
find . -type d -exec mkdir -p $out/\{} \;
|
||||
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
|
||||
popd
|
||||
|
||||
NIX_CFLAGS_COMPILE+=" -B$out/lib"
|
||||
NIX_CFLAGS_COMPILE+=" -I$out/include"
|
||||
NIX_LDFLAGS+=" -L$out/lib"
|
||||
mkdir $BSDSRCDIR/lib/libcompiler_rt/i386
|
||||
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libthr $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libthr $makeFlags install
|
||||
make -C $BSDSRCDIR/lib/libgcc_eh $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libgcc_eh $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/msun $makeFlags
|
||||
make -C $BSDSRCDIR/lib/msun $makeFlags install
|
||||
ln -s $BSDSRCDIR/lib/libc/libc.so.7 $BSDSRCDIR/lib/libc/libc.so # not sure
|
||||
mkdir $BSDSRCDIR/lib/libgcc_s/i386
|
||||
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/librpcsvc $makeFlags
|
||||
make -C $BSDSRCDIR/lib/librpcsvc $makeFlags install
|
||||
NIX_CFLAGS_COMPILE+=" -B$out/lib"
|
||||
NIX_CFLAGS_COMPILE+=" -I$out/include"
|
||||
NIX_LDFLAGS+=" -L$out/lib"
|
||||
|
||||
make -C $BSDSRCDIR/lib/libutil $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libutil $makeFlags install
|
||||
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/librt $makeFlags
|
||||
make -C $BSDSRCDIR/lib/librt $makeFlags install
|
||||
mkdir $BSDSRCDIR/lib/libmd/sys
|
||||
make -C $BSDSRCDIR/lib/libmd $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libmd $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libcrypt $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libcrypt $makeFlags install
|
||||
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
|
||||
|
||||
make -C $BSDSRCDIR/lib/libelf $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libelf $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libexecinfo $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libexecinfo $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libkvm $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libkvm $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libmemstat $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libmemstat $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libprocstat $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libprocstat $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libdevstat $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libdevstat $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libiconv_modules $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libiconv_modules $makeFlags SHLIBDIR=${builtins.placeholder "out"}/lib/i18n install
|
||||
|
||||
make -C $BSDSRCDIR/lib/libdl $makeFlags
|
||||
make -C $BSDSRCDIR/lib/libdl $makeFlags install
|
||||
|
||||
make -C $BSDSRCDIR/share/i18n $makeFlags
|
||||
make -C $BSDSRCDIR/share/i18n $makeFlags ESDBDIR=${builtins.placeholder "out"}/share/i18n/esdb CSMAPPERDIR=${builtins.placeholder "out"}/share/i18n/csmapper install
|
||||
|
||||
''
|
||||
+ lib.optionalString stdenv.hostPlatform.isx86_32 ''
|
||||
$CC -c $BSDSRCDIR/contrib/llvm-project/compiler-rt/lib/builtins/udivdi3.c -o $BSDSRCDIR/contrib/llvm-project/compiler-rt/lib/builtins/udivdi3.o
|
||||
ORIG_NIX_LDFLAGS="$NIX_LDFLAGS"
|
||||
NIX_LDFLAGS+=" $BSDSRCDIR/contrib/llvm-project/compiler-rt/lib/builtins/udivdi3.o"
|
||||
''
|
||||
+ ''
|
||||
make -C $BSDSRCDIR/libexec/rtld-elf $makeFlags
|
||||
make -C $BSDSRCDIR/libexec/rtld-elf $makeFlags install
|
||||
rm -f $out/libexec/ld-elf.so.1
|
||||
mv $out/bin/ld-elf.so.1 $out/libexec
|
||||
'';
|
||||
|
||||
# libc should not be allowed to refer to anything other than itself
|
||||
postFixup = ''
|
||||
find $out -type f | xargs -n1 ${buildPackages.patchelf}/bin/patchelf --shrink-rpath --allowed-rpath-prefixes $out || true
|
||||
'';
|
||||
|
||||
meta.platforms = lib.platforms.freebsd;
|
||||
|
||||
# definitely a bad idea to enable stack protection on the stack protection initializers
|
||||
hardeningDisable = [ "stackprotector" ];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
"debug"
|
||||
];
|
||||
}
|
||||
|
@ -1,16 +1,8 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
install,
|
||||
mandoc,
|
||||
groff,
|
||||
m4,
|
||||
compatIfNeeded,
|
||||
libelf,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
@ -22,16 +14,7 @@ mkDerivation {
|
||||
"sys/sys/elf64.h"
|
||||
"sys/sys/elf_common.h"
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
makeMinimal
|
||||
install
|
||||
mandoc
|
||||
groff
|
||||
|
||||
m4
|
||||
];
|
||||
buildInputs = compatIfNeeded ++ [ libelf ];
|
||||
extraNativeBuildInputs = [ m4 ];
|
||||
buildInputs = compatIfNeeded ++ [ zlib ];
|
||||
MK_TESTS = "no";
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
install,
|
||||
mandoc,
|
||||
groff,
|
||||
m4,
|
||||
}:
|
||||
|
||||
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 = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
makeMinimal
|
||||
install
|
||||
mandoc
|
||||
groff
|
||||
|
||||
m4
|
||||
];
|
||||
MK_TESTS = "no";
|
||||
}
|
49
pkgs/os-specific/bsd/freebsd/pkgs/libmd.nix
Normal file
49
pkgs/os-specific/bsd/freebsd/pkgs/libmd.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
freebsdSetupHook,
|
||||
bsdSetupHook,
|
||||
makeMinimal,
|
||||
}:
|
||||
mkDerivation {
|
||||
path = "lib/libmd";
|
||||
extraPaths = [
|
||||
"sys/sys/md5.h"
|
||||
"sys/crypto/sha2"
|
||||
"sys/crypto/skein"
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
makeMinimal
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
];
|
||||
|
||||
makeFlags = [
|
||||
"STRIP=-s" # flag to install, not command
|
||||
"RELDIR=."
|
||||
] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no";
|
||||
|
||||
preBuild = ''
|
||||
mkdir sys
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
# libmd is used by install. do it yourself!
|
||||
mkdir -p $out/include $out/lib $man/share/man
|
||||
cp libmd.a $out/lib/libmd.a
|
||||
for f in $(make $makeFlags -V INCS); do
|
||||
if [ -e "$f" ]; then cp "$f" "$out/include/$f"; fi
|
||||
if [ -e "$BSDSRCDIR/sys/crypto/sha2/$f" ]; then cp "$BSDSRCDIR/sys/crypto/sha2/$f" "$out/include/$f"; fi
|
||||
if [ -e "$BSDSRCDIR/sys/crypto/skein/$f" ]; then cp "$BSDSRCDIR/sys/crypto/skein/$f" "$out/include/$f"; fi
|
||||
done
|
||||
for f in $(make $makeFlags -V MAN); do
|
||||
cp "$f" "$man/share/man/$f"
|
||||
done
|
||||
'';
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
"man"
|
||||
];
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
patchesRoot,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
@ -10,7 +9,6 @@
|
||||
groff,
|
||||
boot-install,
|
||||
install,
|
||||
compatIfNeeded,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
@ -23,13 +21,8 @@ mkDerivation {
|
||||
groff
|
||||
(if stdenv.hostPlatform == stdenv.buildPlatform then boot-install else install)
|
||||
];
|
||||
patches = lib.optionals (!stdenv.hostPlatform.isFreeBSD) [
|
||||
/${patchesRoot}/libnetbsd-do-install.patch
|
||||
#/${patchesRoot}/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 = compatIfNeeded;
|
||||
}
|
||||
|
@ -3,19 +3,20 @@
|
||||
mkDerivation {
|
||||
path = "cddl/lib/libspl";
|
||||
extraPaths = [
|
||||
"sys/contrib/openzfs/lib/libspl"
|
||||
"sys/contrib/openzfs/include"
|
||||
|
||||
"cddl/compat/opensolaris/include"
|
||||
"sys/contrib/openzfs/include"
|
||||
"sys/contrib/openzfs/lib/libspl"
|
||||
"sys/contrib/openzfs/module/icp/include"
|
||||
"sys/modules/zfs"
|
||||
"sys/modules/zfs/zfs_config.h"
|
||||
];
|
||||
# nativeBuildInputs = [
|
||||
# bsdSetupHook freebsdSetupHook
|
||||
# makeMinimal install mandoc groff
|
||||
|
||||
# flex byacc file2c
|
||||
# ];
|
||||
# buildInputs = compatIfNeeded ++ [ libnv libsbuf ];
|
||||
meta.license = lib.licenses.cddl;
|
||||
# Without a prefix it will try to put object files in nonexistant directories
|
||||
preBuild = ''
|
||||
export MAKEOBJDIRPREFIX=$TMP/obj
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
platform = platforms.freebsd;
|
||||
license = licenses.cddl;
|
||||
};
|
||||
}
|
||||
|
@ -6,6 +6,5 @@
|
||||
mkDerivation {
|
||||
path = "lib/libutil";
|
||||
extraPaths = [ "lib/libc/gen" ];
|
||||
clangFixup = true;
|
||||
MK_TESTS = "no";
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
}:
|
||||
|
||||
mkDerivation rec {
|
||||
mkDerivation {
|
||||
path = "usr.bin/lorder";
|
||||
noCC = true;
|
||||
dontBuild = true;
|
||||
|
@ -7,7 +7,7 @@
|
||||
freebsdSetupHook,
|
||||
}:
|
||||
|
||||
mkDerivation rec {
|
||||
mkDerivation {
|
||||
inherit (make) path;
|
||||
|
||||
buildInputs = [ ];
|
||||
@ -25,6 +25,8 @@ mkDerivation rec {
|
||||
${make.postPatch}
|
||||
'';
|
||||
|
||||
configureFlags = [ "--with-filemon=no" ];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
|
@ -2,11 +2,12 @@
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
versionData,
|
||||
writeText,
|
||||
patches,
|
||||
compatIfNeeded,
|
||||
runCommand,
|
||||
rsync,
|
||||
freebsd-lib,
|
||||
source,
|
||||
filterSource,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
makeMinimal,
|
||||
@ -24,21 +25,13 @@ lib.makeOverridable (
|
||||
in
|
||||
stdenv'.mkDerivation (
|
||||
rec {
|
||||
pname = "${attrs.pname or (baseNameOf attrs.path)}-freebsd";
|
||||
inherit (freebsd-lib) 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="${source}/$p"
|
||||
if [[ -d "$src_path" ]]; then src_path+=/; fi
|
||||
rsync --chmod="+w" -r "$src_path" "$path"
|
||||
set +x
|
||||
done
|
||||
'';
|
||||
|
||||
extraPaths = [ ];
|
||||
pname = "${attrs.pname or (baseNameOf attrs.path)}";
|
||||
src = filterSource {
|
||||
inherit pname;
|
||||
inherit (attrs) path;
|
||||
extraPaths = attrs.extraPaths or [ ];
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
@ -48,8 +41,8 @@ lib.makeOverridable (
|
||||
tsort
|
||||
lorder
|
||||
mandoc
|
||||
groff # statHook
|
||||
];
|
||||
groff
|
||||
] ++ attrs.extraNativeBuildInputs or [ ];
|
||||
buildInputs = compatIfNeeded;
|
||||
|
||||
HOST_SH = stdenv'.shell;
|
||||
@ -72,11 +65,17 @@ lib.makeOverridable (
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
meta = with lib; {
|
||||
maintainers = with maintainers; [ ericson2314 ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.bsd2;
|
||||
};
|
||||
meta =
|
||||
with lib;
|
||||
{
|
||||
maintainers = with maintainers; [
|
||||
rhelmot
|
||||
artemist
|
||||
];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.bsd2;
|
||||
}
|
||||
// attrs.meta or { };
|
||||
}
|
||||
// lib.optionalAttrs stdenv'.hasCC {
|
||||
# TODO should CC wrapper set this?
|
||||
@ -95,5 +94,69 @@ lib.makeOverridable (
|
||||
dontBuild = true;
|
||||
}
|
||||
// attrs
|
||||
// lib.optionalAttrs (stdenv'.hasCC && stdenv'.cc.isClang or false && attrs.clangFixup or true) {
|
||||
preBuild =
|
||||
''
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -D_VA_LIST -D_VA_LIST_DECLARED -Dva_list=__builtin_va_list -D_SIZE_T_DECLARED -D_SIZE_T -Dsize_t=__SIZE_TYPE__ -D_WCHAR_T"
|
||||
export NIX_LDFLAGS="$NIX_LDFLAGS --undefined-version"
|
||||
''
|
||||
+ (attrs.preBuild or "");
|
||||
}
|
||||
// {
|
||||
patches =
|
||||
let
|
||||
isDir =
|
||||
file:
|
||||
let
|
||||
base = baseNameOf file;
|
||||
type = (builtins.readDir (dirOf file)).${base} or null;
|
||||
in
|
||||
file == /. || type == "directory";
|
||||
consolidatePatches =
|
||||
patches:
|
||||
if (lib.isDerivation patches) then
|
||||
[ patches ]
|
||||
else if (builtins.isPath patches) then
|
||||
(if (isDir patches) then (lib.filesystem.listFilesRecursive patches) else [ patches ])
|
||||
else if (builtins.isList patches) then
|
||||
(lib.flatten (builtins.map consolidatePatches patches))
|
||||
else
|
||||
throw "Bad patches - must be path or derivation or list thereof";
|
||||
consolidated = consolidatePatches patches;
|
||||
splitPatch =
|
||||
patchFile:
|
||||
let
|
||||
foldFunc =
|
||||
a: b:
|
||||
if (lib.strings.hasPrefix "--- " 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 =
|
||||
if (builtins.length partitionedPatches' > 1) then
|
||||
(lib.lists.drop 1 partitionedPatches')
|
||||
else
|
||||
(throw "${patchFile} does not seem to be a unified patch (diff -u). this is required for FreeBSD.");
|
||||
filterFunc =
|
||||
patchLines:
|
||||
let
|
||||
prefixedPath = builtins.elemAt (builtins.split " |\t" (builtins.elemAt patchLines 1)) 2;
|
||||
unfixedPath = lib.path.subpath.join (lib.lists.drop 1 (lib.path.subpath.components prefixedPath));
|
||||
in
|
||||
lib.lists.any (included: lib.path.hasPrefix (/. + ("/" + included)) (/. + ("/" + unfixedPath))) (
|
||||
(attrs.extraPaths or [ ]) ++ [ attrs.path ]
|
||||
);
|
||||
filteredLines = builtins.filter filterFunc partitionedPatches;
|
||||
derive = patchLines: writeText "freebsd-patch" (lib.concatLines patchLines);
|
||||
derivedPatches = builtins.map derive filteredLines;
|
||||
in
|
||||
derivedPatches;
|
||||
picked = lib.lists.concatMap splitPatch consolidated;
|
||||
in
|
||||
picked ++ attrs.patches or [ ];
|
||||
}
|
||||
)
|
||||
)
|
||||
|
22
pkgs/os-specific/bsd/freebsd/pkgs/mkcsmapper.nix
Normal file
22
pkgs/os-specific/bsd/freebsd/pkgs/mkcsmapper.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
byacc,
|
||||
flex,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
path = "usr.bin/mkcsmapper";
|
||||
|
||||
extraPaths = [
|
||||
"lib/libc/iconv"
|
||||
"lib/libiconv_modules/mapper_std"
|
||||
];
|
||||
|
||||
BOOTSTRAPPING = !stdenv.hostPlatform.isFreeBSD;
|
||||
|
||||
extraNativeBuildInputs = [
|
||||
byacc
|
||||
flex
|
||||
];
|
||||
}
|
19
pkgs/os-specific/bsd/freebsd/pkgs/mkesdb.nix
Normal file
19
pkgs/os-specific/bsd/freebsd/pkgs/mkesdb.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
byacc,
|
||||
flex,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
path = "usr.bin/mkesdb";
|
||||
|
||||
extraPaths = [ "lib/libc/iconv" ];
|
||||
|
||||
BOOTSTRAPPING = !stdenv.hostPlatform.isFreeBSD;
|
||||
|
||||
extraNativeBuildInputs = [
|
||||
byacc
|
||||
flex
|
||||
];
|
||||
}
|
@ -1,6 +1,39 @@
|
||||
{ mkDerivation, mknod }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
compatIfNeeded,
|
||||
compatIsNeeded,
|
||||
libmd,
|
||||
libnetbsd,
|
||||
libutil,
|
||||
}:
|
||||
|
||||
mkDerivation {
|
||||
path = "contrib/mtree";
|
||||
extraPaths = [ mknod.path ];
|
||||
extraPaths = [ "contrib/mknod" ];
|
||||
buildInputs =
|
||||
compatIfNeeded
|
||||
++ [
|
||||
libmd
|
||||
libnetbsd
|
||||
]
|
||||
++ lib.optional (stdenv.isFreeBSD) libutil;
|
||||
|
||||
postPatch = ''
|
||||
ln -s $BSDSRCDIR/contrib/mknod/*.c $BSDSRCDIR/contrib/mknod/*.h $BSDSRCDIR/contrib/mtree
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
export NIX_LDFLAGS="$NIX_LDFLAGS ${
|
||||
toString (
|
||||
[
|
||||
"-lmd"
|
||||
"-lnetbsd"
|
||||
]
|
||||
++ lib.optional compatIsNeeded "-legacy"
|
||||
++ lib.optional stdenv.isFreeBSD "-lutil"
|
||||
)
|
||||
}"
|
||||
'';
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
patchesRoot,
|
||||
}:
|
||||
|
||||
mkDerivation rec {
|
||||
mkDerivation {
|
||||
path = "usr.bin/rpcgen";
|
||||
patches = lib.optionals (stdenv.hostPlatform.libc == "glibc") [
|
||||
# `WUNTRACED` is defined privately `bits/waitflags.h` in glibc.
|
||||
@ -22,6 +22,6 @@ mkDerivation rec {
|
||||
#
|
||||
# This hacks around this by manually including `WUNTRACED` until
|
||||
# the problem is fixed properly in glibc.
|
||||
/${patchesRoot}/rpcgen-glibc-hack.patch
|
||||
./rpcgen-glibc-hack.patch
|
||||
];
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{ mkDerivation, source }:
|
||||
{ mkDerivation }:
|
||||
|
||||
mkDerivation {
|
||||
path = "usr.bin/sed";
|
||||
TESTSRC = "${source}/contrib/netbsd-tests";
|
||||
MK_TESTS = "no";
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
# If you want you could fetchgit from "https://git.FreeBSD.org/src.git" instead.
|
||||
# The update script still pulls directly from git.freebsd.org
|
||||
fetchFromGitHub {
|
||||
name = "src"; # Want to rename this next rebuild
|
||||
owner = "freebsd";
|
||||
repo = "freebsd-src";
|
||||
inherit (sourceData) rev hash;
|
||||
|
@ -2,7 +2,6 @@
|
||||
stdenv,
|
||||
mkDerivation,
|
||||
freebsd-lib,
|
||||
patchesRoot,
|
||||
buildPackages,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
@ -15,7 +14,7 @@
|
||||
file2c,
|
||||
gawk,
|
||||
uudecode,
|
||||
xargs-j, # , ctfconvert
|
||||
xargs-j,
|
||||
}:
|
||||
|
||||
mkDerivation (
|
||||
@ -39,12 +38,6 @@ mkDerivation (
|
||||
gawk
|
||||
uudecode
|
||||
xargs-j
|
||||
#ctfconvert
|
||||
];
|
||||
|
||||
patches = [
|
||||
/${patchesRoot}/sys-gnu-date.patch
|
||||
/${patchesRoot}/sys-no-explicit-intrinsics-dep.patch
|
||||
];
|
||||
|
||||
# --dynamic-linker /red/herring is used when building the kernel.
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
lib,
|
||||
mkDerivation,
|
||||
bsdSetupHook,
|
||||
freebsdSetupHook,
|
||||
@ -10,6 +11,12 @@
|
||||
|
||||
mkDerivation {
|
||||
path = "usr.bin/tsort";
|
||||
extraPaths = [ ];
|
||||
outputs = [ "out" ];
|
||||
MK_TESTS = "no";
|
||||
makeFlags = [
|
||||
"STRIP=-s" # flag to install, not command
|
||||
];
|
||||
nativeBuildInputs = [
|
||||
bsdSetupHook
|
||||
freebsdSetupHook
|
||||
|
@ -9,6 +9,7 @@ mergeNetBSDSourceDir() {
|
||||
|
||||
addNetBSDMakeFlags() {
|
||||
makeFlags="INCSDIR=${!outputDev}/include $makeFlags"
|
||||
makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
|
||||
}
|
||||
|
||||
postUnpackHooks+=(mergeNetBSDSourceDir)
|
||||
|
@ -49,7 +49,6 @@ addMakeFlags() {
|
||||
makeFlags="LIBDIR=${!outputLib}/lib $makeFlags"
|
||||
makeFlags="SHLIBDIR=${!outputLib}/lib $makeFlags"
|
||||
makeFlags="SHAREDIR=${!outputLib}/share $makeFlags"
|
||||
makeFlags="MANDIR=${!outputMan}/share/man $makeFlags"
|
||||
makeFlags="INFODIR=${!outputInfo}/share/info $makeFlags"
|
||||
makeFlags="DOCDIR=${!outputDoc}/share/doc $makeFlags"
|
||||
makeFlags="LOCALEDIR=${!outputLib}/share/locale $makeFlags"
|
||||
|
@ -193,7 +193,7 @@ with pkgs;
|
||||
pythonInterpreter = "${python3.withPackages (ps: [ ps.pyelftools ])}/bin/python";
|
||||
autoPatchelfScript = ../build-support/setup-hooks/auto-patchelf.py;
|
||||
};
|
||||
meta.platforms = lib.platforms.linux;
|
||||
meta.platforms = lib.platforms.linux ++ lib.platforms.freebsd;
|
||||
} ../build-support/setup-hooks/auto-patchelf.sh;
|
||||
|
||||
tomato-c = callPackage ../applications/misc/tomato-c { };
|
||||
@ -16343,7 +16343,7 @@ with pkgs;
|
||||
# assumption is that or any later version is good.
|
||||
choose = platform:
|
||||
/**/ if platform.isDarwin then 16
|
||||
else if platform.isFreeBSD then 12
|
||||
else if platform.isFreeBSD then 16
|
||||
else if platform.isAndroid then 12
|
||||
else if platform.isLinux then 17
|
||||
else if platform.isWasm then 16
|
||||
@ -22564,7 +22564,7 @@ with pkgs;
|
||||
# We also provide `libiconvReal`, which will always be a standalone libiconv,
|
||||
# just in case you want it regardless of platform.
|
||||
libiconv =
|
||||
if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" ]
|
||||
if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" "fblibc" ]
|
||||
then libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform
|
||||
then libcCross
|
||||
else stdenv.cc.libc)
|
||||
|
@ -57,9 +57,7 @@ in
|
||||
, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
|
||||
# outside of the store. Thus, GCC, GFortran, & co. must always look for files
|
||||
# in standard system directories (/usr/include, etc.)
|
||||
noSysDirs ? stdenv.buildPlatform.system != "x86_64-freebsd"
|
||||
&& stdenv.buildPlatform.system != "i686-freebsd"
|
||||
&& stdenv.buildPlatform.system != "x86_64-solaris"
|
||||
noSysDirs ? stdenv.buildPlatform.system != "x86_64-solaris"
|
||||
&& stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu"
|
||||
|
||||
, # The configuration attribute set
|
||||
|
Loading…
Reference in New Issue
Block a user