Porting the platform gcc flags support to gcc 4.7

This commit is contained in:
Lluís Batlle i Rossell 2012-12-31 09:32:11 +00:00
parent 97d81bde0c
commit ba7cde0156
2 changed files with 144 additions and 121 deletions

View File

@ -85,7 +85,31 @@ let version = "4.7.2";
javaAwtGtk = langJava && gtk != null; javaAwtGtk = langJava && gtk != null;
/* Platform flags */
platformFlags = let
gccArch = stdenv.lib.attrByPath [ "platform" "gcc" "arch" ] null stdenv;
gccCpu = stdenv.lib.attrByPath [ "platform" "gcc" "cpu" ] null stdenv;
gccAbi = stdenv.lib.attrByPath [ "platform" "gcc" "abi" ] null stdenv;
gccFpu = stdenv.lib.attrByPath [ "platform" "gcc" "fpu" ] null stdenv;
gccFloat = stdenv.lib.attrByPath [ "platform" "gcc" "float" ] null stdenv;
gccMode = stdenv.lib.attrByPath [ "platform" "gcc" "mode" ] null stdenv;
withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
in
(withArch +
withCpu +
withAbi +
withFpu +
withFloat +
withMode);
/* Cross-gcc settings */ /* Cross-gcc settings */
crossMingw = (cross != null && cross.libc == "msvcrt");
crossConfigureFlags = let
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross; gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross; gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross; gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
@ -98,9 +122,7 @@ let version = "4.7.2";
withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else ""; withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
withFloat = if gccFloat != null then " --with-float=${gccFloat}" else ""; withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
withMode = if gccMode != null then " --with-mode=${gccMode}" else ""; withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
crossMingw = (cross != null && cross.libc == "msvcrt"); in
crossConfigureFlags =
"--target=${cross.config}" + "--target=${cross.config}" +
withArch + withArch +
withCpu + withCpu +
@ -308,6 +330,7 @@ stdenv.mkDerivation ({
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""} ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
${if cross != null then crossConfigureFlags else ""} ${if cross != null then crossConfigureFlags else ""}
${if !bootstrap then "--disable-bootstrap" else ""} ${if !bootstrap then "--disable-bootstrap" else ""}
${if cross == null then platformFlags else ""}
"; ";
targetConfig = if cross != null then cross.config else null; targetConfig = if cross != null then cross.config else null;