jadahl / rpms / mesa

Forked from rpms/mesa 6 years ago
Clone
Blob Blame History Raw
# S390 doesn't have video cards, but we need swrast for xserver's GLX
%ifarch s390 s390x
%define with_hardware 0
%define dri_drivers --with-dri-drivers=swrast
%else
%define with_hardware 1
%endif

%define _default_patch_fuzz 2

%define manpages gl-manpages-1.0.1
%define gitdate 20110107
#% define snapshot 

Summary: Mesa graphics libraries
Name: mesa
Version: 7.10
Release: 0.23%{?dist}
License: MIT
Group: System Environment/Libraries
URL: http://www.mesa3d.org

#Source0: http://downloads.sf.net/mesa3d/MesaLib-%{version}.tar.bz2
#Source0: http://www.mesa3d.org/beta/MesaLib-%{version}%{?snapshot}.tar.bz2
Source0: %{name}-%{gitdate}.tar.xz
Source2: %{manpages}.tar.bz2
Source3: make-git-snapshot.sh
Source4: llvmcore.mk

Patch2: mesa-7.1-nukeglthread-debug.patch
Patch3: mesa-no-mach64.patch
Patch4: legacy-drivers.patch

#Patch7: mesa-7.1-link-shared.patch
Patch8: mesa-7.10-llvmcore.patch

Patch30: mesa-7.6-hush-vblank-warning.patch
Patch31: mesa-7.10-swrastg.patch

# nouveau patches
#
# update nouveau gallium drivers to git as of 20110117, nvc0 support
Patch50: mesa-7.10-nouveau-updates.patch
# revert various bits to be compatible with 7.10
Patch51: mesa-7.10-nouveau-revert.patch
# fixup classic drivers to new libdrm api
Patch52: mesa-7.10-nouveau-classic-libdrm.patch

BuildRequires: pkgconfig autoconf automake libtool
%if %{with_hardware}
BuildRequires: kernel-headers >= 2.6.27-0.305.rc5.git6
BuildRequires: xorg-x11-server-devel
%endif
BuildRequires: libdrm-devel >= 2.4.21-1
BuildRequires: libXxf86vm-devel
BuildRequires: expat-devel >= 2.0
BuildRequires: xorg-x11-proto-devel >= 7.4-35
BuildRequires: makedepend
BuildRequires: libselinux-devel
BuildRequires: libXext-devel
BuildRequires: libXfixes-devel
BuildRequires: libXdamage-devel
BuildRequires: libXi-devel
BuildRequires: libXmu-devel
BuildRequires: elfutils
BuildRequires: python
BuildRequires: llvm-static
BuildRequires: libxml2-python
BuildRequires: libudev-devel
BuildRequires: libtalloc-devel

%description
Mesa

%package libGL
Summary: Mesa libGL runtime libraries and DRI drivers
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Provides: libGL
Requires: libdrm >= 2.4.23-1
%if %{with_hardware}
Conflicts: xorg-x11-server-Xorg < 1.4.99.901-14
%endif

%description libGL
Mesa libGL runtime library.

%package libEGL
Summary: Mesa libEGL runtime libraries
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: mesa-dri-drivers%{?_isa} = %{version}-%{release}
Requires: libdrm >= 2.4.23-1

%description libEGL
Mesa libEGL runtime libraries

%package libGLES
Summary: Mesa libGLES runtime libraries
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: mesa-dri-drivers%{?_isa} = %{version}-%{release}
Requires: libdrm >= 2.4.23-1

%description libGLES
Mesa GLES runtime libraries

%package dri-filesystem
Summary: Mesa DRI driver filesystem
Group: User Interface/X Hardware Support
%description dri-filesystem
Mesa DRI driver filesystem

