Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jun 2008 07:39:27 GMT
From:      thierry@FreeBSD.org
To:        vmagerya@gmail.com, thierry@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org, thierry@FreeBSD.org
Subject:   Re: ports/123532: Upgrade port graphics/glfw to 2.6 [+patch]
Message-ID:  <200806150739.m5F7dR5x089883@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
Synopsis: Upgrade port graphics/glfw to 2.6 [+patch]

State-Changed-From-To: open->feedback
State-Changed-By: thierry
State-Changed-When: Dim 15 jui 2008 07:33:19 UTC
State-Changed-Why: 

This port fails if Xrandr is not installed. Since I was here, I propose
some other modifications - see the hereunder patch, which includes:

- no -pthread in CFLAGS, use PTHREAD_CFLAGS;

- Xrandr seems required;

- won't build if no symlink to /usr/X11R6, then use REINPLACE_CMD;

- install the pkgconfig file;

- install the shared library;

- don't force CFLAGS to -O3;

- handle NOPORTEXAMPLES.

Could you please check it?

--- glfw.diff begins here ---
diff -urN graphics/glfw.orig/Makefile graphics/glfw/Makefile
--- graphics/glfw.orig/Makefile	2008-04-21 21:45:28.000000000 +0200
+++ graphics/glfw/Makefile	2008-06-15 00:21:09.000000000 +0200
@@ -6,8 +6,7 @@
 #
 
 PORTNAME=	glfw
-PORTVERSION=	2.5.0
-PORTREVISION=	2
+PORTVERSION=	2.6
 CATEGORIES=	graphics
 MASTER_SITES=	SF
 
@@ -15,26 +14,31 @@
 COMMENT=	A portable framework for OpenGL development
 
 USE_BZIP2=	yes
-USE_XORG=	x11 xxf86vm xext
+USE_XORG=	x11 xxf86vm xext xrandr
 USE_GL=		yes
+USE_LDCONFIG=	yes
 ALL_TARGET=	x11
-WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION:R}
+INSTALL_TARGET=	x11-install
+WRKSRC=		${WRKDIR}/${PORTNAME}
+
+pre-configure:
+	${REINPLACE_CMD} -e 's|/usr/X11R6|${X11BASE}|' ${WRKSRC}/compile.sh
 
 do-configure:
 	@(cd ${WRKSRC} &&		\
 	${SETENV} CC="${CC}"		\
 		  CFLAGS="${CFLAGS}"	\
-		  PTHREAD_LIBS="${PTHREAD_LIBS}" ./compile.sh)
-
-do-install:
-	${INSTALL_DATA} ${WRKSRC}/lib/x11/libglfw.a ${PREFIX}/lib
-	${INSTALL_DATA} ${WRKSRC}/include/GL/glfw.h ${PREFIX}/include/GL
+		  PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" PTHREAD_LIBS="${PTHREAD_LIBS}" ${SH} compile.sh)
 
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/lib/x11/libglfw.so ${PREFIX}/lib/libglfw.so.0
+	${LN} -sf ${PREFIX}/lib/libglfw.so.0 ${PREFIX}/lib/libglfw.so
+.ifndef (NOPORTEXAMPLES)
 	@${MKDIR} ${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/examples/Makefile.x11 ${EXAMPLESDIR}/makefile
 	${INSTALL_DATA} ${WRKSRC}/examples/*.c ${EXAMPLESDIR}
 	${INSTALL_DATA} ${WRKSRC}/examples/*.tga ${EXAMPLESDIR}
-
+.endif
 .ifndef (NOPORTDOCS)
 	@${MKDIR} ${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/docs/*.pdf ${DOCSDIR}
diff -urN graphics/glfw.orig/distinfo graphics/glfw/distinfo
--- graphics/glfw.orig/distinfo	2006-01-22 13:34:51.000000000 +0100
+++ graphics/glfw/distinfo	2008-06-14 21:45:44.000000000 +0200
@@ -1,3 +1,3 @@
-MD5 (glfw-2.5.0.tar.bz2) = c6dffefbfbe4415c915851b09e76edd9
-SHA256 (glfw-2.5.0.tar.bz2) = cbf1164baebb00cc27039a406c873794e2b70caa0af0ae3348ed5062ecc26816
-SIZE (glfw-2.5.0.tar.bz2) = 645993
+MD5 (glfw-2.6.tar.bz2) = 0d9b93e6194c3805be9e1c855a985a24
+SHA256 (glfw-2.6.tar.bz2) = 1b86ca8c5678fbf6999a0bfbe50de121f8aec9c07bf2383306819caebe3edfca
+SIZE (glfw-2.6.tar.bz2) = 886843
diff -urN graphics/glfw.orig/files/patch-compile.sh graphics/glfw/files/patch-compile.sh
--- graphics/glfw.orig/files/patch-compile.sh	2008-04-21 21:45:28.000000000 +0200
+++ graphics/glfw/files/patch-compile.sh	2008-06-14 23:23:28.000000000 +0200
@@ -1,121 +1,73 @@
---- compile.sh.orig	2004-07-25 00:36:46.000000000 +0400
-+++ compile.sh	2008-03-20 05:20:39.000000000 +0300
-@@ -72,10 +72,10 @@
- ##########################################################################
- if [ "x$force_gcc" = xyes ]; then
-   CC=gcc
--else
--  CC=${CC-cc}
-+#else
-+#  CC=${CC-cc}
+--- compile.sh.orig	2007-07-01 11:46:46.000000000 +0200
++++ compile.sh	2008-06-14 23:22:27.000000000 +0200
+@@ -63,7 +63,7 @@
+   CC=cc
  fi
+ 
 -CFLAGS=
 +#CFLAGS=
  LFLAGS=
+ LDFLAGS=
  INCS=
- LIBS="-lGL -lX11"
-@@ -99,10 +99,10 @@
-  INCS="-I/usr/X11/include"
-  echo " X11 libraries location: /usr/X11/lib" 1>&6
- # X11R6 in /usr/X11R6/lib ?
--elif [ -r "/usr/X11R6/lib" ]; then
-- LFLAGS="$LFLAGS -L/usr/X11R6/lib"
-- INCS="-I/usr/X11R6/include"
-- echo " X11 libraries location: /usr/X11R6/lib" 1>&6
-+elif [ -r "${LOCALBASE}/lib" ]; then
-+ LFLAGS="$LFLAGS -L${LOCALBASE}/lib"
-+ INCS="-I${LOCALBASE}/include"
-+ echo " X11 libraries location: ${LOCALBASE}/lib" 1>&6
- # X11R5 in /usr/X11R5/lib ?
- elif [ -r "/usr/X11R5/lib" ]; then
-  LFLAGS="$LFLAGS -L/usr/X11R5/lib"
-@@ -145,9 +145,9 @@
+@@ -164,10 +164,10 @@
+ fi
  rm -f conftest*
  
- echo " Using GNU C: ""$use_gcc" 1>&6
+-echo " Using GNU C: ""$use_gcc" 1>&6
 -if [ "x$use_gcc" = xyes ]; then
 -  CC=gcc
 -fi
++#echo " Using GNU C: ""$use_gcc" 1>&6
 +#if [ "x$use_gcc" = xyes ]; then
 +#  CC=gcc
 +#fi
  echo " " 1>&6
  
  
-@@ -169,6 +169,8 @@
- int main() {; return 0;}
+@@ -254,11 +254,11 @@
  EOF
  
-+CFLAGS="${CFLAGS} -I${LOCALBASE}/include"
-+
- if { (eval echo $config_script: \"$compile\") 1>&5; (eval $compile) 2>&5; }; then
+ # Try -pthread (most systems)
+-CFLAGS_THREAD="-pthread"
++CFLAGS_THREAD="$PTHREAD_CFLAGS"
+ CFLAGS_OLD="$CFLAGS"
+ CFLAGS="$CFLAGS $CFLAGS_THREAD"
+ LIBS_OLD="$LIBS"
+-LIBS="$LIBS -pthread"
++LIBS="$LIBS ${PTHREAD_LIBS}"
+ if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
    rm -rf conftest*
-   has_xf86vm=yes
-@@ -200,18 +202,10 @@
+   has_pthread=yes
+@@ -267,20 +267,6 @@
+   cat conftest.c >&5
+ fi
  
- # Try -lpthread (most systems)
- LIBS_OLD="$LIBS"
--LIBS="$LIBS -lpthread"
--if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
--  rm -rf conftest*
--  has_pthread=yes
--else
--  echo "$config_script: failed program was:" >&5
--  cat conftest.c >&5
+-# Try -lpthread 
+-if [ "x$has_pthread" = xno ]; then
+-  CFLAGS_THREAD="-D_REENTRANT"
+-  CFLAGS="$CFLAGS_OLD $CFLAGS_THREAD" 
+-  LIBS="$LIBS_OLD -lpthread"
+-  if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
+-    rm -rf conftest*
+-    has_pthread=yes
+-  else
+-    echo "$config_script: failed program was:" >&5
+-    cat conftest.c >&5
+-  fi
 -fi
- 
- # Try -pthread (e.g. FreeBSD)
+-
+ # Try -lsocket (e.g. QNX)
  if [ "x$has_pthread" = xno ]; then
--  LIBS="$LIBS_OLD -pthread"
-+  LIBS="$LIBS_OLD ${PTHREAD_LIBS}"
-   if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
-     rm -rf conftest*
-     has_pthread=yes
-@@ -369,24 +363,24 @@
- echo "$config_script: Checking for sysconf support" >&5
- has_sysconf=no
- 
--cat > conftest.c <<EOF
-+#cat > conftest.c <<EOF
- #include <unistd.h>
- #ifndef _SC_NPROCESSORS_ONLN
- #ifndef _SC_NPROC_ONLN
- #error Neither _SC_NPROCESSORS_ONLN nor _SC_NPROC_ONLN available
- #endif
- #endif
--int main() {long x=sysconf(_SC_ARG_MAX); return 0; }
--EOF
-+#int main() {long x=sysconf(_SC_ARG_MAX); return 0; }
-+#EOF
- 
--if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
--  rm -rf conftest*
--  has_sysconf=yes
--else
--  echo "$config_script: failed program was:" >&5
--  cat conftest.c >&5
--fi
--rm -f conftest*
-+#if { (eval echo $config_script: \"$link\") 1>&5; (eval $link) 2>&5; }; then
-+#  rm -rf conftest*
-+#  has_sysconf=yes
-+#else
-+#  echo "$config_script: failed program was:" >&5
-+#  cat conftest.c >&5
-+#fi
-+#rm -f conftest*
- 
- echo " sysconf support: ""$has_sysconf" 1>&6
- if [ "x$has_sysconf" = xyes ]; then
-@@ -429,9 +423,9 @@
+   CFLAGS="$CFLAGS_OLD" 
+@@ -534,9 +520,9 @@
  # Post fixups
  ##########################################################################
  if [ "x$use_gcc" = xyes ]; then
 -  CFLAGS_SPEED="-c -I. -I.. $CFLAGS -O3 -ffast-math -Wall"
-+  CFLAGS_SPEED="-c -I. -I.. $CFLAGS -Wall"
++  CFLAGS_SPEED="-c -I. -I.. $CFLAGS -ffast-math -Wall"
    CFLAGS="-c -I. -I.. $CFLAGS -Os -Wall"
 -  CFLAGS_LINK="$INCS -O3 -ffast-math -Wall"
-+  CFLAGS_LINK="$INCS -Wall"
++  CFLAGS_LINK="$INCS -ffast-math -Wall"
  else
    CFLAGS_SPEED="-c -I. -I.. $CFLAGS -O"
    CFLAGS="-c -I. -I.. $CFLAGS -O"
diff -urN graphics/glfw.orig/files/patch-lib_x11_Makefile.x11.in graphics/glfw/files/patch-lib_x11_Makefile.x11.in
--- graphics/glfw.orig/files/patch-lib_x11_Makefile.x11.in	1970-01-01 01:00:00.000000000 +0100
+++ graphics/glfw/files/patch-lib_x11_Makefile.x11.in	2008-06-15 00:36:13.000000000 +0200
@@ -0,0 +1,13 @@
+--- lib/x11/Makefile.x11.in.orig	2007-07-01 11:46:46.000000000 +0200
++++ lib/x11/Makefile.x11.in	2008-06-15 00:35:56.000000000 +0200
+@@ -29,8 +29,8 @@
+ 	$(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 $(PREFIX)/libdata/pkgconfig
++	$(INSTALL) -c -m 644 libglfw.pc $(PREFIX)/libdata/pkgconfig/libglfw.pc
+ 
+ 
+ ##########################################################################
diff -urN graphics/glfw.orig/pkg-plist graphics/glfw/pkg-plist
--- graphics/glfw.orig/pkg-plist	2004-04-01 14:22:05.000000000 +0200
+++ graphics/glfw/pkg-plist	2008-06-15 00:34:01.000000000 +0200
@@ -1,26 +1,29 @@
-lib/libglfw.a
 include/GL/glfw.h
-%%EXAMPLESDIR%%/boing.c
-%%EXAMPLESDIR%%/gears.c
-%%EXAMPLESDIR%%/keytest.c
-%%EXAMPLESDIR%%/listmodes.c
-%%EXAMPLESDIR%%/mipmaps.c
-%%EXAMPLESDIR%%/mtbench.c
-%%EXAMPLESDIR%%/mthello.c
-%%EXAMPLESDIR%%/particles.c
-%%EXAMPLESDIR%%/pong3d.c
-%%EXAMPLESDIR%%/splitview.c
-%%EXAMPLESDIR%%/triangle.c
-%%EXAMPLESDIR%%/wave.c
-%%EXAMPLESDIR%%/mipmaps.tga
-%%EXAMPLESDIR%%/pong3d_field.tga
-%%EXAMPLESDIR%%/pong3d_instr.tga
-%%EXAMPLESDIR%%/pong3d_menu.tga
-%%EXAMPLESDIR%%/pong3d_title.tga
-%%EXAMPLESDIR%%/pong3d_winner1.tga
-%%EXAMPLESDIR%%/pong3d_winner2.tga
-%%EXAMPLESDIR%%/makefile
-@dirrm %%EXAMPLESDIR%%
+lib/libglfw.a
+lib/libglfw.so
+lib/libglfw.so.0
+libdata/pkgconfig/libglfw.pc
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/boing.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/gears.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/keytest.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/listmodes.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/mipmaps.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/mtbench.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/mthello.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/particles.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/splitview.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/triangle.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/wave.c
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/mipmaps.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_field.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_instr.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_menu.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_title.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_winner1.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/pong3d_winner2.tga
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/makefile
+%%PORTEXAMPLES%%@dirrm %%EXAMPLESDIR%%
 %%PORTDOCS%%%%DOCSDIR%%/Reference.pdf
 %%PORTDOCS%%%%DOCSDIR%%/UsersGuide.pdf
 %%PORTDOCS%%@dirrm %%DOCSDIR%%
--- glfw.diff ends here ---

Thanks!



Responsible-Changed-From-To: freebsd-ports-bugs->thierry
Responsible-Changed-By: thierry
Responsible-Changed-When: Dim 15 jui 2008 07:33:19 UTC
Responsible-Changed-Why: 

Take it.


http://www.freebsd.org/cgi/query-pr.cgi?pr=123532



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806150739.m5F7dR5x089883>