Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/by-name/au/auto-patchelf/source/auto-patchelf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ def auto_patchelf_file(path: Path, runtime_deps: list[Path], append_rpaths: list
except ELFError:
return []

# these platforms are packaged in nixpkgs with ld.so in a separate derivation
# than libc.so and friends. keep_libc is mandatory.
keep_libc |= file_osabi in ('ELFOSABI_FREEBSD', 'ELFOSABI_OPENBSD')

rpath = []
if file_is_dynamic_executable:
print("setting interpreter of", path)
Expand Down
37 changes: 37 additions & 0 deletions pkgs/by-name/gd/gdbm/freebsd-patch-src-lock-c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
https://github.com/freebsd/freebsd-ports/blob/e198aef78afa4fd78ddc62fb5d0f7caa1b076bb0/databases/gdbm/files/patch-src_lock.c

--- a/src/lock.c.orig 2025-03-06 16:24:09 UTC
+++ b/src/lock.c
@@ -73,15 +73,10 @@ try_lock_flock (GDBM_FILE dbf, int nb)
{
return TRY_LOCK_OK;
}
- else if (errno == EWOULDBLOCK)
+ else if (errno == EWOULDBLOCK || errno == EINTR)
{
return TRY_LOCK_FAIL;
}
- else if (errno == EINTR)
- {
- errno = ETIME;
- return TRY_LOCK_FAIL;
- }
#endif
return TRY_LOCK_NEXT;
}
@@ -116,7 +111,6 @@ try_lock_lockf (GDBM_FILE dbf, int nb)
switch (errno)
{
case EINTR:
- errno = ETIME;
case EACCES:
case EAGAIN:
case EDEADLK:
@@ -162,7 +156,6 @@ try_lock_fcntl (GDBM_FILE dbf, int nb)
switch (errno)
{
case EINTR:
- errno = ETIME;
case EACCES:
case EAGAIN:
case EDEADLK:
17 changes: 11 additions & 6 deletions pkgs/by-name/gd/gdbm/package.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
lib,
fetchurl,
fetchpatch,
stdenv,
testers,
updateAutotoolsGnuConfigScriptsHook,
Expand All @@ -15,12 +16,16 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-0C2zxZJu2Hf4gXuBzR+S9T73TKjG21Q/u6AnGzTzk+w=";
};

patches = [
# Remove on next release.
./upstream-darwin-clock-nanosleep-fix.patch
./upstream-lockwait-test-fixes.patch
./upstream-musl-ssize_t-fix.patch
];
patches =
[
# Remove on next release.
./upstream-darwin-clock-nanosleep-fix.patch
./upstream-lockwait-test-fixes.patch
./upstream-musl-ssize_t-fix.patch
]
++ lib.optionals stdenv.hostPlatform.isFreeBSD [
./freebsd-patch-src-lock-c.patch
];

nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];