%package dri-llvmcore
Summary: Mesa common LLVM support
Group: User Interface/X Hardware Support
Requires: mesa-dri-filesystem%{?_isa}
%description dri-llvmcore
Common DSO for LLVM support for gallium-based DRI drivers.  This package
exists solely as a disk space hack for Mesa.  Do not link against this
library if you are not Mesa.  You have been warned.

%package dri-drivers
Summary: Mesa-based DRI drivers
Group: User Interface/X Hardware Support
Requires: mesa-dri-filesystem%{?_isa}
%description dri-drivers
Mesa-based DRI drivers.

%package dri-drivers-dri1
Summary: Mesa-based DRI1 drivers
Group: User Interface/X Hardware Support
Requires: mesa-dri-filesystem%{?isa}
%description dri-drivers-dri1
Mesa-based DRI1 drivers.

%package dri-drivers-experimental
Summary: Mesa-based DRI drivers (experimental)
Group: User Interface/X Hardware Support
Requires: mesa-dri-filesystem%{?_isa}
%description dri-drivers-experimental
Mesa-based DRI drivers (experimental).


%package libGL-devel
Summary: Mesa libGL development package
Group: Development/Libraries
Requires: mesa-libGL = %{version}-%{release}
Provides: libGL-devel
Conflicts: xorg-x11-proto-devel <= 7.2-12

%description libGL-devel
Mesa libGL development package

%package libEGL-devel
Summary: Mesa libEGL development package
Group: Development/Libraries
Requires: mesa-libEGL = %{version}-%{release}

%description libEGL-devel
Mesa libEGL development package

%package libGLES-devel
Summary: Mesa libGLES development package
Group: Development/Libraries
Requires: mesa-libGLES = %{version}-%{release}

%description libGLES-devel
Mesa libGLES development package

%package libGLU
Summary: Mesa libGLU runtime library
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Provides: libGLU

%description libGLU
Mesa libGLU runtime library


%package libGLU-devel
Summary: Mesa libGLU development package
Group: Development/Libraries
Requires: mesa-libGLU = %{version}-%{release}
Provides: libGLU-devel

%description libGLU-devel
Mesa libGLU development package


%package libOSMesa
Summary: Mesa offscreen rendering libraries
Group: System Environment/Libraries
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Provides: libOSMesa

%description libOSMesa
Mesa offscreen rendering libraries


%package libOSMesa-devel
Summary: Mesa offscreen rendering development package
Group: Development/Libraries
Requires: mesa-libOSMesa = %{version}-%{release}

%description libOSMesa-devel
Mesa offscreen rendering development package


%package -n xorg-x11-drv-vmwgfx
Summary: VMware GFX DDX driver
Group: User Interface/X Hardware Support
Requires: Xorg %(xserver-sdk-abi-requires ansic) %(xserver-sdk-abi-requires videodrv)

%description -n xorg-x11-drv-vmwgfx
2D driver for VMware SVGA vGPU

%prep
#setup -q -n mesa-%{version}%{?snapshot} -b0 -b2
%setup -q -n mesa-%{gitdate} -b2
%patch2 -p1 -b .intel-glthread
%patch3 -p1 -b .no-mach64
%patch4 -p1 -b .classic
#patch7 -p1 -b .dricore
%patch8 -p1 -b .llvmcore
%patch30 -p1 -b .vblank-warning
#patch31 -p1 -b .swrastg
%patch50 -p1 -b .nv-update
%patch51 -p1 -b .nv-revert
%patch52 -p1 -b .nv-libdrm

%build

autoreconf --install  

export CFLAGS="$RPM_OPT_FLAGS -fno-omit-frame-pointer"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-omit-frame-pointer"
%ifarch %{ix86}
# i do not have words for how much the assembly dispatch code infuriates me
%define common_flags --enable-selinux --enable-pic --enable-udev --disable-asm
%else
%define common_flags --enable-selinux --enable-pic --enable-udev
%endif
%define osmesa_flags --with-driver=osmesa %{common_flags} --disable-gallium --with-dri-drivers="" --disable-glu --disable-egl

