Merge pull request #32403 from obsidiansystems/gcc-modernize-builder
gcc: Modernize builder
This commit is contained in:
commit
0271644491
@ -25,6 +25,7 @@
|
|||||||
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
|
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
|
||||||
, stripped ? true
|
, stripped ? true
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -258,6 +259,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -349,29 +352,32 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, cross != null
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
LD = "ld";
|
LD = "ld";
|
||||||
CC = "gcc";
|
CC = "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -382,39 +388,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${libcCross.dev}/include"
|
([
|
||||||
]
|
"-idirafter ${libcCross.dev}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru = { inherit langC langCC langAda langFortran langVhdl
|
passthru = { inherit langC langCC langAda langFortran langVhdl
|
||||||
enableMultilib version; isGNU = true; };
|
enableMultilib version; isGNU = true; };
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
, gnused ? null
|
, gnused ? null
|
||||||
, darwin ? null
|
, darwin ? null
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -316,6 +317,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -372,14 +375,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -444,12 +439,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -457,18 +452,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -479,39 +477,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${libcCross.dev}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
, gnused ? null
|
, gnused ? null
|
||||||
, darwin ? null
|
, darwin ? null
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -314,6 +315,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -370,14 +373,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -442,12 +437,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -455,18 +450,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -477,39 +475,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${getDev libcCross}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
@ -329,6 +329,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -380,14 +382,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -452,12 +446,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -465,18 +459,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -487,39 +484,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${getDev libcCross}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||||
, darwin ? null
|
, darwin ? null
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -330,6 +331,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -381,14 +384,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -452,12 +447,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -465,18 +460,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -487,39 +485,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${getDev libcCross}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
, darwin ? null
|
, darwin ? null
|
||||||
, flex ? null
|
, flex ? null
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -323,6 +324,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -374,14 +377,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -446,12 +441,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -459,18 +454,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -481,39 +479,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${getDev libcCross}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
source $stdenv/setup
|
source $stdenv/setup
|
||||||
|
|
||||||
|
|
||||||
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
oldOpts="$(shopt -po nounset)" || true
|
||||||
mkdir $NIX_FIXINC_DUMMY
|
set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
|
export NIX_FIXINC_DUMMY="$NIX_BUILD_TOP/dummy"
|
||||||
|
mkdir "$NIX_FIXINC_DUMMY"
|
||||||
|
|
||||||
|
|
||||||
if test "$staticCompiler" = "1"; then
|
if test "$staticCompiler" = "1"; then
|
||||||
@ -13,141 +17,125 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
# GCC interprets empty paths as ".", which we don't want.
|
# GCC interprets empty paths as ".", which we don't want.
|
||||||
if test -z "$CPATH"; then unset CPATH; fi
|
if test -z "${CPATH-}"; then unset CPATH; fi
|
||||||
if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi
|
if test -z "${LIBRARY_PATH-}"; then unset LIBRARY_PATH; fi
|
||||||
echo "\$CPATH is \`$CPATH'"
|
echo "\$CPATH is \`${CPATH-}'"
|
||||||
echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
|
echo "\$LIBRARY_PATH is \`${LIBRARY_PATH-}'"
|
||||||
|
|
||||||
if test "$noSysDirs" = "1"; then
|
if test "$noSysDirs" = "1"; then
|
||||||
|
|
||||||
if test -e $NIX_CC/nix-support/orig-libc; then
|
declare \
|
||||||
|
EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \
|
||||||
|
EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS
|
||||||
|
|
||||||
# Figure out what extra flags to pass to the gcc compilers
|
for pre in 'BUILD_' ''; do
|
||||||
# being generated to make sure that they use our glibc.
|
curCC="NIX_${pre}CC"
|
||||||
extraFlags="$(cat $NIX_CC/nix-support/libc-cflags)"
|
curFIXINC="NIX_${pre}FIXINC_DUMMY"
|
||||||
extraLDFlags="$(cat $NIX_CC/nix-support/libc-ldflags) $(cat $NIX_CC/nix-support/libc-ldflags-before || true)"
|
|
||||||
|
|
||||||
# Use *real* header files, otherwise a limits.h is generated
|
declare -a extraFlags=() extraLDFlags=()
|
||||||
# that does not include Glibc's limits.h (notably missing
|
if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
|
||||||
# SSIZE_MAX, which breaks the build).
|
# Figure out what extra flags to pass to the gcc compilers being
|
||||||
export NIX_FIXINC_DUMMY=$libc_dev/include
|
# generated to make sure that they use our glibc.
|
||||||
|
extraFlags=($(cat "${!curCC}/nix-support/libc-cflags"))
|
||||||
# The path to the Glibc binaries such as `crti.o'.
|
extraLDFlags=($(cat "${!curCC}/nix-support/libc-ldflags") $(cat "${!curCC}/nix-support/libc-ldflags-before" || true))
|
||||||
glibc_libdir="$(cat $NIX_CC/nix-support/orig-libc)/lib"
|
|
||||||
|
|
||||||
else
|
|
||||||
# Hack: support impure environments.
|
|
||||||
extraFlags="-isystem /usr/include"
|
|
||||||
extraLDFlags="-L/usr/lib64 -L/usr/lib"
|
|
||||||
glibc_libdir="/usr/lib"
|
|
||||||
export NIX_FIXINC_DUMMY=/usr/include
|
|
||||||
fi
|
|
||||||
|
|
||||||
extraFlags="-I$NIX_FIXINC_DUMMY $extraFlags"
|
|
||||||
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
|
||||||
|
|
||||||
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below,
|
|
||||||
# make sure to explictly add them so that files compiled with the
|
|
||||||
# bootstrap compiler are optimized and (optionally) contain
|
|
||||||
# debugging information (info "(gccinstall) Building").
|
|
||||||
if test -n "$dontStrip"; then
|
|
||||||
extraFlags="-O2 -g $extraFlags"
|
|
||||||
else
|
|
||||||
# Don't pass `-g' at all; this saves space while building.
|
|
||||||
extraFlags="-O2 $extraFlags"
|
|
||||||
fi
|
|
||||||
|
|
||||||
EXTRA_FLAGS="$extraFlags"
|
|
||||||
for i in $extraLDFlags; do
|
|
||||||
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,$i"
|
|
||||||
done
|
|
||||||
|
|
||||||
if test -n "$targetConfig"; then
|
|
||||||
# Cross-compiling, we need gcc not to read ./specs in order to build
|
|
||||||
# the g++ compiler (after the specs for the cross-gcc are created).
|
|
||||||
# Having LIBRARY_PATH= makes gcc read the specs from ., and the build
|
|
||||||
# breaks. Having this variable comes from the default.nix code to bring
|
|
||||||
# gcj in.
|
|
||||||
unset LIBRARY_PATH
|
|
||||||
unset CPATH
|
|
||||||
else
|
|
||||||
if test -z "$NIX_CC_CROSS"; then
|
|
||||||
EXTRA_TARGET_CFLAGS="$EXTRA_FLAGS"
|
|
||||||
EXTRA_TARGET_CXXFLAGS="$EXTRA_FLAGS"
|
|
||||||
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
|
|
||||||
else
|
|
||||||
# This the case of cross-building the gcc.
|
|
||||||
# We need special flags for the target, different than those of the build
|
|
||||||
# Assertion:
|
|
||||||
test -e $NIX_CC_CROSS/nix-support/orig-libc
|
|
||||||
|
|
||||||
# Figure out what extra flags to pass to the gcc compilers
|
|
||||||
# being generated to make sure that they use our glibc.
|
|
||||||
extraFlags="$(cat $NIX_CC_CROSS/nix-support/libc-cflags)"
|
|
||||||
extraLDFlags="$(cat $NIX_CC_CROSS/nix-support/libc-ldflags) $(cat $NIX_CC_CROSS/nix-support/libc-ldflags-before)"
|
|
||||||
|
|
||||||
# The path to the Glibc binaries such as `crti.o'.
|
# The path to the Glibc binaries such as `crti.o'.
|
||||||
glibc_dir="$(cat $NIX_CC_CROSS/nix-support/orig-libc)"
|
glibc_libdir="$(cat "${!curCC}/nix-support/orig-libc")/lib"
|
||||||
glibc_libdir="$glibc_dir/lib"
|
glibc_devdir="$(cat "${!curCC}/nix-support/orig-libc-dev")"
|
||||||
glibc_devdir="$(cat $NIX_CC_CROSS/nix-support/orig-libc-dev)"
|
|
||||||
configureFlags="$configureFlags --with-native-system-header-dir=$glibc_devdir/include"
|
|
||||||
|
|
||||||
# Use *real* header files, otherwise a limits.h is generated
|
# Use *real* header files, otherwise a limits.h is generated that
|
||||||
# that does not include Glibc's limits.h (notably missing
|
# does not include Glibc's limits.h (notably missing SSIZE_MAX,
|
||||||
# SSIZE_MAX, which breaks the build).
|
# which breaks the build).
|
||||||
NIX_FIXINC_DUMMY_CROSS="$glibc_devdir/include"
|
declare NIX_${pre}FIXINC_DUMMY="$glibc_devdir/include"
|
||||||
|
else
|
||||||
extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
|
# Hack: support impure environments.
|
||||||
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
extraFlags=("-isystem" "/usr/include")
|
||||||
|
extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
|
||||||
EXTRA_TARGET_CFLAGS="$extraFlags"
|
glibc_libdir="/usr/lib"
|
||||||
for i in $extraLDFlags; do
|
declare NIX_${pre}FIXINC_DUMMY=/usr/include
|
||||||
EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
extraFlags=("-I${!curFIXINC}"
|
||||||
|
"${extraFlags[@]}")
|
||||||
|
extraLDFlags=("-L$glibc_libdir" "-rpath" "$glibc_libdir"
|
||||||
|
"${extraLDFlags[@]}")
|
||||||
|
|
||||||
|
# BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
|
||||||
|
# sure to explictly add them so that files compiled with the bootstrap
|
||||||
|
# compiler are optimized and (optionally) contain debugging information
|
||||||
|
# (info "(gccinstall) Building").
|
||||||
|
if test -n "${dontStrip-}"; then
|
||||||
|
extraFlags=("-O2" "-g" "${extraFlags[@]}")
|
||||||
|
else
|
||||||
|
# Don't pass `-g' at all; this saves space while building.
|
||||||
|
extraFlags=("-O2" "${extraFlags[@]}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
declare EXTRA_${pre}FLAGS="${extraFlags[*]}"
|
||||||
|
for i in "${extraLDFlags[@]}"; do
|
||||||
|
declare EXTRA_${pre}LDFLAGS+=" -Wl,$i"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "${targetConfig-}"; then
|
||||||
|
# host = target, so the flags are the same
|
||||||
|
EXTRA_TARGET_FLAGS="$EXTRA_FLAGS"
|
||||||
|
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
|
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
|
||||||
# the startfiles.
|
# the startfiles.
|
||||||
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
|
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
|
||||||
# for the startfiles.
|
# for the startfiles.
|
||||||
makeFlagsArray+=( \
|
makeFlagsArray+=(
|
||||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
"BUILD_SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY"
|
||||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
"SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY"
|
||||||
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
"NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY"
|
||||||
CXXFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
|
||||||
CFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
|
||||||
CXXFLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
|
||||||
FLAGS_FOR_TARGET="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
|
||||||
LDFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
|
||||||
LDFLAGS_FOR_TARGET="$EXTRA_TARGET_LDFLAGS $EXTRA_TARGET_LDFLAGS" \
|
|
||||||
)
|
|
||||||
|
|
||||||
if test -z "$targetConfig"; then
|
"LDFLAGS_FOR_BUILD=$EXTRA_BUILD_LDFLAGS"
|
||||||
makeFlagsArray+=( \
|
#"LDFLAGS=$EXTRA_LDFLAGS"
|
||||||
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
"LDFLAGS_FOR_TARGET=$EXTRA_TARGET_LDFLAGS"
|
||||||
BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
|
||||||
)
|
"CFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
|
||||||
|
"CXXFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
|
||||||
|
"FLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS"
|
||||||
|
|
||||||
|
# It seems there is a bug in GCC 5
|
||||||
|
#"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
|
||||||
|
#"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
|
||||||
|
|
||||||
|
"CFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
|
||||||
|
"CXXFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
|
||||||
|
"FLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
|
||||||
|
)
|
||||||
|
|
||||||
|
if test -z "${targetConfig-}"; then
|
||||||
|
makeFlagsArray+=(
|
||||||
|
"BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
|
||||||
|
"BOOT_LDFLAGS=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS"
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
|
if test -n "${targetConfig-}" -a "$crossStageStatic" == 1; then
|
||||||
# We don't want the gcc build to assume there will be a libc providing
|
# We don't want the gcc build to assume there will be a libc providing
|
||||||
# limits.h in this stagae
|
# limits.h in this stagae
|
||||||
makeFlagsArray+=( \
|
makeFlagsArray+=(
|
||||||
LIMITS_H_TEST=false \
|
'LIMITS_H_TEST=false'
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
makeFlagsArray+=( \
|
makeFlagsArray+=(
|
||||||
LIMITS_H_TEST=true \
|
'LIMITS_H_TEST=true'
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -n "$targetConfig"; then
|
if test -n "${targetConfig-}"; then
|
||||||
# The host strip will destroy some important details of the objects
|
# The host strip will destroy some important details of the objects
|
||||||
dontStrip=1
|
dontStrip=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
eval "$oldOpts"
|
||||||
|
|
||||||
providedPreConfigure="$preConfigure";
|
providedPreConfigure="$preConfigure";
|
||||||
preConfigure() {
|
preConfigure() {
|
||||||
if test -n "$newlibSrc"; then
|
if test -n "$newlibSrc"; then
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
, darwin ? null
|
, darwin ? null
|
||||||
, flex ? null
|
, flex ? null
|
||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert langJava -> zip != null && unzip != null
|
assert langJava -> zip != null && unzip != null
|
||||||
@ -310,6 +311,8 @@ stdenv.mkDerivation ({
|
|||||||
"--with-mpc=${libmpc}"
|
"--with-mpc=${libmpc}"
|
||||||
] ++
|
] ++
|
||||||
optional (libelf != null) "--with-libelf=${libelf}" ++
|
optional (libelf != null) "--with-libelf=${libelf}" ++
|
||||||
|
optional (!(crossMingw && crossStageStatic))
|
||||||
|
"--with-native-system-header-dir=${getDev stdenv.cc.libc}/include" ++
|
||||||
|
|
||||||
# Basic configuration
|
# Basic configuration
|
||||||
[
|
[
|
||||||
@ -361,14 +364,6 @@ stdenv.mkDerivation ({
|
|||||||
# Ada
|
# Ada
|
||||||
optional langAda "--enable-libada" ++
|
optional langAda "--enable-libada" ++
|
||||||
|
|
||||||
# Cross-compilation
|
|
||||||
optional (targetPlatform == hostPlatform) (
|
|
||||||
let incDir = if hostPlatform.isDarwin
|
|
||||||
then "${darwin.usr-include}"
|
|
||||||
else "${getDev stdenv.cc.libc}/include";
|
|
||||||
in "--with-native-system-header-dir=${incDir}"
|
|
||||||
) ++
|
|
||||||
|
|
||||||
platformFlags ++
|
platformFlags ++
|
||||||
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
optional (targetPlatform != hostPlatform) crossConfigureFlags ++
|
||||||
optional (!bootstrap) "--disable-bootstrap" ++
|
optional (!bootstrap) "--disable-bootstrap" ++
|
||||||
@ -433,12 +428,12 @@ stdenv.mkDerivation ({
|
|||||||
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
|
||||||
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
|
||||||
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
|
||||||
# If we are making a cross compiler, targetPlatform != hostPlatform
|
|
||||||
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
buildFlags = "";
|
buildFlags = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
NIX_BUILD_CC = buildPackages.stdenv.cc;
|
||||||
|
|
||||||
# Needed for the cross compilation to work
|
# Needed for the cross compilation to work
|
||||||
AR = "ar";
|
AR = "ar";
|
||||||
@ -446,18 +441,21 @@ stdenv.mkDerivation ({
|
|||||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||||
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
|
||||||
|
|
||||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
|
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||||
# the library headers and binaries, regarless of the language being
|
# library headers and binaries, regarless of the language being compiled.
|
||||||
# compiled.
|
#
|
||||||
|
# Note: When building the Java AWT GTK+ peer, the build system doesn't honor
|
||||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
# `--with-gmp' et al., e.g., when building
|
||||||
# honor `--with-gmp' et al., e.g., when building
|
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
|
||||||
#
|
#
|
||||||
# Likewise, the LTO code doesn't find zlib.
|
# Likewise, the LTO code doesn't find zlib.
|
||||||
|
#
|
||||||
|
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||||
|
# compiler (after the specs for the cross-gcc are created). Having
|
||||||
|
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||||
|
|
||||||
CPATH = makeSearchPathOutput "dev" "include" ([]
|
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
@ -468,39 +466,38 @@ stdenv.mkDerivation ({
|
|||||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||||
# headers.
|
# headers.
|
||||||
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
++ optionals (libcCross != null && libcCross ? propagatedBuildInputs)
|
||||||
libcCross.propagatedBuildInputs);
|
libcCross.propagatedBuildInputs
|
||||||
|
));
|
||||||
|
|
||||||
LIBRARY_PATH = makeLibraryPath ([]
|
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||||
++ optional (zlib != null) zlib
|
++ optional (zlib != null) zlib
|
||||||
++ optional langJava boehmgc
|
++ optional langJava boehmgc
|
||||||
++ optionals javaAwtGtk xlibs
|
++ optionals javaAwtGtk xlibs
|
||||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||||
++ optional (libpthread != null) libpthread);
|
++ optional (libpthread != null) libpthread)
|
||||||
|
);
|
||||||
|
|
||||||
EXTRA_TARGET_CFLAGS =
|
EXTRA_TARGET_FLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-idirafter ${getDev libcCross}/include"
|
([
|
||||||
]
|
"-idirafter ${getDev libcCross}/include"
|
||||||
++ optionals (! crossStageStatic) [
|
] ++ optionals (! crossStageStatic) [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
]
|
]);
|
||||||
else null;
|
|
||||||
|
|
||||||
EXTRA_TARGET_LDFLAGS =
|
EXTRA_TARGET_LDFLAGS = optionals
|
||||||
if targetPlatform != hostPlatform && libcCross != null then [
|
(targetPlatform != hostPlatform && libcCross != null)
|
||||||
"-Wl,-L${libcCross.out}/lib"
|
([
|
||||||
]
|
"-Wl,-L${libcCross.out}/lib"
|
||||||
++ (if crossStageStatic then [
|
] ++ (if crossStageStatic then [
|
||||||
"-B${libcCross.out}/lib"
|
"-B${libcCross.out}/lib"
|
||||||
] else [
|
] else [
|
||||||
"-Wl,-rpath,${libcCross.out}/lib"
|
"-Wl,-rpath,${libcCross.out}/lib"
|
||||||
"-Wl,-rpath-link,${libcCross.out}/lib"
|
"-Wl,-rpath-link,${libcCross.out}/lib"
|
||||||
])
|
]) ++ optionals (libpthreadCross != null) [
|
||||||
++ optionals (libpthreadCross != null) [
|
"-L${libpthreadCross}/lib"
|
||||||
"-L${libpthreadCross}/lib"
|
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
||||||
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
|
]);
|
||||||
]
|
|
||||||
else null;
|
|
||||||
|
|
||||||
passthru =
|
passthru =
|
||||||
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user