* GCC 2.95.3 (required to build some "old" stuff).
svn path=/nixpkgs/trunk/; revision=1213
This commit is contained in:
parent
f4e18e486d
commit
ffdc517c33
73
pkgs/development/compilers/gcc-2.95/builder.sh
Normal file
73
pkgs/development/compilers/gcc-2.95/builder.sh
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
. $stdenv/setup
|
||||||
|
|
||||||
|
|
||||||
|
export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy
|
||||||
|
mkdir $NIX_FIXINC_DUMMY
|
||||||
|
|
||||||
|
|
||||||
|
if test "$noSysDirs" = "1"; then
|
||||||
|
|
||||||
|
if test "$noSysDirs" = "1"; then
|
||||||
|
# Figure out what extra flags to pass to the gcc compilers
|
||||||
|
# being generated to make sure that they use our glibc.
|
||||||
|
if test -e $NIX_GCC/nix-support/orig-glibc; then
|
||||||
|
glibc=$(cat $NIX_GCC/nix-support/orig-glibc)
|
||||||
|
# Ugh. Copied from gcc-wrapper/builder.sh. We can't just
|
||||||
|
# source in $NIX_GCC/nix-support/add-flags, since that
|
||||||
|
# would cause *this* GCC to be linked against the
|
||||||
|
# *previous* GCC. Need some more modularity there.
|
||||||
|
extraCFlags="-B$glibc/lib -isystem $glibc/include"
|
||||||
|
extraLDFlags="-B$glibc/lib -L$glibc/lib -Wl,-s \
|
||||||
|
-Wl,-dynamic-linker,$glibc/lib/ld-linux.so.2"
|
||||||
|
|
||||||
|
# Oh, what a hack. I should be shot for this.
|
||||||
|
# In stage 1, we should link against the previous GCC, but
|
||||||
|
# not afterwards. Otherwise we retain a dependency.
|
||||||
|
# However, ld-wrapper, which adds the linker flags for the
|
||||||
|
# previous GCC, is also used in stage 2/3. We can prevent
|
||||||
|
# it from adding them by NIX_GLIBC_FLAGS_SET, but then
|
||||||
|
# gcc-wrapper will also not add them, thereby causing
|
||||||
|
# stage 1 to fail. So we use a trick to only set the
|
||||||
|
# flags in gcc-wrapper.
|
||||||
|
hook=$(pwd)/ld-wrapper-hook
|
||||||
|
echo "NIX_GLIBC_FLAGS_SET=1" > $hook
|
||||||
|
export NIX_LD_WRAPPER_START_HOOK=$hook
|
||||||
|
fi
|
||||||
|
|
||||||
|
export NIX_EXTRA_CFLAGS=$extraCFlags
|
||||||
|
export NIX_EXTRA_LDFLAGS=$extraLDFlags
|
||||||
|
export CFLAGS=$extraCFlags
|
||||||
|
export CXXFLAGS=$extraCFlags
|
||||||
|
export LDFLAGS=$extraLDFlags
|
||||||
|
export BOOT_LDFLAGS=$extraLDFlags
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
patches=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
preConfigure=preConfigure
|
||||||
|
preConfigure() {
|
||||||
|
|
||||||
|
# Determine the frontends to build.
|
||||||
|
langs="c"
|
||||||
|
if test -n "$langCC"; then
|
||||||
|
langs="$langs,c++"
|
||||||
|
fi
|
||||||
|
if test -n "$langF77"; then
|
||||||
|
langs="$langs,f77"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Perform the build in a different directory.
|
||||||
|
mkdir ../build
|
||||||
|
cd ../build
|
||||||
|
|
||||||
|
configureScript=../$sourceRoot/configure
|
||||||
|
configureFlags="--enable-languages=$langs"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
makeFlags="bootstrap"
|
||||||
|
|
||||||
|
genericBuild
|
18
pkgs/development/compilers/gcc-2.95/default.nix
Normal file
18
pkgs/development/compilers/gcc-2.95/default.nix
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{ stdenv, fetchurl, patch, noSysDirs
|
||||||
|
, langC ? true, langCC ? true, langF77 ? false
|
||||||
|
}:
|
||||||
|
|
||||||
|
assert langC;
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "gcc-2.95.3";
|
||||||
|
builder = ./builder.sh;
|
||||||
|
src = fetchurl {
|
||||||
|
url = ftp://ftp.gnu.org/pub/gnu/gcc/gcc-2.95.3.tar.gz;
|
||||||
|
md5 = "f3ad4f32c2296fad758ed051b5ac8e28";
|
||||||
|
};
|
||||||
|
# !!! apply only if noSysDirs is set
|
||||||
|
patches = [./no-sys-dirs.patch];
|
||||||
|
buildInputs = [patch];
|
||||||
|
inherit noSysDirs langC langCC langF77;
|
||||||
|
}
|
231
pkgs/development/compilers/gcc-2.95/no-sys-dirs.patch
Normal file
231
pkgs/development/compilers/gcc-2.95/no-sys-dirs.patch
Normal file
@ -0,0 +1,231 @@
|
|||||||
|
diff -rc gcc-orig/config.if gcc-2.95.3/config.if
|
||||||
|
*** gcc-orig/config.if 1998-10-18 19:37:10.000000000 +0200
|
||||||
|
--- gcc-2.95.3/config.if 2004-08-03 12:29:32.000000000 +0200
|
||||||
|
***************
|
||||||
|
*** 64,70 ****
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
! ${CC-cc} $dummy.c -o $dummy 2>/dev/null
|
||||||
|
if [ "$?" = 0 ]
|
||||||
|
then
|
||||||
|
libc_interface=-libc6.`./$dummy`-
|
||||||
|
--- 64,70 ----
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
! ${CC-cc} $NIX_EXTRA_CFLAGS $NIX_EXTRA_LDFLAGS $dummy.c -o $dummy 2>/dev/null
|
||||||
|
if [ "$?" = 0 ]
|
||||||
|
then
|
||||||
|
libc_interface=-libc6.`./$dummy`-
|
||||||
|
diff -rc gcc-orig/gcc/cccp.c gcc-2.95.3/gcc/cccp.c
|
||||||
|
*** gcc-orig/gcc/cccp.c 2001-01-25 15:03:00.000000000 +0100
|
||||||
|
--- gcc-2.95.3/gcc/cccp.c 2004-08-03 10:54:39.000000000 +0200
|
||||||
|
***************
|
||||||
|
*** 373,378 ****
|
||||||
|
--- 373,382 ----
|
||||||
|
char fname[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
+ #undef LOCAL_INCLUDE_DIR
|
||||||
|
+ #undef SYSTEM_INCLUDE_DIR
|
||||||
|
+ #undef STANDARD_INCLUDE_DIR
|
||||||
|
+
|
||||||
|
/* #include "file" looks in source file dir, then stack. */
|
||||||
|
/* #include <file> just looks in the stack. */
|
||||||
|
/* -I directories are added to the end, then the defaults are added. */
|
||||||
|
***************
|
||||||
|
*** 424,430 ****
|
||||||
|
--- 428,436 ----
|
||||||
|
#ifndef STANDARD_INCLUDE_COMPONENT
|
||||||
|
#define STANDARD_INCLUDE_COMPONENT 0
|
||||||
|
#endif
|
||||||
|
+ #ifdef STANDARD_INCLUDE_DIR
|
||||||
|
{ STANDARD_INCLUDE_DIR, STANDARD_INCLUDE_COMPONENT, 0, 0, 0 },
|
||||||
|
+ #endif
|
||||||
|
#endif /* not CROSS_COMPILE */
|
||||||
|
{ 0, 0, 0, 0, 0 }
|
||||||
|
};
|
||||||
|
diff -rc gcc-orig/gcc/gcc.c gcc-2.95.3/gcc/gcc.c
|
||||||
|
*** gcc-orig/gcc/gcc.c 2001-01-25 15:03:16.000000000 +0100
|
||||||
|
--- gcc-2.95.3/gcc/gcc.c 2004-08-03 11:48:09.000000000 +0200
|
||||||
|
***************
|
||||||
|
*** 1369,1388 ****
|
||||||
|
#undef MD_STARTFILE_PREFIX_1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- #ifndef STANDARD_EXEC_PREFIX
|
||||||
|
- #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
|
||||||
|
- #endif /* !defined STANDARD_EXEC_PREFIX */
|
||||||
|
-
|
||||||
|
static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
|
||||||
|
- static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
|
||||||
|
#ifdef MD_EXEC_PREFIX
|
||||||
|
static const char *md_exec_prefix = MD_EXEC_PREFIX;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- #ifndef STANDARD_STARTFILE_PREFIX
|
||||||
|
- #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
|
||||||
|
- #endif /* !defined STANDARD_STARTFILE_PREFIX */
|
||||||
|
-
|
||||||
|
#ifdef MD_STARTFILE_PREFIX
|
||||||
|
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
|
||||||
|
#endif
|
||||||
|
--- 1369,1379 ----
|
||||||
|
***************
|
||||||
|
*** 1390,1401 ****
|
||||||
|
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
|
||||||
|
#endif
|
||||||
|
static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
|
||||||
|
- static const char *standard_startfile_prefix_1 = "/lib/";
|
||||||
|
- static const char *standard_startfile_prefix_2 = "/usr/lib/";
|
||||||
|
|
||||||
|
- #ifndef TOOLDIR_BASE_PREFIX
|
||||||
|
- #define TOOLDIR_BASE_PREFIX "/usr/local/"
|
||||||
|
- #endif
|
||||||
|
static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
|
||||||
|
static const char *tooldir_prefix;
|
||||||
|
|
||||||
|
--- 1381,1387 ----
|
||||||
|
***************
|
||||||
|
*** 2896,2908 ****
|
||||||
|
value = argv[++i];
|
||||||
|
else
|
||||||
|
value = p + 1;
|
||||||
|
add_prefix (&exec_prefixes, value, NULL_PTR, 1, 0, &warn_B);
|
||||||
|
add_prefix (&startfile_prefixes, value, NULL_PTR,
|
||||||
|
1, 0, &warn_B);
|
||||||
|
add_prefix (&include_prefixes, concat (value, "include",
|
||||||
|
NULL_PTR),
|
||||||
|
NULL_PTR, 1, 0, NULL_PTR);
|
||||||
|
!
|
||||||
|
/* As a kludge, if the arg is "[foo/]stageN/", just add
|
||||||
|
"[foo/]include" to the include prefix. */
|
||||||
|
{
|
||||||
|
--- 2882,2897 ----
|
||||||
|
value = argv[++i];
|
||||||
|
else
|
||||||
|
value = p + 1;
|
||||||
|
+ if (strlen(value) > 0 && value[strlen(value) - 1] != '/')
|
||||||
|
+ value = concat (value, "/", NULL_PTR);
|
||||||
|
+ add_prefix (&startfile_prefixes, value, "BINUTILS", 0, 0, NULL_PTR);
|
||||||
|
add_prefix (&exec_prefixes, value, NULL_PTR, 1, 0, &warn_B);
|
||||||
|
add_prefix (&startfile_prefixes, value, NULL_PTR,
|
||||||
|
1, 0, &warn_B);
|
||||||
|
add_prefix (&include_prefixes, concat (value, "include",
|
||||||
|
NULL_PTR),
|
||||||
|
NULL_PTR, 1, 0, NULL_PTR);
|
||||||
|
!
|
||||||
|
/* As a kludge, if the arg is "[foo/]stageN/", just add
|
||||||
|
"[foo/]include" to the include prefix. */
|
||||||
|
{
|
||||||
|
***************
|
||||||
|
*** 3060,3073 ****
|
||||||
|
#ifndef OS2
|
||||||
|
add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
|
||||||
|
0, 2, warn_std_ptr);
|
||||||
|
- add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
|
||||||
|
- 0, 2, warn_std_ptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
|
||||||
|
0, 1, warn_std_ptr);
|
||||||
|
- add_prefix (&startfile_prefixes, standard_exec_prefix_1, "BINUTILS",
|
||||||
|
- 0, 1, warn_std_ptr);
|
||||||
|
|
||||||
|
tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
|
||||||
|
dir_separator_str, NULL_PTR);
|
||||||
|
--- 3049,3058 ----
|
||||||
|
***************
|
||||||
|
*** 4865,4874 ****
|
||||||
|
NULL_PTR, 0, 0, NULL_PTR);
|
||||||
|
}
|
||||||
|
|
||||||
|
- add_prefix (&startfile_prefixes, standard_startfile_prefix_1,
|
||||||
|
- "BINUTILS", 0, 0, NULL_PTR);
|
||||||
|
- add_prefix (&startfile_prefixes, standard_startfile_prefix_2,
|
||||||
|
- "BINUTILS", 0, 0, NULL_PTR);
|
||||||
|
#if 0 /* Can cause surprises, and one can use -B./ instead. */
|
||||||
|
add_prefix (&startfile_prefixes, "./", NULL_PTR, 0, 1, NULL_PTR);
|
||||||
|
#endif
|
||||||
|
--- 4850,4855 ----
|
||||||
|
diff -rc gcc-orig/gcc/Makefile.in gcc-2.95.3/gcc/Makefile.in
|
||||||
|
*** gcc-orig/gcc/Makefile.in 2001-01-25 15:02:58.000000000 +0100
|
||||||
|
--- gcc-2.95.3/gcc/Makefile.in 2004-08-03 12:24:39.000000000 +0200
|
||||||
|
***************
|
||||||
|
*** 74,80 ****
|
||||||
|
BOOT_CFLAGS = -O2 $(CFLAGS)
|
||||||
|
#WARN_CFLAGS = -W -Wall
|
||||||
|
# These exists to be overridden by the x-* and t-* files, respectively.
|
||||||
|
! X_CFLAGS =
|
||||||
|
T_CFLAGS =
|
||||||
|
|
||||||
|
X_CPPFLAGS =
|
||||||
|
--- 74,80 ----
|
||||||
|
BOOT_CFLAGS = -O2 $(CFLAGS)
|
||||||
|
#WARN_CFLAGS = -W -Wall
|
||||||
|
# These exists to be overridden by the x-* and t-* files, respectively.
|
||||||
|
! X_CFLAGS = $(NIX_EXTRA_CFLAGS) $(NIX_EXTRA_LDFLAGS)
|
||||||
|
T_CFLAGS =
|
||||||
|
|
||||||
|
X_CPPFLAGS =
|
||||||
|
***************
|
||||||
|
*** 218,224 ****
|
||||||
|
&& [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
|
||||||
|
|
||||||
|
# Dir to search for system headers. Overridden by cross-make.
|
||||||
|
! SYSTEM_HEADER_DIR = /usr/include
|
||||||
|
|
||||||
|
# Control whether to run fixproto.
|
||||||
|
STMP_FIXPROTO = stmp-fixproto
|
||||||
|
--- 218,228 ----
|
||||||
|
&& [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
|
||||||
|
|
||||||
|
# Dir to search for system headers. Overridden by cross-make.
|
||||||
|
! # Nix: we override NATIVE_SYSTEM_HEADER_DIR in order to prevent
|
||||||
|
! # `fixinc' from fixing header files in /usr/include. However,
|
||||||
|
! # NATIVE_SYSTEM_HEADER_DIR must point to an existing directory, so set
|
||||||
|
! # it to some dummy directory.
|
||||||
|
! SYSTEM_HEADER_DIR = $(NIX_FIXINC_DUMMY)
|
||||||
|
|
||||||
|
# Control whether to run fixproto.
|
||||||
|
STMP_FIXPROTO = stmp-fixproto
|
||||||
|
diff -rc gcc-orig/Makefile.in gcc-2.95.3/Makefile.in
|
||||||
|
*** gcc-orig/Makefile.in 1999-06-23 00:44:42.000000000 +0200
|
||||||
|
--- gcc-2.95.3/Makefile.in 2004-08-03 10:46:42.000000000 +0200
|
||||||
|
***************
|
||||||
|
*** 87,94 ****
|
||||||
|
CXXFLAGS = -g -O2
|
||||||
|
|
||||||
|
LIBCFLAGS = $(CFLAGS)
|
||||||
|
! CFLAGS_FOR_TARGET = $(CFLAGS)
|
||||||
|
! LDFLAGS_FOR_TARGET =
|
||||||
|
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
|
||||||
|
PICFLAG =
|
||||||
|
PICFLAG_FOR_TARGET =
|
||||||
|
--- 87,94 ----
|
||||||
|
CXXFLAGS = -g -O2
|
||||||
|
|
||||||
|
LIBCFLAGS = $(CFLAGS)
|
||||||
|
! CFLAGS_FOR_TARGET = $(CFLAGS) $(NIX_EXTRA_CFLAGS)
|
||||||
|
! LDFLAGS_FOR_TARGET = $(NIX_EXTRA_LDFLAGS)
|
||||||
|
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
|
||||||
|
PICFLAG =
|
||||||
|
PICFLAG_FOR_TARGET =
|
||||||
|
***************
|
||||||
|
*** 99,105 ****
|
||||||
|
|
||||||
|
# Use -O2 to stress test the compiler.
|
||||||
|
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||||
|
! CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
|
||||||
|
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
|
||||||
|
|
||||||
|
RANLIB = ranlib
|
||||||
|
--- 99,105 ----
|
||||||
|
|
||||||
|
# Use -O2 to stress test the compiler.
|
||||||
|
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||||
|
! CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(NIX_EXTRA_CFLAGS)
|
||||||
|
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
|
||||||
|
|
||||||
|
RANLIB = ranlib
|
@ -234,6 +234,18 @@ rec {
|
|||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gcc295 = (import ../build-support/gcc-wrapper) {
|
||||||
|
nativeTools = false;
|
||||||
|
nativeGlibc = false;
|
||||||
|
gcc = (import ../development/compilers/gcc-2.95) {
|
||||||
|
inherit fetchurl stdenv noSysDirs;
|
||||||
|
patch = gnupatch;
|
||||||
|
};
|
||||||
|
binutils = stdenv.gcc.binutils;
|
||||||
|
glibc = stdenv.gcc.glibc;
|
||||||
|
inherit stdenv;
|
||||||
|
};
|
||||||
|
|
||||||
g77 = (import ../build-support/gcc-wrapper) {
|
g77 = (import ../build-support/gcc-wrapper) {
|
||||||
name = "g77";
|
name = "g77";
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user