# first, build osmesa.

%configure %{osmesa_flags} --with-osmesa-bits=8
make %{_smp_mflags}
mv %{_lib} osmesa8
make clean

# just to be sure...
[ `find . -name \*.o | wc -l` -eq 0 ] || exit 1

# build llvmcore
TOP=`pwd` make -f %{SOURCE4} llvmcore
mkdir -p %{_lib}
mv libllvmcore*.so %{_lib}

# now build the rest of mesa
%configure %{common_flags} \
    --disable-glw \
    --disable-glut \
    --disable-gl-osmesa \
    --with-driver=dri \
    --with-dri-driverdir=%{_libdir}/dri \
    --with-state-trackers=dri,glx \
    --enable-egl \
    --enable-gles1 \
    --enable-gles2 \
    --enable-gallium-llvm \
    --disable-gallium-intel \
    --disable-gallium-svga \
    --disable-gallium-egl \
%if %{with_hardware}
    --enable-gallium-radeon \
    --enable-gallium-r600 \
    --enable-gallium-nouveau \
%else
    --disable-gallium-radeon \
    --disable-gallium-r600 \
    --disable-gallium-nouveau \
%endif
    %{?dri_drivers}

make %{?_smp_mflags}

pushd ../%{manpages}
autoreconf -v --install
%configure
make %{?_smp_mflags}
popd

%install
rm -rf $RPM_BUILD_ROOT

# core libs and headers, but not drivers.
make install DESTDIR=$RPM_BUILD_ROOT DRI_DIRS=

# just the DRI drivers that are sane
install -d $RPM_BUILD_ROOT%{_libdir}/dri
install -m 0755 -t $RPM_BUILD_ROOT%{_libdir}/dri %{_lib}/libllvmcore-2.8.so >& /dev/null
# use gallium driver iff built
[ -f %{_lib}/gallium/r300_dri.so ] && cp %{_lib}/gallium/r300_dri.so %{_lib}/r300_dri.so
[ -f %{_lib}/gallium/r600_dri.so ] && cp %{_lib}/gallium/r600_dri.so %{_lib}/r600_dri.so
[ -f %{_lib}/gallium/swrastg_dri.so ] && mv %{_lib}/gallium/swrastg_dri.so %{_lib}/swrast_dri.so

for f in i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon savage sis swrast tdfx unichrome nouveau_vieux gallium/vmwgfx ; do
    so=%{_lib}/${f}_dri.so
    test -e $so && echo $so
done | xargs install -m 0755 -t $RPM_BUILD_ROOT%{_libdir}/dri >& /dev/null || :

# strip out undesirable headers
pushd $RPM_BUILD_ROOT%{_includedir}/GL 
rm [a-fh-np-wyz]*.h glf*.h glut*.h
popd

pushd $RPM_BUILD_ROOT%{_libdir}
rm -f xorg/modules/drivers/modesetting_drv.so
popd

# and osmesa
mv osmesa*/libOS* $RPM_BUILD_ROOT%{_libdir}

# man pages
pushd ../%{manpages}
make %{?_smp_mflags} install DESTDIR=$RPM_BUILD_ROOT
popd

# this keeps breaking, check it early.  note that the exit from eu-ftr is odd.
pushd $RPM_BUILD_ROOT%{_libdir}
for i in libOSMesa*.so libGL.so ; do
    eu-findtextrel $i && exit 1
done
popd

%clean
rm -rf $RPM_BUILD_ROOT

%check

%post libGL -p /sbin/ldconfig
%postun libGL -p /sbin/ldconfig
%post libGLU -p /sbin/ldconfig
%postun libGLU -p /sbin/ldconfig
%post libOSMesa -p /sbin/ldconfig
%postun libOSMesa -p /sbin/ldconfig
%post libEGL -p /sbin/ldconfig
%postun libEGL -p /sbin/ldconfig
%post libGLES -p /sbin/ldconfig
%postun libGLES -p /sbin/ldconfig

