stdenv.cc: add proper C++ support
This commit is contained in:
parent
bf93a9d05e
commit
a9b18e95c4
|
@ -79,6 +79,11 @@ in nullPkgs // {
|
|||
# keep libposix NEEDED
|
||||
}) coreutils);
|
||||
|
||||
gccForLibs = if targetPlatform.isGenode then
|
||||
final.genodePackages.genodeSources.toolchain.cc
|
||||
else
|
||||
prev.gccForLibs;
|
||||
|
||||
gdb = addPatchesTarget [ ./gdb/genode.patch ] gdb;
|
||||
|
||||
genodeLibcCross = callPackage ./libc { };
|
||||
|
@ -93,10 +98,6 @@ in nullPkgs // {
|
|||
else
|
||||
prev.grub2;
|
||||
|
||||
libconfig =
|
||||
overrideAttrsHost (attrs: { configureFlags = [ "--disable-examples" ]; })
|
||||
libconfig;
|
||||
|
||||
libcCrossChooser = name:
|
||||
if stdenv.targetPlatform.isGenode then
|
||||
targetPackages.genodeLibcCross
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{ genodePackages, symlinkJoin }:
|
||||
let inherit (genodePackages) genodeSources;
|
||||
in symlinkJoin {
|
||||
name = "libcxx";
|
||||
paths = with genodePackages; [ stdcxx ];
|
||||
postBuild = ''
|
||||
local headerDir="''${!outputDev}/include"
|
||||
mkdir -p "$headerDir"
|
||||
pushd ${genodeSources.ports.stdcxx}/*
|
||||
cp -r \
|
||||
include/include/stdcxx/* \
|
||||
${genodeSources}/repos/libports/include/stdcxx \
|
||||
"$headerDir"
|
||||
popd
|
||||
'';
|
||||
}
|
|
@ -96,12 +96,25 @@ let
|
|||
lldClang = if stdenv.targetPlatform.isGenode then
|
||||
wrapCCWith rec {
|
||||
cc = tools.clang-unwrapped;
|
||||
gccForLibs = genodePackages.genodeSources.toolchain.cc;
|
||||
bintools = wrapBintoolsWith { inherit (tools) bintools; };
|
||||
extraBuildCommands = with genodePackages.genodeSources; ''
|
||||
echo "--gcc-toolchain=${toolchain.cc}" >> $out/nix-support/cc-cflags
|
||||
echo "--sysroot=${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
echo "-I${genodeBase}/include" >> $out/nix-support/cc-cflags
|
||||
echo "-L ${genodeBase}" >> $out/nix-support/cc-cflags
|
||||
|
||||
for dir in ${gccForLibs}/${stdenv.targetPlatform.config}/include/c++/*; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
echo "-isystem ${genodePackages.genodeSources}/repos/libports/include/stdcxx" >> $out/nix-support/libcxx-cxxflags
|
||||
for dir in ${genodePackages.genodeSources.ports.stdcxx}/*/include/stdcxx; do
|
||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/std" >> $out/nix-support/libcxx-cxxflags
|
||||
echo "-isystem $dir/c_global" >> $out/nix-support/libcxx-cxxflags
|
||||
done
|
||||
|
||||
echo "${genodePackages.stdcxx}/lib/stdcxx.lib.so" >> $out/nix-support/libcxx-ldflags
|
||||
'';
|
||||
}
|
||||
else
|
||||
|
|
|
@ -62,8 +62,15 @@ let
|
|||
makeWrapper ''${BIN} x86_64-unknown-genode-''${BIN#$out/bin/genode-x86-}
|
||||
done
|
||||
popd
|
||||
ln -s $out/aarch64-none-elf $out/aarch64-unknown-genode
|
||||
ln -s $out/arm-none-eabi $out/arm-unknown-genode
|
||||
ln -s $out/riscv64-unknown-elf $out/riscv-unknown-genode
|
||||
ln -s $out/x86_64-pc-elf $out/x86_64-unknown-genode
|
||||
'';
|
||||
} // {
|
||||
# Needed by the GCC wrapper.
|
||||
langC = true;
|
||||
langCC = true;
|
||||
isGNU = true;
|
||||
targetPrefix = {
|
||||
aarch64-genode = "genode-arm-";
|
||||
|
|
Loading…
Reference in New Issue