about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2003-08-26 15:25:26 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2003-08-26 15:25:26 +0000
commite83fe5ee786fa753803d5af7d0151bb08796c504 (patch)
tree0a0c54dc2192993b832b046b127399c3ac4a91b0 /pkgs
parent3638af3cab98d5cd6a2e485d31d6e5d7c7bbe6e5 (diff)
* Patched gcc so that it doesn't search the standard include directories
  (/usr/include, /usr/local/include, etc.).

* Immediate pay-off: we see that the glibc header files depend on the Linux
  kernel header files.  So I've added a package that extracts the appropriate
  headers from Linux 2.4.22.

svn path=/nixpkgs/trunk/; revision=361
Diffstat (limited to 'pkgs')
-rwxr-xr-xpkgs/gcc/gcc-build.sh23
-rw-r--r--pkgs/gcc/gcc.fix1
-rwxr-xr-xpkgs/linux-headers/linux-headers-build.sh11
-rw-r--r--pkgs/linux-headers/linux-headers.fix13
-rw-r--r--pkgs/stdenv-linux/setup.sh2
-rwxr-xr-xpkgs/stdenv-linux/stdenv-build.sh1
-rw-r--r--pkgs/stdenv-linux/stdenv.fix5
7 files changed, 52 insertions, 4 deletions
diff --git a/pkgs/gcc/gcc-build.sh b/pkgs/gcc/gcc-build.sh
index f0300f833b9c4..a6b8d87eadc3f 100755
--- a/pkgs/gcc/gcc-build.sh
+++ b/pkgs/gcc/gcc-build.sh
@@ -4,11 +4,23 @@
 export PATH=$binutils/bin:$PATH
 
 tar xvfj $src || exit 1
+
+# Disable the standard include directories.
+cd gcc-* || exit 1
+cat >> ./gcc/cppdefault.h <<EOF
+#undef LOCAL_INCLUDE_DIR
+#undef SYSTEM_INCLUDE_DIR
+#undef STANDARD_INCLUDE_DIR
+EOF
+cd .. || exit 1
+
+# Configure.
 mkdir build || exit 1
 cd build || exit 1
 ../gcc-*/configure --prefix=$out --enable-languages=c,c++ || exit 1
 
-extraflags="$NIX_CFLAGS $NIX_LDFLAGS -Wl,-s"
+# Patch some of the makefiles to force linking against our own glibc.
+extraflags="$NIX_CFLAGS $NIX_LDFLAGS -Wl,-s -isystem $linux/include"
 
 mf=Makefile
 sed \
@@ -22,5 +34,14 @@ sed \
  < $mf > $mf.tmp || exit 1
 mv $mf.tmp $mf
 
+# Patch gcc/Makefile to prevent fixinc.sh from "fixing" system header files
+# from /usr/include.
+mf=gcc/Makefile
+sed \
+ -e "s^NATIVE_SYSTEM_HEADER_DIR =\(.*\)^NATIVE_SYSTEM_HEADER_DIR = /fixinc-disabled^" \
+ < $mf > $mf.tmp || exit 1
+mv $mf.tmp $mf
+
+# Build and install.
 make bootstrap || exit 1
 make install || exit 1
diff --git a/pkgs/gcc/gcc.fix b/pkgs/gcc/gcc.fix
index 57df705dd0c68..1dc57e2211dcb 100644
--- a/pkgs/gcc/gcc.fix
+++ b/pkgs/gcc/gcc.fix
@@ -10,5 +10,6 @@ Package(
 
   , ("stdenv", IncludeFix("stdenv-linux/stdenv-nativetools.fix"))
   , ("binutils", IncludeFix("binutils/binutils.fix"))
+  , ("linux", IncludeFix("linux-headers/linux-headers.fix"))
   ]
 )
