freebsd.libc: break into many small derivations (#359190)

+24 -7
pkgs/os-specific/bsd/freebsd/package-set.nix
···
buildFreebsd,
patchesRoot,
writeText,
+
buildPackages,
}:
self:
···
inherit (self) libmd libnetbsd;
};
-
libc = self.callPackage ./pkgs/libc/package.nix {
+
libcMinimal = self.callPackage ./pkgs/libcMinimal.nix {
inherit (buildFreebsd)
-
makeMinimal
-
install
+
rpcgen
gencat
-
rpcgen
-
mkcsmapper
-
mkesdb
+
;
+
inherit (buildPackages)
+
flex
+
byacc
;
-
inherit (self) csu include;
+
};
+
+
libc = self.callPackage ./pkgs/libc/package.nix {
+
inherit (self) libcMinimal librpcsvc libelf;
+
};
+
+
librpcsvc = self.callPackage ./pkgs/librpcsvc.nix {
+
inherit (buildFreebsd) rpcgen;
+
};
+
+
i18n = self.callPackage ./pkgs/i18n.nix { inherit (buildFreebsd) mkcsmapper mkesdb; };
+
+
libelf = self.callPackage ./pkgs/libelf.nix { inherit (buildPackages) m4; };
+
+
rtld-elf = self.callPackage ./pkgs/rtld-elf.nix {
+
inherit (buildFreebsd) rpcgen;
+
inherit (buildPackages) flex byacc;
};
libnetbsd = self.callPackage ./pkgs/libnetbsd/package.nix { inherit (buildFreebsd) makeMinimal; };
-81
pkgs/os-specific/bsd/freebsd/patches/14.1/bsd-lib-mk-force-static.patch
···
-
From 197b10de54b53a089ad549f2e00787b4fa719210 Mon Sep 17 00:00:00 2001
-
From: Artemis Tosini <me@artem.ist>
-
Date: Sat, 2 Nov 2024 07:50:13 +0000
-
Subject: [PATCH] HACK: bsd.lib.mk: Treat empty SHLIB_NAME as nonexistant
-
-
Unsetting SHLIB_NAME in nix package definitions is a pain
-
but we can easily set it to be empty. This is useful when
-
building static libraries without unneeded static libraries.
-
---
-
share/mk/bsd.lib.mk | 14 +++++++-------
-
1 file changed, 7 insertions(+), 7 deletions(-)
-
-
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
-
index 5f328d5378ca..89d16dc6fa41 100644
-
--- a/share/mk/bsd.lib.mk
-
+++ b/share/mk/bsd.lib.mk
-
@@ -242,7 +242,7 @@ PO_FLAG=-pg
-
_LIBDIR:=${LIBDIR}
-
_SHLIBDIR:=${SHLIBDIR}
-
-
-.if defined(SHLIB_NAME)
-
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
-
.if ${MK_DEBUG_FILES} != "no"
-
SHLIB_NAME_FULL=${SHLIB_NAME}.full
-
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
-
@@ -277,7 +277,7 @@ LDFLAGS+= -Wl,--undefined-version
-
.endif
-
.endif
-
-
-.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
-
+.if defined(LIB) && !empty(LIB) || (defined(SHLIB_NAME) && !empty(SHLIB_NAME))
-
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
-
BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
-
LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
-
@@ -320,14 +320,14 @@ lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
-
CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll
-
.endif
-
-
-.if defined(SHLIB_NAME) || \
-
+.if (defined(SHLIB_NAME) && !empty(SHLIB_NAME)) || \
-
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
-
SOBJS+= ${OBJS:.o=.pico}
-
DEPENDOBJS+= ${SOBJS}
-
CLEANFILES+= ${SOBJS}
-
.endif
-
-
-.if defined(SHLIB_NAME)
-
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
-
_LIBS+= ${SHLIB_NAME}
-
-
SOLINKOPTS+= -shared -Wl,-x
-
@@ -435,7 +435,7 @@ all: all-man
-
CLEANFILES+= ${_LIBS}
-
-
_EXTRADEPEND:
-
-.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME)
-
+.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) && !empty(SHLIB_NAME)
-
.if defined(DPADD) && !empty(DPADD)
-
echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE}
-
.endif
-
@@ -501,7 +501,7 @@ _libinstall:
-
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/
-
.endif
-
.endif
-
-.if defined(SHLIB_NAME)
-
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
-
${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-
${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
-
${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
-
@@ -588,7 +588,7 @@ OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
-
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S}
-
.endfor
-
.endif
-
-.if defined(SHLIB_NAME) || \
-
+.if (defined(SHLIB_NAME) && !empty(SHLIB_NAME)) || \
-
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
-
.for _S in ${SRCS:N*.[hly]}
-
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S}
-
--
-
2.46.1
-
+13
pkgs/os-specific/bsd/freebsd/patches/14.1/libelf-bootstrapping.patch
···
+
diff --git a/lib/libelf/Makefile b/lib/libelf/Makefile
+
index c15ce2798a91..d6d8754e2b4f 100644
+
--- a/lib/libelf/Makefile
+
+++ b/lib/libelf/Makefile
+
@@ -80,7 +80,7 @@ INCS= libelf.h gelf.h
+
SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h
+
+
# Allow bootstrapping elftoolchain on Linux:
+
-.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux"
+
+.if defined(BOOTSTRAPPING)
+
native-elf-format.h:
+
${ELFTCDIR}/common/native-elf-format > ${.TARGET} || rm ${.TARGET}
+
SRCS+= native-elf-format.h
+154
pkgs/os-specific/bsd/freebsd/patches/14.1/mk.patch
···
+
diff --git a/share/mk/bsd.incs.mk b/share/mk/bsd.incs.mk
+
index df4cf4641141..a87c7f9db03a 100644
+
--- a/share/mk/bsd.incs.mk
+
+++ b/share/mk/bsd.incs.mk
+
@@ -63,8 +63,8 @@ stage_includes: stage_as.${header:T}
+
+
installincludes: _${group}INS_${header:T}
+
_${group}INS_${header:T}: ${header}
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C -o ${${group}OWN_${.ALLSRC:T}} \
+
- -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -C \
+
+ -m ${${group}MODE_${.ALLSRC:T}} \
+
${.ALLSRC} \
+
${DESTDIR}${${group}DIR_${.ALLSRC:T}}/${${group}NAME_${.ALLSRC:T}}
+
.else
+
@@ -78,10 +78,10 @@ stage_includes: stage_files.${group}
+
installincludes: _${group}INS
+
_${group}INS: ${_${group}INCS}
+
.if defined(${group}NAME)
+
- ${INSTALL} ${${group}TAG_ARGS} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
+
+ ${INSTALL} ${${group}TAG_ARGS} -C -m ${${group}MODE} \
+
${.ALLSRC} ${DESTDIR}${${group}DIR}/${${group}NAME}
+
.else
+
- ${INSTALL} ${${group}TAG_ARGS} -C -o ${${group}OWN} -g ${${group}GRP} -m ${${group}MODE} \
+
+ ${INSTALL} ${${group}TAG_ARGS} -C -m ${${group}MODE} \
+
${.ALLSRC} ${DESTDIR}${${group}DIR}/
+
.endif
+
.endif # !empty(_${group}INCS)
+
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
+
index 5f328d5378ca..264bbcc84ffb 100644
+
--- a/share/mk/bsd.lib.mk
+
+++ b/share/mk/bsd.lib.mk
+
@@ -242,7 +242,7 @@ PO_FLAG=-pg
+
_LIBDIR:=${LIBDIR}
+
_SHLIBDIR:=${SHLIBDIR}
+
+
-.if defined(SHLIB_NAME)
+
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
+
.if ${MK_DEBUG_FILES} != "no"
+
SHLIB_NAME_FULL=${SHLIB_NAME}.full
+
# Use ${DEBUGDIR} for base system debug files, else .debug subdirectory
+
@@ -277,7 +277,7 @@ LDFLAGS+= -Wl,--undefined-version
+
.endif
+
.endif
+
+
-.if defined(LIB) && !empty(LIB) || defined(SHLIB_NAME)
+
+.if defined(LIB) && !empty(LIB) || (defined(SHLIB_NAME) && !empty(SHLIB_NAME))
+
OBJS+= ${SRCS:N*.h:${OBJS_SRCS_FILTER:ts:}:S/$/.o/}
+
BCOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.bco/g}
+
LLOBJS+= ${SRCS:N*.[hsS]:N*.asm:${OBJS_SRCS_FILTER:ts:}:S/$/.llo/g}
+
@@ -320,14 +320,14 @@ lib${LIB_PRIVATE}${LIB}.ll: ${LLOBJS}
+
CLEANFILES+= lib${LIB_PRIVATE}${LIB}.bc lib${LIB_PRIVATE}${LIB}.ll
+
.endif
+
+
-.if defined(SHLIB_NAME) || \
+
+.if (defined(SHLIB_NAME) && !empty(SHLIB_NAME)) || \
+
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
+
SOBJS+= ${OBJS:.o=.pico}
+
DEPENDOBJS+= ${SOBJS}
+
CLEANFILES+= ${SOBJS}
+
.endif
+
+
-.if defined(SHLIB_NAME)
+
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
+
_LIBS+= ${SHLIB_NAME}
+
+
SOLINKOPTS+= -shared -Wl,-x
+
@@ -435,7 +435,7 @@ all: all-man
+
CLEANFILES+= ${_LIBS}
+
+
_EXTRADEPEND:
+
-.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME)
+
+.if !defined(NO_EXTRADEPEND) && defined(SHLIB_NAME) && !empty(SHLIB_NAME)
+
.if defined(DPADD) && !empty(DPADD)
+
echo ${SHLIB_NAME_FULL}: ${DPADD} >> ${DEPENDFILE}
+
.endif
+
@@ -482,7 +482,7 @@ _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}}
+
installpcfiles: installpcfiles-${pcfile}
+
+
installpcfiles-${pcfile}: ${pcfile}
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -m ${LIBMODE} \
+
${_INSTALLFLAGS} \
+
${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig/
+
.endfor
+
@@ -494,28 +494,28 @@ realinstall: _libinstall installpcfiles
+
.ORDER: beforeinstall _libinstall
+
_libinstall:
+
.if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no"
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -m ${LIBMODE} \
+
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}${_STATICLIB_SUFFIX}.a ${DESTDIR}${_LIBDIR}/
+
.if ${MK_PROFILE} != "no"
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -m ${LIBMODE} \
+
${_INSTALLFLAGS} lib${LIB_PRIVATE}${LIB}_p.a ${DESTDIR}${_LIBDIR}/
+
.endif
+
.endif
+
-.if defined(SHLIB_NAME)
+
- ${INSTALL} ${TAG_ARGS} ${STRIP} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+.if defined(SHLIB_NAME) && !empty(SHLIB_NAME)
+
+ ${INSTALL} ${TAG_ARGS} ${STRIP} -m ${LIBMODE} \
+
${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \
+
${SHLIB_NAME} ${DESTDIR}${_SHLIBDIR}/
+
.if ${MK_DEBUG_FILES} != "no"
+
.if defined(DEBUGMKDIR)
+
${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -d ${DESTDIR}${DEBUGFILEDIR}/
+
.endif
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -o ${LIBOWN} -g ${LIBGRP} -m ${DEBUGMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dbg} -m ${DEBUGMODE} \
+
${_INSTALLFLAGS} \
+
${SHLIB_NAME}.debug ${DESTDIR}${DEBUGFILEDIR}/
+
.endif
+
.if defined(SHLIB_LINK)
+
.if commands(${SHLIB_LINK:R}.ld)
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -S -m ${LIBMODE} \
+
${_INSTALLFLAGS} ${SHLIB_LINK:R}.ld \
+
${DESTDIR}${_LIBDIR}/${SHLIB_LINK}
+
.for _SHLIB_LINK_LINK in ${SHLIB_LDSCRIPT_LINKS}
+
@@ -548,7 +548,7 @@ _libinstall:
+
.endif # SHLIB_LINK
+
.endif # SHIB_NAME
+
.if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
+
- ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+
+ ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -m ${LIBMODE} \
+
${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${_LIBDIR}/
+
.endif
+
.endif # !defined(INTERNALLIB)
+
@@ -588,7 +588,7 @@ OBJS_DEPEND_GUESS+= ${SRCS:M*.h}
+
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.po+= ${_S}
+
.endfor
+
.endif
+
-.if defined(SHLIB_NAME) || \
+
+.if (defined(SHLIB_NAME) && !empty(SHLIB_NAME)) || \
+
defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB)
+
.for _S in ${SRCS:N*.[hly]}
+
OBJS_DEPEND_GUESS.${_S:${OBJS_SRCS_FILTER:ts:}}.pico+= ${_S}
+
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
+
index 04316c46b705..9ad3c8ce70e7 100644
+
--- a/share/mk/bsd.man.mk
+
+++ b/share/mk/bsd.man.mk
+
@@ -50,9 +50,9 @@
+
.endif
+
+
.if ${MK_MANSPLITPKG} == "no"
+
-MINSTALL?= ${INSTALL} ${TAG_ARGS} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
+
+MINSTALL?= ${INSTALL} ${TAG_ARGS} -m ${MANMODE}
+
.else
+
-MINSTALL?= ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},man} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
+
+MINSTALL?= ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},man} -m ${MANMODE}
+
.endif
+
+
CATDIR= ${MANDIR:H:S/$/\/cat/}
+13
pkgs/os-specific/bsd/freebsd/patches/14.1/rtld-elf-symlink.patch
···
+
diff --git a/libexec/rtld-elf/Makefile b/libexec/rtld-elf/Makefile
+
index 0dbd2b8aa935..241d7a78e208 100644
+
--- a/libexec/rtld-elf/Makefile
+
+++ b/libexec/rtld-elf/Makefile
+
@@ -54,7 +54,7 @@ NO_WCAST_ALIGN= yes
+
INSTALLFLAGS= -C -b
+
PRECIOUSPROG=
+
BINDIR= /libexec
+
-SYMLINKS= ../..${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
+
+SYMLINKS= ${BINDIR}/${PROG} ${LIBEXECDIR}/${PROG}
+
MLINKS?= rtld.1 ld-elf.so.1.1 \
+
rtld.1 ld.so.1
+
-4
pkgs/os-specific/bsd/freebsd/pkgs/bin.nix
···
mkDerivation,
pkgsBuildBuild,
libjail,
-
libmd,
libnetbsd,
libcapsicum,
libcasper,
-
libelf,
libxo,
libncurses-tinfo,
libedit,
···
];
buildInputs = [
libjail
-
libmd
libnetbsd
libcapsicum
libcasper
-
libelf
libxo
libncurses-tinfo
libedit
+2
pkgs/os-specific/bsd/freebsd/pkgs/compat/package.nix
···
# build build-time dependencies for building FreeBSD packages). It is
# not needed when building for FreeBSD.
meta.broken = stdenv.hostPlatform.isFreeBSD;
+
+
alwaysKeepStatic = true;
}
+20
pkgs/os-specific/bsd/freebsd/pkgs/i18n.nix
···
+
{
+
mkDerivation,
+
mkcsmapper,
+
mkesdb,
+
}:
+
+
mkDerivation {
+
path = "share/i18n";
+
+
noLibc = true;
+
+
extraNativeBuildInputs = [
+
mkcsmapper
+
mkesdb
+
];
+
+
preBuild = ''
+
export makeFlags="$makeFlags ESDBDIR=$out/share/i18n/esdb CSMAPPERDIR=$out/share/i18n/csmapper"
+
'';
+
}
-1
pkgs/os-specific/bsd/freebsd/pkgs/include/package.nix
···
{
-
stdenv,
lib,
mkDerivation,
buildPackages,
+11 -4
pkgs/os-specific/bsd/freebsd/pkgs/install.nix
···
@out@/bin/xinstall "''${args[@]}"
''
);
+
libmd' = libmd.override {
+
bootstrapInstallation = true;
+
};
in
mkDerivation {
path = "usr.bin/xinstall";
···
(if stdenv.hostPlatform == stdenv.buildPlatform then boot-install else install)
];
skipIncludesPhase = true;
-
buildInputs = compatIfNeeded ++ [
-
libmd
-
libnetbsd
-
];
+
buildInputs =
+
compatIfNeeded
+
++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [
+
libmd'
+
]
+
++ [
+
libnetbsd
+
];
makeFlags =
[
"STRIP=-s" # flag to install, not command
+4 -2
pkgs/os-specific/bsd/freebsd/pkgs/kldxref.nix
···
{
+
lib,
+
stdenv,
mkDerivation,
-
libelf,
compatIfNeeded,
+
libelf,
}:
mkDerivation {
path = "usr.sbin/kldxref";
-
buildInputs = [ libelf ] ++ compatIfNeeded;
+
buildInputs = lib.optionals (!stdenv.hostPlatform.isFreeBSD) [ libelf ] ++ compatIfNeeded;
# We symlink in our modules, make it follow symlinks
postPatch = ''
-3
pkgs/os-specific/bsd/freebsd/pkgs/ldd.nix
···
lib,
stdenv,
mkDerivation,
-
libelf,
}:
mkDerivation {
path = "usr.bin/ldd";
···
"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";
+50 -297
pkgs/os-specific/bsd/freebsd/pkgs/libc/package.nix
···
{
-
lib,
-
buildPackages,
-
stdenv,
-
mkDerivation,
-
-
bsdSetupHook,
-
freebsdSetupHook,
-
makeMinimal,
-
install,
-
flex,
-
byacc,
-
gencat,
-
rpcgen,
-
mkcsmapper,
-
mkesdb,
-
+
symlinkJoin,
+
include,
csu,
-
include,
-
versionData,
+
libcMinimal,
+
libssp_nonshared,
+
libgcc,
+
libmd,
+
libthr,
+
msun,
+
librpcsvc,
+
libutil,
+
librt,
+
libcrypt,
+
libelf,
+
libexecinfo,
+
libkvm,
+
libmemstat,
+
libprocstat,
+
libdevstat,
+
libiconvModules,
+
libdl,
+
i18n,
+
rtld-elf,
+
baseModules ? [
+
include
+
csu
+
libcMinimal
+
libssp_nonshared
+
libgcc
+
libmd
+
libthr
+
msun
+
librpcsvc
+
libutil
+
librt
+
libcrypt
+
libelf
+
libexecinfo
+
libkvm
+
libmemstat
+
libprocstat
+
libdevstat
+
libiconvModules
+
libdl
+
i18n
+
rtld-elf
+
],
+
extraModules ? [ ],
}:
-
mkDerivation {
-
noLibc = true;
+
symlinkJoin {
pname = "libc";
-
path = "lib/libc";
-
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"
-
]
-
++ lib.optionals (versionData.major == 13) [ "contrib/tzcode/stdtime" ]
-
++ lib.optionals (versionData.major >= 14) [ "contrib/tzcode" ]
-
++ [
-
-
# libthr
-
"lib/libthr"
-
"lib/libthread_db"
-
"libexec/rtld-elf"
-
"lib/csu/common/crtbrand.S"
-
"lib/csu/common/notes.h"
-
-
# librpcsvc
-
"lib/librpcsvc"
-
-
# librt
-
"lib/librt"
-
-
# libcrypt
-
"lib/libcrypt"
-
"lib/libmd"
-
"sys/crypto/sha2"
-
"sys/crypto/skein"
-
-
# 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"
-
-
# terminfo
-
"lib/ncurses"
-
"contrib/ncurses"
-
"lib/Makefile.inc"
-
]
-
++ lib.optionals (stdenv.hostPlatform.isx86_32) [ "lib/libssp_nonshared" ]
-
++ [
-
"lib/libexecinfo"
-
"contrib/libexecinfo"
-
-
"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"
-
-
# Used for aarch64-freebsd
-
"contrib/arm-optimized-routines"
-
];
-
-
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'
-
'';
-
-
# NIX_CFLAGS_LINK is empty at this point except when building static,
-
# in which case the stdenv adapter adds the `-static` flag.
-
# Building with `-static` set causes linker errors.
-
postConfigure = ''
-
export NIX_CFLAGS_LINK=
-
'';
-
-
nativeBuildInputs = [
-
bsdSetupHook
-
freebsdSetupHook
-
makeMinimal
-
install
-
-
flex
-
byacc
-
gencat
-
rpcgen
-
mkcsmapper
-
mkesdb
-
];
-
buildInputs = [
-
include
-
csu
-
];
-
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
-
# 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 = "yes";
-
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";
-
MACHINE_ABI = "";
-
MK_DETECT_TZ_CHANGES = "no";
-
MK_MACHDEP_OPTIMIZATIONS = "yes";
-
MK_ASAN = "no";
-
MK_UBSAN = "no";
-
-
NO_FSCHG = "yes";
-
-
preBuild = lib.optionalString (stdenv.hostPlatform.isx86_32) ''
-
make -C $BSDSRCDIR/lib/libssp_nonshared $makeFlags
-
make -C $BSDSRCDIR/lib/libssp_nonshared $makeFlags install
-
'';
-
-
postInstall =
-
''
-
pushd ${include}
-
find . -type d -exec mkdir -p $out/\{} \;
-
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
-
popd
-
-
pushd ${csu}
-
find . -type d -exec mkdir -p $out/\{} \;
-
find . \( -type f -o -type l \) -exec cp -pr \{} $out/\{} \;
-
popd
-
-
mkdir $BSDSRCDIR/lib/libcompiler_rt/i386 $BSDSRCDIR/lib/libcompiler_rt/cpu_model
-
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags
-
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags install
-
-
make -C $BSDSRCDIR/lib/libgcc_eh $makeFlags
-
make -C $BSDSRCDIR/lib/libgcc_eh $makeFlags install
-
-
ln -s $BSDSRCDIR/lib/libc/libc.so.7 $BSDSRCDIR/lib/libc/libc.so # otherwise these dynamic libraries try to link with libc.a
-
mkdir $BSDSRCDIR/lib/libgcc_s/i386 $BSDSRCDIR/lib/libgcc_s/cpu_model
-
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags
-
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags install
-
-
NIX_CFLAGS_COMPILE+=" -B$out/lib"
-
NIX_CFLAGS_COMPILE+=" -I$out/include"
-
NIX_LDFLAGS+=" -L$out/lib"
-
-
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags
-
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags install
-
-
mkdir $BSDSRCDIR/lib/libmd/sys
-
make -C $BSDSRCDIR/lib/libmd $makeFlags
-
make -C $BSDSRCDIR/lib/libmd $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
-
''
-
+ lib.optionalString (!stdenv.hostPlatform.isStatic) ''
-
mkdir $out/lib/keep_static
-
mv $out/lib/*_nonshared.a $out/lib/libgcc*.a $out/lib/libcompiler_rt.a $out/lib/keep_static
-
rm $out/lib/*.a
-
mv $out/lib/keep_static/* $out/lib
-
rmdir $out/lib/keep_static
-
'';
-
-
# 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"
-
];
+
inherit (libcMinimal) version;
+
paths = baseModules ++ extraModules;
}
+92
pkgs/os-specific/bsd/freebsd/pkgs/libcMinimal.nix
···
+
{
+
mkDerivation,
+
include,
+
rpcgen,
+
flex,
+
byacc,
+
gencat,
+
csu,
+
}:
+
+
mkDerivation {
+
pname = "libcMinimal";
+
path = "lib/libc";
+
extraPaths = [
+
"lib/libc_nonshared"
+
"lib/msun"
+
"lib/libmd"
+
"lib/libutil"
+
"libexec/rtld-elf"
+
"include/rpcsvc"
+
"contrib/libc-pwcache"
+
"contrib/libc-vis"
+
"contrib/tzcode"
+
"contrib/gdtoa"
+
"contrib/jemalloc"
+
"sys/sys"
+
"sys/kern"
+
"sys/libkern"
+
"sys/crypto"
+
"sys/opencrypto"
+
"etc/group"
+
"etc/master.passwd"
+
"etc/shells"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
];
+
+
extraNativeBuildInputs = [
+
rpcgen
+
flex
+
byacc
+
gencat
+
];
+
+
# this target is only used in the rtld-elf derivation. build it there instead.
+
postPatch = ''
+
sed -E -i -e '/BUILD_NOSSP_PIC_ARCHIVE=/d' $BSDSRCDIR/lib/libc/Makefile
+
'';
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
postBuild = ''
+
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags
+
'';
+
+
postInstall = ''
+
make -C $BSDSRCDIR/lib/libc_nonshared $makeFlags install
+
'';
+
+
alwaysKeepStatic = true;
+
+
env = {
+
MK_TESTS = "no";
+
MK_SYMVER = "yes";
+
MK_SSP = "yes";
+
MK_NLS = "yes";
+
MK_ICONV = "yes";
+
MK_NS_CACHING = "yes";
+
MK_INET6_SUPPORT = "yes";
+
MK_HESIOD = "yes";
+
MK_NIS = "yes";
+
MK_HYPERV = "yes";
+
MK_FP_LIBC = "yes";
+
MK_MALLOC_PRODUCTION = "yes";
+
MK_MACHDEP_OPTIMIZATIONS = "yes";
+
};
+
+
# definitely a bad idea to enable stack protection on the stack protection initializers
+
hardeningDisable = [ "stackprotector" ];
+
}
+37
pkgs/os-specific/bsd/freebsd/pkgs/libcrypt.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libcrypt";
+
extraPaths = [
+
"sys/kern"
+
"sys/crypto"
+
"lib/libmd"
+
"secure/lib/libcrypt"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+10 -8
pkgs/os-specific/bsd/freebsd/pkgs/libcxxrt.nix
···
pname = "libcxxrt";
path = "lib/libcxxrt";
extraPaths = [ "contrib/libcxxrt" ];
-
outputs =
-
[
-
"out"
-
"dev"
-
]
-
++ lib.optionals (!stdenv.hostPlatform.isStatic) [
-
"debug"
-
];
+
outputs = [
+
"out"
+
"dev"
+
"debug"
+
];
noLibcxx = true;
libName = "cxxrt";
+
+
# they already fixed the undefined symbols in the version map upstream. it'll be released probably in 15.0
+
preBuild = ''
+
export NIX_LDFLAGS="$NIX_LDFLAGS --undefined-version"
+
'';
}
+44
pkgs/os-specific/bsd/freebsd/pkgs/libdevstat.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
libkvm,
+
libprocstat,
+
libutil,
+
libelf,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libdevstat";
+
extraPaths = [
+
"lib/libc/Versions.def"
+
"sys/contrib/openzfs"
+
"sys/contrib/pcg-c"
+
"sys/opencrypto"
+
"sys/crypto"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
libkvm
+
libprocstat
+
libutil
+
libelf
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
}
+28 -3
pkgs/os-specific/bsd/freebsd/pkgs/libdl.nix
···
-
{ mkDerivation, ... }:
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
csu,
+
}:
+
mkDerivation {
path = "lib/libdl";
extraPaths = [
-
"lib/libc"
"libexec/rtld-elf"
+
"lib/libc/gen"
+
"lib/libc/include"
+
"lib/libc/Versions.def"
];
-
buildInputs = [ ];
+
+
outputs = [
+
"out"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
}
+30 -12
pkgs/os-specific/bsd/freebsd/pkgs/libelf.nix
···
{
+
lib,
stdenv,
mkDerivation,
-
bsdSetupHook,
-
freebsdSetupHook,
-
makeMinimal,
-
install,
m4,
+
include,
+
libcMinimal,
+
libgcc,
+
compatIfNeeded,
+
csu,
}:
+
mkDerivation {
path = "lib/libelf";
extraPaths = [
"lib/libc"
"contrib/elftoolchain"
-
"sys/sys/elf32.h"
-
"sys/sys/elf64.h"
-
"sys/sys/elf_common.h"
+
"sys/sys"
];
-
nativeBuildInputs = [
-
bsdSetupHook
-
freebsdSetupHook
-
makeMinimal
-
install
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = stdenv.hostPlatform.isFreeBSD;
+
+
buildInputs =
+
lib.optionals stdenv.hostPlatform.isFreeBSD [
+
include
+
libcMinimal
+
libgcc
+
]
+
++ compatIfNeeded;
+
+
extraNativeBuildInputs = [
m4
];
+
+
preBuild = lib.optionalString stdenv.hostPlatform.isFreeBSD ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
}
+36
pkgs/os-specific/bsd/freebsd/pkgs/libexecinfo.nix
···
+
{
+
mkDerivation,
+
include,
+
libelf,
+
libcMinimal,
+
libgcc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libexecinfo";
+
extraPaths = [
+
"contrib/libexecinfo"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libelf
+
libcMinimal
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+49
pkgs/os-specific/bsd/freebsd/pkgs/libgcc.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libgcc_eh";
+
extraPaths = [
+
"lib/libgcc_s"
+
"lib/libcompiler_rt"
+
"lib/msun"
+
"lib/libc" # needs arch-specific fpmath files
+
"contrib/llvm-project/compiler-rt"
+
"contrib/llvm-project/libunwind"
+
];
+
+
outputs = [
+
"out"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
postBuild = ''
+
mkdir $BSDSRCDIR/lib/libgcc_s/i386 $BSDSRCDIR/lib/libgcc_s/cpu_model
+
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags
+
+
mkdir $BSDSRCDIR/lib/libcompiler_rt/i386 $BSDSRCDIR/lib/libcompiler_rt/cpu_model
+
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags
+
'';
+
+
postInstall = ''
+
make -C $BSDSRCDIR/lib/libgcc_s $makeFlags install
+
make -C $BSDSRCDIR/lib/libcompiler_rt $makeFlags install
+
'';
+
+
alwaysKeepStatic = true;
+
}
+32
pkgs/os-specific/bsd/freebsd/pkgs/libiconvModules.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libiconv_modules";
+
extraPaths = [
+
"lib/libc/iconv"
+
];
+
+
outputs = [
+
"out"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
export makeFlags="$makeFlags SHLIBDIR=$out/lib/i18n"
+
'';
+
}
+36
pkgs/os-specific/bsd/freebsd/pkgs/libkvm.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
libelf,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libkvm";
+
extraPaths = [
+
"sys" # wants sys/${arch}
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
libelf
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+65 -39
pkgs/os-specific/bsd/freebsd/pkgs/libmd.nix
···
lib,
stdenv,
mkDerivation,
+
libcMinimal,
+
include,
+
libgcc,
+
makeMinimal,
+
bsdSetupHook,
freebsdSetupHook,
-
bsdSetupHook,
-
makeMinimal,
+
compatIfNeeded,
+
csu,
+
# this is set to true when used as the dependency of install
+
# this is set to false when used as the dependency of libc
+
bootstrapInstallation ? false,
}:
-
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";
+
mkDerivation (
+
{
+
path = "lib/libmd";
+
extraPaths = [
+
"sys/crypto"
+
"sys/sys"
+
];
-
preBuild = ''
-
mkdir sys
-
'';
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
-
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
-
'';
+
noLibc = !bootstrapInstallation;
-
outputs = [
-
"out"
-
"man"
-
];
-
}
+
buildInputs =
+
lib.optionals (!bootstrapInstallation) [
+
libcMinimal
+
include
+
libgcc
+
]
+
++ compatIfNeeded;
+
+
preBuild =
+
''
+
mkdir $BSDSRCDIR/lib/libmd/sys
+
''
+
+ lib.optionalString stdenv.hostPlatform.isFreeBSD ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
installPhase =
+
if (!bootstrapInstallation) then
+
null
+
else
+
''
+
# 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
+
'';
+
}
+
// lib.optionalAttrs bootstrapInstallation {
+
nativeBuildInputs = [
+
makeMinimal
+
bsdSetupHook
+
freebsdSetupHook
+
];
+
}
+
)
+31
pkgs/os-specific/bsd/freebsd/pkgs/libmemstat.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
libkvm,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libmemstat";
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
libkvm
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
}
+2
pkgs/os-specific/bsd/freebsd/pkgs/libnetbsd/package.nix
···
"STRIP=-s" # flag to install, not command
"MK_WERROR=no"
] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "INSTALL=boot-install";
+
+
alwaysKeepStatic = true;
}
+42
pkgs/os-specific/bsd/freebsd/pkgs/libprocstat.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
libkvm,
+
libutil,
+
libelf,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libprocstat";
+
extraPaths = [
+
"lib/libc/Versions.def"
+
"sys/contrib/openzfs"
+
"sys/contrib/pcg-c"
+
"sys/opencrypto"
+
"sys/crypto"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
libkvm
+
libutil
+
libelf
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
}
-2
pkgs/os-specific/bsd/freebsd/pkgs/libradius.nix
···
{
mkDerivation,
openssl,
-
libmd,
}:
mkDerivation {
path = "lib/libradius";
buildInputs = [
-
libmd
openssl
];
+30
pkgs/os-specific/bsd/freebsd/pkgs/librpcsvc.nix
···
+
{
+
mkDerivation,
+
rpcgen,
+
include,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/librpcsvc";
+
extraPaths = [
+
"sys/nlm"
+
"include/rpcsvc"
+
];
+
noLibc = true;
+
+
extraNativeBuildInputs = [
+
rpcgen
+
];
+
+
buildInputs = [
+
include
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${include}/include/rpcsvc"
+
'';
+
+
alwaysKeepStatic = true;
+
}
+36
pkgs/os-specific/bsd/freebsd/pkgs/librt.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
libthr,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/librt";
+
extraPaths = [
+
"lib/libc/include" # private headers
+
"lib/libc/Versions.def"
+
];
+
+
outputs = [
+
"out"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
libthr
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+1 -1
pkgs/os-specific/bsd/freebsd/pkgs/libsbuf.nix
···
mkDerivation {
path = "lib/libsbuf";
extraPaths = [ "sys/kern" ];
-
MK_TESTS = "no";
+
env.MK_TESTS = "no";
}
+15
pkgs/os-specific/bsd/freebsd/pkgs/libssp_nonshared.nix
···
+
{
+
mkDerivation,
+
include,
+
}:
+
+
mkDerivation {
+
path = "lib/libssp_nonshared";
+
noLibc = true;
+
+
buildInputs = [
+
include
+
];
+
+
alwaysKeepStatic = true;
+
}
+36
pkgs/os-specific/bsd/freebsd/pkgs/libthr.nix
···
+
{
+
mkDerivation,
+
libcMinimal,
+
include,
+
libgcc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/libthr";
+
extraPaths = [
+
"lib/libthread_db"
+
"lib/libc" # needs /include + arch-specific files
+
"libexec/rtld-elf"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
libcMinimal
+
include
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+27 -2
pkgs/os-specific/bsd/freebsd/pkgs/libutil.nix
···
-
{ mkDerivation }:
+
{
+
mkDerivation,
+
include,
+
libgcc,
+
libcMinimal,
+
csu,
+
}:
mkDerivation {
path = "lib/libutil";
extraPaths = [ "lib/libc/gen" ];
-
MK_TESTS = "no";
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libgcc
+
libcMinimal
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
}
+19
pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
···
MACHINE_CPUARCH = freebsd-lib.mkBsdCpuArch stdenv';
COMPONENT_PATH = attrs.path or null;
+
+
# don't set filesystem flags that require root
+
NO_FSCHG = "yes";
}
// lib.optionalAttrs stdenv'.hasCC {
# TODO should CC wrapper set this?
···
))
++ attrs.patches or [ ];
}
+
//
+
lib.optionalAttrs
+
(!stdenv.hostPlatform.isStatic && !attrs.alwaysKeepStatic or false && stdenv.hostPlatform.isFreeBSD)
+
{
+
postInstall =
+
(attrs.postInstall or "")
+
+ ''
+
rm -f $out/lib/*.a
+
'';
+
}
+
//
+
lib.optionalAttrs
+
((stdenv.hostPlatform.isStatic || !stdenv.hostPlatform.isFreeBSD) && attrs ? outputs)
+
{
+
outputs = lib.lists.remove "debug" attrs.outputs;
+
}
)
)
+34
pkgs/os-specific/bsd/freebsd/pkgs/msun.nix
···
+
{
+
mkDerivation,
+
include,
+
libcMinimal,
+
libgcc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "lib/msun";
+
extraPaths = [
+
"lib/libc" # wants arch headers
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
libcMinimal
+
libgcc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
'';
+
+
env.MK_TESTS = "no";
+
}
+11 -5
pkgs/os-specific/bsd/freebsd/pkgs/mtree.nix
···
mkDerivation,
compatIfNeeded,
compatIsNeeded,
-
libmd,
libnetbsd,
-
libutil,
+
libmd,
}:
+
let
+
libmd' = libmd.override {
+
bootstrapInstallation = true;
+
};
+
+
in
mkDerivation {
path = "contrib/mtree";
extraPaths = [ "contrib/mknod" ];
buildInputs =
compatIfNeeded
+
++ lib.optionals (!stdenv.hostPlatform.isFreeBSD) [
+
libmd'
+
]
++ [
-
libmd
libnetbsd
-
]
-
++ lib.optional (stdenv.hostPlatform.isFreeBSD) libutil;
+
];
postPatch = ''
ln -s $BSDSRCDIR/contrib/mknod/*.c $BSDSRCDIR/contrib/mknod/*.h $BSDSRCDIR/contrib/mtree
-1
pkgs/os-specific/bsd/freebsd/pkgs/rpcgen/package.nix
···
lib,
mkDerivation,
stdenv,
-
patchesRoot,
}:
mkDerivation {
+58
pkgs/os-specific/bsd/freebsd/pkgs/rtld-elf.nix
···
+
{
+
mkDerivation,
+
include,
+
rpcgen,
+
flex,
+
byacc,
+
csu,
+
}:
+
+
mkDerivation {
+
path = "libexec/rtld-elf";
+
extraPaths = [
+
"lib/csu"
+
"lib/libc"
+
"lib/libmd"
+
"lib/msun"
+
"lib/libutil"
+
"lib/libc_nonshared"
+
"include/rpcsvc"
+
"contrib/libc-pwcache"
+
"contrib/libc-vis"
+
"contrib/tzcode"
+
"contrib/gdtoa"
+
"contrib/jemalloc"
+
"sys/sys"
+
"sys/kern"
+
"sys/libkern"
+
"sys/crypto"
+
];
+
+
outputs = [
+
"out"
+
"man"
+
"debug"
+
];
+
+
noLibc = true;
+
+
buildInputs = [
+
include
+
];
+
+
extraNativeBuildInputs = [
+
rpcgen
+
flex
+
byacc
+
];
+
+
preBuild = ''
+
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -B${csu}/lib"
+
make -C $BSDSRCDIR/lib/libc $makeFlags libc_nossp_pic.a
+
'';
+
+
# definitely a bad idea to enable stack protection on the stack protection initializers
+
hardeningDisable = [ "stackprotector" ];
+
+
env.MK_TESTS = "no";
+
}