Merge 'staging' into closure-size

- there were many easy merge conflicts
- cc-wrapper needed nontrivial changes

Many other problems might've been created by interaction of the branches,
but stdenv and a few other packages build fine now.
This commit is contained in:
Vladimír Čunát
2015-04-18 11:22:20 +02:00
6303 changed files with 375444 additions and 91358 deletions
+62 -44
View File
@@ -1,7 +1,7 @@
{ stdenv, fetchurl, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll
, python, libxml2Python, file, expat, makedepend
, libdrm, xorg, wayland, udev, llvm, libffi
, libvdpau, libelf
{ stdenv, fetchurl, fetchpatch, pkgconfig, intltool, flex, bison, autoreconfHook, substituteAll
, python, libxml2Python, file, expat, makedepend, pythonPackages
, libdrm, xorg, wayland, udev, llvmPackages, libffi, libomxil-bellagio
, libvdpau, libelf, libva, libclc
, grsecEnabled
, enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
, enableExtraFeatures ? false # not maintained
@@ -15,18 +15,18 @@ else
- The basic mesa ($out) contains headers and libraries (GLU is in mesa_glu now).
This or the mesa attribute (which also contains GLU) are small (~ 2 MB, mostly headers)
and are designed to be the buildInput of other packages.
- DRI and EGL drivers are compiled into $drivers output,
which is much bigger and depends on LLVM.
These should be searched at runtime in "/run/opengl-driver{,-32}/lib/*"
and so are kind-of impure (given by NixOS).
- DRI drivers are compiled into $drivers output, which is much bigger and
depends on LLVM. These should be searched at runtime in
"/run/opengl-driver{,-32}/lib/*" and so are kind-of impure (given by NixOS).
(I suppose on non-NixOS one would create the appropriate symlinks from there.)
- libOSMesa is in $osmesa (~4 MB)
*/
let
version = "10.2.6";
version = "10.5.3";
# this is the default search path for DRI drivers
driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32";
clang = if llvmPackages ? clang-unwrapped then llvmPackages.clang-unwrapped else llvmPackages.clang;
in
with { inherit (stdenv.lib) optional optionals optionalString; };
@@ -34,14 +34,16 @@ stdenv.mkDerivation {
name = "mesa-noglu-${version}";
src = fetchurl {
url = "ftp://ftp.freedesktop.org/pub/mesa/${version}/MesaLib-${version}.tar.bz2";
sha256 = "01n8ib190s12m8hiiyi4wfm9jhkbqjd769npjwvf965smp918cqr";
urls = [
"https://launchpad.net/mesa/trunk/${version}/+download/mesa-${version}.tar.xz"
"ftp://ftp.freedesktop.org/pub/mesa/${version}/mesa-${version}.tar.xz"
];
sha256 = "18ibj4c8zmg738md8phmq3va40ycsjdilg76ylw35h7mwhdyw0c7";
};
prePatch = "patchShebangs .";
patches = [
./static-gallium.patch
./glx_ro_text_segm.patch # fix for grsecurity/PaX
# TODO: revive ./dricore-gallium.patch when it gets ported (from Ubuntu),
# as it saved ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
@@ -51,59 +53,75 @@ stdenv.mkDerivation {
inherit udev;
});
# Change the search path for EGL drivers from $drivers/* to driverLink
postPatch = ''
sed '/D_EGL_DRIVER_SEARCH_DIR=/s,EGL_DRIVER_INSTALL_DIR,${driverLink}/lib/egl,' \
-i src/egl/main/Makefile.am
'' + /* work around RTTI LLVM problems */ ''
patch -R -p1 < ${./rtti.patch}
substituteInPlace src/egl/main/egldriver.c \
--replace _EGL_DRIVER_SEARCH_DIR '"${driverLink}"'
'';
outputs = [ "dev" "out" "drivers" "osmesa" ];
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-clang-libdir=${clang}/lib"
"--with-dri-driverdir=$(drivers)/lib/dri"
"--with-egl-driver-dir=$(drivers)/lib/egl"
"--with-dri-searchpath=${driverLink}/lib/dri"
"--enable-gles1"
"--enable-gles2"
"--enable-dri"
"--enable-glx-tls"
"--enable-shared-glapi" "--enable-shared-gallium"
"--enable-driglx-direct" # seems enabled anyway
"--enable-gallium-llvm" "--enable-llvm-shared-libs"
] ++ optional stdenv.isLinux "--enable-dri3"
++ [
"--enable-glx"
"--enable-gallium-osmesa" # used by wine
"--enable-egl"
"--enable-xa" # used in vmware driver
"--enable-gles1" "--enable-gles2"
"--enable-gbm"
] ++ optional stdenv.isLinux "--enable-nine" # Direct3D in Wine
++ [
"--enable-xvmc"
"--enable-vdpau"
"--enable-osmesa" # used by wine
"--enable-omx"
"--enable-va"
"--with-dri-drivers=i965,r200,radeon"
"--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast,radeonsi"
"--with-egl-platforms=x11,wayland,drm" "--enable-gbm"
]
++ optional enableTextureFloats "--enable-texture-float"
++ optionals enableExtraFeatures [
"--enable-openvg" "--enable-gallium-egl" # not needed for EGL in Gallium, but OpenVG might be useful
#"--enable-xvmc" # tests segfault with 9.1.{1,2,3}
#"--enable-opencl" # ToDo: opencl seems to need libclc for clover
]
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
"--disable-opencl"
#"--enable-opencl"
#"--enable-opencl-icd"
"--with-gallium-drivers=svga,i915,ilo,r300,r600,radeonsi,nouveau,freedreno,swrast"
"--enable-shared-glapi"
"--enable-sysfs"
"--enable-driglx-direct" # seems enabled anyway
"--enable-glx-tls"
"--with-dri-drivers=i915,i965,nouveau,radeon,r200,swrast"
"--with-egl-platforms=x11,wayland,drm"
"--enable-gallium-llvm"
"--enable-llvm-shared-libs"
] ++ optional enableTextureFloats "--enable-texture-float"
++ optional grsecEnabled "--enable-glx-rts"; # slight performance degradation, enable only for grsec
nativeBuildInputs = [ pkgconfig python makedepend file flex bison ];
nativeBuildInputs = [ pkgconfig python makedepend file flex bison pythonPackages.Mako ];
propagatedBuildInputs = with xorg; [ libXdamage libXxf86vm ]
++ optionals stdenv.isLinux [libdrm]
;
++ optionals stdenv.isLinux [ libdrm ];
buildInputs = with xorg; [
autoreconfHook intltool expat libxml2Python llvm
autoreconfHook intltool expat libxml2Python llvmPackages.llvm
glproto dri2proto dri3proto presentproto
libX11 libXext libxcb libXt libXfixes libxshmfence
libffi wayland libvdpau libelf
] ++ optionals enableExtraFeatures [ /*libXvMC*/ ]
++ optional stdenv.isLinux udev
;
libffi wayland libvdpau libelf libXvMC libomxil-bellagio libva
libclc clang
] ++ optional stdenv.isLinux udev;
enableParallelBuilding = true;
#doCheck = true; # https://bugs.freedesktop.org/show_bug.cgi?id=67672
doCheck = false;
installFlags = [
"sysconfdir=\${out}/etc"
"localstatedir=\${TMPDIR}"
];
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM;
# also move libOSMesa to $osmesa, as it's relatively big
@@ -169,6 +187,6 @@ stdenv.mkDerivation {
homepage = http://www.mesa3d.org/;
license = "bsd";
platforms = stdenv.lib.platforms.mesaPlatforms;
maintainers = with stdenv.lib.maintainers; [ simons vcunat ];
maintainers = with stdenv.lib.maintainers; [ eduarrrd simons vcunat ];
};
}
@@ -1,72 +0,0 @@
http://lists.freedesktop.org/archives/mesa-dev/2013-October/046311.html
* As discussed on the mailing list,
forced no-rtti breaks C++ public
API's such as the Haiku C++ libGL.so
* -fno-rtti *can* be still set however
instead of blindly forcing -fno-rtti,
we can rely on the llvm-config
--cppflags output.
If the system llvm is built without
rtti (default), the no-rtti flag will be
present in llvm-config --cppflags
(which we pick up on)
If llvm is built with rtti
(REQUIRES_RTTI=1), then -fno-rtti is
removed from llvm-config --cppflags.
* We could selectively add / remove rtti
from various components, however mixing
rtti and non-rtti code is tricky and
could introduce bugs.
* This needs impact tested.
---
configure.ac | 1 -
scons/llvm.py | 3 ---
src/gallium/auxiliary/Makefile.am | 6 ------
3 files changed, 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0d082d2..3335575 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1943,7 +1943,6 @@ AM_CONDITIONAL(HAVE_LOADER_GALLIUM, test x$enable_gallium_loader = xyes)
AM_CONDITIONAL(HAVE_DRM_LOADER_GALLIUM, test x$enable_gallium_drm_loader = xyes)
AM_CONDITIONAL(HAVE_GALLIUM_COMPUTE, test x$enable_opencl = xyes)
AM_CONDITIONAL(HAVE_MESA_LLVM, test x$MESA_LLVM = x1)
-AM_CONDITIONAL(LLVM_NEEDS_FNORTTI, test $LLVM_VERSION_INT -ge 302)
AC_SUBST([ELF_LIB])
diff --git a/scons/llvm.py b/scons/llvm.py
index 7cd609c..c1c3736 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -195,9 +195,6 @@ def generate(env):
if llvm_version >= distutils.version.LooseVersion('3.1'):
components.append('mcjit')
- if llvm_version >= distutils.version.LooseVersion('3.2'):
- env.Append(CXXFLAGS = ('-fno-rtti',))
-
env.ParseConfig('llvm-config --libs ' + ' '.join(components))
env.ParseConfig('llvm-config --ldflags')
except OSError:
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index 670e124..2d2d8d4 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -25,12 +25,6 @@ AM_CXXFLAGS += \
$(GALLIUM_CFLAGS) \
$(LLVM_CXXFLAGS)
-if LLVM_NEEDS_FNORTTI
-
-AM_CXXFLAGS += -fno-rtti
-
-endif
-
libgallium_la_SOURCES += \
$(GALLIVM_SOURCES) \
$(GALLIVM_CPP_SOURCES)
--
1.8.4
@@ -1,64 +0,0 @@
117-static-gallium.patch from Ubuntu Trusty
diff --git a/configure.ac b/configure.ac
index b9fcb0b..be89843 100644
--- a/configure.ac
+++ b/configure.ac
@@ -747,6 +747,19 @@ if test "x$enable_shared_glapi" = xyes; then
fi
AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
+AC_ARG_ENABLE([shared-gallium],
+ [AS_HELP_STRING([--enable-shared-gallium],
+ [Enable shared gallium core @<:@default=yes@:>@])],
+ [enable_shared_gallium="$enableval"],
+ [enable_shared_gallium=yes])
+
+SHARED_GALLIUM="0"
+if test "x$enable_shared_gallium" = xyes; then
+ SHARED_GALLIUM="1"
+fi
+AC_SUBST([SHARED_GALLIUM])
+AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
+
dnl
dnl Driver specific build directories
dnl
diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
index f14279b..3cdec83 100644
--- a/src/gallium/auxiliary/Makefile.am
+++ b/src/gallium/auxiliary/Makefile.am
@@ -3,14 +3,19 @@ AUTOMAKE_OPTIONS = subdir-objects
include Makefile.sources
include $(top_srcdir)/src/gallium/Automake.inc
-noinst_LTLIBRARIES = libgallium.la
-
AM_CFLAGS = \
-I$(top_srcdir)/src/gallium/auxiliary/util \
- $(GALLIUM_CFLAGS) \
- $(VISIBILITY_CFLAGS)
+ $(GALLIUM_CFLAGS)
-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
+AM_CXXFLAGS =
+
+if HAVE_SHARED_GALLIUM
+lib_LTLIBRARIES = libgallium.la
+else
+noinst_LTLIBRARIES = libgallium.la
+AM_CFLAGS += $(VISIBILITY_CFLAGS)
+AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
+endif
libgallium_la_SOURCES = \
$(C_SOURCES) \
@@ -29,6 +34,8 @@ if LLVM_NEEDS_FNORTTI
AM_CXXFLAGS += -fno-rtti
+libgallium_la_LIBADD = $(LLVM_LIBS)
+
endif
libgallium_la_SOURCES += \