* gcc-wrapper: use the right dynamic linker when -m32 is used.

* An attribute `stdenv_32bit' that returns a stdenv capable of
  building 32-bit binaries.
* grub: build on x86_64-linux.

svn path=/nixpkgs/trunk/; revision=12211
This commit is contained in:
Eelco Dolstra 2008-06-29 16:13:02 +00:00
parent 66b3c35d9c
commit 7d1ba0ace0
5 changed files with 37 additions and 24 deletions

View File

@ -9,6 +9,10 @@ if test -z "$nativeLibc"; then
dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker
if test -e $libc/lib/32/ld-linux.so.2; then
echo $libc/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
fi
# The "-B$libc/lib/" flag is a quick hack to force gcc to link
# against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure'

View File

@ -32,6 +32,10 @@ for i in "$@"; do
dontLink=1
elif test "${i:0:1}" != "-"; then
nonFlagArgs=1
elif test "$i" = "-m32"; then
if test -e @out@/nix-support/dynamic-linker-m32; then
NIX_LDFLAGS="$NIX_LDFLAGS -dynamic-linker $(cat @out@/nix-support/dynamic-linker-m32)"
fi
fi
done

View File

@ -1,9 +1,5 @@
{stdenv, fetchurl, autoconf, automake}:
if stdenv.system == "x86_64-linux" then
abort "Grub doesn't build on x86_64-linux. You should use the build for i686-linux instead."
else
stdenv.mkDerivation {
name = "grub-0.97-patch-1.7";

View File

@ -267,6 +267,15 @@ let pkgs = rec {
}
else defaultStdenv;
# A stdenv capable of building 32-bit binaries. On x86_64-linux,
# it uses GCC compiled with multilib support; on i686-linux, it's
# just the plain stdenv.
stdenv_32bit =
if system == "x86_64-linux" then
overrideGCC stdenv gcc43multi
else
stdenv;
### BUILD SUPPORT
@ -677,12 +686,9 @@ let pkgs = rec {
inherit fetchurl stdenv;
};
grub =
if system == "x86_64-linux" then
(import ./all-packages.nix {system = "i686-linux";}).grub
else
import ../tools/misc/grub {
inherit fetchurl stdenv autoconf automake;
grub = import ../tools/misc/grub {
inherit fetchurl autoconf automake;
stdenv = stdenv_32bit;
};
gssdp = import ../development/libraries/gssdp {
@ -2346,7 +2352,8 @@ let pkgs = rec {
});
aterm242fixes = import ../development/libraries/aterm/2.4.2-fixes.nix {
inherit fetchurl stdenv;
inherit fetchurl;
stdenv = overrideGCC stdenv gcc43multi;
};
aterm23x = import ../development/libraries/aterm/2.3.nix {

View File

@ -54,6 +54,7 @@ let
gawk
gcc
gcc34
gcc43
gdb
ghc
ghostscript
@ -66,6 +67,7 @@ let
gnutar
gqview
graphviz
grub
gzip
hal
hello
@ -209,7 +211,6 @@ let
batik
ecj
eclipsesdk
grub
jakartaregexp
jdkPlugin
jetty
@ -243,6 +244,7 @@ let
emacs
firefox
gcc
gcc43multi
hello
libtool
nixUnstable