Expand Down
1 change: 1 addition & 0 deletions pkgs/by-name/li/libarchive/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ stdenv.mkDerivation (finalAttrs: {
# the filesystem does not necessarily have hardlink capabilities
"libarchive/test/test_write_disk_hardlink.c"
# access-time-related tests flakey on some systems
"libarchive/test/test_read_disk_directory_traversals.c"
"cpio/test/test_option_a.c"
"cpio/test/test_option_t.c"
]
Expand Down
4 changes: 4 additions & 0 deletions pkgs/by-name/li/libuv/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ stdenv.mkDerivation (finalAttrs: {
# EOPNOTSUPP when performed in jailed build env
"tcp_reuseport"
"udp_reuseport"
# jailed build env does not have a hostname
"gethostname"
# Fails when built on non-nix FreeBSD
# https://github.com/libuv/libuv/issues/4606
"fs_event_watch_delete_dir"
Expand All @@ -142,6 +144,8 @@ stdenv.mkDerivation (finalAttrs: {
in
lib.optionalString (finalAttrs.finalPackage.doCheck) ''
sed '/${tdRegexp}/d' -i test/test-list.h
# https://github.com/libuv/libuv/issues/4794
substituteInPlace Makefile.am --replace-fail -lutil "-lutil -lm"
'';

nativeBuildInputs = [
Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/compilers/llvm/common/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ stdenv.mkDerivation (
optionalString stdenv.hostPlatform.isFreeBSD ''
rm test/tools/llvm-libtool-darwin/L-and-l.test
rm test/ExecutionEngine/Interpreter/intrinsics.ll
# Fails in sandbox
substituteInPlace unittests/Support/LockFileManagerTest.cpp --replace-fail "Basic" "DISABLED_Basic"
''
+ ''
patchShebangs test/BugPoint/compile-custom.ll.py
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/compilers/llvm/common/tblgen.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
ninja,
patches ? [ ],
python3,
updateAutotoolsGnuConfigScriptsHook,
release_version,
runCommand,
src ? null,
Expand Down Expand Up @@ -76,6 +77,10 @@ let
cmake
ninja
python3

# while this is not an autotools build, it still includes a config.guess
# this is needed until scripts are updated to not use /usr/bin/uname on FreeBSD native
updateAutotoolsGnuConfigScriptsHook
];

cmakeFlags = [
Expand Down
7 changes: 7 additions & 0 deletions pkgs/os-specific/bsd/freebsd/pkgs/libcMinimal.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
byacc,
gencat,
csu,
i18n,
extraSrc ? [ ],
}:

Expand All @@ -32,6 +33,7 @@ mkDerivation {
"etc/group"
"etc/master.passwd"
"etc/shells"
"include/paths.h"
] ++ extraSrc;

outputs = [
Expand All @@ -54,8 +56,13 @@ mkDerivation {
];

# this target is only used in the rtld-elf derivation. build it there instead.
#
# WE SHOULD REALLY BE REPLACING /usr/lib/i18n WITH THE libiconvModules DERIVATION
# but this causes some awful dependency loops which basically collapse the entire libc derivation
# instead, set the PATH_I18NMODULE environment variable whenever possible
postPatch = ''
sed -E -i -e '/BUILD_NOSSP_PIC_ARCHIVE=/d' $BSDSRCDIR/lib/libc/Makefile
substituteInPlace $BSDSRCDIR/include/paths.h --replace '/usr/share/i18n' '${i18n}/share/i18n'
'';

preBuild = ''
Expand Down
20 changes: 14 additions & 6 deletions pkgs/stdenv/freebsd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ let
name = attrs.name or (builtins.baseNameOf (builtins.elemAt attrs.paths 0));
src = bootstrapArchive;
builder = "${bootstrapArchive}/bin/bash";
# this script will prefer to link files instead of copying them.
# this prevents clang in particular, but possibly others, from calling readlink(argv[0])
# and obtaining dependencies, ld(1) in particular, from there instead of $PATH.
args = [ ./linkBootstrap.sh ];
PATH = "${bootstrapArchive}/bin";
paths = attrs.paths;
Expand Down Expand Up @@ -93,6 +96,7 @@ let
"bin/clang"
"bin/clang++"
"bin/cpp"
"lib/clang"
];
# SYNCME: this version number must be synced with the one in make-bootstrap-tools.nix
version = "18";
Expand Down Expand Up @@ -442,18 +446,22 @@ let
inherit (prevStage.freebsd) libc;
inherit (prevStage) gnugrep coreutils expand-response-params;
runtimeShell = shell;
bintools = prevStage.binutils-unwrapped;
bintools = (prevStage.llvmPackages or { }).bintools-unwrapped or prevStage.binutils-unwrapped;
propagateDoc = false;
nativeTools = false;
nativeLibc = false;
};
};
overrides = overrides prevStage;
preHook = ''
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
export PATH_LOCALE=${prevStage.freebsd.localesReal or prevStage.freebsd.locales}/share/locale
'';
preHook =
''
export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
export PATH_LOCALE=${prevStage.freebsd.localesReal or prevStage.freebsd.locales}/share/locale
''
+ lib.optionalString (prevStage.freebsd ? libiconvModules) ''
export PATH_I18NMODULE=${prevStage.freebsd.libiconvModules}/lib/i18n
'';
};
in
{
Expand Down
6 changes: 5 additions & 1 deletion pkgs/stdenv/freebsd/linkBootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ for path in $paths; do
exit 1
fi
mkdir -p $out/$(dirname $path)
ln -s $src/$path $out/$path
if [[ -d $src/$path ]]; then
ln -s $src/$path $out/$path
else
cp -RL $src/$path $out/$path
fi
done
4 changes: 4 additions & 0 deletions pkgs/tools/text/diffutils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ stdenv.mkDerivation rec {
sed -i -E 's:[[:space:]]test-sigsegv-catch-stackoverflow[12]\$\(EXEEXT\)::g' gnulib-tests/Makefile.in
sed -i -E 's:[[:space:]]test-sigaction\$\(EXEEXT\)::g' gnulib-tests/Makefile.in
''
else if stdenv.hostPlatform.isFreeBSD then
''
sed -i -E 's:test-time::g' gnulib-tests/Makefile.in
''
else
null;

Expand Down
8 changes: 8 additions & 0 deletions pkgs/tools/text/gnupatch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenv,
fetchurl,
ed,
autoreconfHook,
}:

stdenv.mkDerivation rec {
Expand All @@ -14,6 +15,13 @@ stdenv.mkDerivation rec {
hash = "sha256-+Hzuae7CtPy/YKOWsDCtaqNBXxkqpffuhMrV4R9/WuM=";
};

# This test is filesystem-dependent - observed failing on ZFS
postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''
sed -E -i -e '/bad-filenames/d' tests/Makefile.am
'';

nativeBuildInputs = [ autoreconfHook ];

configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"ac_cv_func_strnlen_working=yes"
];
Expand Down
3 changes: 3 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ with pkgs;
auto-patchelf
bintools
];
substitutions = {
hostPlatform = stdenv.hostPlatform.config;
};
} ../build-support/setup-hooks/auto-patchelf.sh;

appimageTools = callPackage ../build-support/appimage { };
Expand Down