diff options
author | Milton Woods <miltonjwoods@gmail.com> | 2017-09-19 04:10:54 +1000 |
---|---|---|
committer | scheibelp <scheibel1@llnl.gov> | 2017-09-18 11:10:54 -0700 |
commit | 2f269c391987c2fc7129c92acc0c1c4fede347d1 (patch) | |
tree | 51c09b5038cc170baa38c13b5333b3987a03cc9c /var | |
parent | c7a789e2d61b85d081f65100f0d5ee40bf78928f (diff) | |
download | spack-2f269c391987c2fc7129c92acc0c1c4fede347d1.tar.gz spack-2f269c391987c2fc7129c92acc0c1c4fede347d1.tar.bz2 spack-2f269c391987c2fc7129c92acc0c1c4fede347d1.tar.xz spack-2f269c391987c2fc7129c92acc0c1c4fede347d1.zip |
mesa: merge multiple branches into one (#5170)
Merge work from multiple contributors on the mesa package. This
includes the following changes and decisions:
* Added in mesa +hwrender support
* make +swrender the default selection since this represents a very
common usage case (ie, cluster usage)
* leave ~llvm as the default, since inadvertently building this package
could take a very long time. May need to revisit this assumption in
the future since the performance difference can be quite substantial.
* build libGLESv1+2 and libGL for all variants
* avoid dependence on dri/libdrm when ~hwrender
* disable gallium drivers if none are requested
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin/packages/mesa/package.py | 136 |
1 files changed, 102 insertions, 34 deletions
diff --git a/var/spack/repos/builtin/packages/mesa/package.py b/var/spack/repos/builtin/packages/mesa/package.py index 33d0501228..1a26b4974c 100644 --- a/var/spack/repos/builtin/packages/mesa/package.py +++ b/var/spack/repos/builtin/packages/mesa/package.py @@ -2,8 +2,7 @@ # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # -# This file is part of Spack. -# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# This file is released as part of spack under the LGPL license. # LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack @@ -22,6 +21,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## + from spack import * @@ -34,66 +34,109 @@ class Mesa(AutotoolsPackage): list_url = "https://mesa.freedesktop.org/archive" list_depth = 2 + version('17.1.5', '6cf936fbcaadd98924298a7009e8265d') + version('17.1.4', 'be2ef7c9edec23b07f74f6512a6a6fa5') version('17.1.3', '1946a93d543bc219427e2bebe2ac4752') + version('17.1.1', 'a4844bc6052578574f9629458bcbb749') version('13.0.6', '1e5a769bc6cfd839cf3febcb179c27cc') version('12.0.6', '1a3d4fea0656c208db59289e4ed33b3f') version('12.0.3', '1113699c714042d8c4df4766be8c57d8') - variant('swrender', default=False, - description="Build with (gallium) software rendering.") - + variant('swrender', default=True, + description="Build with (gallium) software rendering.") + variant('hwrender', default=False, + description="Build with (DRI) hardware rendering.") variant('llvm', default=False, - description="Use llvm for rendering pipes.") + description="Use llvm for rendering pipes.") # General dependencies - depends_on('python@2.6.4:') - depends_on('py-mako@0.3.4:', type=('build', 'run')) + depends_on('pkg-config@0.9.0:', type='build') depends_on('flex@2.5.35:', type='build') depends_on('bison@2.4.1:', type='build') - depends_on('pkg-config@0.9.0:', type='build') - - # Off-screen with llvmpipe - # Note: there must be a better way of selecting the preferred llvm - depends_on('llvm+link_dylib', when='+llvm') - - # For DRI and hardware acceleration + depends_on('binutils', type='build') + depends_on('python@2.6.4:', type='build') + depends_on('py-mako@0.3.4:', type='build') + depends_on('gettext') + depends_on('icu4c') + depends_on('expat') depends_on('libpthread-stubs') - depends_on('libdrm') depends_on('openssl') + depends_on('xproto') + depends_on('glproto@1.4.14:') + depends_on('presentproto@1.0:') depends_on('libxcb@1.9.3:') - depends_on('libxshmfence@1.1:', when='~swrender') - depends_on('libx11', when='~swrender') - depends_on('libxext', when='~swrender') - depends_on('libxdamage', when='~swrender') + depends_on('libx11') + depends_on('libxext') + depends_on('libxshmfence@1.1:') + depends_on('libxdamage') depends_on('libxfixes') - # depends_on('expat', when='~swrender') - depends_on('libelf', when='+llvm~swrender') + depends_on('libxv') + depends_on('libxvmc') - depends_on('glproto@1.4.14:', type='build', when='~swrender') - depends_on('dri2proto@2.6:', type='build', when='~swrender') - depends_on('dri3proto@1.0:', type='build', when='~swrender') - depends_on('presentproto@1.0:', type='build', when='~swrender') + # For DRI and hardware acceleration + depends_on('dri2proto@2.6:', type='build', when='+hwrender') + depends_on('dri3proto@1.0:', type='build', when='+hwrender') + depends_on('libdrm', when='+hwrender') - # TODO: Add package for systemd, provides libudev - # Using the system package manager to install systemd didn't work for me + depends_on('llvm@:3.8.1+link_dylib', when='@12:12.99+llvm') + depends_on('llvm@:3.9.1+link_dylib', when='@13:13.99+llvm') + depends_on('llvm+link_dylib', when='+llvm') + depends_on('libelf', when='+llvm') def configure_args(self): + """Build drivers for platforms supported by spack; + exclude drivers for embedded systems. + """ spec = self.spec - args = [] + args = ['--enable-glx', '--enable-glx-tls'] drivers = [] + if '+swrender' in spec: drivers = ['swrast'] - # Needs +llvm, but also C++14? -> drivers.append('swr') args.extend([ + '--disable-osmesa', + '--enable-gallium-osmesa', + '--enable-texture-float', + ]) + if '+llvm' in spec: + # For @17.1.1:17.1.2 the swr driver requires C++14 support + # Should be fixed in 17.1.3, but can still encounter problems + if spec.version >= Version('17'): + if spec.satisfies('%gcc@4.9:'): + drivers.append('swr') + else: + drivers.append('swr') + else: + args.append('--disable-gallium-osmesa') + # Fallback for "~hwrender~swrender" -> old osmesa + if '~hwrender' in spec: + args.append('--enable-osmesa') + + if '+hwrender' in spec: + args.append('--enable-xa') + if spec.version >= Version('17'): + args.append('--with-platforms=x11,drm') + else: + args.append('--with-egl-platforms=x11,drm') + drivers.extend([ + 'svga', 'i915', 'r600', 'nouveau', 'virgl' + ]) + + # These hardware drivers need llvm + if '+llvm' in spec: + drivers.extend(['r300', 'radeonsi']) + + else: + args.extend([ + '--disable-xa', '--disable-dri', + '--disable-dri3', '--disable-egl', '--disable-gbm', - '--disable-gles1', - '--disable-glx', '--disable-xvmc', - '--enable-texture-float', - '--enable-gallium-osmesa', ]) + if spec.version >= Version('17'): + args.append('--with-platforms=x11') if '+llvm' in spec: if self.spec.version < Version('17'): @@ -108,5 +151,30 @@ class Mesa(AutotoolsPackage): if drivers: args.append('--with-gallium-drivers=' + ','.join(drivers)) + else: + args.append('--without-gallium-drivers') + + # Avoid errors due to missing clock_gettime symbol: + arch = spec.architecture + if arch.platform == 'linux': + args.append('LIBS=-lrt') return args + + def configure(self, spec, prefix): + """Configure mesa, detecting if libsysfs is required + for DRI support on the build host. + """ + options = ['--prefix={0}'.format(prefix)] + self.configure_args() + + try: + # First attempt uses libudev: + configure(*options) + except ProcessError: + if '+hwrender' in spec and not spec.satisfies('@13:'): + print('Configuring with libudev failed ... ' + ' trying libsysfs ...') + options.append('--enable-sysfs') + configure(*options) + else: + raise |