%files libGL
%defattr(-,root,root,-)
%doc docs/COPYING
%{_libdir}/libGL.so.1
%{_libdir}/libGL.so.1.*

%files libEGL
%defattr(-,root,root,-)
%doc docs/COPYING
%{_libdir}/libEGL.so.1
%{_libdir}/libEGL.so.1.*
%{_libdir}/egl/egl_glx.so
%{_libdir}/egl/egl_dri2.so

%files libGLES
%defattr(-,root,root,-)
%doc docs/COPYING
%{_libdir}/libGLESv1_CM.so.1
%{_libdir}/libGLESv1_CM.so.1.*
%{_libdir}/libGLESv2.so.2
%{_libdir}/libGLESv2.so.2.*

%files dri-filesystem
%defattr(-,root,root,-)
%doc docs/COPYING
%dir %{_libdir}/dri

%files dri-llvmcore
%defattr(-,root,root,-)
%{_libdir}/dri/libllvmcore-2.8.so

%files dri-drivers
%defattr(-,root,root,-)
%if %{with_hardware}
%{_libdir}/dri/radeon_dri.so
%{_libdir}/dri/r200_dri.so
%{_libdir}/dri/r300_dri.so
%{_libdir}/dri/r600_dri.so
%{_libdir}/dri/i915_dri.so
%{_libdir}/dri/i965_dri.so
%endif
%{_libdir}/dri/swrast_dri.so
%exclude %{_libdir}/dri/swrastg_dri.so

%files dri-drivers-dri1
%defattr(-,root,root,-)
%doc docs/COPYING
%if %{with_hardware}
%ifarch %{ix86}
%{_libdir}/dri/i810_dri.so
%{_libdir}/dri/sis_dri.so
%endif
%{_libdir}/dri/mga_dri.so
%{_libdir}/dri/r128_dri.so
%{_libdir}/dri/savage_dri.so
%{_libdir}/dri/tdfx_dri.so
%{_libdir}/dri/unichrome_dri.so
%endif

%files dri-drivers-experimental
%defattr(-,root,root,-)
%if %{with_hardware}
#{_libdir}/dri/vmwgfx_dri.so
%{_libdir}/dri/nouveau_dri.so
%{_libdir}/dri/nouveau_vieux_dri.so
%endif

%files libGL-devel
%defattr(-,root,root,-)
%{_includedir}/GL/gl.h
%{_includedir}/GL/gl_mangle.h
%{_includedir}/GL/glext.h
%{_includedir}/GL/glx.h
%{_includedir}/GL/glx_mangle.h
%{_includedir}/GL/glxext.h
%dir %{_includedir}/GL/internal
%{_includedir}/GL/internal/dri_interface.h
%{_libdir}/pkgconfig/dri.pc
%{_libdir}/libGL.so
%{_libdir}/pkgconfig/gl.pc
%{_datadir}/man/man3/gl[^uX]*.3gl*
%{_datadir}/man/man3/glX*.3gl*

%files libEGL-devel
%defattr(-,root,root,-)
%{_includedir}/EGL/eglext.h
%{_includedir}/EGL/egl.h
%{_includedir}/EGL/eglplatform.h
%{_includedir}/KHR/khrplatform.h
%{_libdir}/pkgconfig/egl.pc
%{_libdir}/libEGL.so

%files libGLES-devel
%defattr(-,root,root,-)
%{_includedir}/GLES/egl.h
%{_includedir}/GLES/gl.h
%{_includedir}/GLES/glext.h
%{_includedir}/GLES/glplatform.h
%{_includedir}/GLES2/gl2platform.h
%{_includedir}/GLES2/gl2.h
%{_includedir}/GLES2/gl2ext.h
%{_libdir}/pkgconfig/glesv1_cm.pc
%{_libdir}/pkgconfig/glesv2.pc
%{_libdir}/libGLESv1_CM.so
%{_libdir}/libGLESv2.so

