at master 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 gcc_meta, 5 release_version, 6 version, 7 getVersionFile, 8 monorepoSrc ? null, 9 fetchpatch, 10 autoreconfHook269, 11 runCommand, 12 gettext, 13}: 14stdenv.mkDerivation (finalAttrs: { 15 pname = "libstdcxx"; 16 inherit version; 17 18 src = runCommand "libstdcxx-src-${version}" { src = monorepoSrc; } '' 19 runPhase unpackPhase 20 21 mkdir -p "$out/gcc" 22 cp gcc/BASE-VER "$out/gcc" 23 cp gcc/DATESTAMP "$out/gcc" 24 25 mkdir -p "$out/libgcc" 26 cp libgcc/gthr*.h "$out/libgcc" 27 cp libgcc/unwind-pe.h "$out/libgcc" 28 29 cp -r libstdc++-v3 "$out" 30 31 cp -r libiberty "$out" 32 cp -r include "$out" 33 cp -r contrib "$out" 34 35 cp -r config "$out" 36 cp -r multilib.am "$out" 37 38 cp config.guess "$out" 39 cp config.rpath "$out" 40 cp config.sub "$out" 41 cp config-ml.in "$out" 42 cp ltmain.sh "$out" 43 cp install-sh "$out" 44 cp mkinstalldirs "$out" 45 46 [[ -f MD5SUMS ]]; cp MD5SUMS "$out" 47 ''; 48 49 outputs = [ 50 "out" 51 "dev" 52 ]; 53 54 patches = [ 55 (fetchpatch { 56 name = "custom-threading-model.patch"; 57 url = "https://inbox.sourceware.org/gcc-patches/20250716204545.1063669-1-git@JohnEricson.me/raw"; 58 hash = "sha256-jPP0+MoPLtCwWcW6doO6KHCppwAYK40qNVyriLXcGOg="; 59 includes = [ 60 "config/*" 61 "libstdc++-v3/*" 62 ]; 63 }) 64 (getVersionFile "libstdcxx/force-regular-dirs.patch") 65 ]; 66 67 postUnpack = '' 68 mkdir -p ./build 69 buildRoot=$(readlink -e "./build") 70 ''; 71 72 preAutoreconf = '' 73 sourceRoot=$(readlink -e "./libstdc++-v3") 74 cd $sourceRoot 75 ''; 76 77 enableParallelBuilding = true; 78 79 nativeBuildInputs = [ 80 autoreconfHook269 81 gettext 82 ]; 83 84 preConfigure = '' 85 cd "$buildRoot" 86 configureScript=$sourceRoot/configure 87 chmod +x "$configureScript" 88 ''; 89 90 configurePlatforms = [ 91 "build" 92 "host" 93 ]; 94 95 configureFlags = [ 96 "--disable-dependency-tracking" 97 "gcc_cv_target_thread_file=posix" 98 "cross_compiling=true" 99 "--disable-multilib" 100 101 "--enable-clocale=gnu" 102 "--disable-libstdcxx-pch" 103 "--disable-vtable-verify" 104 "--enable-libstdcxx-visibility" 105 "--with-default-libstdcxx-abi=new" 106 ]; 107 108 hardeningDisable = [ 109 # PATH_MAX 110 "fortify" 111 ]; 112 113 postInstall = '' 114 moveToOutput lib/libstdc++.modules.json "$dev" 115 ''; 116 117 doCheck = true; 118 119 passthru = { 120 isGNU = true; 121 }; 122 123 meta = gcc_meta // { 124 homepage = "https://gcc.gnu.org/onlinedocs/libstdc++"; 125 description = "GNU C++ Library"; 126 }; 127})