Fixing the gcc-cross-wrapper; it failed after some changes related to breaking

dependencies with it. (I should never link ld.so with a NIX_LDFLAGS -rpath
forced)

I made vim, scummvm cross-build. I added prboom (that cross-builds).
Mplayer and elinks don't cross-build fine still, but are on the way.
The mplayer fails to build in a weird way; nix does not show either a gcc
error message or even the 'make' error message.

svn path=/nixpkgs/branches/stdenv-updates/; revision=23131
This commit is contained in:
Lluís Batlle i Rossell 2010-08-11 20:14:25 +00:00
parent 039b660b5b
commit 51f6aec764
9 changed files with 115 additions and 36 deletions

View File

@ -12,6 +12,21 @@ stdenv.mkDerivation rec {
postInstall = "ln -s $out/bin/vim $out/bin/vi"; postInstall = "ln -s $out/bin/vim $out/bin/vi";
crossAttrs = {
configureFlags = [
"vim_cv_toupper_broken=no"
"--with-tlib=ncurses"
"vim_cv_terminfo=yes"
"vim_cv_tty_group=tty"
"vim_cv_tty_mode=0660"
"vim_cv_getcwd_broken=no"
"vim_cv_stat_ignores_slash=yes"
"ac_cv_sizeof_int=4"
"vim_cv_memmove_handles_overlap=yes"
"STRIP=${stdenv.cross.config}-strip"
];
};
meta = { meta = {
description = "The most popular clone of the VI editor"; description = "The most popular clone of the VI editor";
homepage = http://www.vim.org; homepage = http://www.vim.org;

View File

@ -18,6 +18,16 @@ stdenv.mkDerivation rec {
--enable-nntp --with-openssl=${openssl} --enable-nntp --with-openssl=${openssl}
''; '';
crossAttrs = {
propagatedBuildInputs = [ ncurses.hostDrv zlib.hostDrv openssl.hostDrv ];
configureFlags = ''
--enable-finger --enable-html-highlight
--enable-gopher --enable-cgi --enable-bittorrent --enable-nntp
--with-openssl=${openssl.hostDrv}
--with-bzip2=${bzip2.hostDrv}
'';
};
meta = { meta = {
description = "Full-featured text-mode web browser"; description = "Full-featured text-mode web browser";
homepage = http://elinks.or.cz; homepage = http://elinks.or.cz;

View File

@ -1,10 +1,11 @@
{ alsaSupport ? false, xvSupport ? true, theoraSupport ? false, cacaSupport ? false { alsaSupport ? false, xvSupport ? true, theoraSupport ? false, cacaSupport ? false
, xineramaSupport ? false, randrSupport ? false, dvdnavSupport ? true , xineramaSupport ? false, randrSupport ? false, dvdnavSupport ? true
, stdenv, fetchurl, x11, freetype, fontconfig, zlib , stdenv, fetchurl, x11, freetype, fontconfig, zlib
, alsa ? null, libX11, libXv ? null, libtheora ? null, libcaca ? null , alsa ? null, libXv ? null, libtheora ? null, libcaca ? null
, libXinerama ? null, libXrandr ? null, libdvdnav ? null , libXinerama ? null, libXrandr ? null, libdvdnav ? null
, cdparanoia ? null, cddaSupport ? true , cdparanoia ? null, cddaSupport ? true
, amrnb ? null, amrwb ? null, amrSupport ? false , amrnb ? null, amrwb ? null, amrSupport ? false
, x11Support ? true, libX11 ? null
, jackaudioSupport ? false, jackaudio ? null , jackaudioSupport ? false, jackaudio ? null
, x264Support ? false, x264 ? null , x264Support ? false, x264 ? null
, xvidSupport ? false, xvidcore ? null , xvidSupport ? false, xvidcore ? null
@ -13,11 +14,12 @@
}: }:
assert alsaSupport -> alsa != null; assert alsaSupport -> alsa != null;
assert xvSupport -> libXv != null; assert x11Support -> libX11 != null;
assert xvSupport -> (libXv != null && x11Support);
assert theoraSupport -> libtheora != null; assert theoraSupport -> libtheora != null;
assert cacaSupport -> libcaca != null; assert cacaSupport -> libcaca != null;
assert xineramaSupport -> libXinerama != null; assert xineramaSupport -> (libXinerama != null && x11Support);
assert randrSupport -> libXrandr != null; assert randrSupport -> (libXrandr != null && x11Support);
assert dvdnavSupport -> libdvdnav != null; assert dvdnavSupport -> libdvdnav != null;
assert cddaSupport -> cdparanoia != null; assert cddaSupport -> cdparanoia != null;
assert jackaudioSupport -> jackaudio != null; assert jackaudioSupport -> jackaudio != null;
@ -54,7 +56,8 @@ stdenv.mkDerivation {
}; };
buildInputs = buildInputs =
[ x11 libXv freetype zlib mesa pkgconfig yasm ] [ freetype zlib pkgconfig ]
++ stdenv.lib.optional x11Support [ libX11 mesa ]
++ stdenv.lib.optional alsaSupport alsa ++ stdenv.lib.optional alsaSupport alsa
++ stdenv.lib.optional xvSupport libXv ++ stdenv.lib.optional xvSupport libXv
++ stdenv.lib.optional theoraSupport libtheora ++ stdenv.lib.optional theoraSupport libtheora
@ -69,18 +72,32 @@ stdenv.mkDerivation {
++ stdenv.lib.optional xvidSupport xvidcore ++ stdenv.lib.optional xvidSupport xvidcore
++ stdenv.lib.optional lameSupport lame; ++ stdenv.lib.optional lameSupport lame;
buildNativeInputs = [ yasm ];
configureFlags = '' configureFlags = ''
${if cacaSupport then "--enable-caca" else "--disable-caca"} ${if cacaSupport then "--enable-caca" else "--disable-caca"}
${if dvdnavSupport then "--enable-dvdnav --enable-dvdread --disable-dvdread-internal" else ""} ${if dvdnavSupport then "--enable-dvdnav --enable-dvdread --disable-dvdread-internal" else ""}
${if x264Support then "--enable-x264 --extra-libs=-lx264" else ""} ${if x264Support then "--enable-x264 --extra-libs=-lx264" else ""}
--codecsdir=${codecs} --codecsdir=${codecs}
--enable-runtime-cpudetection --enable-runtime-cpudetection
--enable-x11 ${if x11Support then "--enable-x11" else ""}
--disable-xanim --disable-xanim
--disable-ivtv --disable-ivtv
''; '';
NIX_LDFLAGS = "-lX11 -lXext"; NIX_LDFLAGS = if x11Support then "-lX11 -lXext" else "";
crossAttrs = {
preConfigure = ''
configureFlags="`echo $configureFlags |
sed -e 's/--build[^ ]\+//' \
-e 's/--host[^ ]\+//' \
-e 's/--codecsdir[^ ]\+//' \
-e 's/--enable-runtime-cpudetection//' `"
configureFlags="$configureFlags --target=${stdenv.cross.arch}-linux
--cc=$crossConfig-gcc --as=$crossConfig-as"
'';
};
meta = { meta = {
description = "A movie player that supports many video formats"; description = "A movie player that supports many video formats";

View File

@ -12,9 +12,11 @@ if test -z "$nativeLibc"; then
ldflags="$ldflags -L$libc/lib" ldflags="$ldflags -L$libc/lib"
# Get the proper dynamic linker for glibc and uclibc. # Get the proper dynamic linker for glibc and uclibc.
dlinker=`eval 'echo $libc/lib/ld*.so.?'` dlinker=`eval 'echo $libc/lib/ld*.so.?'`
if [ -n "$dynamicLinker" ]; then if [ -n "$dlinker" ]; then
ldflagsBefore="-dynamic-linker $dlinker" ldflagsBefore="-dynamic-linker $dlinker"
fi
# The same as above, but put into files, useful for the gcc builder.
echo $dlinker > $out/nix-support/dynamic-linker
# This trick is to avoid dependencies on the cross-toolchain gcc # This trick is to avoid dependencies on the cross-toolchain gcc
# for libgcc, libstdc++, ... # for libgcc, libstdc++, ...
# -L is for libtool's .la files, and -rpath for the usual fixupPhase # -L is for libtool's .la files, and -rpath for the usual fixupPhase
@ -22,13 +24,6 @@ if test -z "$nativeLibc"; then
if [ -n "$gccLibs" ]; then if [ -n "$gccLibs" ]; then
ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib" ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib"
fi fi
# The same as above, but put into files, useful for the gcc builder.
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 fi
echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags echo "$cflagsCompile -B$libc/lib/ -idirafter $libc/include -idirafter $gcc/lib/gcc/*/*/include-fixed" > $out/nix-support/libc-cflags

View File

@ -1,8 +1,6 @@
NIX_CROSS_CFLAGS_COMPILE="" NIX_CROSS_CFLAGS_COMPILE=""
NIX_CROSS_LDFLAGS="" NIX_CROSS_LDFLAGS=""
set -x
crossAddCVars () { crossAddCVars () {
if test -d $1/include; then if test -d $1/include; then
export NIX_CROSS_CFLAGS_COMPILE="$NIX_CROSS_CFLAGS_COMPILE -I$1/include" export NIX_CROSS_CFLAGS_COMPILE="$NIX_CROSS_CFLAGS_COMPILE -I$1/include"
@ -70,7 +68,9 @@ if test -n "@libc@"; then
crossAddCVars @libc@ crossAddCVars @libc@
fi fi
configureFlags="$configureFlags --build=$system --host=$crossConfig" if test "$dontSetConfigureCross" != "1"; then
configureFlags="$configureFlags --build=$system --host=$crossConfig"
fi
# Disabling the tests when cross compiling, as usually the tests are meant for # Disabling the tests when cross compiling, as usually the tests are meant for
# native compilations. # native compilations.
doCheck="" doCheck=""
@ -82,5 +82,3 @@ if test "$NIX_NO_SELF_RPATH" != "1"; then
export NIX_CROSS_LDFLAGS="-rpath $out/lib64 -rpath-link $out/lib $NIX_CROSS_LDFLAGS" export NIX_CROSS_LDFLAGS="-rpath $out/lib64 -rpath-link $out/lib $NIX_CROSS_LDFLAGS"
fi fi
fi fi
set +x

View File

@ -1,6 +1,7 @@
{ stdenv, fetchurl, x11, libXrandr, pkgconfig { stdenv, fetchurl, pkgconfig
, openglSupport ? false, mesa ? null , openglSupport ? false, mesa ? null
, alsaSupport ? true, alsaLib ? null , alsaSupport ? true, alsaLib ? null
, x11Support ? true, x11 ? null, libXrandr ? null
, pulseaudioSupport ? true, pulseaudio ? null , pulseaudioSupport ? true, pulseaudio ? null
}: }:
@ -8,10 +9,18 @@
# PulseAudio. # PulseAudio.
assert alsaSupport || pulseaudioSupport; assert alsaSupport || pulseaudioSupport;
assert openglSupport -> mesa != null; assert openglSupport -> (mesa != null && x11Support);
assert x11Support -> (x11 != null && libXrandr != null);
assert alsaSupport -> alsaLib != null; assert alsaSupport -> alsaLib != null;
assert pulseaudioSupport -> pulseaudio != null; assert pulseaudioSupport -> pulseaudio != null;
let
configureFlagsFun = attrs: ''
--disable-oss
--disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
'';
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "SDL-1.2.14"; name = "SDL-1.2.14";
@ -21,7 +30,7 @@ stdenv.mkDerivation rec {
}; };
# Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated. # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
propagatedBuildInputs = [ x11 libXrandr ] ++ propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
stdenv.lib.optional pulseaudioSupport pulseaudio; stdenv.lib.optional pulseaudioSupport pulseaudio;
buildInputs = [ pkgconfig ] ++ buildInputs = [ pkgconfig ] ++
@ -31,11 +40,11 @@ stdenv.mkDerivation rec {
# XXX: By default, SDL wants to dlopen() PulseAudio, in which case # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
# we must arrange to add it to its RPATH; however, `patchelf' seems # we must arrange to add it to its RPATH; however, `patchelf' seems
# to fail at doing this, hence `--disable-pulseaudio-shared'. # to fail at doing this, hence `--disable-pulseaudio-shared'.
configureFlags = '' configureFlags = configureFlagsFun { inherit alsaLib; };
--disable-oss
--disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared crossAttrs = {
${if alsaSupport then "--with-alsa-prefix=${alsaLib}/lib" else ""} configureFlags = configureFlagsFun { alsaLib = alsaLib.hostDrv; };
''; };
passthru = {inherit openglSupport;}; passthru = {inherit openglSupport;};

View File

@ -0,0 +1,20 @@
{stdenv, fetchurl, SDL, SDL_mixer, SDL_net, mesa}:
stdenv.mkDerivation {
name = "prboom-2.5.0";
src = fetchurl {
url = mirror://sourceforge/prboom/prboom-2.5.0.tar.gz;
sha256 = "1bjb04q8dk232956k30qlpq6q0hxb904yh1nflr87jcc1x3iqv12";
};
buildInputs = [ SDL SDL_mixer SDL_net mesa ];
crossAttrs = {
propagatedBuildInputs = [ SDL.hostDrv SDL_mixer.hostDrv SDL_net.hostDrv ];
configureFlags = "--disable-gl --disable-cpu-opt --without-x --disable-sdltest
ac_cv_type_uid_t=yes ac_cv_type_gid_t=yes";
postInstall = ''
mv $out/games/ $out/bin
'';
};
}

View File

@ -10,6 +10,18 @@ stdenv.mkDerivation {
buildInputs = [SDL zlib mpeg2dec]; buildInputs = [SDL zlib mpeg2dec];
crossAttrs = {
preConfigure = ''
# Remove the --build flag set by the gcc cross wrapper setup
# hook
export configureFlags="--host=${stdenv.cross.config}"
'';
postConfigure = ''
# They use 'install -s', that calls the native strip instead of the cross
sed -i 's/-c -s/-c/' ports.mk;
'';
};
meta = { meta = {
description = "Program to run certain classic graphical point-and-click adventure games (such as Monkey Island)"; description = "Program to run certain classic graphical point-and-click adventure games (such as Monkey Island)";
homepage = http://www.scummvm.org/; homepage = http://www.scummvm.org/;

View File

@ -3676,8 +3676,9 @@ let
schroedinger = callPackage ../development/libraries/schroedinger { }; schroedinger = callPackage ../development/libraries/schroedinger { };
SDL = callPackage ../development/libraries/SDL { SDL = callPackage ../development/libraries/SDL {
openglSupport = mesaSupported; openglSupport = false; #mesaSupported;
alsaSupport = true; alsaSupport = true;
x11Support = false;
pulseaudioSupport = false; # better go through ALSA pulseaudioSupport = false; # better go through ALSA
}; };
@ -6451,6 +6452,8 @@ let
inherit (gtkLibs) gtk /*glib gtkmm*/; inherit (gtkLibs) gtk /*glib gtkmm*/;
}; };
prboom = callPackage ../games/prboom { };
quake3demo = callPackage ../games/quake3/wrapper { quake3demo = callPackage ../games/quake3/wrapper {
name = "quake3-demo-${quake3game.name}"; name = "quake3-demo-${quake3game.name}";
description = "Demo of Quake 3 Arena, a classic first-person shooter"; description = "Demo of Quake 3 Arena, a classic first-person shooter";