mesa: dependency cleanup (not using output changes)

- drop python build-time dependency; announcement:
 > Unlike mesa 10.5.2, the build process should finally be python/mako free :-)
- drop other (seemingly) unneeded deps, such as bison and flex
- make $out not depend on llvm, again
- various fixes and refactoring
This commit is contained in:
Vladimír Čunát 2015-04-14 22:41:22 +02:00
parent a8813a3db0
commit 3c793aca79

View File

@ -1,6 +1,5 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll { stdenv, fetchurl, fetchpatch, pkgconfig, intltool, autoreconfHook, substituteAll
, python, libxml2Python, file, expat, makedepend, pythonPackages , file, expat, libdrm, xorg, wayland, udev, llvmPackages, libffi, libomxil-bellagio
, libdrm, xorg, wayland, udev, llvmPackages, libffi, libomxil-bellagio
, libvdpau, libelf, libva, libclc , libvdpau, libelf, libva, libclc
, grsecEnabled , grsecEnabled
, enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt , enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
@ -22,13 +21,14 @@ else
- libOSMesa is in $osmesa (~4 MB) - libOSMesa is in $osmesa (~4 MB)
*/ */
with { inherit (stdenv.lib) optional optionalString; };
let let
version = "10.5.3"; version = "10.5.3";
# this is the default search path for DRI drivers # this is the default search path for DRI drivers
driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32"; driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32";
clang = if llvmPackages ? clang-unwrapped then llvmPackages.clang-unwrapped else llvmPackages.clang; clang = if llvmPackages ? clang-unwrapped then llvmPackages.clang-unwrapped else llvmPackages.clang;
in in
with { inherit (stdenv.lib) optional optionals optionalString; };
stdenv.mkDerivation { stdenv.mkDerivation {
name = "mesa-noglu-${version}"; name = "mesa-noglu-${version}";
@ -63,7 +63,7 @@ stdenv.mkDerivation {
configureFlags = [ configureFlags = [
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--localstatedir=/var" "--localstatedir=/var"
"--with-clang-libdir=${clang}/lib" #"--with-clang-libdir=${clang}/lib"
"--with-dri-driverdir=$(drivers)/lib/dri" "--with-dri-driverdir=$(drivers)/lib/dri"
"--with-dri-searchpath=${driverLink}/lib/dri" "--with-dri-searchpath=${driverLink}/lib/dri"
@ -102,17 +102,17 @@ stdenv.mkDerivation {
] ++ optional enableTextureFloats "--enable-texture-float" ] ++ optional enableTextureFloats "--enable-texture-float"
++ optional grsecEnabled "--enable-glx-rts"; # slight performance degradation, enable only for grsec ++ optional grsecEnabled "--enable-glx-rts"; # slight performance degradation, enable only for grsec
nativeBuildInputs = [ pkgconfig python makedepend file flex bison pythonPackages.Mako ]; nativeBuildInputs = [ pkgconfig file ];
propagatedBuildInputs = with xorg; [ libXdamage libXxf86vm ] propagatedBuildInputs = with xorg; [ libXdamage libXxf86vm ]
++ optionals stdenv.isLinux [ libdrm ]; ++ optional stdenv.isLinux libdrm;
buildInputs = with xorg; [ buildInputs = with xorg; [
autoreconfHook intltool expat libxml2Python llvmPackages.llvm autoreconfHook intltool expat llvmPackages.llvm
glproto dri2proto dri3proto presentproto glproto dri2proto dri3proto presentproto
libX11 libXext libxcb libXt libXfixes libxshmfence libX11 libXext libxcb libXt libXfixes libxshmfence
libffi wayland libvdpau libelf libXvMC libomxil-bellagio libva libffi wayland libvdpau libelf libXvMC libomxil-bellagio libva
libclc clang #libclc clang
] ++ optional stdenv.isLinux udev; ] ++ optional stdenv.isLinux udev;
enableParallelBuilding = true; enableParallelBuilding = true;
@ -128,16 +128,17 @@ stdenv.mkDerivation {
# ToDo: probably not all .la files are completely fixed, but it shouldn't matter # ToDo: probably not all .la files are completely fixed, but it shouldn't matter
postInstall = with stdenv.lib; '' postInstall = with stdenv.lib; ''
mv -t "$drivers/lib/" \ mv -t "$drivers/lib/" \
'' + optionalString enableExtraFeatures '' $out/lib/libXvMC* \
`#$out/lib/libXvMC*` \
$out/lib/gbm $out/lib/libgbm* \
'' + ''
$out/lib/gallium-pipe \
$out/lib/libdricore* \ $out/lib/libdricore* \
$out/lib/libgallium* \ $out/lib/libgallium* \
$out/lib/vdpau \ $out/lib/vdpau \
$out/lib/{bellagio,d3d} \
$out/lib/libxatracker* $out/lib/libxatracker*
mv -t "$drivers/lib/dri/" \
"$out"/lib/dri/*
rmdir "$out/lib/dri"
mkdir -p {$osmesa,$drivers}/lib/pkgconfig mkdir -p {$osmesa,$drivers}/lib/pkgconfig
mv -t $osmesa/lib/ \ mv -t $osmesa/lib/ \
$out/lib/libOSMesa* $out/lib/libOSMesa*
@ -150,43 +151,44 @@ stdenv.mkDerivation {
'' + /* now fix references in .la files */ '' '' + /* now fix references in .la files */ ''
sed "/^libdir=/s,$out,$drivers," -i \ sed "/^libdir=/s,$out,$drivers," -i \
'' + optionalString enableExtraFeatures '' $drivers/lib/libXvMC*.la \
`#$drivers/lib/libXvMC*.la` \
'' + ''
$drivers/lib/gallium-pipe/*.la \
$drivers/lib/libgallium.la \
$drivers/lib/vdpau/*.la \ $drivers/lib/vdpau/*.la \
$drivers/lib/libdricore*.la $drivers/lib/libdricore*.la
sed "s,$out\(/lib/\(libdricore[0-9\.]*\|libgallium\).la\),$drivers\1,g" \ sed "s,$out\(/lib/libdricore[0-9\.]*.la\),$drivers\1,g" \
-i $drivers/lib/*.la $drivers/lib/*/*.la -i $drivers/lib/*.la $drivers/lib/*/*.la
sed "/^libdir=/s,$out,$osmesa," -i \ sed "/^libdir=/s,$out,$osmesa," -i \
$osmesa/lib/libOSMesa*.la $osmesa/lib/libOSMesa*.la
'' + /* work around bug #529, but maybe $drivers should also be patchelf-ed */ ''
find $drivers/ $osmesa/ -type f -executable -print0 | xargs -0 strip -S || true
'' + /* add RPATH so the drivers can find the moved libgallium and libdricore9 */ ''
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
if [[ ! -L "$lib" ]]; then
patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
fi
done
'' + /* set the default search path for DRI drivers; used e.g. by X server */ '' '' + /* set the default search path for DRI drivers; used e.g. by X server */ ''
substituteInPlace "$out/lib/pkgconfig/dri.pc" --replace '$(drivers)' "${driverLink}" substituteInPlace "$out/lib/pkgconfig/dri.pc" --replace '$(drivers)' "${driverLink}"
'' + /* move vdpau drivers to $drivers/lib, so they are found */ '' '' + /* move vdpau drivers to $drivers/lib, so they are found */ ''
mv "$drivers"/lib/vdpau/* "$drivers"/lib/ && rmdir "$drivers"/lib/vdpau mv "$drivers"/lib/vdpau/* "$drivers"/lib/ && rmdir "$drivers"/lib/vdpau
''; '';
#ToDo: @vcunat isn't sure if drirc will be found when in $out/etc/, but it doesn't seem important ATM #ToDo: @vcunat isn't sure if drirc will be found when in $out/etc/, but it doesn't seem important ATM */
postFixup =
# add RPATH so the drivers can find the moved libgallium and libdricore9
# moved here to avoid problems with stripping patchelfed files
''
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
if [[ ! -L "$lib" ]]; then
patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
fi
done
'';
# ToDo + /* check $out doesn't depend on llvm */ ''
# builder failures are ignored for some reason
# grep -qv '${llvmPackages.llvm}' -R "$out"
passthru = { inherit libdrm version driverLink; }; passthru = { inherit libdrm version driverLink; };
meta = { meta = with stdenv.lib; {
description = "An open source implementation of OpenGL"; description = "An open source implementation of OpenGL";
homepage = http://www.mesa3d.org/; homepage = http://www.mesa3d.org/;
license = "bsd"; license = licenses.mit; # X11 variant, in most files
platforms = stdenv.lib.platforms.mesaPlatforms; platforms = platforms.mesaPlatforms;
maintainers = with stdenv.lib.maintainers; [ eduarrrd simons vcunat ]; maintainers = with maintainers; [ eduarrrd simons vcunat ];
}; };
} }