diff --git a/pkgs/linux-headers/linux-headers-build.sh b/pkgs/linux-headers/linux-headers-build.sh
new file mode 100755
index 0000000000000..acacaa6a3889e
--- /dev/null
+++ b/pkgs/linux-headers/linux-headers-build.sh
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+. $stdenv/setup || exit 1
+
+mkdir $out || exit 1
+cd $out || exit 1
+tar xvfj $src 'linux-*/include/linux' 'linux-*/include/asm-i386' || exit 1
+mv linux-*/include . || exit 1
+rmdir linux-* || exit 1
+cd include || exit 1
+ln -s asm-i386 asm || exit 1
diff --git a/pkgs/linux-headers/linux-headers.fix b/pkgs/linux-headers/linux-headers.fix
new file mode 100644
index 0000000000000..baf7c1de65858
--- /dev/null
+++ b/pkgs/linux-headers/linux-headers.fix
@@ -0,0 +1,13 @@
+Package(
+  [ ("name", "linux-headers-2.4.22-i386")
+
+  , ("build", Relative("linux-headers/linux-headers-build.sh"))
+
+  , ("src", Call(IncludeFix("fetchurl/fetchurl.fix"),
+      [ ("url", "ftp://ftp.nl.kernel.org/pub/linux/kernel/v2.4/linux-2.4.22.tar.bz2")
+      , ("md5", "75dc85149b06ac9432106b8941eb9f7b")
+      ]))
+
+  , ("stdenv", IncludeFix("stdenv-linux/stdenv-nativetools.fix"))
+  ]
+)
diff --git a/pkgs/stdenv-linux/setup.sh b/pkgs/stdenv-linux/setup.sh
index 1e7c8b4d2a56d..aa195830c5337 100644
--- a/pkgs/stdenv-linux/setup.sh
+++ b/pkgs/stdenv-linux/setup.sh
@@ -3,7 +3,7 @@ export SHELL=@SHELL@
 
 . @BASEENV@/setup
 
-export NIX_CFLAGS="-isystem @GLIBC@/include $NIX_CFLAGS"
+export NIX_CFLAGS="-isystem @GLIBC@/include -isystem @LINUX@/include $NIX_CFLAGS"
 export NIX_LDFLAGS="-L@GLIBC@/lib -Wl,-dynamic-linker,@GLIBC@/lib/ld-linux.so.2,-rpath,@GLIBC@/lib $NIX_LDFLAGS -L@GCC@/lib -Wl,-rpath,@GCC@/lib"
 export NIX_CC=@CC@
 export NIX_CXX=@CXX@
diff --git a/pkgs/stdenv-linux/stdenv-build.sh b/pkgs/stdenv-linux/stdenv-build.sh
index fdcd95a96faf4..c73f08ea6ce14 100755
--- a/pkgs/stdenv-linux/stdenv-build.sh
+++ b/pkgs/stdenv-linux/stdenv-build.sh
@@ -23,6 +23,7 @@ echo "########## $p"
 
 sed \
  -e s^@GLIBC\@^$glibc^g \
+ -e s^@LINUX\@^$linux^g \
  -e s^@GCC\@^$gcc^g \
  -e s^@CC\@^$cc^g \
  -e s^@CXX\@^$cxx^g \
diff --git a/pkgs/stdenv-linux/stdenv.fix b/pkgs/stdenv-linux/stdenv.fix
index 4b8aa94314b01..eea9541c5e29c 100644
--- a/pkgs/stdenv-linux/stdenv.fix
+++ b/pkgs/stdenv-linux/stdenv.fix
@@ -5,6 +5,7 @@ Package(
   , ("setup", Relative("stdenv-linux/setup.sh"))
   , ("baseenv", IncludeFix("baseenv/baseenv.fix"))
   , ("glibc", IncludeFix("glibc/glibc.fix"))
+  , ("linux", IncludeFix("linux-headers/linux-headers.fix"))
 
   , ("tools", 
       [ IncludeFix("coreutils/coreutils.fix")
@@ -21,7 +22,7 @@ Package(
       , IncludeFix("bash/bash.fix")
       ])
 
-    , ("gcc", IncludeFix("gcc/gcc.fix"))
-    , ("shell", IncludeFix("bash/bash.fix"))
+  , ("gcc", IncludeFix("gcc/gcc.fix"))
+  , ("shell", IncludeFix("bash/bash.fix"))
   ]
 )