%files libGLU
%defattr(-,root,root,-)
%{_libdir}/libGLU.so.1
%{_libdir}/libGLU.so.1.3.*

%files libGLU-devel
%defattr(-,root,root,-)
%{_libdir}/libGLU.so
%{_libdir}/pkgconfig/glu.pc
%{_includedir}/GL/glu.h
%{_includedir}/GL/glu_mangle.h
%{_datadir}/man/man3/glu*.3gl*

%files libOSMesa
%defattr(-,root,root,-)
%doc docs/COPYING
%{_libdir}/libOSMesa.so.7*

%files libOSMesa-devel
%defattr(-,root,root,-)
%{_includedir}/GL/osmesa.h
%{_libdir}/libOSMesa.so

%changelog
* Thu Jan 20 2011 Ben Skeggs <bskeggs@redhat.com> 7.10-0.23
- nouveau: nvc0 (fermi) backport + nv10/nv20 gnome-shell fixes

* Tue Jan 18 2011 Adam Jackson <ajax@redhat.com> 7.10-0.22
- Add -dri-filesystem common subpackage for directory and COPYING
- Add -dri-llvmcore subpackage and buildsystem hack

* Tue Jan 18 2011 Adam Jackson <ajax@redhat.com> 7.10-0.21
- Fix the s390 case a different way
- s/i686/%%{ix86}
- Add libudev support for wayland (Casey Dahlin)

* Tue Jan 18 2011 Dan Horák <dan[at]danny.cz> 7.10-0.20
- updated for s390(x), r300 is really built even when with_hardware == 0

* Tue Jan 18 2011 Dave Airlie <airlied@redhat.com> 7.10-0.19
- split out DRI1 drivers to reduce package size.

* Fri Jan 07 2011 Dave Airlie <airlied@redhat.com> 7.10-0.18
- new snapshot from 7.10 branch (include Radeon HD6xxx support)

* Thu Dec 16 2010 Dave Airlie <airlied@redhat.com> 7.10-0.17
- new snapshot from 7.10 branch

* Wed Dec 15 2010 Adam Jackson <ajax@redhat.com> 7.10-0.16
- Today's (yesterday's) git snap.
- Switch the sourceball to xz.

* Mon Dec 06 2010 Adam Jackson <ajax@redhat.com> 7.10-0.15
- Really disable gallium EGL.  Requires disabling OpenVG due to buildsystem
  nonsense.  Someone fix that someday. (Patch from krh)

* Thu Dec 02 2010 Adam Jackson <ajax@redhat.com> 7.10-0.14
- --disable-gallium-egl

* Wed Dec 01 2010 Dan Horák <dan[at]danny.cz> 7.10-0.13
- workaround failing build on s390(x)

* Mon Nov 29 2010 Adam Jackson <ajax@redhat.com> 7.10-0.12
- Today's git snap.

* Thu Nov 18 2010 Adam Jackson <ajax@redhat.com> 7.10-0.11
- Today's git snap.
- Build with -fno-omit-frame-pointer for profiling.
- Install swrastg as the swrast driver.
- legacy-drivers.patch: Disable swrast classic.

* Mon Nov 15 2010 Adam Jackson <ajax@redhat.com>
- Drop Requires: mesa-dri-drivers from -experimental, not needed in a non-
  dricore build.
- Drop Requires: mesa-dri-drivers from -libGL, let comps do that.

* Thu Nov 11 2010 Adam Jackson <ajax@redhat.com> 7.10-0.10
- Build libOpenVG too
- Add X driver ABI magic for vmwgfx
- Linker script hack for swrastg to make it slightly less offensively huge

* Mon Nov 08 2010 Dave Airlie <airlied@redhat.com> 7.10-0.9
- update to latest git snap + enable r600g by default

