Name:           libglvnd
Version:        1.2.0
Release:        3
Epoch:          1
Summary:        The GL Vendor-Neutral Dispatch library
License:        MIT
URL:            https://github.com/NVIDIA/libglvnd
Source0:        https://github.com/NVIDIA/libglvnd/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  libtool xorg-x11-server-Xvfb pkgconfig(xext) pkgconfig(x11)
BuildRequires:  gcc python3-rpm-macros python3-libxml2 pkgconfig(glproto)

Requires:       mesa-libEGL%{?_isa} >= 13.0.4-1
Requires:       mesa-libGL%{?_isa} >= 13.0.4-1

Provides:       %{name}-egl %{name}-egl%{?_isa} %{name}-gles %{name}-gles%{?_isa} %{name}-glx
Obsoletes: 	%{name}-egl %{name}-gles %{name}-glx
Provides:       %{name}-glx%{?_isa} %{name}-opengl %{name}-opengl%{?_isa} libGLES libGLES%{?_isa}
Obsoletes:      %{name}-opengl libGLES 
Provides:       libEG  libEGL  libEGL%{?_isa} libGL libGL%{?_isa}
Obsoletes:      libEG  libEGL libGL 

%description
libglvnd is a vendor-neutral dispatch layer for arbitrating OpenGL API calls between multiple vendors.
It allows multiple drivers from different vendors to coexist on the same filesystem, and determines
which vendor to dispatch each API call to at runtime.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Provides:       libglvnd-core-devel = %{epoch}:%{version}-%{release}
Obsoletes:      libglvnd-core-devel < %{epoch}:%{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%autosetup -n %{name}-%{version} -p1
autoreconf -vif

%build
export PYTHON=%{__python3}
%configure --enable-asm --enable-tls

%make_build V=1

%install
%make_install
%delete_la

mkdir -p %{buildroot}%{_sysconfdir}/glvnd/egl_vendor.d/
mkdir -p %{buildroot}%{_datadir}/glvnd/egl_vendor.d/
mkdir -p %{buildroot}%{_sysconfdir}/egl/egl_external_platform.d/
mkdir -p %{buildroot}%{_datadir}/egl/egl_external_platform.d/

%check
export DO_X11_TESTS=1
xvfb-run -s '-screen 0 640x480x24' -d make check V=1 || (cat `find . -name test-suite.log` ; exit 1)

%ldconfig_scriptlets

%files
%defattr(-,root,root)
%doc README.md
%{_libdir}/*.so.*
%dir %{_sysconfdir}/glvnd/egl_vendor.d/
%dir %{_sysconfdir}/egl/egl_external_platform.d/
%dir %{_datadir}/glvnd/egl_vendor.d/
%dir %{_datadir}/egl/egl_external_platform.d/

%files devel
%defattr(-,root,root)
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/libglvnd.pc
%{_includedir}/glvnd/*
%exclude %{_includedir}/*G*
%exclude %{_includedir}/KHR
%exclude %{_libdir}/pkgconfig/g*.pc
%exclude %{_libdir}/pkgconfig/*gl.pc

%changelog
* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 1:1.2.0-3
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:delete the arch in obsoletes

* Tue Jan 14 2020 openEuler Buildteam <buildteam@openeuler.org> - 1:1.2.0-2
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:optimization the spec

* Fri Jan 10 2020 openEuler Buildteam <buildteam@openeuler.org> - 1:1.2.0-1
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:updtae to 1.2.0

* Tue Oct 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:1.1.0-4
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:change the provides of libglvnd-core-devel

* Tue Sep 17 2019 openEuler Buildteam <buildteam@openeuler.org> - 1:1.1.0-3
- Package init
