Better support for loading extensions:
[cl-glfw.git] / generators / make-opengl-bindings.rb
blobb424f17c73c9f275d88781de049c46103fd60b52
1 #!/usr/bin/env ruby
3 require 'fileutils'
5 BASE=File::dirname($0)+'/..'
6 #Dir::chdir(BASE+'/work')
8 def check_ok
9   unless $?.success?
10     puts "Process returned #{$?.inspect}"
11     exit
12   end
13 end
15 def fetch_specs
16   puts `wget -P #{BASE}/src -N http://www.opengl.org/registry/api/gl.tm http://www.opengl.org/registry/api/gl.spec  http://www.opengl.org/registry/api/enum.spec  http://www.opengl.org/registry/api/enumext.spec`
17   check_ok
18 end
20 while arg=ARGV.shift
21   case arg
22   when '--fetch-specs'
23     fetch_specs
24   when '--help'
25     puts "Re-generates OpenGL bindings from specifications."
26     puts "Use --fetch-specs to force re-download of spec files from http://www.opengl.org/registry"
27     exit
28   end
29 end
31 fetch_specs unless File::exists?("#{BASE}/src/gl.tm") and
32     File::exists?("#{BASE}/src/gl.spec") and
33     File::exists?("#{BASE}/src/enum.spec") and
34     File::exists?("#{BASE}/src/enumext.spec")
36 puts `ruby #{BASE}/generators/sexpize-gl-spec.rb`
37 check_ok
38 puts `sbcl --load #{BASE}/generators/make-bindings-from-spec.lisp --eval "(progn (main) (sb-ext:quit))"`
39 check_ok