sgl

changeset 12:bf34fa677960

- fixed mac issues.
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 14 May 2011 12:02:22 +0300
parents b925dabd4e96
children e989ab58ec5b
files Makefile.in configure src/wsys_glut.c tests/simple/simple.c tests/tests-makefile
diffstat 5 files changed, 23 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/Makefile.in	Sat May 14 09:06:46 2011 +0300
     1.2 +++ b/Makefile.in	Sat May 14 12:02:22 2011 +0300
     1.3 @@ -14,7 +14,7 @@
     1.4  sharedopt_unix = -shared -Wl,-soname,$(soname)
     1.5  sharedopt_mac = -dynamiclib
     1.6  
     1.7 -ifeq ($(shell uname -a), Darwin)
     1.8 +ifeq ($(shell uname -s), Darwin)
     1.9  	sys = mac
    1.10  else
    1.11  	sys = unix
     2.1 --- a/configure	Sat May 14 09:06:46 2011 +0300
     2.2 +++ b/configure	Sat May 14 12:02:22 2011 +0300
     2.3 @@ -5,7 +5,7 @@
     2.4  
     2.5  extract()
     2.6  {
     2.7 -	grep "$2:" $1 | sed "s/^.*$2:\(.*\)\*\//\1/" | awk '{ print $1 }'
     2.8 +	grep "$2:" $1 | sed "s/^.*$2: *\(.*\)\*\//\1/"
     2.9  }
    2.10  
    2.11  get_depline()
    2.12 @@ -68,9 +68,9 @@
    2.13  	fi
    2.14  
    2.15  	name=`echo $m | sort | sed 's/src\/wsys_//' | sed 's/\.c//'`
    2.16 -	echo -n "-> trying module $name (needs: $dep) ... "
    2.17 +	`which echo` -n "-> trying module $name (needs: $dep) ... "
    2.18  
    2.19 -	if try_link $dep; then
    2.20 +	if try_link "$dep"; then
    2.21  		echo ok
    2.22  
    2.23  		libs="$libs $dep"
     3.1 --- a/src/wsys_glut.c	Sat May 14 09:06:46 2011 +0300
     3.2 +++ b/src/wsys_glut.c	Sat May 14 12:02:22 2011 +0300
     3.3 @@ -6,6 +6,7 @@
     3.4  
     3.5  #ifdef USE_WSYS_MODULE_GLUT
     3.6  
     3.7 +#include <stdlib.h>
     3.8  #include <setjmp.h>
     3.9  #ifndef __APPLE__
    3.10  #include <GL/glut.h>
     4.1 --- a/tests/simple/simple.c	Sat May 14 09:06:46 2011 +0300
     4.2 +++ b/tests/simple/simple.c	Sat May 14 12:02:22 2011 +0300
     4.3 @@ -1,6 +1,10 @@
     4.4  #include <stdio.h>
     4.5  #include <ctype.h>
     4.6 +#ifndef __APPLE__
     4.7  #include <GL/gl.h>
     4.8 +#else
     4.9 +#include <OpenGL/gl.h>
    4.10 +#endif
    4.11  #include "sgl.h"
    4.12  
    4.13  void disp(void);
     5.1 --- a/tests/tests-makefile	Sat May 14 09:06:46 2011 +0300
     5.2 +++ b/tests/tests-makefile	Sat May 14 12:02:22 2011 +0300
     5.3 @@ -3,15 +3,27 @@
     5.4  src = $(wildcard *.c)
     5.5  obj = $(src:.c=.o)
     5.6  
     5.7 +ifeq ($(shell uname -s), Darwin)
     5.8 +	libsgl = libsgl.dylib
     5.9 +	libgl = -framework OpenGL
    5.10 +else
    5.11 +	libsgl = libsgl.so
    5.12 +	libgl = -lGL -lGLU
    5.13 +	rpath = -Wl,-rpath=.
    5.14 +endif
    5.15 +
    5.16  sgldir = ../..
    5.17  
    5.18  CC = gcc
    5.19  CFLAGS = -pedantic -Wall -g -I$(sgldir)/include
    5.20 -LDFLAGS = -L. -Wl,-rpath=. -lsgl -lGL -lGLU -lm
    5.21 +LDFLAGS = -L. $(rpath) -lsgl $(libgl) -lm
    5.22  
    5.23 -$(bin): $(obj) libsgl.so
    5.24 +$(bin): $(obj) $(libsgl)
    5.25  	$(CC) -o $@ $(obj) $(LDFLAGS)
    5.26  
    5.27 +libsgl.dylib: $(sgldir)/libsgl.dylib
    5.28 +	ln -s $< $@
    5.29 +
    5.30  libsgl.so: $(sgldir)/libsgl.so.0.0
    5.31  	ln -s $< $@.0
    5.32  	ln -s $< $@