Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 62ad982
Showing
4 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
CC = <%= config['CC'] %> | ||
|
||
arch = <%= config['arch'] %> | ||
CFLAGS = <%= config['CFLAGS'] %> | ||
LIBS = <%= config['LIBS'] %> | ||
LDFLAGS = <%= config['LDFLAGS'] %> | ||
LIBRUBYARG = <%= config['LIBRUBYARG'] %> | ||
EXEEXT = <%= config['EXEEXT'] %> | ||
|
||
PROGRAM = <%= config['RSDL'] %>$(EXEEXT) | ||
|
||
OBJS = rsdl.o | ||
|
||
.c.o: | ||
$(CC) $(CFLAGS) -c $< | ||
|
||
all: $(PROGRAM) | ||
|
||
clean: | ||
<%= config['RMALL'] %> $(PROGRAM) $(OBJS) | ||
|
||
install: | ||
<%= config['INSTALL'] %> $(PROGRAM) <%= config['bindir'] %> | ||
|
||
$(PROGRAM): $(OBJS) | ||
$(CC) $(OBJS) $(LDFLAGS) $(LIBRUBYARG) $(LIBS) -o $@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
rsdl - SDL initialized ruby | ||
|
||
REQUIREMENTS: | ||
- ruby 1.8 or later | ||
- libsdl | ||
|
||
INSTALL: | ||
$ruby configure.rb | ||
$make | ||
$sudo make install | ||
|
||
USAGE: | ||
Run your script with rsdl instead of ruby. | ||
$rsdl myscript.rb | ||
|
||
LICENSE: | ||
ruby's. | ||
|
||
Copyright 2009 Ryuichi Sakamoto. | ||
mail: kumaryu __at__ kumaryu.net | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env ruby | ||
# vim:encoding=utf-8 | ||
|
||
require 'mkmf' | ||
require 'erb' | ||
|
||
dir_config('sdl') #--with-sdl-dir, --with-sdl-include, or --with-sdl-lib | ||
sdlconfig = with_config('sdl-config', 'sdl-config') | ||
|
||
config = {} | ||
config['arch'] = Config::CONFIG['arch'] | ||
config['INSTALL'] = Config::CONFIG['INSTALL'] | ||
config['RMALL'] = Config::CONFIG['RMALL'] | ||
config['CC'] = Config::CONFIG['CC'] | ||
config['CFLAGS'] = Config::CONFIG['CFLAGS'] | ||
config['CFLAGS'] += " -I\"#{$hdrdir}\"" if $hdrdir | ||
config['CFLAGS'] += " -I\"#{$arch_hdrdir}\"" if $arch_hdrdir | ||
config['CFLAGS'] += ' ' + `"#{sdlconfig}" --cflags` if sdlconfig and not sdlconfig.empty? | ||
config['LDFLAGS'] = Config::CONFIG['LDFLAGS'] | ||
config['LIBS'] = Config::CONFIG['LIBS'] | ||
config['LIBS'] += ' ' + `"#{sdlconfig}" --libs` if sdlconfig and not sdlconfig.empty? | ||
config['LIBRUBYARG'] = Config::CONFIG['LIBRUBYARG'] | ||
config['EXEEXT'] = Config::CONFIG['EXEEXT'] | ||
config['bindir'] = Config::CONFIG['bindir'] | ||
config['RSDL'] = Config::CONFIG['RUBY_INSTALL_NAME'].sub(/ruby/, 'rsdl') | ||
|
||
headers = [] | ||
headers << '#define HAVE_RUBY_SYSINIT 1' if have_func('ruby_sysinit') | ||
headers << '#define HAVE_RUBY_RUN_NODE 1' if have_func('ruby_run_node') | ||
config['COMMON_HEADERS'] = ([(COMMON_HEADERS || '')]+headers).join("\n") | ||
|
||
makefile_in = ERB.new(File.read('Makefile.in'), nil, '%') | ||
open('Makefile', 'w') do |f| | ||
f.print makefile_in.result | ||
end | ||
|
||
rsdl_c_in = ERB.new(File.read('rsdl.c.in'), nil, '%') | ||
open('rsdl.c', 'w') do |f| | ||
f.print rsdl_c_in.result | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
#include <ruby.h> | ||
<%= config['COMMON_HEADERS'] %> | ||
#include <SDL.h> | ||
#include "SDL_main.h" | ||
#ifdef HAVE_LOCALE_H | ||
#include <locale.h> | ||
#endif | ||
|
||
#ifdef RUBY_GLOBAL_SETUP | ||
RUBY_GLOBAL_SETUP | ||
#endif | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
#ifdef HAVE_LOCALE_H | ||
setlocale(LC_CTYPE, ""); | ||
#endif | ||
|
||
#ifdef HAVE_RUBY_SYSINIT | ||
ruby_sysinit(&argc, &argv); | ||
#endif | ||
{ | ||
#ifdef RUBY_INIT_STACK | ||
RUBY_INIT_STACK; | ||
#endif | ||
ruby_init(); | ||
#ifdef HAVE_RUBY_RUN_NODE | ||
return ruby_run_node(ruby_options(argc, argv)); | ||
#else | ||
ruby_options(argc, argv); | ||
ruby_run(); //no return | ||
return 0; | ||
#endif | ||
} | ||
} | ||
|