[packages/glfw2] - new, last glfw 2.x as parallel-installable with glfw 3.x

qboosh qboosh at pld-linux.org
Fri Jan 3 17:50:39 CET 2014


commit 431b1b2d047b11b2fd6d359db862706e94cdf93c
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Jan 3 17:51:04 2014 +0100

    - new, last glfw 2.x as parallel-installable with glfw 3.x

 glfw2-libdir.patch |  59 +++++++++++++++++++++++
 glfw2-opt.patch    |  49 +++++++++++++++++++
 glfw2-soname.patch |  20 ++++++++
 glfw2.spec         | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 264 insertions(+)
---
diff --git a/glfw2.spec b/glfw2.spec
new file mode 100644
index 0000000..07dfd88
--- /dev/null
+++ b/glfw2.spec
@@ -0,0 +1,136 @@
+# NOTE: this spec contains the last glfw 2.x for backward compatibility,
+# built as parallel-installable with glfw 3.x.
+# The only change required at build time is to change "-lglfw" to "-lglfw2".
+Summary:	Free, portable framework for OpenGL application development
+Summary(pl.UTF-8):	Wolnodostępny, przenośny szkielet do tworzenia aplikacji OpenGL
+Name:		glfw2
+Version:	2.7.9
+Release:	1
+License:	BSD-like
+Group:		Libraries
+Source0:	http://downloads.sourceforge.net/glfw/glfw-%{version}.tar.bz2
+# Source0-md5:	96e12be48801984f0f0c23e38549b277
+Patch0:		%{name}-opt.patch
+Patch1:		%{name}-libdir.patch
+Patch2:		%{name}-soname.patch
+URL:		http://glfw.sourceforge.net/
+BuildRequires:	OpenGL-GLU-devel
+BuildRequires:	OpenGL-GLX-devel
+BuildRequires:	libtool
+BuildRequires:	sed >= 4.0
+BuildRequires:	xorg-lib-libX11-devel
+BuildRequires:	xorg-lib-libXxf86vm-devel
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%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, mouse and joystick
+input.
+
+It also provides functions for reading a high precision timer,
+accessing OpenGL extensions, creating and synchronizing threads,
+reading textures from files and more.
+
+GLFW is available for Windows, MacOS X, Unix-like systems such as
+Linux and FreeBSD, and for AmigaOS and DOS.
+
+%description -l pl.UTF-8
+GLFW to wolnodostępny, mający otwarte źródła, przenośny szkielet do
+tworzenia aplikacji OpenGL. W skrócie jest to pojedyncza biblioteka
+udostępniająca potężne, przenośne API do zadań zależnych od systemu
+operacyjnego, takich jak otwieranie okna OpenGL, odczyt wejścia z
+klawiatury, myszy i joysticka.
+
+Zawiera także funkcje do odczytu zegara o wysokiej rozdzielczości,
+dostępu do rozszerzeń OpenGL, tworzenia i synchronizowania wątków,
+odczytu tekstur z plików i innych zadań.
+
+GLFW jest dostępny dla Windows, MacOS X, systemów uniksowych takich
+jak Linux czy FreeBSD oraz dla AmigaOS i DOS-a.
+
+%package devel
+Summary:	Header files for GLFW 2 library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki GLFW 2
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+Requires:	OpenGL-GLX-devel
+Requires:	xorg-lib-libX11-devel
+Requires:	xorg-lib-libXxf86vm-devel
+
+%description devel
+Header files for GLFW 2 library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki GLFW 2.
+
+%package static
+Summary:	Static GLFW 2 library
+Summary(pl.UTF-8):	Statyczna biblioteka GLFW 2
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static GLFW 2 library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka GLFW 2.
+
+%prep
+%setup -q -n glfw-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+%build
+CC="%{__cc}" \
+LFLAGS="%{rpmldflags}" \
+CFLAGS="%{rpmcflags}" \
+sh ./compile.sh
+
+%{__make} -C lib/x11 -f Makefile.x11 \
+	PREFIX=%{_prefix} \
+	LIBDIR=%{_libdir}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+
+%{__make} -C lib/x11 -f Makefile.x11 dist-install \
+	DESTDIR=$RPM_BUILD_ROOT \
+	PREFIX=%{_prefix} \
+	LIBDIR=%{_libdir}
+
+install examples/{*.c,*.tga,Makefile.x11} $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
+
+# make it parallel-installable with glfw 3.x (from glfw.spec)
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/{libglfw.so,libglfw.so.%{version}}
+ln -sf libglfw.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libglfw.so.2
+ln -sf libglfw.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libglfw2.so
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/{libglfw.a,libglfw2.a}
+%{__sed} -i -e 's,-lglfw,-lglfw2,' $RPM_BUILD_ROOT%{_pkgconfigdir}/libglfw.pc
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc COPYING.txt readme.html
+%attr(755,root,root) %{_libdir}/libglfw.so.2.*.*
+%attr(755,root,root) %ghost %{_libdir}/libglfw.so.2
+
+%files devel
+%defattr(644,root,root,755)
+%doc docs/{Reference,UsersGuide}.pdf
+%attr(755,root,root) %{_libdir}/libglfw2.so
+%{_includedir}/GL/glfw.h
+%{_pkgconfigdir}/libglfw.pc
+%{_examplesdir}/%{name}-%{version}
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libglfw2.a
diff --git a/glfw2-libdir.patch b/glfw2-libdir.patch
new file mode 100644
index 0000000..ab7943f
--- /dev/null
+++ b/glfw2-libdir.patch
@@ -0,0 +1,59 @@
+--- glfw-2.7.9/lib/x11/Makefile.x11.in.orig	2013-05-30 16:07:32.000000000 +0200
++++ glfw-2.7.9/lib/x11/Makefile.x11.in	2014-01-02 21:39:16.648051292 +0100
+@@ -3,7 +3,8 @@
+ # Installation prefix (default to /usr/local)
+ ##########################################################################
+ PREFIX ?= /usr/local
+-
++LIBDIR ?= $(PREFIX)/lib
++DESTDIR ?= 
+ 
+ ##########################################################################
+ # Default: Build GLFW static library
+@@ -26,19 +27,19 @@
+ # Install GLFW static library
+ ##########################################################################
+ install: libglfw.a libglfw.pc
+-	$(INSTALL) -d $(PREFIX)/lib
+-	$(INSTALL) -c -m 644 libglfw.a $(PREFIX)/lib/libglfw.a
+-	$(INSTALL) -d $(PREFIX)/include/GL
+-	$(INSTALL) -c -m 644 ../../include/GL/glfw.h $(PREFIX)/include/GL/glfw.h
+-	$(INSTALL) -d $(PREFIX)/lib/pkgconfig
+-	$(INSTALL) -c -m 644 libglfw.pc $(PREFIX)/lib/pkgconfig/libglfw.pc
++	$(INSTALL) -d $(DESTDIR)$(LIBDIR)
++	$(INSTALL) -c -m 644 libglfw.a $(DESTDIR)$(LIBDIR)/libglfw.a
++	$(INSTALL) -d $(DESTDIR)$(PREFIX)/include/GL
++	$(INSTALL) -c -m 644 ../../include/GL/glfw.h $(DESTDIR)$(PREFIX)/include/GL/glfw.h
++	$(INSTALL) -d $(DESTDIR)$(LIBDIR)/pkgconfig
++	$(INSTALL) -c -m 644 libglfw.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libglfw.pc
+ 
+ 
+ ##########################################################################
+ # Install GLFW static and shared libraries
+ ##########################################################################
+ dist-install: libglfw.so install
+-	$(INSTALL) -c -m 644 libglfw.so $(PREFIX)/lib/libglfw.so
++	$(INSTALL) -c -m 644 libglfw.so $(DESTDIR)$(LIBDIR)/libglfw.so
+ 
+ 
+ ##########################################################################
+@@ -99,7 +100,7 @@
+ # Rule for building libglfw.pc
+ ##########################################################################
+ libglfw.pc: libglfw.pc.in
+-	$(SED) -e 's,\@PREFIX\@,$(PREFIX),' libglfw.pc.in > libglfw.pc
++	$(SED) -e 's,\@PREFIX\@,$(PREFIX),;s,\@LIBDIR\@,$(LIBDIR),' libglfw.pc.in > libglfw.pc
+ 
+ 
+ ##########################################################################
+--- glfw-2.7.9/compile.sh.orig	2014-01-02 21:35:52.898059835 +0100
++++ glfw-2.7.9/compile.sh	2014-01-02 21:40:16.361382033 +0100
+@@ -705,7 +705,7 @@
+ prefix=@PREFIX@
+ exec_prefix=\${prefix}
+ includedir=\${prefix}/include
+-libdir=\${exec_prefix}/lib
++libdir=@LIBDIR@
+ 
+ Name: GLFW
+ Description: A portable framework for OpenGL development
diff --git a/glfw2-opt.patch b/glfw2-opt.patch
new file mode 100644
index 0000000..c1c6601
--- /dev/null
+++ b/glfw2-opt.patch
@@ -0,0 +1,49 @@
+--- glfw-2.7.1/compile.sh.orig	2011-06-28 05:55:28.000000000 +0200
++++ glfw-2.7.1/compile.sh	2011-07-30 18:04:01.660628707 +0200
+@@ -107,35 +107,8 @@
+ ##########################################################################
+ echo -n "Checking for X11 libraries location... " 1>&6
+ 
+-if [ -r "/usr/X11/lib" ]; then
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11/lib"
+-  GLFW_CFLAGS="-I/usr/X11/include $GLFW_CFLAGS"
+-  echo "/usr/X11/lib" 1>&6
+-elif [ -r "/usr/X11R7/lib" ]; then
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R7/lib"
+-  GLFW_CFLAGS="-I/usr/X11R7/include $GLFW_CFLAGS"
+-  echo "/usr/X11R7/lib" 1>&6
+-elif [ -r "/usr/X11R6/lib" ]; then
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R6/lib"
+-  GLFW_CFLAGS="-I/usr/X11R6/include $GLFW_CFLAGS"
+-  echo "/usr/X11R6/lib" 1>&6
+-elif [ -r "/usr/X11R5/lib" ]; then
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X11R5/lib"
+-  GLFW_CFLAGS="-I/usr/X11R5/include $GLFW_CFLAGS"
+-  echo "/usr/X11R5/lib" 1>&6
+-elif [ -r "/opt/X11R6/lib" ]; then
+-  # This location is used on QNX
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/opt/X11R6/lib"
+-  GLFW_CFLAGS="-I/opt/X11R6/include $GLFW_CFLAGS"
+-  echo "/opt/X11R6/lib" 1>&6
+-elif [ -r "/usr/X/lib" ]; then
+-  GLFW_LFLAGS="$GLFW_LFLAGS -L/usr/X/lib"
+-  GLFW_CFLAGS="-I/usr/X/include $GLFW_CFLAGS"
+-  echo "/usr/X/lib" 1>&6
+-else
+   # TODO: Detect and report X11R7 in /usr/lib
+   echo "unknown (assuming linker will find them)" 1>&6
+-fi
+ 
+ 
+ ##########################################################################
+@@ -571,9 +544,7 @@
+ 
+ if [ "x$CFLAGS" = x ]; then
+   if [ "x$use_gcc" = xyes ]; then
+-    GLFW_CFLAGS="$GLFW_CFLAGS -O2 -Wall"
+-  else
+-    GLFW_CFLAGS="$GLFW_CFLAGS -O"
++    GLFW_CFLAGS="$GLFW_CFLAGS -Wall"
+   fi
+ fi
+ 
diff --git a/glfw2-soname.patch b/glfw2-soname.patch
new file mode 100644
index 0000000..69722fa
--- /dev/null
+++ b/glfw2-soname.patch
@@ -0,0 +1,20 @@
+--- glfw-2.7.9/compile.sh.orig	2014-01-02 21:40:39.754714463 +0100
++++ glfw-2.7.9/compile.sh	2014-01-03 16:50:29.355152575 +0100
+@@ -88,7 +88,7 @@
+ case "x`uname 2> /dev/null`" in
+ xLinux)
+   GLFW_LIB_CFLAGS="$GLFW_LIB_CFLAGS -D_GLFW_USE_LINUX_JOYSTICKS"
+-  SOFLAGS="-shared -Wl,-soname,libglfw.so"
++  SOFLAGS="-shared -Wl,-soname,libglfw.so.2"
+   echo "Linux" 1>&6
+   ;;
+ xDarwin)
+@@ -96,7 +96,7 @@
+   echo "Mac OS X" 1>&6
+   ;;
+ *)
+-  SOFLAGS="-shared -soname libglfw.so"
++  SOFLAGS="-shared -soname libglfw.so.2"
+   echo "Generic Unix" 1>&6
+   ;;
+ esac
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/glfw2.git/commitdiff/431b1b2d047b11b2fd6d359db862706e94cdf93c



More information about the pld-cvs-commit mailing list