* Sat Nov 06 2010 Dave Airlie <airlied@redhat.com> 7.10-0.8
- enable EGL/GLES

* Wed Nov 03 2010 Dave Airlie <airlied@redhat.com> 7.10-0.7
- fix r300g selection

* Tue Nov 02 2010 Adam Jackson <ajax@redhat.com> 7.10-0.6
- Use standard CFLAGS
- Move swrastg_dri to -experimental

* Mon Nov 01 2010 Adam Jackson <ajax@redhat.com> 7.10-0.5
- BR: llvm-static not llvm-devel (#627965)

* Thu Oct 28 2010 Adam Jackson <ajax@redhat.com> 7.10-0.4
- -dri-drivers-experimental Requires dri-drivers (#556789)

* Thu Oct 28 2010 Adam Jackson <ajax@redhat.com> 7.10-0.3
- Drop demos and glx-utils subpackages, they have their own source package
  now. (#605719)

* Wed Oct 20 2010 Adam Jackson <ajax@redhat.com> 7.10-0.2
- git snapshot, fixes osmesa linking issues

* Wed Oct 20 2010 Adam Jackson <ajax@redhat.com> 7.10-0.1
- git snapshot
- Drop osmesa16 and osmesa32, nothing's using them

* Tue Aug 24 2010 Dave Airlie <airlied@redhat.com> 7.9-0.7
- latest git snapshot - enable talloc/llvm links

* Tue Jul 20 2010 Dave Airlie <airlied@redhat.com> 7.9-0.6
- snapshot latest git

* Fri Jul 09 2010 Dave Airlie <airlied@redhat.com> 7.9-0.5
- resnapshot latest git

* Thu Jul 08 2010 Adam Jackson <ajax@redhat.com> 7.9-0.4
- Install COPYING like we ought to.

* Thu Jun 24 2010 Dan Horák <dan[at]danny.cz> 7.9-0.3
- add libtool (needed by mesa-demos) to BR: - normally it's brought via
    xorg-x11-util-macros and xorg-x11-server-devel, but not on platforms
    without hardware drivers
- build gallium drivers and the dri-drivers-experimental subpackage only
    when hardware drivers are requested

* Sat Jun 12 2010 Dave Airlie <airlied@redhat.com> 7.9-0.2
- rebase to git snapshot with TFP fixes for r300 + gallium - enable r300g

* Sun May 30 2010 Dave Airlie <airlied@redhat.com> 7.9-0.1
- rebase to a git snapshot - disable vmwgfx

* Mon Feb 08 2010 Ben Skeggs <bskeggs@redhat.com> 7.8-0.16
- patch mesa to enable legacy nouveau driver build on i386

* Mon Feb 08 2010 Ben Skeggs <bskeggs@redhat.com> 7.8-0.15
- rebase for legacy nouveau drivers

* Thu Feb 04 2010 Dave Airlie <airlied@redhat.com> 7.8-0.14
- rebase again to fix r300

* Wed Feb 03 2010 Dave Airlie <airlied@redhat.com> 7.8-0.13
- update dri2proto requirement
- add nouveau to experimental drivers set

* Wed Jan 27 2010 Dave Airlie <airlied@redhat.com> 7.8-0.12
- Fix radeon colors for rawhide

* Thu Jan 21 2010 Dave Airlie <airlied@redhat.com> 7.8-0.11
- rebase for new DRI2 API

* Fri Jan 08 2010 Dave Airlie <airlied@redhat.com> 7.8-0.10
- rebase to new snapshot with fix for radeon in it

* Thu Jan 07 2010 Dave Airlie <airlied@redhat.com> 7.8-0.9
- Disable dricore for now as it conflicts with upstream vis changes

* Wed Jan 06 2010 Dave Airlie <airlied@redhat.com> 7.8-0.8
- update to latest snapshot and fixup build