File glfw.spec of Package glfw

#
# spec file for package glfw
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%if 0%{?is_opensuse}
%bcond_without geany
%else
%bcond_with geany
%endif
Name:           glfw
Version:        3.1.2
Release:        0
Summary:        Portable framework for OpenGL application development
License:        Zlib
Group:          Development/Libraries/C and C++
%define sover  3
Url:            http://www.glfw.org/

Source:         https://github.com/glfw/glfw/archive/%version.tar.gz
BuildRequires:  cmake >= 2.8.12
BuildRequires:  doxygen
BuildRequires:  gcc-c++
%if %{with geany}
BuildRequires:  geany
%endif
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xrandr)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GLFW is a free, Open Source, portable framework for OpenGL application
development. In short, it is a single library providing a powerful,
portable API for otherwise operating system specific tasks such as opening
an OpenGL window, and reading keyboard, time, mouse and joystick input.

%package -n libglfw%{sover}
Summary:        Portable framework for OpenGL application development
Group:          System/Libraries

%description -n libglfw%{sover}
GLFW is a free, Open Source, portable framework for OpenGL application
development. In short, it is a single library providing a powerful,
portable API for otherwise operating system specific tasks such as opening
an OpenGL window, and reading keyboard, time, mouse and joystick input.

%package -n libglfw-devel
Summary:        Portable framework for OpenGL application development
Group:          Development/Libraries/C and C++
Requires:       cmake
Requires:       libglfw%{sover} = %{version}

%description -n libglfw-devel
GLFW is a free, Open Source, portable framework for OpenGL application
development. In short, it is a single library providing a powerful,
portable API for otherwise operating system specific tasks such as opening
an OpenGL window, and reading keyboard, time, mouse and joystick input.

%prep
%setup -q
find . -type f | xargs sed -i 's/\r//'

# temp geany config directory for allow geany to generate tags
mkdir -p geany_config

%build
%cmake -DCMAKE_INSTALL_PREFIX=%{_prefix}
make %{?_smp_mflags} all
%if %{with geany}
# generate geany tags
geany -c geany_config -g glfw.c.tags $(find src \( ! -name CMakeFiles \) -type f \( -iname "*.c" -o -iname "*.h" \) \( ! -iname "win32*" \) \( ! -iname "cocoa*" \)
) include/GL/glfw3.h
%endif

%install
cd build
make %{?_smp_mflags} install PREFIX=%{_prefix} LIBDIR=%{_lib} DESTDIR=%{buildroot}
%if %{with geany}
# install geany tags
install -d %{buildroot}/%{_datadir}/geany/tags/
install -m0644 glfw.c.tags %{buildroot}/%{_datadir}/geany/tags/
%endif

%post   -n libglfw%{sover} -p /sbin/ldconfig
%postun -n libglfw%{sover} -p /sbin/ldconfig

%files -n libglfw%{sover}
%defattr(-,root,root)
%doc COPYING.txt README.md
%{_libdir}/libglfw.so.*

%files -n libglfw-devel
%defattr(-,root,root)
%doc examples/*.c
%{_includedir}/GLFW/
%{_libdir}/cmake/glfw/
%{_libdir}/libglfw.so
%{_libdir}/pkgconfig/glfw3.pc
%if %{with geany}
%{_datadir}/geany/
%endif

%changelog
openSUSE Build Service is sponsored by