Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

minimal-bootstrap.gcc46-cxx: init at 4.6.4

+153 -37
+8
pkgs/os-specific/linux/minimal-bootstrap/default.nix
··· 91 91 # FIXME: not sure why new gawk doesn't work 92 92 gawk = gawk-mes; 93 93 }; 94 + gcc46-cxx = callPackage ./gcc/4.6.cxx.nix { 95 + gcc = gcc46; 96 + gnumake = gnumake-musl; 97 + gnutar = gnutar-musl; 98 + # FIXME: not sure why new gawk doesn't work 99 + gawk = gawk-mes; 100 + }; 94 101 95 102 inherit (callPackage ./glibc { 96 103 bash = bash_2_05; ··· 199 206 echo ${gcc2.tests.get-version} 200 207 echo ${gcc2-mes.tests.get-version} 201 208 echo ${gcc46.tests.get-version} 209 + echo ${gcc46-cxx.tests.hello-world} 202 210 echo ${gnugrep.tests.get-version} 203 211 echo ${gnused.tests.get-version} 204 212 echo ${gnused-mes.tests.get-version}
+140
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.cxx.nix
··· 1 + { lib 2 + , buildPlatform 3 + , hostPlatform 4 + , fetchurl 5 + , bash 6 + , coreutils 7 + , gcc 8 + , musl 9 + , binutils 10 + , gnumake 11 + , gnupatch 12 + , gnused 13 + , gnugrep 14 + , gawk 15 + , diffutils 16 + , findutils 17 + , gnutar 18 + , gzip 19 + }: 20 + let 21 + pname = "gcc-cxx"; 22 + version = "4.6.4"; 23 + 24 + src = fetchurl { 25 + url = "mirror://gnu/gcc/gcc-${version}/gcc-core-${version}.tar.gz"; 26 + sha256 = "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75"; 27 + }; 28 + 29 + ccSrc = fetchurl { 30 + url = "mirror://gnu/gcc/gcc-${version}/gcc-g++-${version}.tar.gz"; 31 + sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9"; 32 + }; 33 + 34 + gmpVersion = "4.3.2"; 35 + gmp = fetchurl { 36 + url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz"; 37 + sha256 = "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv"; 38 + }; 39 + 40 + mpfrVersion = "2.4.2"; 41 + mpfr = fetchurl { 42 + url = "mirror://gnu/mpfr/mpfr-${mpfrVersion}.tar.gz"; 43 + sha256 = "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94"; 44 + }; 45 + 46 + mpcVersion = "1.0.3"; 47 + mpc = fetchurl { 48 + url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.gz"; 49 + sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1"; 50 + }; 51 + 52 + patches = [ 53 + # Remove hardcoded NATIVE_SYSTEM_HEADER_DIR 54 + ./no-system-headers.patch 55 + ]; 56 + in 57 + bash.runCommand "${pname}-${version}" { 58 + inherit pname version; 59 + 60 + nativeBuildInputs = [ 61 + gcc 62 + binutils 63 + gnumake 64 + gnupatch 65 + gnused 66 + gnugrep 67 + gawk 68 + diffutils 69 + findutils 70 + gnutar 71 + gzip 72 + ]; 73 + 74 + passthru.tests.hello-world = result: 75 + bash.runCommand "${pname}-simple-program-${version}" { 76 + nativeBuildInputs = [ binutils musl result ]; 77 + } '' 78 + cat <<EOF >> test.c 79 + #include <stdio.h> 80 + int main() { 81 + printf("Hello World!\n"); 82 + return 0; 83 + } 84 + EOF 85 + musl-gcc -o test test.c 86 + ./test 87 + mkdir $out 88 + ''; 89 + 90 + meta = with lib; { 91 + description = "GNU Compiler Collection, version ${version}"; 92 + homepage = "https://gcc.gnu.org"; 93 + license = licenses.gpl3Plus; 94 + maintainers = teams.minimal-bootstrap.members; 95 + platforms = platforms.unix; 96 + }; 97 + } '' 98 + # Unpack 99 + tar xzf ${src} 100 + tar xzf ${ccSrc} 101 + tar xzf ${gmp} 102 + tar xzf ${mpfr} 103 + tar xzf ${mpc} 104 + cd gcc-${version} 105 + 106 + ln -s ../gmp-${gmpVersion} gmp 107 + ln -s ../mpfr-${mpfrVersion} mpfr 108 + ln -s ../mpc-${mpcVersion} mpc 109 + 110 + # Patch 111 + ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 112 + # doesn't recognise musl 113 + sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host 114 + 115 + # Configure 116 + export CC="gcc -Wl,-dynamic-linker -Wl,${musl}/lib/libc.so" 117 + export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${musl}/lib/libc.so" 118 + export C_INCLUDE_PATH="${musl}/include" 119 + export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH" 120 + export LIBRARY_PATH="${musl}/lib" 121 + 122 + bash ./configure \ 123 + --prefix=$out \ 124 + --build=${buildPlatform.config} \ 125 + --host=${hostPlatform.config} \ 126 + --with-native-system-header-dir=${musl}/include \ 127 + --with-build-sysroot=${musl} \ 128 + --enable-languages=c,c++ \ 129 + --disable-bootstrap \ 130 + --disable-libmudflap \ 131 + --disable-libstdcxx-pch \ 132 + --disable-lto \ 133 + --disable-multilib 134 + 135 + # Build 136 + make -j $NIX_BUILD_CORES 137 + 138 + # Install 139 + make -j $NIX_BUILD_CORES install 140 + ''
+5 -5
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
··· 29 29 sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9"; 30 30 }; 31 31 32 - patches = [ 33 - # Remove hardcoded NATIVE_SYSTEM_HEADER_DIR 34 - ./no-system-headers.patch 35 - ]; 36 - 37 32 gmpVersion = "4.3.2"; 38 33 gmp = fetchurl { 39 34 url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz"; ··· 51 46 url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.gz"; 52 47 sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1"; 53 48 }; 49 + 50 + patches = [ 51 + # Remove hardcoded NATIVE_SYSTEM_HEADER_DIR 52 + ./no-system-headers.patch 53 + ]; 54 54 in 55 55 bash.runCommand "${pname}-${version}" { 56 56 inherit pname version;
-32
pkgs/os-specific/linux/minimal-bootstrap/gcc/libstdc++-target.patch
··· 1 - Patch to make the target libraries 'configure' scripts find the proper CPP. 2 - I noticed that building the mingw32 cross compiler. 3 - Looking at the build script for mingw in archlinux, I think that only nixos 4 - needs this patch. I don't know why. 5 - diff --git a/Makefile.in b/Makefile.in 6 - index 93f66b6..d691917 100644 7 - --- a/Makefile.in 8 - +++ b/Makefile.in 9 - @@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \ 10 - AR="$(AR_FOR_TARGET)"; export AR; \ 11 - AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ 12 - CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ 13 - + CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \ 14 - CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ 15 - CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ 16 - CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ 17 - @@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \ 18 - RAW_CXX_TARGET_EXPORTS = \ 19 - $(BASE_TARGET_EXPORTS) \ 20 - CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ 21 - - CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; 22 - + CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \ 23 - + CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX; 24 - 25 - NORMAL_TARGET_EXPORTS = \ 26 - $(BASE_TARGET_EXPORTS) \ 27 - - CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; 28 - + CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \ 29 - + CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX; 30 - 31 - # Where to find GMP 32 - HOST_GMPLIBS = @gmplibs@