Skip to content

Commit

Permalink
freebsd packages: Init at 13.1
Browse files Browse the repository at this point in the history
Always set `SRCTOP`, set it with abs path

llvmPackages: Bump minimum version for FreeBSD

llvmPackages_*, libgcc, compiler_rt: Hack in enough libs that one can compiler C

freebsd.compat: Rename some things to work around cc-wrapper change

0bea4a1 / #191724 in particular
  • Loading branch information
Ericson2314 committed Nov 4, 2022
1 parent 66aa02f commit 0afe9d1
Show file tree
Hide file tree
Showing 46 changed files with 1,235 additions and 30 deletions.
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/10/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -99,6 +101,8 @@ stdenv.mkDerivation {
for f in $out/lib/*/*builtins-i?86*; do
ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/')
done
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/10/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stdenv.mkDerivation {
];

nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/11/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -108,6 +110,8 @@ stdenv.mkDerivation {
for f in $out/lib/*/*builtins-i?86*; do
ln -s "$f" $(echo "$f" | sed -e 's/builtins-i.86/builtins-i386/')
done
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/11/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/11/libcxxabi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
, enableShared ? !stdenv.hostPlatform.isStatic
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
}:

stdenv.mkDerivation {
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/12/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -94,6 +96,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/12/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/12/libcxxabi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta, cmake, python3, fetch, libcxx, libunwind, llvm, version
, enableShared ? !stdenv.hostPlatform.isStatic
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
}:

stdenv.mkDerivation {
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/13/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt }:
{ lib, stdenv, llvm_meta, version, src, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -99,6 +101,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/13/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/13/libcxxabi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta, cmake, python3, src, cxx-headers, libunwind, version
, enableShared ? !stdenv.hostPlatform.isStatic
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
}:

stdenv.mkDerivation rec {
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/14/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib, stdenv, llvm_meta, version
, monorepoSrc, runCommand
, cmake, python3, xcbuild, libllvm, libcxxabi, libxcrypt
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let
Expand Down Expand Up @@ -110,6 +111,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/14/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ let
]
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
++ lib.optional
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
"-lunwind"
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/14/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
];

nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = [
"-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/5/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -86,6 +88,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/5/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stdenv.mkDerivation {
];

nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin) libunwind;

preInstall = lib.optionalString stdenv.isDarwin ''
for file in lib/*.dylib; do
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/6/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -86,6 +88,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/linux/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/linux/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/linux/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/freebsd/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/6/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stdenv.mkDerivation {
];

nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin) libunwind;

preInstall = lib.optionalString stdenv.isDarwin ''
for file in lib/*.dylib; do
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/7/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -89,6 +91,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/7/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/7/libcxxabi/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version
, fetchpatch
, standalone ? stdenv.hostPlatform.useLLVM or false
, withLibunwind ? !stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
# on musl the shared objects don't build
, enableShared ? !stdenv.hostPlatform.isStatic
}:
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/8/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -89,6 +91,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/8/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/8/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stdenv.mkDerivation {
];

nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/9/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi }:
{ lib, stdenv, llvm_meta, version, fetch, cmake, python3, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let

Expand Down Expand Up @@ -88,6 +90,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/9/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ let
echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
'' + lib.optionalString (!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false) ''
echo "-lunwind" >> $out/nix-support/cc-ldflags
'' + lib.optionalString stdenv.targetPlatform.isWasm ''
echo "-fno-exceptions" >> $out/nix-support/cc-cflags
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/9/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ stdenv.mkDerivation {
];

nativeBuildInputs = [ cmake ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = lib.optionals (stdenv.hostPlatform.useLLVM or false) [
"-DLLVM_ENABLE_LIBCXX=ON"
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/compilers/llvm/git/compiler-rt/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib, stdenv, llvm_meta, version
, monorepoSrc, runCommand
, cmake, python3, xcbuild, libllvm, libcxxabi
, doFakeLibgcc ? stdenv.hostPlatform.isFreeBSD
}:

let
Expand Down Expand Up @@ -106,6 +107,8 @@ stdenv.mkDerivation {
ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
'' + lib.optionalString doFakeLibgcc ''
ln -s $out/lib/freebsd/libclang_rt.builtins-*.a $out/lib/libgcc.a
'';

meta = llvm_meta // {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/git/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ let
]
++ lib.optional (!stdenv.targetPlatform.isWasm) "--unwindlib=libunwind"
++ lib.optional
(!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false)
(!stdenv.targetPlatform.isWasm && !stdenv.targetPlatform.isFreeBSD && stdenv.targetPlatform.useLLVM or false)
"-lunwind"
++ lib.optional stdenv.targetPlatform.isWasm "-fno-exceptions";
};
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/llvm/git/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
'';

nativeBuildInputs = [ cmake python3 ];
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.hostPlatform.isWasm) libunwind;

cmakeFlags = [
"-DLLVM_ENABLE_RUNTIMES=libcxxabi"
Expand Down
32 changes: 32 additions & 0 deletions pkgs/os-specific/bsd/freebsd/compat-fix-typedefs-locations.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--- a/tools/build/cross-build/include/common/sys/_types.h
+++ b/tools/build/cross-build/include/common/sys/_types.h
@@ -47,3 +47,6 @@
* Neither GLibc nor macOS define __va_list but many FreeBSD headers require it.
*/
typedef __builtin_va_list __va_list;
+
+typedef __UINTPTR_TYPE__ __uintptr_t;
+typedef __INTPTR_TYPE__ __intptr_t;
--- a/tools/build/cross-build/include/common/sys/types.h
+++ b/tools/build/cross-build/include/common/sys/types.h
@@ -49,9 +49,6 @@
#include <sys/sysmacros.h>
#endif

-typedef __UINTPTR_TYPE__ __uintptr_t;
-typedef __INTPTR_TYPE__ __intptr_t;
-
/* needed for gencat */
typedef int __nl_item;

--- a/tools/build/cross-build/include/linux/sys/types.h
+++ b/tools/build/cross-build/include/linux/sys/types.h
@@ -39,6 +39,8 @@

#include_next <sys/types.h>

+#include <sys/_types.h>
+
#ifndef __size_t
typedef __SIZE_TYPE__ __size_t;
#endif
Loading

0 comments on commit 0afe9d1

Please sign in to comment.