Hi,
I just build Ruby/OpenGL 0.32f with glut on my Mac. Just replace the content of its extconf.rb with what's beneath (starting with #---extconf.rb). I just tested it on my Mac (Ruby 1.9 CVS, Mac OS X 10.3.5, last developer tools), but it should work. I you have any problem with it, do not hesitate :o). To test it, just do: ruby extconf.rb && make
Then try a sample: ruby sample/wrap.rb
If it works, you can then install it: sudo make install
I hope it helps ^o^
Some of it was inspired from stuff available on ruby-talk. The harder part was to know that you have to add '-framework Foundation' not to have an Objective-C error: 'objc: failed objc_getClass(NSObject) for GLUTApplication->isa->isa'
Bye,
Vincent Isambart
#---extconf.rb
require 'mkmf'
File.unlink('Makefile') if File.exist?('Makefile')
File.unlink('Makefile.ogl') if File.exist?('Makefile.ogl')
File.unlink('Makefile.glut') if File.exist?('Makefile.glut')
$CFLAGS = '-I. -I/System/Library/Frameworks/OpenGL.framework/Headers -I/System/Library/Frameworks/GLUT.framework/Headers'
$LDFLAGS = '-L/System/Library/Frameworks/OpenGL.framework/Libraries -framework GLUT -framework Foundation'
Dir.mkdir('GL') unless File.exist?('GL')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/gl.h', 'GL/gl.h') unless File.exist?('GL/gl.h')
File.symlink('/System/Library/Frameworks/OpenGL.framework/Headers/glu.h', 'GL/glu.h') unless File.exist?('GL/glu.h')
File.symlink('/System/Library/Frameworks/GLUT.framework/Headers/glut.h', 'GL/glut.h') unless File.exist?('GL/glut.h')
$objs = ['glu.o', 'ogl.o', 'rbogl.o']
create_makefile("opengl")
File.rename('Makefile', 'Makefile.ogl')
$objs = ['glut.o']
create_makefile("glut")
File.rename('Makefile', 'Makefile.glut')
modules = "glut.#{CONFIG['DLEXT']} opengl.#{CONFIG['DLEXT']}"
open('Makefile', 'w') {|f|
v = $nmake ? '{$(srcdir)}' : ''
f.write <<"MAKEFILE"
SHELL = /bin/sh
srcdir = #{$srcdir}
VPATH = $(srcdir)
all: #{modules}
opengl.#{CONFIG['DLEXT']}: #{v}rbogl.c #{v}ogl.c #{v}glu.c #{v}rbogl.h
@echo Now Making opengl extend module
@$(MAKE) -f Makefile.ogl
glut.#{CONFIG['DLEXT']}: #{v}glut.c
@echo Now Making glut extend module
@$(MAKE) -f Makefile.glut
clean:
@$(MAKE) -f Makefile.ogl clean
@$(MAKE) -f Makefile.glut clean
distclean:
@$(MAKE) -f Makefile.ogl distclean
@$(MAKE) -f Makefile.glut distclean
install: #{modules}
@$(MAKE) -f Makefile.ogl install
@$(MAKE) -f Makefile.glut install
site-install: #{modules}
@$(MAKE) -f Makefile.ogl site-install
@$(MAKE) -f Makefile.glut site-install
MAKEFILE
}