%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: A library for handling OpenGL function pointer management
Name: libepoxy
Version: 1.5.7
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: MIT
URL: https://github.com/anholt/libepoxy
Source0: https://github.com/anholt/libepoxy/releases/download/%{version}/%{name}-%{version}.tar.xz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: meson
BuildRequires: gcc
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(egl)
BuildRequires: libGL-devel
BuildRequires: libX11-devel
BuildRequires: pkgconfig(glesv2)
BuildRequires: python3
BuildRequires: xorg-x11-server-Xvfb mesa-dri-drivers xorg-x11-xauth

%description
Epoxy is a library for handling OpenGL function pointer management for you.


%package devel
Summary: Development tools for %{name}
Summary(ja): %{name} の開発環境
Group: programming
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
Header files and libraries for building a extension library for the %{name}.


# compat32
%package -n compat32-%{name}
Summary: A library for handling OpenGL function pointer management
Group: system,legaxy
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
Epoxy is a library for handling OpenGL function pointer management for you.


%package -n compat32-%{name}-devel
Summary: Development tools for compat32-%{name}
Summary(ja): compat32-%{name} の開発環境
Group: programming,legaxy
Requires: compat32-%{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
Header files and libraries for building a extension library for the compat32-%{name}.


%debug_package


%prep
%setup -q


%build
%meson -Degl=yes
%meson_build


%install
rm -rf $RPM_BUILD_ROOT
%meson_install


%clean
rm -rf $RPM_BUILD_ROOT

%if 0
%check
# this should be %%meson_test but the macro expands with a bajillion
# embedded newlines for no obvious reason
xvfb-run -d -s "-screen 0 640x480x24" ninja -C %{_vpath_builddir} test || \
    (cat %{_vpath_builddir}/meson-logs/testlog.txt ; exit 1)
%endif


%files
%defattr(-,root,root,-)
%license COPYING
%doc README.md
%{_libdir}/libepoxy.so.*

%files devel
%defattr(-,root,root,-)
%{_includedir}/epoxy
%{_libdir}/libepoxy.so
%{_libdir}/pkgconfig/epoxy.pc

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root,-)
%{_libdir}/libepoxy.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root,-)
%{_libdir}/libepoxy.so
%endif

%changelog
* Tue May 11 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.7-1
- new upstream release.

* Sat Apr 10 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.5-1
- new upstream release.
- dropped ldconfig scriptlets.

* Fri Aug 07 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.4-2
- enabled egl.

* Tue May 05 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.4-1
- new upstream release.

* Thu Oct 29 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.3.1-1
- new upstream release

* Sat Nov 22 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2-1
- initial build