Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1fccf6a
Minimal set of changes to get FreeBSD stdenv building again
rhelmot Mar 17, 2024
4f92570
Update maintainers/maintainer-list.nix
rhelmot Mar 17, 2024
af93d00
Remove dead code
rhelmot Mar 17, 2024
f63b420
FreeBSD update.py: Add type annotation
rhelmot Mar 17, 2024
384d080
Update pkgs/os-specific/bsd/freebsd/update.py: add type annotation
rhelmot Mar 17, 2024
19b9753
FreeBSD update.py: Add type annotations
rhelmot Mar 17, 2024
0aaf0eb
lint update.py
rhelmot Mar 17, 2024
306fb57
Update pkgs/stdenv/freebsd/autotools-abspath.sh: make enumeration cle…
rhelmot Mar 17, 2024
04e3501
meson: convert pkgconfig patch to diff
rhelmot Mar 17, 2024
6699990
chore: replace freebsd13 with freebsd globally
rhelmot Mar 17, 2024
d81c159
freebsd: include some patches which didn't make it into the merge
rhelmot Mar 17, 2024
b91401c
meson: make freebsd patch unconditional
rhelmot Mar 17, 2024
3ef8c6b
expect: cleanup - move NIX_CFLAGS_COMPILE into env package env declar…
rhelmot Mar 17, 2024
165b329
cyrus_sasl: cleanup - remove commented line
rhelmot Mar 17, 2024
246fde6
coreutils: remove spurious option
rhelmot Mar 17, 2024
b4fbf66
stdenv-freebsd: clean up formatting for initialPath
rhelmot Mar 17, 2024
c4c8309
freebsd/by-name: cleanup - remove ... from package arguments
rhelmot Mar 17, 2024
3c28dd7
freebsd.bin: remove dead code
rhelmot Mar 17, 2024
bf114ed
llvmPackages16.compiler-rt: reformat substituteInPlace calls
rhelmot Mar 17, 2024
cdca9d6
freebsd.libncurses-tinfo: remove dead code
rhelmot Mar 17, 2024
b2557e4
freebsd.iconv: init
rhelmot Mar 17, 2024
1005c14
meson: make freebsd diff patch actually apply
rhelmot Mar 17, 2024
5e29ff7
freebsd.libdl: init
rhelmot Mar 17, 2024
e635092
FreeBSD bootstrap: remove libcxxabi
rhelmot Mar 17, 2024
e4a8691
libxcrypt: fix build on freebsd/llvm17
rhelmot Mar 18, 2024
4458c09
llvmPackages17.libcxx: fix FreeBSD vis a vis static compilation
rhelmot Mar 18, 2024
db51a48
zlib: Fix linker error on freebsd/llvm17
rhelmot Mar 18, 2024
e50b523
binutils: fix linker error on freebsd/llvm17
rhelmot Mar 18, 2024
00985a1
ncurses: add a flag to prevent linker errors for FreeBSD cross
rhelmot Mar 18, 2024
5c6e061
stdenv/freebsd: update bootstrap hashes
rhelmot Mar 18, 2024
62b21b9
rhash: make FreeBSD patches less ad-hoc
rhelmot Mar 19, 2024
fe0ffcf
bintools-wrapper: only install existing outputs
rhelmot Mar 19, 2024
c282078
freebsd: fix infinite recursion; remove premature drm stuff; add libn…
rhelmot Mar 19, 2024
2ab4ef2
bintools-wrapper, cc-wrapper: do not propagate outputsToInstall
rhelmot Mar 19, 2024
0bc8964
Merge remote-tracking branch 'upstream/staging' into freebsd-minimal
rhelmot Mar 19, 2024
e38418f
bintools-wrapper: uncomment assertion
rhelmot Mar 24, 2024
224ea7e
Merge branch 'staging' into freebsd-minimal
rhelmot Mar 24, 2024
36dba9c
Merge remote-tracking branch 'upstream/master' into freebsd-minimal
rhelmot May 12, 2024
7098aea
Merge remote-tracking branch 'upstream/staging' into freebsd-minimal
rhelmot May 12, 2024
1eff7de
freebsd: fix additional merge conflicts
rhelmot May 12, 2024
6415043
stdenv/freebsd: update bootstrap hashes
rhelmot May 12, 2024
2cb8c01
stdenv/freebsd: Pass runtimeShell
artemist May 12, 2024
3388ede
stdenv/freebsd: finish making things eval
rhelmot May 13, 2024
081de11
freebsd: do not use compiler with libs for compiling libc
rhelmot May 14, 2024
e67d7c5
Update bootstrap hashes
rhelmot May 14, 2024
22fae3d
stdenv/freebsd: fix eval again
rhelmot May 14, 2024
c3154d4
lib: add x86_64-freebsd back to flake-systems
rhelmot May 14, 2024
1c8e902
rsync: Make enableLZ4 = false actually work
rhelmot May 14, 2024
71fdd08
stdenv/freebsd: provide locales to all stdenvs, not just the final one
rhelmot May 14, 2024
9c08ec7
rsync: Make enableOpenSSL = false actually work
rhelmot May 14, 2024
1291482
llvmPackages: actually use previously-added patches
rhelmot May 15, 2024
3d759aa
freebsd.boot-install: filter the arguments that are not applicable to…
rhelmot May 15, 2024
c01e88d
cmake: remove propagatedBuildInput ps and patch code to use an abspat…
rhelmot May 15, 2024
748300b
expect: clean up the patches a bit
rhelmot May 15, 2024
9ec1473
coreutils: switch freebsd singleBinary default to shebangs
rhelmot May 15, 2024
6123b96
texinfo: remove unneeded CFLAGS entry
rhelmot May 15, 2024
0caae9c
cpython: remove deterministic uname and commit harder to patching una…
rhelmot May 16, 2024
61fc724
freebsd: strip installed binaries, remove associated hack from coreutils
rhelmot May 17, 2024
ab98306
re-disable FreeBSD single binary
rhelmot May 17, 2024
2715514
cpython: make uname patch unconditional
rhelmot May 17, 2024
6639fd2
bash: remove a configure flag now that we have a stripped libc
rhelmot May 17, 2024
f7f7aa4
coreutils: make autoreconfHook patch conditional
rhelmot May 17, 2024
8b4ad6a
all-packages: remove some extraneous code to reduce the diff
rhelmot May 17, 2024
8642aac
freebsd.locale: init
rhelmot May 17, 2024
3cba71f
Undo the libuuid diff, it's not needed for right now.
rhelmot May 18, 2024
9c98c7e
meson: clean up dramatically
rhelmot May 18, 2024
0a48f4d
re2c: undo disable tests
rhelmot May 18, 2024
18e19db
bash: make FreeBSD configure flag less conditional
rhelmot May 18, 2024
ce6fa56
bintools: drop the jank hunk
rhelmot May 20, 2024
8a95ec4
make autotools-abspath obsolete
rhelmot May 21, 2024
111c50f
coreutils: enable single-binary build on FreeBSD
rhelmot May 22, 2024
9da4293
freebsd.libncurses: Fix typo
artemist May 26, 2024
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
2 changes: 2 additions & 0 deletions lib/systems/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ rec {
&& 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"
Expand Down
4 changes: 2 additions & 2 deletions lib/systems/doubles.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let
"x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin"

# FreeBSD
"i686-freebsd13" "x86_64-freebsd13"
"i686-freebsd" "x86_64-freebsd"
Comment thread
Mic92 marked this conversation as resolved.

# Genode
"aarch64-genode" "i686-genode" "x86_64-genode"
Expand Down Expand Up @@ -115,5 +115,5 @@ in {

embedded = filterDoubles predicates.isNone;

mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin" "riscv64-linux"];
mesaPlatforms = ["i686-linux" "x86_64-linux" "x86_64-darwin" "armv5tel-linux" "armv6l-linux" "armv7l-linux" "armv7a-linux" "aarch64-linux" "powerpc64-linux" "powerpc64le-linux" "aarch64-darwin" "riscv64-linux" "x86_64-freebsd"];
}
6 changes: 1 addition & 5 deletions lib/systems/parse.nix
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,7 @@ rec {
# the normalized name for macOS.
macos = { execFormat = macho; families = { inherit darwin; }; name = "darwin"; };
ios = { execFormat = macho; families = { inherit darwin; }; };
# A tricky thing about FreeBSD is that there is no stable ABI across
# versions. That means that putting in the version as part of the
# config string is paramount.
freebsd12 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 12; };
freebsd13 = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; version = 13; };
freebsd = { execFormat = elf; families = { inherit bsd; }; name = "freebsd"; };
linux = { execFormat = elf; families = { }; };
netbsd = { execFormat = elf; families = { inherit bsd; }; };
none = { execFormat = unknown; families = { }; };
Expand Down
8 changes: 8 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1647,6 +1647,7 @@
email = "me@artem.ist";
github = "artemist";
githubId = 1226638;
matrix = "@artemist:mildlyfunctional.gay";
Comment thread
rhelmot marked this conversation as resolved.
Outdated
name = "Artemis Tosini";
keys = [{
fingerprint = "3D2B B230 F9FA F0C5 1832 46DD 4FDC 96F1 61E7 BA8A";
Expand Down Expand Up @@ -16409,6 +16410,13 @@
githubId = 12279531;
name = "Ricardo Guevara";
};
rhelmot = {
name = "Audrey Dutcher";
github = "rhelmot";
githubId = 2498805;
email = "audrey@rhelmot.io";
matrix = "@rhelmot:matrix.org";
};
rhendric = {
name = "Ryan Hendrickson";
github = "rhendric";
Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/networking/sync/rsync/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ stdenv.mkDerivation rec {
] ++ lib.optionals (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isx86_64) [
# fix `multiversioning needs 'ifunc' which is not supported on this target` error
"--disable-roll-simd"
] ++ lib.optionals (!enableZstd) [
"--disable-zstd"
] ++ lib.optionals (!enableXXHash) [
"--disable-xxhash"
];

enableParallelBuilding = true;
Expand Down
5 changes: 3 additions & 2 deletions pkgs/build-support/bintools-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
else
lib.getLib libc
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? ""
, propagateDoc ? bintools != null && bintools ? man
, propagateDoc ? bintools != null && bintools ? "man"
, extraPackages ? [], extraBuildCommands ? ""
, isGNU ? bintools.isGNU or false
, isLLVM ? bintools.isLLVM or false
Expand Down Expand Up @@ -61,6 +61,7 @@

with lib;

assert propagateDoc -> bintools ? "man";
assert nativeTools -> !propagateDoc && nativePrefix != "";
assert !nativeTools ->
bintools != null && coreutils != null && gnugrep != null;
Expand Down Expand Up @@ -113,7 +114,7 @@ let
else if targetPlatform.isRiscV then "${sharedLibraryLoader}/lib/ld-linux-riscv*.so.1"
else if targetPlatform.isLoongArch64 then "${sharedLibraryLoader}/lib/ld-linux-loongarch*.so.1"
else if targetPlatform.isDarwin then "/usr/lib/dyld"
else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1"
else if targetPlatform.isFreeBSD then "${sharedLibraryLoader}/libexec/ld-elf.so.1"
else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
else "";

Expand Down
2 changes: 2 additions & 0 deletions pkgs/build-support/deterministic-uname/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ substituteAll {
then "GNU/Linux"
else if stdenv.buildPlatform.isDarwin
then "Darwin" # darwin isn't in host-os.m4 so where does this come from?
else if stdenv.buildPlatform.isFreeBSD
then "FreeBSD"
else "unknown";

# in os-specific/linux module packages
Expand Down
2 changes: 2 additions & 0 deletions pkgs/build-support/deterministic-uname/deterministic-uname.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ fi
# Darwin *nodename* 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64 arm Darwin
# NixOS:
# Linux *nodename* 6.0.13 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 14 10:41:06 UTC 2022 x86_64 GNU/Linux
# FreeBSD:
# FreeBSD *nodename* 14.0-RELEASE FreeBSD 14.0-RELEASE #0 releng/14.0-n265380-f9716eee8ab4: Fri Nov 10 05:57:23 UTC 2023 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 amd64 AMD Ryzen 9 5950X 16-Core Processor FreeBSD
output=()
if [[ "$all" = "1" ]]; then
output+=("$KERNEL_NAME_VAL" "$NODENAME_VAL" "$KERNEL_RELEASE_VAL" "$KERNEL_VERSION_VAL" "$MACHINE_VAL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

makeSetupHook {
name = "make-binary-wrapper-hook";
propagatedBuildInputs = [ dieHook ];
propagatedBuildInputs = [ dieHook cc ];
Comment thread
Mic92 marked this conversation as resolved.

substitutions = {
cc = "${cc}/bin/${cc.targetPrefix}cc ${lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers)}";
Expand Down
6 changes: 4 additions & 2 deletions pkgs/by-name/cm/cmake/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
, buildDocs ? !(isMinimalBuild || (uiToolkits == []))
, darwin
, libsForQt5
, freebsd
, gitUpdater
}:

Expand Down Expand Up @@ -99,9 +100,10 @@ stdenv.mkDerivation (finalAttrs: {
++ lib.optional cursesUI ncurses
++ lib.optional qt5UI qtbase
++ lib.optional stdenv.isDarwin CoreServices
++ lib.optional (stdenv.isDarwin && !isMinimalBuild) SystemConfiguration;
++ lib.optional (stdenv.isDarwin && !isMinimalBuild) SystemConfiguration
++ lib.optional stdenv.isFreeBSD freebsd.libkvm;

propagatedBuildInputs = lib.optional stdenv.isDarwin ps;
propagatedBuildInputs = lib.optional (stdenv.isDarwin || stdenv.isFreeBSD) ps;

preConfigure = ''
fixCmakeFiles .
Expand Down
23 changes: 21 additions & 2 deletions pkgs/by-name/me/meson/package.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{ lib
, stdenv
, buildPackages
, fetchFromGitHub
, installShellFiles
, coreutils
, darwin
, libblocksruntime
, llvmPackages
, libxcrypt
, openldap
, ninja
Expand Down Expand Up @@ -71,6 +74,8 @@ python3.pkgs.buildPythonApplication rec {
libxcrypt
];

propagatedNativeBuildInputs = lib.optionals stdenv.isFreeBSD [ buildPackages.freebsd.ldd ];
Comment thread
Mic92 marked this conversation as resolved.
Outdated

nativeBuildInputs = [ installShellFiles ];

nativeCheckInputs = [
Expand All @@ -88,8 +93,16 @@ python3.pkgs.buildPythonApplication rec {
LDAP
OpenGL
openldap
] ++ lib.optionals (stdenv.cc.isClang && !stdenv.isDarwin) [
libblocksruntime
llvmPackages.openmp
];

postPatch = lib.optionalString stdenv.hostPlatform.isFreeBSD ''
# This edge case is explicilty part of meson but is wrong for nix
sed -E -i -e s/mesonlib.is_freebsd../False/g mesonbuild/modules/pkgconfig.py
Comment thread
rhelmot marked this conversation as resolved.
Outdated
'';

checkPhase = lib.concatStringsSep "\n" ([
"runHook preCheck"
''
Expand All @@ -100,7 +113,7 @@ python3.pkgs.buildPythonApplication rec {
''
]
# Remove problematic tests
++ (builtins.map (f: ''rm -vr "${f}";'') [
++ (builtins.map (f: ''rm -vr "${f}";'') ([
# requires git, creating cyclic dependency
''test cases/common/66 vcstag''
# requires glib, creating cyclic dependency
Expand All @@ -110,7 +123,13 @@ python3.pkgs.buildPythonApplication rec {
''test cases/linuxlike/14 static dynamic linkage''
# Nixpkgs cctools does not have bitcode support.
''test cases/osx/7 bitcode''
])
] ++ lib.optionals stdenv.isFreeBSD [
# pch doesn't work quite right on FreeBSD, I think
''test cases/common/13 pch''
# tests hardcode lib instead of libdata, which FreeBSD uses
''test cases/common/44 pkgconfig-gen''
''test cases/common/230 external project''
]))
++ [
''HOME="$TMPDIR" python ./run_project_tests.py''
"runHook postCheck"
Expand Down
3 changes: 2 additions & 1 deletion pkgs/data/misc/tzdata/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, buildPackages }:
{ lib, stdenv, fetchurl, buildPackages, libintl }:

stdenv.mkDerivation (finalAttrs: {
pname = "tzdata";
Expand All @@ -23,6 +23,7 @@ stdenv.mkDerivation (finalAttrs: {

outputs = [ "out" "bin" "man" "dev" ];
propagatedBuildOutputs = [ ];
buildInputs = lib.optionals stdenv.hostPlatform.isFreeBSD [ libintl ];

makeFlags = [
"TOPDIR=${placeholder "out"}"
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/16/compiler-rt/asan-offset.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/lib/asan/CMakeLists.txt 2022-06-22 16:46:24.000000000 +0000
+++ b/lib/asan/CMakeLists.txt
@@ -46,7 +46,7 @@ set(ASAN_STATIC_SOURCES
asan_rtl_static.cpp
)

-if (NOT WIN32 AND NOT APPLE)
+if (LINUX)
list(APPEND ASAN_STATIC_SOURCES
asan_rtl_x86_64.S
)
13 changes: 13 additions & 0 deletions pkgs/development/compilers/llvm/16/compiler-rt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ stdenv.mkDerivation {
../../common/compiler-rt/darwin-plistbuddy-workaround.patch
# See: https://github.com/NixOS/nixpkgs/pull/194634#discussion_r999829893
# ../../common/compiler-rt/armv7l-15.patch

# disable an optimized implementation of asan checks that fails on bsd/gcc and compiles incorrectly on bsd/clang
# See: https://github.com/llvm/llvm-project/issues/57086
./asan-offset.patch
] ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
./freebsd-i386.patch
];

# TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
Expand All @@ -113,10 +119,17 @@ stdenv.mkDerivation {
'' + lib.optionalString (useLLVM && !haveLibc) ''
substituteInPlace lib/builtins/int_util.c \
--replace "#include <stdlib.h>" ""
'' + lib.optionalString (useLLVM && !haveLibc && !stdenv.hostPlatform.isFreeBSD) ''
substituteInPlace lib/builtins/clear_cache.c \
--replace "#include <assert.h>" ""
substituteInPlace lib/builtins/cpu_model.c \
--replace "#include <assert.h>" ""
'' + lib.optionalString (useLLVM && !haveLibc && stdenv.hostPlatform.isFreeBSD) ''
# As per above, but in FreeBSD assert is a macro and simply allowing it to be implicitly declared causes Issues!!!!!
substituteInPlace lib/builtins/clear_cache.c \
--replace "#include <assert.h>" "#define assert(e) ((e)?(void)0:__assert(__FUNCTION__,__FILE__,__LINE__,#e))"
substituteInPlace lib/builtins/cpu_model.c \
--replace "#include <assert.h>" "#define assert(e) ((e)?(void)0:__assert(__FUNCTION__,__FILE__,__LINE__,#e))"
Comment thread
rhelmot marked this conversation as resolved.
Outdated
'';

# Hack around weird upsream RPATH bug
Expand Down
21 changes: 21 additions & 0 deletions pkgs/development/compilers/llvm/16/compiler-rt/freebsd-i386.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--- a/lib/builtins/fp_lib.h 1969-12-31 16:00:01.000000000 -0800
+++ b/lib/builtins/fp_lib.h 2023-12-21 23:39:36.066927293 -0800
@@ -26,18 +26,6 @@
#include <stdbool.h>
#include <stdint.h>

-// x86_64 FreeBSD prior v9.3 define fixed-width types incorrectly in
Comment thread
Mic92 marked this conversation as resolved.
-// 32-bit mode.
-#if defined(__FreeBSD__) && defined(__i386__)
-#include <sys/param.h>
-#if __FreeBSD_version < 903000 // v9.3
-#define uint64_t unsigned long long
-#define int64_t long long
-#undef UINT64_C
-#define UINT64_C(c) (c##ULL)
-#endif
-#endif
-
#if defined SINGLE_PRECISION

typedef uint16_t half_rep_t;
5 changes: 2 additions & 3 deletions pkgs/development/compilers/llvm/16/libcxx/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{ lib, stdenv, llvm_meta
, monorepoSrc, runCommand, fetchpatch
, monorepoSrc, runCommand
, cmake, lndir, ninja, python3, fixDarwinDylibNames, version
, cxxabi ? if stdenv.hostPlatform.isFreeBSD then libcxxrt else null
, libcxxrt, libunwind
, libunwind, cxxabi ? null
, enableShared ? !stdenv.hostPlatform.isStatic
}:

Expand Down
16 changes: 15 additions & 1 deletion pkgs/development/compilers/llvm/16/llvm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# broken for the armv7l builder
&& !stdenv.hostPlatform.isAarch
, enablePolly ? true
, enableTerminfo ? true
}:

let
Expand Down Expand Up @@ -167,7 +168,7 @@ in

# This test tries to call the intrinsics `@llvm.roundeven.f32` and
# `@llvm.roundeven.f64` which seem to (incorrectly?) lower to `roundevenf`
# and `roundeven` on macOS.
# and `roundeven` on macOS and FreeBSD.
#
# However these functions are glibc specific so the test fails:
# - https://www.gnu.org/software/gnulib/manual/html_node/roundevenf.html
Expand Down Expand Up @@ -246,6 +247,14 @@ in
'' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
# Seems to require certain floating point hardware (NEON?)
rm test/ExecutionEngine/frem.ll
'' + optionalString stdenv.isFreeBSD ''
# TODO: Why does this test fail on FreeBSD?
# It seems to reference /usr/local/lib/libfile.a, which is clearly a problem.
rm test/tools/llvm-libtool-darwin/L-and-l.test

# This test fails for the same reason it fails on MacOS, but the fix is
# not trivial to apply.
rm test/ExecutionEngine/Interpreter/intrinsics.ll
'' + ''
patchShebangs test/BugPoint/compile-custom.ll.py
'';
Expand Down Expand Up @@ -317,9 +326,12 @@ in
"-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
"-DLLVM_ENABLE_DUMP=ON"
] ++ optionals (!doCheck) [
"-DLLVM_INCLUDE_TESTS=OFF"
] ++ optionals stdenv.hostPlatform.isStatic [
# Disables building of shared libs, -fPIC is still injected by cc-wrapper
"-DLLVM_ENABLE_PIC=OFF"
"-DCMAKE_SKIP_INSTALL_RPATH=ON"
"-DLLVM_BUILD_STATIC=ON"
"-DLLVM_LINK_LLVM_DYLIB=off"
# libxml2 needs to be disabled because the LLVM build system ignores its .la
Expand Down Expand Up @@ -368,6 +380,8 @@ in
nativeInstallFlags
])
)
] ++ optionals (!enableTerminfo) [
"-DLLVM_ENABLE_TERMINFO=OFF"
];

postInstall = ''
Expand Down
Loading