* 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" dynamicLinker="$libc/lib/$dynamicLinker"
echo $dynamicLinker > $out/nix-support/dynamic-linker 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 # 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 # against the crt1.o from our own glibc, rather than the one in
# /usr/lib. (This is only an issue when using an `impure' # /usr/lib. (This is only an issue when using an `impure'

View File

@ -32,6 +32,10 @@ for i in "$@"; do
dontLink=1 dontLink=1
elif test "${i:0:1}" != "-"; then elif test "${i:0:1}" != "-"; then
nonFlagArgs=1 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 fi
done done

View File

@ -1,9 +1,5 @@
{stdenv, fetchurl, autoconf, automake}: {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 { stdenv.mkDerivation {
name = "grub-0.97-patch-1.7"; name = "grub-0.97-patch-1.7";

View File

@ -267,6 +267,15 @@ let pkgs = rec {
} }
else defaultStdenv; 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 ### BUILD SUPPORT
@ -677,19 +686,16 @@ let pkgs = rec {
inherit fetchurl stdenv; inherit fetchurl stdenv;
}; };
grub = grub = import ../tools/misc/grub {
if system == "x86_64-linux" then inherit fetchurl autoconf automake;
(import ./all-packages.nix {system = "i686-linux";}).grub stdenv = stdenv_32bit;
else };
import ../tools/misc/grub {
inherit fetchurl stdenv autoconf automake;
};
gssdp = import ../development/libraries/gssdp { gssdp = import ../development/libraries/gssdp {
inherit fetchurl stdenv pkgconfig libxml2; inherit fetchurl stdenv pkgconfig libxml2;
inherit (gtkLibs) glib; inherit (gtkLibs) glib;
inherit (gnome) libsoup; inherit (gnome) libsoup;
}; };
gtkgnutella = import ../tools/networking/p2p/gtk-gnutella { gtkgnutella = import ../tools/networking/p2p/gtk-gnutella {
inherit fetchurl stdenv pkgconfig libxml2; inherit fetchurl stdenv pkgconfig libxml2;
@ -697,15 +703,15 @@ let pkgs = rec {
}; };
gupnp = import ../development/libraries/gupnp { gupnp = import ../development/libraries/gupnp {
inherit fetchurl stdenv pkgconfig libxml2 gssdp e2fsprogs; inherit fetchurl stdenv pkgconfig libxml2 gssdp e2fsprogs;
inherit (gtkLibs) glib; inherit (gtkLibs) glib;
inherit (gnome) libsoup; inherit (gnome) libsoup;
}; };
gupnptools = import ../tools/networking/gupnp-tools { gupnptools = import ../tools/networking/gupnp-tools {
inherit fetchurl stdenv gssdp gupnp pkgconfig libxml2 e2fsprogs; inherit fetchurl stdenv gssdp gupnp pkgconfig libxml2 e2fsprogs;
inherit (gtkLibs) gtk glib; inherit (gtkLibs) gtk glib;
inherit (gnome) libsoup libglade gnomeicontheme; inherit (gnome) libsoup libglade gnomeicontheme;
}; };
gzip = useFromStdenv "gzip" gzip = useFromStdenv "gzip"
@ -2346,7 +2352,8 @@ let pkgs = rec {
}); });
aterm242fixes = import ../development/libraries/aterm/2.4.2-fixes.nix { 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 { aterm23x = import ../development/libraries/aterm/2.3.nix {

View File

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