From e83fe5ee786fa753803d5af7d0151bb08796c504 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 26 Aug 2003 15:25:26 +0000 Subject: [PATCH] * 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 --- pkgs/gcc/gcc-build.sh | 23 ++++++++++++++++++++++- pkgs/gcc/gcc.fix | 1 + pkgs/linux-headers/linux-headers-build.sh | 11 +++++++++++ pkgs/linux-headers/linux-headers.fix | 13 +++++++++++++ pkgs/stdenv-linux/setup.sh | 2 +- pkgs/stdenv-linux/stdenv-build.sh | 1 + pkgs/stdenv-linux/stdenv.fix | 5 +++-- 7 files changed, 52 insertions(+), 4 deletions(-) create mode 100755 pkgs/linux-headers/linux-headers-build.sh create mode 100644 pkgs/linux-headers/linux-headers.fix diff --git a/pkgs/gcc/gcc-build.sh b/pkgs/gcc/gcc-build.sh index f0300f833b9..a6b8d87eadc 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 < $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 57df705dd0c..1dc57e2211d 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 00000000000..acacaa6a388 --- /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 00000000000..baf7c1de658 --- /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 1e7c8b4d2a5..aa195830c53 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 fdcd95a96fa..c73f08ea6ce 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 4b8aa94314b..eea9541c5e2 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")) ] )