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

@ -11,6 +11,21 @@ stdenv.mkDerivation rec {
buildInputs = [ ncurses ];
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 = {
description = "The most popular clone of the VI editor";

View File

@ -18,6 +18,16 @@ stdenv.mkDerivation rec {
--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 = {
description = "Full-featured text-mode web browser";
homepage = http://elinks.or.cz;

View File

@ -1,10 +1,11 @@
{ alsaSupport ? false, xvSupport ? true, theoraSupport ? false, cacaSupport ? false
, xineramaSupport ? false, randrSupport ? false, dvdnavSupport ? true
, 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
, cdparanoia ? null, cddaSupport ? true
, amrnb ? null, amrwb ? null, amrSupport ? false
, x11Support ? true, libX11 ? null
, jackaudioSupport ? false, jackaudio ? null
, x264Support ? false, x264 ? null
, xvidSupport ? false, xvidcore ? null
@ -13,11 +14,12 @@
}:
assert alsaSupport -> alsa != null;
assert xvSupport -> libXv != null;
assert x11Support -> libX11 != null;
assert xvSupport -> (libXv != null && x11Support);
assert theoraSupport -> libtheora != null;
assert cacaSupport -> libcaca != null;
assert xineramaSupport -> libXinerama != null;
assert randrSupport -> libXrandr != null;
assert xineramaSupport -> (libXinerama != null && x11Support);
assert randrSupport -> (libXrandr != null && x11Support);
assert dvdnavSupport -> libdvdnav != null;
assert cddaSupport -> cdparanoia != null;
assert jackaudioSupport -> jackaudio != null;
@ -54,7 +56,8 @@ stdenv.mkDerivation {
};
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 xvSupport libXv
++ stdenv.lib.optional theoraSupport libtheora
@ -69,18 +72,32 @@ stdenv.mkDerivation {
++ stdenv.lib.optional xvidSupport xvidcore
++ stdenv.lib.optional lameSupport lame;
buildNativeInputs = [ yasm ];
configureFlags = ''
${if cacaSupport then "--enable-caca" else "--disable-caca"}
${if dvdnavSupport then "--enable-dvdnav --enable-dvdread --disable-dvdread-internal" else ""}
${if x264Support then "--enable-x264 --extra-libs=-lx264" else ""}
--codecsdir=${codecs}
--enable-runtime-cpudetection
--enable-x11
${if x11Support then "--enable-x11" else ""}
--disable-xanim
--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 = {
description = "A movie player that supports many video formats";

View File

@ -12,23 +12,18 @@ if test -z "$nativeLibc"; then
ldflags="$ldflags -L$libc/lib"
# Get the proper dynamic linker for glibc and uclibc.
dlinker=`eval 'echo $libc/lib/ld*.so.?'`
if [ -n "$dynamicLinker" ]; then
if [ -n "$dlinker" ]; then
ldflagsBefore="-dynamic-linker $dlinker"
fi
# This trick is to avoid dependencies on the cross-toolchain gcc
# for libgcc, libstdc++, ...
# -L is for libtool's .la files, and -rpath for the usual fixupPhase
# shrinking rpaths.
if [ -n "$gccLibs" ]; then
ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib"
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
# 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
# for libgcc, libstdc++, ...
# -L is for libtool's .la files, and -rpath for the usual fixupPhase
# shrinking rpaths.
if [ -n "$gccLibs" ]; then
ldflagsBefore="$ldflagsBefore -rpath $gccLibs/lib"
fi
fi
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_LDFLAGS=""
set -x
crossAddCVars () {
if test -d $1/include; then
export NIX_CROSS_CFLAGS_COMPILE="$NIX_CROSS_CFLAGS_COMPILE -I$1/include"
@ -70,7 +68,9 @@ if test -n "@libc@"; then
crossAddCVars @libc@
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
# native compilations.
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"
fi
fi
set +x

View File

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

View File

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