Skip to content

Commit

Permalink
llvmPackages_{12,13,14,15,16,17,git}.{libcxx,libcxxabi}: re-export li…
Browse files Browse the repository at this point in the history
…bcxxabi new, delete, exceptions
  • Loading branch information
annalee committed Jan 23, 2024
1 parent 83e43e9 commit 1c4b076
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkgs/development/compilers/llvm/12/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

assert stdenv.isDarwin -> cxxabi.pname == "libcxxabi";

stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxx";
inherit version;

Expand All @@ -23,6 +23,7 @@ stdenv.mkDerivation {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -44,6 +45,9 @@ stdenv.mkDerivation {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

preInstall = lib.optionalString (stdenv.isDarwin) ''
Expand Down
13 changes: 12 additions & 1 deletion pkgs/development/compilers/llvm/12/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, withLibunwind ? !stdenv.isDarwin && !stdenv.hostPlatform.isWasm
}:

stdenv.mkDerivation {
stdenv.mkDerivation rec {
pname = "libcxxabi";
inherit version;

Expand All @@ -27,6 +27,7 @@ stdenv.mkDerivation {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -67,6 +68,16 @@ stdenv.mkDerivation {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/13/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -44,6 +45,9 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

buildFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/13/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -64,6 +65,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/14/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand All @@ -60,6 +61,9 @@ stdenv.mkDerivation rec {
"-DLIBCXX_ENABLE_THREADS=OFF"
"-DLIBCXX_ENABLE_FILESYSTEM=OFF"
"-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";

buildFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/14/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ stdenv.mkDerivation rec {

patches = [
./gnu-install-dirs.patch
../../libcxxabi-re-export.diff
];

nativeBuildInputs = [ cmake python3 ];
Expand Down Expand Up @@ -74,6 +75,16 @@ stdenv.mkDerivation rec {
make install
install -d 755 $out/include
install -m 644 ../include/*.h $out/include
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f re-exports/new-delete.exp ]]; then
install -Dm 644 re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f re-exports/exceptions.exp ]]; then
install -Dm 644 re-exports/exceptions.exp -t "$dev/share/${pname}"
cat re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
''
else ''
install -d -m 755 $out/include $out/lib
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/15/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
] ++ lib.optionals stdenv.hostPlatform.isMusl [
../../libcxx-0001-musl-hacks.patch
];
Expand Down Expand Up @@ -115,6 +116,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/15/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -93,6 +94,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/16/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -102,6 +103,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/16/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/17/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -101,6 +102,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/17/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/development/compilers/llvm/git/libcxx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
hash = "sha256-LNoPg1KCoP8RWxU/AzHR52f4Dww24I9BGQJedMhFxyQ=";
relative = "libcxx";
})
../../libcxx-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -101,6 +102,9 @@ stdenv.mkDerivation rec {
++ lib.optionals (headersOnly) [
"-DCMAKE_C_COMPILER_WORKS=ON"
"-DCMAKE_CXX_COMPILER_WORKS=ON"
] ++ lib.optionals (!headersOnly && stdenv.hostPlatform.isDarwin) [
"-DLIBCXXABI_REEXPORT_NEW_DELETE=${lib.getDev cxxabi}/share/${cxxabi.pname}/new-delete.exp"
"-DLIBCXXABI_REEXPORT_EXCEPTIONS=${lib.getDev cxxabi}/share/${cxxabi.pname}/exceptions.exp"
];

ninjaFlags = lib.optional headersOnly "generate-cxx-headers";
Expand Down
11 changes: 11 additions & 0 deletions pkgs/development/compilers/llvm/git/libcxxabi/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ stdenv.mkDerivation rec {
sha256 = "1xyjd56m4pfwq8p3xh6i8lhkk9kq15jaml7qbhxdf87z4jjkk63a";
stripLen = 1;
})
../../libcxxabi-re-export.diff
];

postPatch = ''
Expand Down Expand Up @@ -94,6 +95,16 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$dev/include"
install -m 644 ../../${pname}/include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p "$dev/share/${pname}"
touch "$dev/share/${pname}/exceptions.exp" "$dev/share/${pname}/new-delete.exp"
if [[ -f libcxxabi/re-exports/new-delete.exp ]]; then
install -Dm 644 libcxxabi/re-exports/new-delete.exp -t "$dev/share/${pname}"
fi
if [[ -f libcxxabi/re-exports/exceptions.exp ]]; then
install -Dm 644 libcxxabi/re-exports/exceptions.exp -t "$dev/share/${pname}"
cat libcxxabi/re-exports/personality-*.exp >> "$dev/share/${pname}/exceptions.exp"
fi
'';

passthru = {
Expand Down
21 changes: 21 additions & 0 deletions pkgs/development/compilers/llvm/libcxx-re-export.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 329964a00136..ac6f510196bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -242,6 +242,16 @@ if (LIBCXX_ENABLE_SHARED)
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/notweak.exp"
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/../lib/weak.exp")

+ if (NOT LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
+ AND DEFINED LIBCXXABI_REEXPORT_NEW_DELETE)
+ target_link_libraries(cxx_shared PRIVATE
+ "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_NEW_DELETE}")
+ endif()
+ if (DEFINED LIBCXXABI_REEXPORT_EXCEPTIONS)
+ target_link_libraries(cxx_shared PRIVATE
+ "-Wl,-reexported_symbols_list,${LIBCXXABI_REEXPORT_EXCEPTIONS}")
+ endif()
+
target_link_libraries(cxx_shared PRIVATE $<TARGET_NAME_IF_EXISTS:cxxabi-reexports>)
endif()

13 changes: 13 additions & 0 deletions pkgs/development/compilers/llvm/libcxxabi-re-export.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 4198827203fc..1a028720bb7d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -222,6 +222,7 @@ if (LIBCXXABI_ENABLE_SHARED)
function(reexport_symbols file)
export_symbols("${file}")
target_link_libraries(cxxabi-reexports INTERFACE "-Wl,-reexported_symbols_list,${file}")
+ file(INSTALL "${file}" DESTINATION "${LIBCXXABI_BINARY_DIR}/re-exports")
endfunction()

export_symbols("${CMAKE_CURRENT_SOURCE_DIR}/../lib/itanium-base.exp")

0 comments on commit 1c4b076

Please sign in to comment.