diff options
Diffstat (limited to 'pkgs/development/compilers/gcc/7/default.nix')
-rw-r--r-- | pkgs/development/compilers/gcc/7/default.nix | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 59897ccff426..c75a6c6e68f8 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -67,7 +67,7 @@ let version = "7.3.0"; [ "--with-as=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-as" "--with-ld=${targetPackages.stdenv.cc.bintools}/bin/${targetPlatform.config}-ld" ] ++ (if crossMingw && crossStageStatic then [ - "--with-headers=${libcCross}/include" + "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}" "--with-gcc" "--with-gnu-as" "--with-gnu-ld" @@ -92,7 +92,7 @@ let version = "7.3.0"; "--disable-libmpx" # requires libc ] else [ (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" - else "--with-headers=${getDev libcCross}/include") + else "--with-headers=${getDev libcCross}${libcCross.incdir or "/include"}") "--enable-__cxa_atexit" "--enable-long-long" ] ++ @@ -115,11 +115,17 @@ let version = "7.3.0"; "--disable-libgomp" # musl at least, disable: https://git.buildroot.net/buildroot/commit/?id=873d4019f7fb00f6a80592224236b3ba7d657865 "--disable-libmpx" - ] ++ [ - "--enable-threads=posix" - "--enable-nls" - "--disable-decimal-float" # No final libdecnumber (it may work only in 386) - ])); + ] + ++ optional (targetPlatform.libc == "newlib") "--with-newlib" + ++ optional (targetPlatform.libc == "avrlibc") "--with-avrlibc" + ++ [ + "--enable-threads=${if targetPlatform.isUnix then "posix" + else if targetPlatform.isWindows then "win32" + else "single"}" + "--enable-nls" + # No final libdecnumber (it may work only in 386) + "--disable-decimal-float" + ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else ""; @@ -188,7 +194,12 @@ stdenv.mkDerivation ({ sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR' '' ) - else ""); + else "") + + stdenv.lib.optionalString targetPlatform.isAvr '' + makeFlagsArray+=( + 'LIMITS_H_TEST=false' + ) + ''; inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; @@ -267,7 +278,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -334,20 +345,20 @@ stdenv.mkDerivation ({ EXTRA_TARGET_FLAGS = optionals (targetPlatform != hostPlatform && libcCross != null) ([ - "-idirafter ${getDev libcCross}/include" + "-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" ] ++ optionals (! crossStageStatic) [ - "-B${libcCross.out}/lib" + "-B${libcCross.out}${libcCross.libdir or "/lib"}" ]); EXTRA_TARGET_LDFLAGS = optionals (targetPlatform != hostPlatform && libcCross != null) ([ - "-Wl,-L${libcCross.out}/lib" + "-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}" ] ++ (if crossStageStatic then [ - "-B${libcCross.out}/lib" + "-B${libcCross.out}${libcCross.libdir or "/lib"}" ] else [ - "-Wl,-rpath,${libcCross.out}/lib" - "-Wl,-rpath-link,${libcCross.out}/lib" + "-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}" + "-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}" ])); passthru = |