2021-05-11 21:12:04 +00:00
|
|
|
{ lib, stdenv, llvm_meta, cmake, fetch, libcxx, libunwind, llvm, version }:
|
2018-01-31 14:09:24 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2021-05-11 19:43:21 +00:00
|
|
|
pname = "libcxxabi";
|
2019-08-13 21:52:01 +00:00
|
|
|
inherit version;
|
2018-01-31 14:09:24 +00:00
|
|
|
|
2018-06-28 20:58:05 +00:00
|
|
|
src = fetch "libcxxabi" "0prqvdj317qrc8nddaq1hh2ag9algkd9wbkj3y4mr5588k12x7r0";
|
2018-01-31 14:09:24 +00:00
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2018-01-31 14:09:24 +00:00
|
|
|
|
|
|
|
postUnpack = ''
|
|
|
|
unpackFile ${libcxx.src}
|
|
|
|
unpackFile ${llvm.src}
|
|
|
|
export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
|
2021-01-22 11:25:31 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2018-01-31 14:09:24 +00:00
|
|
|
export TRIPLE=x86_64-apple-darwin
|
2021-01-22 11:25:31 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
2021-04-15 10:15:07 +00:00
|
|
|
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
|
2018-01-31 14:09:24 +00:00
|
|
|
'';
|
|
|
|
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
patches = [
|
|
|
|
./gnu-install-dirs.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2020-03-09 06:10:06 +00:00
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin) libunwind;
|
llvmPackages: Multuple outputs for everythting
Also begin to start work on cross compilation, though that will have to
be finished later.
The patches are based on the first version of
https://reviews.llvm.org/D99484. It's very annoying to do the
back-porting but the review has uncovered nothing super major so I'm
fine sticking with what I've got.
Beyond making the outputs work, I also strove to re-sync the packages,
as they have been drifting pointlessly apart for some time.
----
Other misc notes, highly incomplete
- lvm-config-native and llvm-config are put in `dev` because they are
tools just for build time.
- Clang no longer has an lld dep. That was introduced in
db29857eb391ed002046090851a44c452b80bdbd, but if clang needs help
finding lld when it is used we should just pass it flags / put in the
resource dir. Providing it at build time increases critical path
length for no good reason.
----
A note on `nativeCC`:
`stdenv` takes tools from the previous stage, so:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.stdenv.cc`: `(?0, ?1, x)`
while:
1. `pkgsBuildBuild`: `(?1, x, x)`
2. `pkgsBuildBuild.targetPackages`: `(x, x, ?2)`
3. `pkgsBuildBuild.targetPackages.stdenv.cc`: `(?1, x, x)`
2020-10-15 08:23:57 +00:00
|
|
|
|
2022-08-18 04:10:08 +00:00
|
|
|
preInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
for file in lib/*.dylib; do
|
2022-11-15 01:54:14 +00:00
|
|
|
if [ -L "$file" ]; then continue; fi
|
|
|
|
|
2022-08-09 10:17:47 +00:00
|
|
|
# Fix up the install name. Preserve the basename, just replace the path.
|
2022-11-22 21:37:47 +00:00
|
|
|
installName="$out/lib/$(basename $(${stdenv.cc.targetPrefix}otool -D $file | tail -n 1))"
|
2022-08-09 10:17:47 +00:00
|
|
|
|
2022-08-18 04:10:08 +00:00
|
|
|
# this should be done in CMake, but having trouble figuring out
|
|
|
|
# the magic combination of necessary CMake variables
|
|
|
|
# if you fancy a try, take a look at
|
|
|
|
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
2022-08-09 10:17:47 +00:00
|
|
|
${stdenv.cc.targetPrefix}install_name_tool -id $installName $file
|
|
|
|
|
|
|
|
# cc-wrapper passes '-lc++abi' to all c++ link steps, but that causes
|
|
|
|
# libcxxabi to sometimes link against a different version of itself.
|
|
|
|
# Here we simply make that second reference point to ourselves.
|
2022-11-22 21:37:47 +00:00
|
|
|
for other in $(${stdenv.cc.targetPrefix}otool -L $file | awk '$1 ~ "/libc\\+\\+abi" { print $1 }'); do
|
2022-08-09 10:17:47 +00:00
|
|
|
${stdenv.cc.targetPrefix}install_name_tool -change $other $installName $file
|
|
|
|
done
|
2022-08-18 04:10:08 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$dev/include"
|
|
|
|
install -m 644 ../include/${if stdenv.isDarwin then "*" else "cxxabi.h"} "$dev/include"
|
|
|
|
'';
|
2018-01-31 14:09:24 +00:00
|
|
|
|
2023-01-13 20:03:29 +00:00
|
|
|
passthru = {
|
|
|
|
libName = "c++abi";
|
|
|
|
};
|
|
|
|
|
2021-05-11 21:12:04 +00:00
|
|
|
meta = llvm_meta // {
|
2020-04-13 16:50:35 +00:00
|
|
|
homepage = "https://libcxxabi.llvm.org/";
|
2021-05-11 21:12:04 +00:00
|
|
|
description = "Provides C++ standard library support";
|
|
|
|
longDescription = ''
|
|
|
|
libc++abi is a new implementation of low level support for a standard C++ library.
|
|
|
|
'';
|
|
|
|
# "All of the code in libc++abi is dual licensed under the MIT license and
|
|
|
|
# the UIUC License (a BSD-like license)":
|
|
|
|
license = with lib.licenses; [ mit ncsa ];
|
|
|
|
maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
|
2018-01-31 14:09:24 +00:00
|
|
|
};
|
|
|
|
}
|