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

Summary: A library for handling OpenGL function pointer management
Name: libepoxy
Version: 1.2
Release: 1%{?_dist_release}
License: MIT
Group: System Environment/Libraries
URL: https://github.com/anholt/libepoxy

Source0: %{name}-%{version}.tar.gz

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

BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libEGL-devel
BuildRequires: mesa-libGLES-devel
BuildRequires: xorg-x11-util-macros
BuildRequires: python
BuildRequires: autoconf
BuildRequires: libtool

Vendor: Project Vine
Distribution: Vine Linux
Packager: Takemikaduchi

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

%package devel
Summary: Development tools for %{name}
Summary(ja): %{name} の開発環境
Group: Development/Libraries
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 Environment/Libraries
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: Development/Libraries
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}.

%prep
%setup -q
sed -i "s|python3||g" configure.ac

%build
autoreconf -if
%configure --disable-static
make %{?smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} \;

%clean
rm -rf $RPM_BUILD_ROOT

%check
make check

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%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
* Sat Nov 22 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2-1
- initial build

