diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-15 16:11:20 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-29 14:34:09 -0500 |
commit | 412093994b9a4fe0fa7da99d1947effc85d9070b (patch) | |
tree | 7be2219ecb1781b707672adf9274e6b5e11c1979 /pkgs | |
parent | 72e3b2a6629dbe12f184ed0156d9c34af271e158 (diff) | |
download | nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar.gz nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar.bz2 nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar.lz nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar.xz nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.tar.zst nixlib-412093994b9a4fe0fa7da99d1947effc85d9070b.zip |
gcc: support avr
- respect libc’s incdir and libdir - make non-unix systems single threaded - set LIMITS_H_TEST to false for avr - misc updates to support new libc’s - use multilib with avr For threads we want to use: - posix on unix systems - win32 on windows - single on everything else For avr: - add library directories for avrlibc - to disable relro and bind - avr5 should have precedence over avr3 - otherwise gcc uses the wrong one
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 12 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 16 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.8/default.nix | 29 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/4.9/default.nix | 29 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/5/default.nix | 29 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/6/default.nix | 29 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/7/default.nix | 41 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/8/default.nix | 32 | ||||
-rw-r--r-- | pkgs/development/compilers/gcc/snapshot/default.nix | 25 | ||||
-rw-r--r-- | pkgs/development/misc/avr/libc/default.nix | 6 |
10 files changed, 155 insertions, 93 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 99f556b973a1..3ac1e52f3092 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -210,7 +210,7 @@ stdenv.mkDerivation { ## General libc support ## - echo "-L${libc_lib}/lib" > $out/nix-support/libc-ldflags + echo "-L${libc_lib}${libc.libdir or "/lib"}" > $out/nix-support/libc-ldflags echo "${libc_lib}" > $out/nix-support/orig-libc echo "${libc_dev}" > $out/nix-support/orig-libc-dev @@ -293,6 +293,16 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" pic" '' + + optionalString targetPlatform.isAvr '' + hardening_unsupported_flags+=" relro bindnow" + '' + + + optionalString (libc != null && targetPlatform.isAvr) '' + for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do + echo "-L${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags + done + '' + + '' set +u substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index e59758371a38..06aa9436bfc0 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -232,7 +232,7 @@ stdenv.mkDerivation { # compile, because it uses "#include_next <limits.h>" to find the # limits.h file in ../includes-fixed. To remedy the problem, # another -idirafter is necessary to add that directory again. - echo "-B${libc_lib}/lib/ -idirafter ${libc_dev}/include ${optionalString isGNU "-idirafter ${cc}/lib/gcc/*/*/include-fixed"}" > $out/nix-support/libc-cflags + echo "-B${libc_lib}${libc.libdir or "/lib/"} -idirafter ${libc_dev}${libc.incdir or "/include"} ${optionalString isGNU "-idirafter ${cc}/lib/gcc/*/*/include-fixed"}" > $out/nix-support/libc-cflags echo "${libc_lib}" > $out/nix-support/orig-libc echo "${libc_dev}" > $out/nix-support/orig-libc-dev @@ -284,6 +284,20 @@ stdenv.mkDerivation { hardening_unsupported_flags+=" stackprotector" '' + + optionalString targetPlatform.isAvr '' + hardening_unsupported_flags+=" stackprotector pic" + '' + + + optionalString (targetPlatform.libc == "newlib") '' + hardening_unsupported_flags+=" stackprotector fortify pie pic" + '' + + + optionalString (libc != null && targetPlatform.isAvr) '' + for isa in avr5 avr3 avr4 avr6 avr25 avr31 avr35 avr51 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 tiny-stack; do + echo "-B${getLib libc}/avr/lib/$isa" >> $out/nix-support/libc-cflags + done + '' + + '' substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh substituteAll ${./add-hardening.sh} $out/nix-support/add-hardening.sh diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index d9376f597a70..e585f296e877 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -130,7 +130,7 @@ let version = "4.8.5"; "--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" ] ++ @@ -148,10 +148,15 @@ let version = "4.8.5"; # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. "--disable-libgomp" - ] ++ [ - "--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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else ""; @@ -270,7 +275,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -360,20 +365,20 @@ stdenv.mkDerivation ({ EXTRA_TARGET_FLAGS = optionals (targetPlatform != hostPlatform && libcCross != null) ([ - "-idirafter ${libcCross.dev}/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 = { diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index c60f54f1560c..9dae061ecbb3 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -135,7 +135,7 @@ let version = "4.9.4"; "--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" ] ++ @@ -156,10 +156,15 @@ let version = "4.9.4"; # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. "--disable-libgomp" - ] ++ [ - "--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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else ""; @@ -292,7 +297,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -381,20 +386,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 = diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index 47c849d2dcc8..fbc192752c72 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -122,7 +122,7 @@ let version = "5.5.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" ] ++ @@ -143,10 +143,15 @@ let version = "5.5.0"; # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. "--disable-libgomp" - ] ++ [ - "--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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else ""; @@ -296,7 +301,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -387,20 +392,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 = diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index eeb57be97157..793752dee19e 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -120,7 +120,7 @@ let version = "6.4.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" ] ++ @@ -143,10 +143,15 @@ let version = "6.4.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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "${targetPlatform.config}${stageNameAddon}-" else ""; @@ -301,7 +306,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -391,20 +396,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 = 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 = diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 7842110a2146..bcac577712aa 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -87,7 +87,7 @@ let version = "8.2.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" ] ++ @@ -110,10 +110,15 @@ let version = "8.2.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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else ""; @@ -261,7 +266,7 @@ stdenv.mkDerivation ({ }" ] ++ - (if enableMultilib + (if (enableMultilib || targetPlatform.isAvr) then ["--enable-multilib" "--disable-libquadmath"] else ["--disable-multilib"]) ++ optional (!enableShared) "--disable-shared" ++ @@ -322,23 +327,16 @@ stdenv.mkDerivation ({ LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); - EXTRA_TARGET_FLAGS = optionals - (targetPlatform != hostPlatform && libcCross != null) - ([ - "-idirafter ${getDev libcCross}/include" - ] ++ optionals (! crossStageStatic) [ - "-B${libcCross.out}/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 = diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix index 0de6be36c351..a308abd9c16f 100644 --- a/pkgs/development/compilers/gcc/snapshot/default.nix +++ b/pkgs/development/compilers/gcc/snapshot/default.nix @@ -104,10 +104,15 @@ let version = "7-20170409"; # In uclibc cases, libgomp needs an additional '-ldl' # and as I don't know how to pass it, I disable libgomp. "--disable-libgomp" - ] ++ [ - "--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" + "--disable-decimal-float" # No final libdecnumber (it may work only in 386) ])); stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final"; crossNameAddon = if targetPlatform != hostPlatform then "-${targetPlatform.config}" + stageNameAddon else ""; @@ -290,20 +295,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 = diff --git a/pkgs/development/misc/avr/libc/default.nix b/pkgs/development/misc/avr/libc/default.nix index 9bfffe7b2fee..afe30e4b5eef 100644 --- a/pkgs/development/misc/avr/libc/default.nix +++ b/pkgs/development/misc/avr/libc/default.nix @@ -14,9 +14,13 @@ stdenv.mkDerivation { nativeBuildInputs = [ automake autoconf ]; # Make sure we don't strip the libraries in lib/gcc/avr. - stripDebugList= "bin"; + stripDebugList = "bin"; dontPatchELF = true; + passthru = { + incdir = "/avr/include"; + }; + meta = with stdenv.lib; { description = "a C runtime library for AVR microcontrollers"; homepage = http://savannah.nongnu.org/projects/avr-libc/; |