mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
gcc: add version 4.8.0
This commit is contained in:
parent
62e37492b9
commit
642b07f988
9 changed files with 1169 additions and 0 deletions
230
pkgs/development/compilers/gcc/4.8/arm-eabi.patch
Normal file
230
pkgs/development/compilers/gcc/4.8/arm-eabi.patch
Normal file
|
@ -0,0 +1,230 @@
|
|||
Index: gcc-4_7-branch/libstdc++-v3/configure.host
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libstdc++-v3/configure.host (revision 194579)
|
||||
+++ gcc-4_7-branch/libstdc++-v3/configure.host (revision 194580)
|
||||
@@ -340,7 +340,7 @@
|
||||
fi
|
||||
esac
|
||||
case "${host}" in
|
||||
- arm*-*-linux-*eabi)
|
||||
+ arm*-*-linux-*eabi*)
|
||||
port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
|
||||
;;
|
||||
esac
|
||||
Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194579)
|
||||
+++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_signed/requirements/typedefs-2.cc (revision 194580)
|
||||
@@ -1,5 +1,5 @@
|
||||
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
|
||||
-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
|
||||
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
||||
//
|
||||
Index: gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194579)
|
||||
+++ gcc-4_7-branch/libstdc++-v3/testsuite/20_util/make_unsigned/requirements/typedefs-2.cc (revision 194580)
|
||||
@@ -1,5 +1,5 @@
|
||||
// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums" }
|
||||
-// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+// { dg-options "-std=gnu++0x -funsigned-char -fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
|
||||
// 2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
||||
//
|
||||
Index: gcc-4_7-branch/libjava/configure.ac
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libjava/configure.ac (revision 194579)
|
||||
+++ gcc-4_7-branch/libjava/configure.ac (revision 194580)
|
||||
@@ -931,7 +931,7 @@
|
||||
# on Darwin -single_module speeds up loading of the dynamic libraries.
|
||||
extra_ldflags_libjava=-Wl,-single_module
|
||||
;;
|
||||
-arm*linux*eabi)
|
||||
+arm*-*-linux*eabi*)
|
||||
# Some of the ARM unwinder code is actually in libstdc++. We
|
||||
# could in principle replicate it in libgcj, but it's better to
|
||||
# have a dependency on libstdc++.
|
||||
Index: gcc-4_7-branch/libjava/configure
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libjava/configure (revision 194579)
|
||||
+++ gcc-4_7-branch/libjava/configure (revision 194580)
|
||||
@@ -20542,7 +20542,7 @@
|
||||
# on Darwin -single_module speeds up loading of the dynamic libraries.
|
||||
extra_ldflags_libjava=-Wl,-single_module
|
||||
;;
|
||||
-arm*linux*eabi)
|
||||
+arm*-*-linux*eabi*)
|
||||
# Some of the ARM unwinder code is actually in libstdc++. We
|
||||
# could in principle replicate it in libgcj, but it's better to
|
||||
# have a dependency on libstdc++.
|
||||
Index: gcc-4_7-branch/libgcc/config.host
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/libgcc/config.host (revision 194579)
|
||||
+++ gcc-4_7-branch/libgcc/config.host (revision 194580)
|
||||
@@ -327,7 +327,7 @@
|
||||
arm*-*-linux*) # ARM GNU/Linux with ELF
|
||||
tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix"
|
||||
case ${host} in
|
||||
- arm*-*-linux-*eabi)
|
||||
+ arm*-*-linux-*eabi*)
|
||||
tmake_file="${tmake_file} arm/t-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
|
||||
tm_file="$tm_file arm/bpabi-lib.h"
|
||||
unwind_header=config/arm/unwind-arm.h
|
||||
Index: gcc-4_7-branch/gcc/doc/install.texi
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/doc/install.texi (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/doc/install.texi (revision 194580)
|
||||
@@ -3222,7 +3222,7 @@
|
||||
@heading @anchor{arm-x-eabi}arm-*-eabi
|
||||
ARM-family processors. Subtargets that use the ELF object format
|
||||
require GNU binutils 2.13 or newer. Such subtargets include:
|
||||
-@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi}
|
||||
+@code{arm-*-netbsdelf}, @code{arm-*-*linux-gnueabi*}
|
||||
and @code{arm-*-rtemseabi}.
|
||||
|
||||
@html
|
||||
Index: gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/gcc.target/arm/synchronize.c (revision 194580)
|
||||
@@ -1,4 +1,4 @@
|
||||
-/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi } } } */
|
||||
+/* { dg-final { scan-assembler "__sync_synchronize|dmb|mcr" { target arm*-*-linux-*eabi* } } } */
|
||||
|
||||
void *foo (void)
|
||||
{
|
||||
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.jason/enum6.C (revision 194580)
|
||||
@@ -7,10 +7,10 @@
|
||||
// enum-size attributes should only be emitted if there are values of
|
||||
// enum type that can escape the compilation unit, gcc cannot currently
|
||||
// detect this; if this facility is added then this linker option should
|
||||
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||
// those platforms where the EABI supplement defines enum values to be
|
||||
// 32 bits wide.
|
||||
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.other/enum4.C (revision 194580)
|
||||
@@ -9,10 +9,10 @@
|
||||
// enum-size attributes should only be emitted if there are values of
|
||||
// enum type that can escape the compilation unit, gcc cannot currently
|
||||
// detect this; if this facility is added then this linker option should
|
||||
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||
// those platforms where the EABI supplement defines enum values to be
|
||||
// 32 bits wide.
|
||||
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
|
||||
enum E {
|
||||
a = -312
|
||||
Index: gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/g++.old-deja/g++.law/enum9.C (revision 194580)
|
||||
@@ -7,10 +7,10 @@
|
||||
// enum-size attributes should only be emitted if there are values of
|
||||
// enum type that can escape the compilation unit, gcc cannot currently
|
||||
// detect this; if this facility is added then this linker option should
|
||||
-// not be needed. arm-*-linux*eabi should be a good approximation to
|
||||
+// not be needed. arm-*-linux*eabi* should be a good approximation to
|
||||
// those platforms where the EABI supplement defines enum values to be
|
||||
// 32 bits wide.
|
||||
-// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+// { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
|
||||
// GROUPS passed enums
|
||||
extern "C" int printf (const char *, ...);
|
||||
Index: gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/lib/target-supports.exp (revision 194580)
|
||||
@@ -3818,7 +3818,7 @@
|
||||
}
|
||||
} ""
|
||||
}]
|
||||
- } elseif { [istarget arm*-*-linux-gnueabi] } {
|
||||
+ } elseif { [istarget arm*-*-linux-gnueabi*] } {
|
||||
return [check_runtime sync_longlong_runtime {
|
||||
#include <stdlib.h>
|
||||
int main ()
|
||||
@@ -3860,7 +3860,7 @@
|
||||
|| [istarget i?86-*-*]
|
||||
|| [istarget x86_64-*-*]
|
||||
|| [istarget alpha*-*-*]
|
||||
- || [istarget arm*-*-linux-gnueabi]
|
||||
+ || [istarget arm*-*-linux-gnueabi*]
|
||||
|| [istarget bfin*-*linux*]
|
||||
|| [istarget hppa*-*linux*]
|
||||
|| [istarget s390*-*-*]
|
||||
@@ -3890,7 +3890,7 @@
|
||||
|| [istarget i?86-*-*]
|
||||
|| [istarget x86_64-*-*]
|
||||
|| [istarget alpha*-*-*]
|
||||
- || [istarget arm*-*-linux-gnueabi]
|
||||
+ || [istarget arm*-*-linux-gnueabi*]
|
||||
|| [istarget hppa*-*linux*]
|
||||
|| [istarget s390*-*-*]
|
||||
|| [istarget powerpc*-*-*]
|
||||
Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_9.f90 (revision 194580)
|
||||
@@ -1,6 +1,6 @@
|
||||
! { dg-do run }
|
||||
! { dg-options "-fshort-enums" }
|
||||
-! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+! { dg-options "-fshort-enums -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
! Program to test enumerations when option -fshort-enums is given
|
||||
|
||||
program main
|
||||
Index: gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/testsuite/gfortran.dg/enum_10.f90 (revision 194580)
|
||||
@@ -1,7 +1,7 @@
|
||||
! { dg-do run }
|
||||
! { dg-additional-sources enum_10.c }
|
||||
! { dg-options "-fshort-enums -w" }
|
||||
-! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
|
||||
+! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi* } }
|
||||
! Make sure short enums are indeed interoperable with the
|
||||
! corresponding C type.
|
||||
|
||||
Index: gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/ada/gcc-interface/Makefile.in (revision 194580)
|
||||
@@ -1866,7 +1866,7 @@
|
||||
LIBRARY_VERSION := $(LIB_VERSION)
|
||||
endif
|
||||
|
||||
-ifeq ($(strip $(filter-out arm% linux-gnueabi,$(arch) $(osys)-$(word 4,$(targ)))),)
|
||||
+ifeq ($(strip $(filter-out arm%-linux,$(arch)-$(osys)) $(if $(findstring eabi,$(word 4,$(targ))),,$(word 4,$(targ)))),)
|
||||
LIBGNAT_TARGET_PAIRS = \
|
||||
a-intnam.ads<a-intnam-linux.ads \
|
||||
s-inmaop.adb<s-inmaop-posix.adb \
|
||||
Index: gcc-4_7-branch/gcc/config.gcc
|
||||
===================================================================
|
||||
--- gcc-4_7-branch/gcc/config.gcc (revision 194579)
|
||||
+++ gcc-4_7-branch/gcc/config.gcc (revision 194580)
|
||||
@@ -855,7 +855,7 @@
|
||||
esac
|
||||
tmake_file="${tmake_file} arm/t-arm"
|
||||
case ${target} in
|
||||
- arm*-*-linux-*eabi)
|
||||
+ arm*-*-linux-*eabi*)
|
||||
tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
|
||||
tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
|
||||
# Define multilib configuration for arm-linux-androideabi.
|
245
pkgs/development/compilers/gcc/4.8/builder.sh
Normal file
245
pkgs/development/compilers/gcc/4.8/builder.sh
Normal file
|
@ -0,0 +1,245 @@
|
|||
source $stdenv/setup
|
||||
|
||||
|
||||
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
||||
mkdir $NIX_FIXINC_DUMMY
|
||||
|
||||
|
||||
if test "$staticCompiler" = "1"; then
|
||||
EXTRA_LDFLAGS="-static"
|
||||
else
|
||||
EXTRA_LDFLAGS=""
|
||||
fi
|
||||
|
||||
# GCC interprets empty paths as ".", which we don't want.
|
||||
if test -z "$CPATH"; then unset CPATH; fi
|
||||
if test -z "$LIBRARY_PATH"; then unset LIBRARY_PATH; fi
|
||||
echo "\$CPATH is \`$CPATH'"
|
||||
echo "\$LIBRARY_PATH is \`$LIBRARY_PATH'"
|
||||
|
||||
if test "$noSysDirs" = "1"; then
|
||||
|
||||
if test -e $NIX_GCC/nix-support/orig-libc; then
|
||||
|
||||
# Figure out what extra flags to pass to the gcc compilers
|
||||
# being generated to make sure that they use our glibc.
|
||||
extraFlags="$(cat $NIX_GCC/nix-support/libc-cflags)"
|
||||
extraLDFlags="$(cat $NIX_GCC/nix-support/libc-ldflags) $(cat $NIX_GCC/nix-support/libc-ldflags-before)"
|
||||
|
||||
# Use *real* header files, otherwise a limits.h is generated
|
||||
# that does not include Glibc's limits.h (notably missing
|
||||
# SSIZE_MAX, which breaks the build).
|
||||
export NIX_FIXINC_DUMMY=$(cat $NIX_GCC/nix-support/orig-libc)/include
|
||||
|
||||
# The path to the Glibc binaries such as `crti.o'.
|
||||
glibc_libdir="$(cat $NIX_GCC/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
|
||||
if test -z "$crossStageStatic"; then
|
||||
EXTRA_TARGET_CFLAGS="-B${libcCross}/lib -idirafter ${libcCross}/include"
|
||||
EXTRA_TARGET_LDFLAGS="-Wl,-L${libcCross}/lib -Wl,-rpath,${libcCross}/lib -Wl,-rpath-link,${libcCross}/lib"
|
||||
fi
|
||||
else
|
||||
if test -z "$NIX_GCC_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_GCC_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_GCC_CROSS/nix-support/libc-cflags)"
|
||||
extraLDFlags="$(cat $NIX_GCC_CROSS/nix-support/libc-ldflags) $(cat $NIX_GCC_CROSS/nix-support/libc-ldflags-before)"
|
||||
|
||||
# Use *real* header files, otherwise a limits.h is generated
|
||||
# that does not include Glibc's limits.h (notably missing
|
||||
# SSIZE_MAX, which breaks the build).
|
||||
NIX_FIXINC_DUMMY_CROSS=$(cat $NIX_GCC_CROSS/nix-support/orig-libc)/include
|
||||
|
||||
# The path to the Glibc binaries such as `crti.o'.
|
||||
glibc_dir="$(cat $NIX_GCC_CROSS/nix-support/orig-libc)"
|
||||
glibc_libdir="$glibc_dir/lib"
|
||||
configureFlags="$configureFlags --with-native-system-header-dir=$glibc_dir/include"
|
||||
|
||||
extraFlags="-I$NIX_FIXINC_DUMMY_CROSS $extraFlags"
|
||||
extraLDFlags="-L$glibc_libdir -rpath $glibc_libdir $extraLDFlags"
|
||||
|
||||
EXTRA_TARGET_CFLAGS="$extraFlags"
|
||||
for i in $extraLDFlags; do
|
||||
EXTRA_TARGET_LDFLAGS="$EXTRA_TARGET_LDFLAGS -Wl,$i"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
|
||||
# the startfiles.
|
||||
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
|
||||
# for the startfiles.
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
NATIVE_SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
SYSTEM_HEADER_DIR="$NIX_FIXINC_DUMMY" \
|
||||
CFLAGS_FOR_BUILD="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
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
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
BOOT_CFLAGS="$EXTRA_FLAGS $EXTRA_LDFLAGS" \
|
||||
BOOT_LDFLAGS="$EXTRA_TARGET_CFLAGS $EXTRA_TARGET_LDFLAGS" \
|
||||
)
|
||||
fi
|
||||
|
||||
if test -n "$targetConfig" -a "$crossStageStatic" == 1; then
|
||||
# We don't want the gcc build to assume there will be a libc providing
|
||||
# limits.h in this stagae
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
LIMITS_H_TEST=false \
|
||||
)
|
||||
else
|
||||
makeFlagsArray=( \
|
||||
"${makeFlagsArray[@]}" \
|
||||
LIMITS_H_TEST=true \
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$targetConfig"; then
|
||||
# The host strip will destroy some important details of the objects
|
||||
dontStrip=1
|
||||
fi
|
||||
|
||||
providedPreConfigure="$preConfigure";
|
||||
preConfigure() {
|
||||
if test -n "$newlibSrc"; then
|
||||
tar xvf "$newlibSrc" -C ..
|
||||
ln -s ../newlib-*/newlib newlib
|
||||
# Patch to get armvt5el working:
|
||||
sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
|
||||
fi
|
||||
# Bug - they packaged zlib
|
||||
if test -d "zlib"; then
|
||||
# This breaks the build without-headers, which should build only
|
||||
# the target libgcc as target libraries.
|
||||
# See 'configure:5370'
|
||||
rm -Rf zlib
|
||||
fi
|
||||
|
||||
if test -f "$NIX_GCC/nix-support/orig-libc"; then
|
||||
# Patch the configure script so it finds glibc headers. It's
|
||||
# important for example in order not to get libssp built,
|
||||
# because its functionality is in glibc already.
|
||||
glibc_headers="$(cat $NIX_GCC/nix-support/orig-libc)/include"
|
||||
sed -i \
|
||||
-e "s,glibc_header_dir=/usr/include,glibc_header_dir=$glibc_headers", \
|
||||
gcc/configure
|
||||
fi
|
||||
|
||||
if test -n "$crossMingw" -a -n "$crossStageStatic"; then
|
||||
mkdir -p ../mingw
|
||||
# --with-build-sysroot expects that:
|
||||
cp -R $libcCross/include ../mingw
|
||||
configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
|
||||
fi
|
||||
|
||||
# Eval the preConfigure script from nix expression.
|
||||
eval $providedPreConfigure;
|
||||
env;
|
||||
# Perform the build in a different directory.
|
||||
mkdir ../build
|
||||
cd ../build
|
||||
configureScript=../$sourceRoot/configure
|
||||
}
|
||||
|
||||
|
||||
postConfigure() {
|
||||
# Don't store the configure flags in the resulting executables.
|
||||
sed -e '/TOPLEVEL_CONFIGURE_ARGUMENTS=/d' -i Makefile
|
||||
}
|
||||
|
||||
|
||||
postInstall() {
|
||||
# Remove precompiled headers for now. They are very big and
|
||||
# probably not very useful yet.
|
||||
find $out/include -name "*.gch" -exec rm -rf {} \; -prune
|
||||
|
||||
# Remove `fixincl' to prevent a retained dependency on the
|
||||
# previous gcc.
|
||||
rm -rf $out/libexec/gcc/*/*/install-tools
|
||||
rm -rf $out/lib/gcc/*/*/install-tools
|
||||
|
||||
# More dependencies with the previous gcc or some libs (gccbug stores the build command line)
|
||||
rm -rf $out/bin/gccbug
|
||||
# Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
|
||||
for i in $out/libexec/gcc/*/*/*; do
|
||||
if PREV_RPATH=`patchelf --print-rpath $i`; then
|
||||
patchelf --set-rpath `echo $PREV_RPATH | sed 's,:[^:]*bootstrap-tools/lib,,'` $i
|
||||
fi
|
||||
done
|
||||
|
||||
# Get rid of some "fixed" header files
|
||||
rm -rf $out/lib/gcc/*/*/include/root
|
||||
|
||||
# Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
|
||||
for i in $out/bin/*-gcc*; do
|
||||
if cmp -s $out/bin/gcc $i; then
|
||||
ln -sfn gcc $i
|
||||
fi
|
||||
done
|
||||
|
||||
for i in $out/bin/c++ $out/bin/*-c++* $out/bin/*-g++*; do
|
||||
if cmp -s $out/bin/g++ $i; then
|
||||
ln -sfn g++ $i
|
||||
fi
|
||||
done
|
||||
|
||||
eval "$postInstallGhdl"
|
||||
}
|
||||
|
||||
genericBuild
|
525
pkgs/development/compilers/gcc/4.8/default.nix
Normal file
525
pkgs/development/compilers/gcc/4.8/default.nix
Normal file
|
@ -0,0 +1,525 @@
|
|||
{ stdenv, fetchurl, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langJava ? false
|
||||
, langAda ? false
|
||||
, langVhdl ? false
|
||||
, langGo ? false
|
||||
, profiledCompiler ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? true
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man); required for Java
|
||||
, gmp, mpfr, mpc, gettext, which
|
||||
, libelf # optional, for link-time optimizations (LTO)
|
||||
, ppl ? null, cloog ? null, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null, boehmgc ? null
|
||||
, zip ? null, unzip ? null, pkgconfig ? null, gtk ? null, libart_lgpl ? null
|
||||
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
||||
, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
|
||||
, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
|
||||
, gnatboot ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? true # whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, cross ? null
|
||||
, binutilsCross ? null
|
||||
, libcCross ? null
|
||||
, crossStageStatic ? true
|
||||
, gnat ? null
|
||||
, libpthread ? null, libpthreadCross ? null # required for GNU/Hurd
|
||||
, stripped ? true
|
||||
, gnused ? null
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
&& zlib != null && boehmgc != null
|
||||
&& perl != null; # for `--enable-java-home'
|
||||
assert langAda -> gnatboot != null;
|
||||
assert langVhdl -> gnat != null;
|
||||
|
||||
# We enable the isl cloog backend.
|
||||
assert cloog != null -> isl != null;
|
||||
|
||||
# LTO needs libelf and zlib.
|
||||
assert libelf != null -> zlib != null;
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
with stdenv.lib;
|
||||
with builtins;
|
||||
|
||||
let version = "4.8.0";
|
||||
|
||||
# Whether building a cross-compiler for GNU/Hurd.
|
||||
crossGNU = cross != null && cross.config == "i586-pc-gnu";
|
||||
|
||||
patches = []
|
||||
++ optional stdenv.isArm [ ./arm-eabi.patch ]
|
||||
++ optional (cross != null) ./libstdc++-target.patch
|
||||
# ++ optional noSysDirs ./no-sys-dirs.patch
|
||||
# The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
|
||||
# target libraries and tools.
|
||||
++ optional langAda ./gnat-cflags.patch
|
||||
++ optional langFortran ./gfortran-driving.patch;
|
||||
|
||||
javaEcj = fetchurl {
|
||||
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
||||
# `configure' time.
|
||||
|
||||
# XXX: Eventually we might want to take it from upstream.
|
||||
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
||||
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
||||
};
|
||||
|
||||
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
||||
# binary distribution here to allow the whole chain to be bootstrapped.
|
||||
javaAntlr = fetchurl {
|
||||
url = http://www.antlr.org/download/antlr-3.1.3.jar;
|
||||
sha256 = "1f41j0y4kjydl71lqlvr73yagrs2jsg1fjymzjz66mjy7al5lh09";
|
||||
};
|
||||
|
||||
xlibs = [
|
||||
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
||||
xproto renderproto xextproto inputproto randrproto
|
||||
];
|
||||
|
||||
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 */
|
||||
crossMingw = (cross != null && cross.libc == "msvcrt");
|
||||
crossConfigureFlags = let
|
||||
gccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null cross;
|
||||
gccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null cross;
|
||||
gccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null cross;
|
||||
gccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null cross;
|
||||
gccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null cross;
|
||||
gccMode = stdenv.lib.attrByPath [ "gcc" "mode" ] null cross;
|
||||
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
|
||||
"--target=${cross.config}" +
|
||||
withArch +
|
||||
withCpu +
|
||||
withAbi +
|
||||
withFpu +
|
||||
withFloat +
|
||||
withMode +
|
||||
(if crossMingw && crossStageStatic then
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --with-gcc" +
|
||||
" --with-gnu-as" +
|
||||
" --with-gnu-ld" +
|
||||
" --with-gnu-ld" +
|
||||
" --disable-shared" +
|
||||
" --disable-nls" +
|
||||
" --disable-debug" +
|
||||
" --enable-sjlj-exceptions" +
|
||||
" --enable-threads=win32" +
|
||||
" --disable-win32-registry"
|
||||
else if crossStageStatic then
|
||||
" --disable-libssp --disable-nls" +
|
||||
" --without-headers" +
|
||||
" --disable-threads " +
|
||||
" --disable-libmudflap " +
|
||||
" --disable-libgomp " +
|
||||
" --disable-libquadmath" +
|
||||
" --disable-shared" +
|
||||
" --disable-decimal-float" # libdecnumber requires libc
|
||||
else
|
||||
" --with-headers=${libcCross}/include" +
|
||||
" --enable-__cxa_atexit" +
|
||||
" --enable-long-long" +
|
||||
(if crossMingw then
|
||||
" --enable-threads=win32" +
|
||||
" --enable-sjlj-exceptions" +
|
||||
" --enable-hash-synchronization" +
|
||||
" --disable-libssp" +
|
||||
" --disable-nls" +
|
||||
" --with-dwarf2" +
|
||||
# I think noone uses shared gcc libs in mingw, so we better do the same.
|
||||
# In any case, mingw32 g++ linking is broken by default with shared libs,
|
||||
# unless adding "-lsupc++" to any linking command. I don't know why.
|
||||
" --disable-shared" +
|
||||
(if cross.config == "x86_64-w64-mingw32" then
|
||||
# To keep ABI compatibility with upstream mingw-w64
|
||||
" --enable-fully-dynamic-string"
|
||||
else "")
|
||||
else (if cross.libc == "uclibc" then
|
||||
# In uclibc cases, libgomp needs an additional '-ldl'
|
||||
# and as I don't know how to pass it, I disable libgomp.
|
||||
" --disable-libgomp" else "") +
|
||||
" --enable-threads=posix" +
|
||||
" --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 cross != null then "-${cross.config}" + stageNameAddon else "";
|
||||
|
||||
bootstrap = cross == null && !stdenv.isArm && !stdenv.isMips;
|
||||
|
||||
in
|
||||
|
||||
# We need all these X libraries when building AWT with GTK+.
|
||||
assert gtk != null -> (filter (x: x == null) xlibs) == [];
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
|
||||
sha256 = "0b6cp9d1sas3vq6dj3zrgd134p9b569fqhbixb9cl7mp698zwdxh";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
postPatch =
|
||||
if (stdenv.isGNU
|
||||
|| (libcCross != null # e.g., building `gcc.crossDrv'
|
||||
&& libcCross ? crossConfig
|
||||
&& libcCross.crossConfig == "i586-pc-gnu")
|
||||
|| (crossGNU && libcCross != null))
|
||||
then
|
||||
# On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
|
||||
# in glibc, so add the right `-I' flags to the default spec string.
|
||||
assert libcCross != null -> libpthreadCross != null;
|
||||
let
|
||||
libc = if libcCross != null then libcCross else stdenv.glibc;
|
||||
gnu_h = "gcc/config/gnu.h";
|
||||
extraCPPDeps =
|
||||
libc.propagatedBuildInputs
|
||||
++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
|
||||
++ stdenv.lib.optional (libpthread != null) libpthread;
|
||||
extraCPPSpec =
|
||||
concatStrings (intersperse " "
|
||||
(map (x: "-I${x}/include") extraCPPDeps));
|
||||
extraLibSpec =
|
||||
if libpthreadCross != null
|
||||
then "-L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}"
|
||||
else "-L${libpthread}/lib";
|
||||
in
|
||||
'' echo "augmenting \`CPP_SPEC' in \`${gnu_h}' with \`${extraCPPSpec}'..."
|
||||
sed -i "${gnu_h}" \
|
||||
-es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g'
|
||||
|
||||
echo "augmenting \`LIB_SPEC' in \`${gnu_h}' with \`${extraLibSpec}'..."
|
||||
sed -i "${gnu_h}" \
|
||||
-es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g'
|
||||
|
||||
echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc}/include'..."
|
||||
sed -i "${gnu_h}" \
|
||||
-es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc}/include"|g'
|
||||
''
|
||||
else if cross != null || stdenv.gcc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
libc = if libcCross != null then libcCross else stdenv.gcc.libc;
|
||||
in
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q LIBC_DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc}\3"|g'
|
||||
done
|
||||
''
|
||||
else null;
|
||||
|
||||
inherit noSysDirs staticCompiler langJava crossStageStatic
|
||||
libcCross crossMingw;
|
||||
|
||||
nativeBuildInputs = [ texinfo which gettext ]
|
||||
++ (optional (perl != null) perl)
|
||||
++ (optional javaAwtGtk pkgconfig);
|
||||
|
||||
buildInputs = [ gmp mpfr mpc libelf ]
|
||||
++ (optional (ppl != null) ppl)
|
||||
++ (optional (cloog != null) cloog)
|
||||
++ (optional (isl != null) isl)
|
||||
++ (optional (zlib != null) zlib)
|
||||
++ (optionals langJava [ boehmgc zip unzip ])
|
||||
++ (optionals javaAwtGtk ([ gtk libart_lgpl ] ++ xlibs))
|
||||
++ (optionals (cross != null) [binutilsCross])
|
||||
++ (optionals langAda [gnatboot])
|
||||
++ (optionals langVhdl [gnat])
|
||||
|
||||
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
|
||||
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
|
||||
++ (optional stdenv.isDarwin gnused)
|
||||
;
|
||||
|
||||
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isSunOS "-lm -ldl";
|
||||
|
||||
preConfigure = ''
|
||||
configureFlagsArray=(
|
||||
${stdenv.lib.optionalString (ppl != null && ppl ? dontDisableStatic && ppl.dontDisableStatic)
|
||||
"'--with-host-libstdcxx=-lstdc++ -lgcc_s'"}
|
||||
${stdenv.lib.optionalString (ppl != null && stdenv.isSunOS)
|
||||
"\"--with-host-libstdcxx=-Wl,-rpath,\$prefix/lib/amd64 -lstdc++\"
|
||||
\"--with-boot-ldflags=-L../prev-x86_64-pc-solaris2.11/libstdc++-v3/src/.libs\""}
|
||||
);
|
||||
${stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit)
|
||||
''
|
||||
export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
|
||||
export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
|
||||
export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
|
||||
export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
|
||||
''}
|
||||
'';
|
||||
|
||||
# 'iant' at #go-nuts@freenode, gccgo maintainer, said that
|
||||
# they have a bug in 4.7.1 if adding "--disable-static"
|
||||
dontDisableStatic = langGo || staticCompiler;
|
||||
|
||||
configureFlags = "
|
||||
${if stdenv.isSunOS then
|
||||
" --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
|
||||
# On Illumos/Solaris GNU as is preferred
|
||||
" --with-gnu-as --without-gnu-ld "
|
||||
else ""}
|
||||
--enable-lto
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
${if enableShared then "" else "--disable-shared"}
|
||||
${if enablePlugin then "--enable-plugin" else "--disable-plugin"}
|
||||
${if ppl != null then "--with-ppl=${ppl} --disable-ppl-version-check" else ""}
|
||||
${optionalString (isl != null) "--with-isl=${isl}"}
|
||||
${optionalString (cloog != null) "--with-cloog=${cloog} --disable-cloog-version-check --enable-cloog-backend=isl"}
|
||||
${if langJava then
|
||||
"--with-ecj-jar=${javaEcj} " +
|
||||
|
||||
# Follow Sun's layout for the convenience of IcedTea/OpenJDK. See
|
||||
# <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2010-April/008888.html>.
|
||||
"--enable-java-home --with-java-home=\${prefix}/lib/jvm/jre "
|
||||
else ""}
|
||||
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
||||
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""}
|
||||
--with-gmp=${gmp}
|
||||
--with-mpfr=${mpfr}
|
||||
--with-mpc=${mpc}
|
||||
${if libelf != null then "--with-libelf=${libelf}" else ""}
|
||||
--disable-libstdcxx-pch
|
||||
--without-included-gettext
|
||||
--with-system-zlib
|
||||
--enable-languages=${
|
||||
concatStrings (intersperse ","
|
||||
( optional langC "c"
|
||||
++ optional langCC "c++"
|
||||
++ optional langFortran "fortran"
|
||||
++ optional langJava "java"
|
||||
++ optional langAda "ada"
|
||||
++ optional langVhdl "vhdl"
|
||||
++ optional langGo "go"
|
||||
)
|
||||
)
|
||||
}
|
||||
${if (stdenv ? glibc && cross == null)
|
||||
then " --with-native-system-header-dir=${stdenv.glibc}/include"
|
||||
else ""}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
|
||||
${if cross != null then crossConfigureFlags else ""}
|
||||
${if !bootstrap then "--disable-bootstrap" else ""}
|
||||
${if cross == null then platformFlags else ""}
|
||||
";
|
||||
|
||||
targetConfig = if cross != null then cross.config else null;
|
||||
|
||||
buildFlags = if bootstrap then
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap")
|
||||
else "";
|
||||
|
||||
installTargets =
|
||||
if stripped
|
||||
then "install-strip"
|
||||
else "install";
|
||||
|
||||
crossAttrs = let
|
||||
xgccArch = stdenv.lib.attrByPath [ "gcc" "arch" ] null stdenv.cross;
|
||||
xgccCpu = stdenv.lib.attrByPath [ "gcc" "cpu" ] null stdenv.cross;
|
||||
xgccAbi = stdenv.lib.attrByPath [ "gcc" "abi" ] null stdenv.cross;
|
||||
xgccFpu = stdenv.lib.attrByPath [ "gcc" "fpu" ] null stdenv.cross;
|
||||
xgccFloat = stdenv.lib.attrByPath [ "gcc" "float" ] null stdenv.cross;
|
||||
xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
|
||||
xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
|
||||
xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
|
||||
xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else "";
|
||||
xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else "";
|
||||
in {
|
||||
AR = "${stdenv.cross.config}-ar";
|
||||
LD = "${stdenv.cross.config}-ld";
|
||||
CC = "${stdenv.cross.config}-gcc";
|
||||
CXX = "${stdenv.cross.config}-gcc";
|
||||
AR_FOR_TARGET = "${stdenv.cross.config}-ar";
|
||||
LD_FOR_TARGET = "${stdenv.cross.config}-ld";
|
||||
CC_FOR_TARGET = "${stdenv.cross.config}-gcc";
|
||||
NM_FOR_TARGET = "${stdenv.cross.config}-nm";
|
||||
CXX_FOR_TARGET = "${stdenv.cross.config}-g++";
|
||||
# If we are making a cross compiler, cross != null
|
||||
NIX_GCC_CROSS = if cross == null then "${stdenv.gccCross}" else "";
|
||||
dontStrip = true;
|
||||
configureFlags = ''
|
||||
${if enableMultilib then "" else "--disable-multilib"}
|
||||
${if enableShared then "" else "--disable-shared"}
|
||||
${if ppl != null then "--with-ppl=${ppl.crossDrv}" else ""}
|
||||
${if cloog != null then "--with-cloog=${cloog.crossDrv} --enable-cloog-backend=isl" else ""}
|
||||
${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""}
|
||||
${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
|
||||
${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""}
|
||||
--with-gmp=${gmp.crossDrv}
|
||||
--with-mpfr=${mpfr.crossDrv}
|
||||
--disable-libstdcxx-pch
|
||||
--without-included-gettext
|
||||
--with-system-zlib
|
||||
--enable-languages=${
|
||||
concatStrings (intersperse ","
|
||||
( optional langC "c"
|
||||
++ optional langCC "c++"
|
||||
++ optional langFortran "fortran"
|
||||
++ optional langJava "java"
|
||||
++ optional langAda "ada"
|
||||
++ optional langVhdl "vhdl"
|
||||
++ optional langGo "go"
|
||||
)
|
||||
)
|
||||
}
|
||||
${if langAda then " --enable-libada" else ""}
|
||||
--target=${stdenv.cross.config}
|
||||
${xwithArch}
|
||||
${xwithCpu}
|
||||
${xwithAbi}
|
||||
${xwithFpu}
|
||||
${xwithFloat}
|
||||
'';
|
||||
buildFlags = "";
|
||||
};
|
||||
|
||||
|
||||
# Needed for the cross compilation to work
|
||||
AR = "ar";
|
||||
LD = "ld";
|
||||
# http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
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
|
||||
# the library headers and binaries, regarless of the language being
|
||||
# compiled.
|
||||
|
||||
# Note: When building the Java AWT GTK+ peer, the build system doesn't
|
||||
# honor `--with-gmp' et al., e.g., when building
|
||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
|
||||
# add them to $CPATH and $LIBRARY_PATH in this case.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
|
||||
CPATH = concatStrings
|
||||
(intersperse ":" (map (x: x + "/include")
|
||||
(optionals (zlib != null) [ zlib ]
|
||||
++ optionals langJava [ boehmgc ]
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
++ optional (libpthread != null) libpthread
|
||||
++ optional (libpthreadCross != null) libpthreadCross
|
||||
|
||||
# On GNU/Hurd glibc refers to Mach & Hurd
|
||||
# headers.
|
||||
++ optionals (libcCross != null &&
|
||||
hasAttr "propagatedBuildInputs" libcCross)
|
||||
libcCross.propagatedBuildInputs)));
|
||||
|
||||
LIBRARY_PATH = concatStrings
|
||||
(intersperse ":" (map (x: x + "/lib")
|
||||
(optionals (zlib != null) [ zlib ]
|
||||
++ optionals langJava [ boehmgc ]
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
++ optional (libpthread != null) libpthread)));
|
||||
|
||||
EXTRA_TARGET_CFLAGS =
|
||||
if cross != null && libcCross != null
|
||||
then "-idirafter ${libcCross}/include"
|
||||
else null;
|
||||
|
||||
EXTRA_TARGET_LDFLAGS =
|
||||
if cross != null && libcCross != null
|
||||
then "-B${libcCross}/lib -Wl,-L${libcCross}/lib" +
|
||||
(optionalString (libpthreadCross != null)
|
||||
" -L${libpthreadCross}/lib -Wl,${libpthreadCross.TARGET_LDFLAGS}")
|
||||
else null;
|
||||
|
||||
passthru = { inherit langC langCC langAda langFortran langVhdl
|
||||
langGo enableMultilib version; };
|
||||
|
||||
/* From gccinstall.info:
|
||||
"parallel make is currently not supported since collisions in profile
|
||||
collecting may occur"
|
||||
*/
|
||||
enableParallelBuilding = !profiledCompiler;
|
||||
|
||||
meta = {
|
||||
homepage = http://gcc.gnu.org/;
|
||||
license = "GPLv3+"; # runtime support libraries are typically LGPLv3+
|
||||
description = "GNU Compiler Collection, version ${version}"
|
||||
+ (if stripped then "" else " (with debugging info)");
|
||||
|
||||
longDescription = ''
|
||||
The GNU Compiler Collection includes compiler front ends for C, C++,
|
||||
Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
|
||||
as libraries for these languages (libstdc++, libgcj, libgomp,...).
|
||||
|
||||
GCC development is a part of the GNU Project, aiming to improve the
|
||||
compiler used in the GNU system including the GNU/Linux variant.
|
||||
'';
|
||||
|
||||
maintainers = with stdenv.lib.maintainers; [ ludo viric shlevy simons ];
|
||||
|
||||
# Volunteers needed for the {Cyg,Dar}win ports of *PPL.
|
||||
# gnatboot is not available out of linux platforms, so we disable the darwin build
|
||||
# for the gnat (ada compiler).
|
||||
platforms = stdenv.lib.platforms.linux ++ optionals (langAda == false && libelf == null) [ "i686-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
|
||||
# Strip kills static libs of other archs (hence cross != null)
|
||||
// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
|
||||
)
|
20
pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
Normal file
20
pkgs/development/compilers/gcc/4.8/gfortran-driving.patch
Normal file
|
@ -0,0 +1,20 @@
|
|||
This patch fixes interaction with Libtool.
|
||||
See <http://thread.gmane.org/gmane.comp.gcc.patches/258777>, for details.
|
||||
|
||||
--- a/gcc/fortran/gfortranspec.c
|
||||
+++ b/gcc/fortran/gfortranspec.c
|
||||
@@ -461,8 +461,15 @@ For more information about these matters, see the file named COPYING\n\n"));
|
||||
{
|
||||
fprintf (stderr, _("Driving:"));
|
||||
for (i = 0; i < g77_newargc; i++)
|
||||
+ {
|
||||
+ if (g77_new_decoded_options[i].opt_index == OPT_l)
|
||||
+ /* Make sure no white space is inserted after `-l'. */
|
||||
+ fprintf (stderr, " -l%s",
|
||||
+ g77_new_decoded_options[i].canonical_option[1]);
|
||||
+ else
|
||||
fprintf (stderr, " %s",
|
||||
g77_new_decoded_options[i].orig_option_with_args_text);
|
||||
+ }
|
||||
fprintf (stderr, "\n");
|
||||
}
|
33
pkgs/development/compilers/gcc/4.8/gnat-cflags.patch
Normal file
33
pkgs/development/compilers/gcc/4.8/gnat-cflags.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
diff --git a/libada/Makefile.in b/libada/Makefile.in
|
||||
index f5057a0..337e0c6 100644
|
||||
--- a/libada/Makefile.in
|
||||
+++ b/libada/Makefile.in
|
||||
@@ -55,7 +55,7 @@ GCC_WARN_CFLAGS = $(LOOSE_WARN)
|
||||
WARN_CFLAGS = @warn_cflags@
|
||||
|
||||
TARGET_LIBGCC2_CFLAGS=
|
||||
-GNATLIBCFLAGS= -g -O2
|
||||
+GNATLIBCFLAGS= -g -O2 $(CFLAGS)
|
||||
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
|
||||
-DIN_RTS @have_getipinfo@
|
||||
|
||||
--- a/gcc/ada/gcc-interface/Makefile.in
|
||||
+++ b/gcc/ada/gcc-interface/Makefile.in
|
||||
@@ -105,7 +105,7 @@ ADAFLAGS = -W -Wall -gnatpg -gnata
|
||||
SOME_ADAFLAGS =-gnata
|
||||
FORCE_DEBUG_ADAFLAGS = -g
|
||||
GNATLIBFLAGS = -gnatpg -nostdinc
|
||||
-GNATLIBCFLAGS = -g -O2
|
||||
+GNATLIBCFLAGS = -g -O2 $(CFLAGS_FOR_TARGET)
|
||||
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
|
||||
# should be autodetected during the configuration of libada and passed down to
|
||||
# here, but we need something for --disable-libada and hope for the best.
|
||||
@@ -193,7 +193,7 @@ RTSDIR = rts$(subst /,_,$(MULTISUBDIR))
|
||||
# Link flags used to build gnat tools. By default we prefer to statically
|
||||
# link with libgcc to avoid a dependency on shared libgcc (which is tricky
|
||||
# to deal with as it may conflict with the libgcc provided by the system).
|
||||
-GCC_LINK_FLAGS=-static-libgcc
|
||||
+GCC_LINK_FLAGS=-static-libgcc $(CFLAGS_FOR_TARGET)
|
||||
|
||||
# End of variables for you to override.
|
||||
|
17
pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch
Normal file
17
pkgs/development/compilers/gcc/4.8/java-jvgenmain-link.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
The `jvgenmain' executable must be linked against `vec.o', among others,
|
||||
since it uses its vector API.
|
||||
|
||||
--- gcc-4.3.3/gcc/java/Make-lang.in 2008-12-05 00:00:19.000000000 +0100
|
||||
+++ gcc-4.3.3/gcc/java/Make-lang.in 2009-07-03 16:11:41.000000000 +0200
|
||||
@@ -109,9 +109,9 @@ jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIB
|
||||
$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
|
||||
$(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
|
||||
|
||||
-jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
|
||||
+jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS) $(BUILD_RTL)
|
||||
rm -f $@
|
||||
- $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
|
||||
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(BUILD_RTL) $(LIBS)
|
||||
|
||||
#
|
||||
# Build hooks:
|
32
pkgs/development/compilers/gcc/4.8/libstdc++-target.patch
Normal file
32
pkgs/development/compilers/gcc/4.8/libstdc++-target.patch
Normal file
|
@ -0,0 +1,32 @@
|
|||
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
||||
I noticed that building the mingw32 cross compiler.
|
||||
Looking at the build script for mingw in archlinux, I think that only nixos
|
||||
needs this patch. I don't know why.
|
||||
diff --git a/Makefile.in b/Makefile.in
|
||||
index 93f66b6..d691917 100644
|
||||
--- a/Makefile.in
|
||||
+++ b/Makefile.in
|
||||
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
||||
AR="$(AR_FOR_TARGET)"; export AR; \
|
||||
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
||||
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
||||
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
||||
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
||||
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
||||
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
||||
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
||||
RAW_CXX_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
||||
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
NORMAL_TARGET_EXPORTS = \
|
||||
$(BASE_TARGET_EXPORTS) \
|
||||
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
||||
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
||||
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
||||
|
||||
# Where to find GMP
|
||||
HOST_GMPLIBS = @gmplibs@
|
41
pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
Normal file
41
pkgs/development/compilers/gcc/4.8/no-sys-dirs.patch
Normal file
|
@ -0,0 +1,41 @@
|
|||
diff -ru gcc-4.3.1-orig/gcc/cppdefault.c gcc-4.3.1/gcc/cppdefault.c
|
||||
--- gcc-4.3.1-orig/gcc/cppdefault.c 2007-07-26 10:37:01.000000000 +0200
|
||||
+++ gcc-4.3.1/gcc/cppdefault.c 2008-06-25 17:48:23.000000000 +0200
|
||||
@@ -41,6 +41,10 @@
|
||||
# undef CROSS_INCLUDE_DIR
|
||||
#endif
|
||||
|
||||
+#undef LOCAL_INCLUDE_DIR
|
||||
+#undef SYSTEM_INCLUDE_DIR
|
||||
+#undef STANDARD_INCLUDE_DIR
|
||||
+
|
||||
const struct default_include cpp_include_defaults[]
|
||||
#ifdef INCLUDE_DEFAULTS
|
||||
= INCLUDE_DEFAULTS;
|
||||
diff -ru gcc-4.3.1-orig/gcc/gcc.c gcc-4.3.1/gcc/gcc.c
|
||||
--- gcc-4.3.1-orig/gcc/gcc.c 2008-03-02 23:55:19.000000000 +0100
|
||||
+++ gcc-4.3.1/gcc/gcc.c 2008-06-25 17:52:53.000000000 +0200
|
||||
@@ -1478,10 +1478,10 @@
|
||||
/* Default prefixes to attach to command names. */
|
||||
|
||||
#ifndef STANDARD_STARTFILE_PREFIX_1
|
||||
-#define STANDARD_STARTFILE_PREFIX_1 "/lib/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_1 ""
|
||||
#endif
|
||||
#ifndef STANDARD_STARTFILE_PREFIX_2
|
||||
-#define STANDARD_STARTFILE_PREFIX_2 "/usr/lib/"
|
||||
+#define STANDARD_STARTFILE_PREFIX_2 ""
|
||||
#endif
|
||||
|
||||
#ifdef CROSS_DIRECTORY_STRUCTURE /* Don't use these prefixes for a cross compiler. */
|
||||
--- gcc-4.3.1-orig/gcc/Makefile.in 2008-05-11 20:54:15.000000000 +0200
|
||||
+++ gcc-4.3.1/gcc/Makefile.in 2008-06-25 17:48:23.000000000 +0200
|
||||
@@ -3277,7 +3281,7 @@
|
||||
-DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
|
||||
-DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
|
||||
-DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
|
||||
- -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
|
||||
+ -DLOCAL_INCLUDE_DIR=\"/no-such-dir\" \
|
||||
-DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
|
||||
-DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
|
||||
-DPREFIX=\"$(prefix)/\" \
|
|
@ -2237,6 +2237,32 @@ let
|
|||
binutilsCross = null;
|
||||
}));
|
||||
|
||||
gcc48_real = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 {
|
||||
inherit noSysDirs;
|
||||
# I'm not sure if profiling with enableParallelBuilding helps a lot.
|
||||
# We can enable it back some day. This makes the *gcc* builds faster now.
|
||||
profiledCompiler = false;
|
||||
|
||||
# When building `gcc.crossDrv' (a "Canadian cross", with host == target
|
||||
# and host != build), `cross' must be null but the cross-libc must still
|
||||
# be passed.
|
||||
cross = null;
|
||||
libcCross = if crossSystem != null then libcCross else null;
|
||||
libpthreadCross =
|
||||
if crossSystem != null && crossSystem.config == "i586-pc-gnu"
|
||||
then gnu.libpthreadCross
|
||||
else null;
|
||||
}));
|
||||
|
||||
gcc48_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.8 {
|
||||
stripped = false;
|
||||
|
||||
inherit noSysDirs;
|
||||
cross = null;
|
||||
libcCross = null;
|
||||
binutilsCross = null;
|
||||
}));
|
||||
|
||||
gccApple =
|
||||
assert stdenv.isDarwin;
|
||||
wrapGCC (makeOverridable (import ../development/compilers/gcc/4.2-apple64) {
|
||||
|
|
Loading…
Reference in a new issue