require 'rbuild-bundle' require 'rbuild-cfamily' if RUBY_PLATFORM =~ /darwin/ && !ARGV.include?('--x11') then objects = build_objects( :sources => Dir['Source/MacOSX/*.c'] + Dir['Source/MacOSX/*.m'] + Dir['Source/Common/*.c'], :extra_cflags => '-ISource/Common') build_bundle( :bundle_name => 'GameShell.app', :resources_directory => 'Resources', :info_plist_file => 'Info.plist') build_executable( :executable => 'GameShell.app/Contents/MacOS/GameShell', :objects => objects, :frameworks => ['Carbon', 'Cocoa', 'OpenGL']) elsif RUBY_PLATFORM =~ /linux/ || ARGV.include?('--x11') then objects = build_objects( :sources => Dir['Source/GTK/*.c'] + ['Glade/DisplayMode/src/interface.c', 'Glade/DisplayMode/src/support.c'] + ['Source/GTK/xfullscreen-0.2/xfullscreen.c'] + Dir['Source/Common/*.c'], :extra_cflags => "`pkg-config --cflags gtk+-2.0 gtkglext-1.0` -ISource/Common -IGlade/DisplayMode/src -ISource/GTK/xfullscreen-0.2 -DHAVE_XF86VIDMODE -DHAVE_XINERAMA") build_executable( :executable => 'GameShell', :objects => objects, :extra_linker_flags => "`pkg-config --libs gtk+-2.0 gtkglext-1.0`", :library_search_paths => ['/usr/X11R6/lib'], :libraries => ['Xxf86vm', 'X11', 'Xinerama']) build( :targets => ['Glade/DisplayMode/src/interface.c', 'Glade/DisplayMode/src/support.c'], :dependencies => ['Glade/DisplayMode/displaymode.glade'], :command => "glade-2 -w Glade/DisplayMode/displaymode.glade", :message => 'Compiling DisplayMode interface with Glade') build( :targets => ['Source/GTK/xfullscreen-0.2/xfullscreen.c', 'Source/GTK/xfullscreen-0.2/xfullscreen.h'], :dependencies => ['Source/GTK/xfullscreen-0.2.tar.gz'], :command => "cd Source/GTK && tar xzf xfullscreen-0.2.tar.gz && touch xfullscreen-0.2/xfullscreen.*", :message => 'Unpacking xfullscreen source') elsif RUBY_PLATFORM =~ /mswin32/ then objects = build_objects( :sources => Dir['Source/Win32/*.c'] + Dir['Source/Common/*.c'], :extra_cflags => '-ISource/Common -msse -msse2 -mfpmath=sse') build_executable( :executable => 'GameShell.exe', :objects => objects, :extra_linker_flags => '-mwindows -mconsole', :libraries => ['opengl32']) else raise 'Unknown platform' end