2
0
Fork 0
Genode Packages collection https://git.sr.ht/~ehmry/genodepkgs/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

102 lines
3.3 KiB

{ preparePort, nixpkgs, toolchain, upstream }:
let
inherit (nixpkgs.buildPackages) fetchurl fetchgit flex bison;
libc = import ./../libc { inherit preparePort nixpkgs toolchain upstream; };
libm = import ./../libm { inherit preparePort nixpkgs toolchain upstream; };
version = "8.3.0";
in
preparePort {
name = "stdcxx-${version}";
outputs = [ "source" "dev" ];
inherit version;
depsBuildBuild = with nixpkgs.buildPackages; [ pkgconfig stdenv.cc ];
buildInputs = [ toolchain ];
src = fetchurl {
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
sha256 = "0b3xv411xhlnjmin2979nxcbnidgvzqdf4nbhix99x60dkzavfk4";
};
tarFlags =
[ "gcc-${version}/libstdc++-v3"
"gcc-${version}/libgcc/gthr-single.h"
];
sourceRoot = "gcc-${version}/libstdc++-v3";
patches = "${upstream.src}/repos/libports/src/lib/stdcxx/patches}/*.patch";
patchFlags = "-p1";
buildPhase =
''
for slop in include/c_global/cstdlib include/bits/std_abs.h include/c_global/cmath; do
sed 's/^#include_next/#include/' -i $slop
done
mkdir -p $dev/lib
compileStub ${./stdcxx.symbols} $dev/lib/stdcxx.lib.so
'';
installPhase =
''
mkdir -p $source $includedir/bits $includedir/config $pkgconfigdir
local libcPc=${libc.dev}/lib/pkgconfig/libc.pc
local libmPc=${libm.dev}/lib/pkgconfig/libm.pc
libcCflags=`awk '/^Cflags/ { $1=""; print $0 }' $libcPc` \
libmCflags=`awk '/^Cflags/ { $1=""; print $0 }' $libmPc` \
substituteAll ${./stdcxx.pc.in} $pkgconfigdir/stdcxx.pc
cp -r src config libsupc++ $source
cp -r \
include/* \
include/c_compatibility/complex.h \
include/c_compatibility/fenv.h \
include/c_compatibility/tgmath.h \
libsupc++/cxxabi.h \
libsupc++/exception \
libsupc++/initializer_list \
libsupc++/new \
libsupc++/typeinfo \
$includedir
cp -r \
libsupc++/atomic_lockfree_defines.h \
libsupc++/cxxabi_forced.h \
libsupc++/cxxabi_init_exception.h \
libsupc++/exception.h \
libsupc++/exception_defines.h \
libsupc++/exception_ptr.h \
libsupc++/hash_bytes.h \
libsupc++/nested_exception.h \
config/cpu/generic/atomic_word.h \
config/cpu/generic/cpu_defines.h \
config/cpu/generic/cxxabi_tweaks.h \
config/cpu/generic/opt/bits/opt_random.h \
config/os/generic/ctype_base.h \
config/os/generic/ctype_inline.h \
config/os/generic/error_constants.h \
config/os/generic/os_defines.h \
config/locale/generic/messages_members.h \
config/locale/generic/time_members.h \
${upstream.src}/repos/libports/include/stdcxx/bits/*.h \
$includedir/bits
cp -r \
config/allocator/new_allocator_base.h \
config/io/basic_file_stdio.h \
config/io/c_io_stdio.h \
config/locale/generic/c_locale.h \
$includedir/config
cp config/io/basic_file_stdio.h $includedir/bits/basic_file.h
cp config/allocator/new_allocator_base.h $includedir/bits/c++allocator.h
cp config/io/c_io_stdio.h $includedir/bits/c++io.h
cp config/locale/generic/c_locale.h $includedir/bits/c++locale.h
cp ../libgcc/gthr-single.h $includedir/bits/gthr.h
'';
}