2021-01-22 18:25:31 +07:00
|
|
|
{ lib, stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
|
2017-09-15 19:38:38 -05:00
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2019-08-13 21:52:01 +00:00
|
|
|
pname = "libc++abi";
|
|
|
|
inherit version;
|
2017-09-15 19:38:38 -05:00
|
|
|
|
2018-05-04 10:54:06 -05:00
|
|
|
src = fetch "libcxxabi" "12lp799rskr4fc2xr64qn4jfkjnfd8b1aymvsxyn4k9ar7r9pgqv";
|
2017-09-15 19:38:38 -05: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 17:23:57 +09:00
|
|
|
outputs = [ "out" "dev" ];
|
2017-09-15 19:38:38 -05: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 18:25:31 +07:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2017-09-15 19:38:38 -05:00
|
|
|
export TRIPLE=x86_64-apple-darwin
|
2021-01-22 18:25:31 +07:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
2021-04-15 12:15:07 +02:00
|
|
|
patch -p1 -d $(ls -d libcxx-*) -i ${../../libcxx-0001-musl-hacks.patch}
|
2017-09-15 19:38:38 -05: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 17:23:57 +09:00
|
|
|
patches = [
|
|
|
|
./gnu-install-dirs.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
|
|
|
|
|
2017-09-15 19:38:38 -05:00
|
|
|
installPhase = if stdenv.isDarwin
|
|
|
|
then ''
|
|
|
|
for file in lib/*.dylib; do
|
|
|
|
# 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
|
2020-02-25 14:37:25 +01:00
|
|
|
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
|
2017-09-15 19:38:38 -05:00
|
|
|
install_name_tool -id $out/$file $file
|
|
|
|
done
|
|
|
|
make install
|
|
|
|
install -d 755 $out/include
|
|
|
|
install -m 644 ../include/*.h $out/include
|
|
|
|
''
|
|
|
|
else ''
|
|
|
|
install -d -m 755 $out/include $out/lib
|
2018-12-13 20:05:54 +00:00
|
|
|
install -m 644 lib/libc++abi.a $out/lib
|
2017-09-15 19:38:38 -05:00
|
|
|
install -m 644 lib/libc++abi.so.1.0 $out/lib
|
|
|
|
install -m 644 ../include/cxxabi.h $out/include
|
|
|
|
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
|
|
|
|
ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2020-04-13 18:50:35 +02:00
|
|
|
homepage = "https://libcxxabi.llvm.org/";
|
2017-09-15 19:38:38 -05:00
|
|
|
description = "A new implementation of low level support for a standard C++ library";
|
2021-01-22 18:25:31 +07:00
|
|
|
license = with lib.licenses; [ ncsa mit ];
|
|
|
|
maintainers = with lib.maintainers; [ vlstill ];
|
|
|
|
platforms = lib.platforms.unix;
|
2017-09-15 19:38:38 -05:00
|
|
|
};
|
|
|
|
}
|