ruby-miyako 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1115 -0
- data/Rakefile +7 -0
- data/defines.h +144 -0
- data/extconf.rb +44 -0
- data/extern.h +29 -0
- data/img/cursor.png +0 -0
- data/img/cursors.png +0 -0
- data/img/dice.png +0 -0
- data/img/wait_cursor.png +0 -0
- data/img/win_base.png +0 -0
- data/img/window.png +0 -0
- data/install_miyako.rb +87 -0
- data/lib/Miyako/API/audio.rb +584 -0
- data/lib/Miyako/API/basic_data.rb +1026 -0
- data/lib/Miyako/API/bitmap.rb +534 -0
- data/lib/Miyako/API/choices.rb +481 -0
- data/lib/Miyako/API/collision.rb +638 -0
- data/lib/Miyako/API/diagram.rb +586 -0
- data/lib/Miyako/API/drawing.rb +151 -0
- data/lib/Miyako/API/exceptions.rb +105 -0
- data/lib/Miyako/API/fixedmap.rb +462 -0
- data/lib/Miyako/API/font.rb +430 -0
- data/lib/Miyako/API/input.rb +456 -0
- data/lib/Miyako/API/layout.rb +644 -0
- data/lib/Miyako/API/map.rb +583 -0
- data/lib/Miyako/API/map_event.rb +222 -0
- data/lib/Miyako/API/modules.rb +357 -0
- data/lib/Miyako/API/movie.rb +166 -0
- data/lib/Miyako/API/parts.rb +188 -0
- data/lib/Miyako/API/plane.rb +205 -0
- data/lib/Miyako/API/screen.rb +341 -0
- data/lib/Miyako/API/shape.rb +443 -0
- data/lib/Miyako/API/sprite.rb +773 -0
- data/lib/Miyako/API/sprite_animation.rb +494 -0
- data/lib/Miyako/API/sprite_list.rb +1135 -0
- data/lib/Miyako/API/spriteunit.rb +168 -0
- data/lib/Miyako/API/story.rb +350 -0
- data/lib/Miyako/API/textbox.rb +773 -0
- data/lib/Miyako/API/utility.rb +419 -0
- data/lib/Miyako/API/viewport.rb +190 -0
- data/lib/Miyako/API/yuki.rb +1180 -0
- data/lib/Miyako/EXT/miyako_cairo.rb +62 -0
- data/lib/Miyako/EXT/raster_scroll.rb +138 -0
- data/lib/Miyako/EXT/slides.rb +157 -0
- data/lib/Miyako/miyako.rb +201 -0
- data/lib/Miyako/miyako_require_only.rb +35 -0
- data/logo/EGSR_logo.png +0 -0
- data/logo/EGSR_logo_bg.png +0 -0
- data/logo/EGSR_logo_fg.png +0 -0
- data/logo/EGSR_title_banner.png +0 -0
- data/logo/EGSR_title_logo.png +0 -0
- data/logo/miyako.png +0 -0
- data/logo/miyako_banner.png +0 -0
- data/logo/space.png +0 -0
- data/miyako_basicdata.c +484 -0
- data/miyako_bitmap.c +1225 -0
- data/miyako_collision.c +403 -0
- data/miyako_drawing.c +187 -0
- data/miyako_font.c +334 -0
- data/miyako_hsv.c +830 -0
- data/miyako_input_audio.c +254 -0
- data/miyako_layout.c +191 -0
- data/miyako_no_katana.c +1086 -0
- data/miyako_sprite2.c +431 -0
- data/miyako_transform.c +438 -0
- data/miyako_utility.c +288 -0
- data/sample/Animation1/m1ku.rb +68 -0
- data/sample/Animation1/m1ku_arm_0.png +0 -0
- data/sample/Animation1/m1ku_arm_1.png +0 -0
- data/sample/Animation1/m1ku_arm_2.png +0 -0
- data/sample/Animation1/m1ku_arm_3.png +0 -0
- data/sample/Animation1/m1ku_back.jpg +0 -0
- data/sample/Animation1/m1ku_body.png +0 -0
- data/sample/Animation1/m1ku_eye_0.png +0 -0
- data/sample/Animation1/m1ku_eye_1.png +0 -0
- data/sample/Animation1/m1ku_eye_2.png +0 -0
- data/sample/Animation1/m1ku_eye_3.png +0 -0
- data/sample/Animation1/m1ku_hair_front.png +0 -0
- data/sample/Animation1/m1ku_hair_rear.png +0 -0
- data/sample/Animation1/readme.txt +72 -0
- data/sample/Animation2/lex.rb +96 -0
- data/sample/Animation2/lex_back.png +0 -0
- data/sample/Animation2/lex_body.png +0 -0
- data/sample/Animation2/lex_roadroller.png +0 -0
- data/sample/Animation2/lex_wheel_0.png +0 -0
- data/sample/Animation2/lex_wheel_1.png +0 -0
- data/sample/Animation2/lex_wheel_2.png +0 -0
- data/sample/Animation2/readme.txt +72 -0
- data/sample/Animation2/song_title.png +0 -0
- data/sample/Diagram_sample/back.png +0 -0
- data/sample/Diagram_sample/chr01.png +0 -0
- data/sample/Diagram_sample/chr02.png +0 -0
- data/sample/Diagram_sample/cursor.png +0 -0
- data/sample/Diagram_sample/diagram_sample_yuki2.rb +329 -0
- data/sample/Diagram_sample/readme.txt +90 -0
- data/sample/Diagram_sample/wait_cursor.png +0 -0
- data/sample/Room3/blue.rb +297 -0
- data/sample/Room3/ending.rb +180 -0
- data/sample/Room3/green.rb +220 -0
- data/sample/Room3/image/akamatsu.png +0 -0
- data/sample/Room3/image/aoyama.png +0 -0
- data/sample/Room3/image/congra.png +0 -0
- data/sample/Room3/image/congratulation.png +0 -0
- data/sample/Room3/image/congratulation_bg.png +0 -0
- data/sample/Room3/image/cursor.png +0 -0
- data/sample/Room3/image/midori.png +0 -0
- data/sample/Room3/image/mittsu_no_oheya.png +0 -0
- data/sample/Room3/image/mittsu_no_oheya_logo.png +0 -0
- data/sample/Room3/image/room_blue.png +0 -0
- data/sample/Room3/image/room_green.png +0 -0
- data/sample/Room3/image/room_red.png +0 -0
- data/sample/Room3/image/start.png +0 -0
- data/sample/Room3/image/three_doors.png +0 -0
- data/sample/Room3/image/wait_cursor.png +0 -0
- data/sample/Room3/main.rb +120 -0
- data/sample/Room3/main_component.rb +59 -0
- data/sample/Room3/readme.txt +76 -0
- data/sample/Room3/red.rb +227 -0
- data/sample/Room3/room3.rb +25 -0
- data/sample/Room3/title.rb +184 -0
- data/sample/ball_action_sample.rb +204 -0
- data/sample/blit_rop.rb +70 -0
- data/sample/cairo_sample.rb +25 -0
- data/sample/circle_collision_test.rb +66 -0
- data/sample/collision_test.rb +33 -0
- data/sample/collision_test2.rb +108 -0
- data/sample/fixed_map_test/cursor.png +0 -0
- data/sample/fixed_map_test/fixed_map_sample.rb +140 -0
- data/sample/fixed_map_test/map.csv +19 -0
- data/sample/fixed_map_test/map_01.png +0 -0
- data/sample/fixed_map_test/mapchip.csv +23 -0
- data/sample/fixed_map_test/monster.png +0 -0
- data/sample/fixed_map_test/readme.txt +72 -0
- data/sample/map_test/chara.rb +58 -0
- data/sample/map_test/chr1.png +0 -0
- data/sample/map_test/cursor.png +0 -0
- data/sample/map_test/main_parts.rb +69 -0
- data/sample/map_test/main_scene.rb +153 -0
- data/sample/map_test/map.png +0 -0
- data/sample/map_test/map2.png +0 -0
- data/sample/map_test/map_layer.csv +127 -0
- data/sample/map_test/map_manager.rb +75 -0
- data/sample/map_test/map_test.rb +23 -0
- data/sample/map_test/mapchip.csv +21 -0
- data/sample/map_test/oasis.rb +71 -0
- data/sample/map_test/readme.txt +89 -0
- data/sample/map_test/route.rb +157 -0
- data/sample/map_test/sea.png +0 -0
- data/sample/map_test/town.rb +74 -0
- data/sample/map_test/wait_cursor.png +0 -0
- data/sample/map_test/window.png +0 -0
- data/sample/polygon_test.rb +35 -0
- data/sample/rasterscroll.rb +25 -0
- data/sample/takahashi.rb +42 -0
- data/sample/text.png +0 -0
- data/sample/textbox_sample.rb +192 -0
- data/sample/transform.rb +54 -0
- data/sample/utility_test.rb +73 -0
- data/sample/utility_test2.rb +61 -0
- data/sample/utility_test3.rb +64 -0
- data/sample/utility_test4.rb +73 -0
- data/uninstall_miyako.rb +19 -0
- data/win/miyako_no_katana.so +0 -0
- metadata +216 -0
data/Rakefile
ADDED
data/defines.h
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
/*
|
2
|
+
--
|
3
|
+
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
+
Copyright (C) 2008 Cyross Makoto
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
++
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <SDL.h>
|
23
|
+
#include <SDL_ttf.h>
|
24
|
+
#include <SDL_endian.h>
|
25
|
+
#include <stdlib.h>
|
26
|
+
#include <math.h>
|
27
|
+
#include "ruby.h"
|
28
|
+
#include "ruby/encoding.h"
|
29
|
+
|
30
|
+
typedef struct
|
31
|
+
{
|
32
|
+
SDL_Surface* surface;
|
33
|
+
} Surface;
|
34
|
+
|
35
|
+
typedef struct
|
36
|
+
{
|
37
|
+
Uint32 r;
|
38
|
+
Uint32 g;
|
39
|
+
Uint32 b;
|
40
|
+
Uint32 a;
|
41
|
+
} MiyakoColor;
|
42
|
+
|
43
|
+
typedef struct
|
44
|
+
{
|
45
|
+
int w;
|
46
|
+
int h;
|
47
|
+
} MiyakoSize;
|
48
|
+
|
49
|
+
typedef struct
|
50
|
+
{
|
51
|
+
VALUE unit;
|
52
|
+
SDL_Surface *surface;
|
53
|
+
SDL_PixelFormat *fmt;
|
54
|
+
SDL_Rect rect;
|
55
|
+
MiyakoColor color;
|
56
|
+
Uint32 a255;
|
57
|
+
Uint32 *ptr;
|
58
|
+
int x;
|
59
|
+
int y;
|
60
|
+
} MiyakoBitmap;
|
61
|
+
|
62
|
+
// from rubysdl.h
|
63
|
+
#define GLOBAL_DEFINE_GET_STRUCT(struct_name, fun, klass, klassstr) \
|
64
|
+
struct_name* fun(VALUE obj) \
|
65
|
+
{ \
|
66
|
+
struct_name* st; \
|
67
|
+
\
|
68
|
+
if(!rb_obj_is_kind_of(obj, klass)){ \
|
69
|
+
rb_raise(rb_eTypeError, "wrong argument type %s (expected " klassstr ")", \
|
70
|
+
rb_obj_classname(obj)); \
|
71
|
+
} \
|
72
|
+
Data_Get_Struct(obj, struct_name, st); \
|
73
|
+
return st; \
|
74
|
+
}
|
75
|
+
|
76
|
+
#define MIYAKO_GETCOLOR(COLOR) \
|
77
|
+
COLOR.r = (Uint32)(((pixel & fmt->Rmask) >> fmt->Rshift) << fmt->Rloss); \
|
78
|
+
COLOR.g = (Uint32)(((pixel & fmt->Gmask) >> fmt->Gshift) << fmt->Gloss); \
|
79
|
+
COLOR.b = (Uint32)(((pixel & fmt->Bmask) >> fmt->Bshift) << fmt->Bloss); \
|
80
|
+
COLOR.a = (Uint32)(((pixel & fmt->Amask) >> fmt->Ashift) << fmt->Aloss);
|
81
|
+
|
82
|
+
#define MIYAKO_SETCOLOR(RESULT, COLOR) \
|
83
|
+
RESULT = (COLOR.r >> fmt->Rloss) << fmt->Rshift | \
|
84
|
+
(COLOR.g >> fmt->Gloss) << fmt->Gshift | \
|
85
|
+
(COLOR.b >> fmt->Bloss) << fmt->Bshift | \
|
86
|
+
(COLOR.a >> fmt->Aloss) << fmt->Ashift;
|
87
|
+
|
88
|
+
#define MIYAKO_SET_RECT(RECT, BASE) \
|
89
|
+
RECT.x = NUM2INT(*(RSTRUCT_PTR(BASE) + 1)); \
|
90
|
+
RECT.y = NUM2INT(*(RSTRUCT_PTR(BASE) + 2)); \
|
91
|
+
RECT.w = NUM2INT(*(RSTRUCT_PTR(BASE) + 3)); \
|
92
|
+
RECT.h = NUM2INT(*(RSTRUCT_PTR(BASE) + 4));
|
93
|
+
|
94
|
+
#define MIYAKO_INIT_RECT1 \
|
95
|
+
int dlx = drect.x + x; \
|
96
|
+
int dly = drect.y + y; \
|
97
|
+
int dmx = dlx + (srect.w < drect.w ? srect.w : drect.w); \
|
98
|
+
int dmy = dly + (srect.h < drect.h ? srect.h : drect.h);
|
99
|
+
|
100
|
+
#define MIYAKO_INIT_RECT2 \
|
101
|
+
int dlx = drect.x; \
|
102
|
+
int dly = drect.y; \
|
103
|
+
int dmx = dlx + drect.w; \
|
104
|
+
int dmy = dly + drect.h;
|
105
|
+
|
106
|
+
#define MIYAKO_INIT_RECT3 \
|
107
|
+
if(s2rect.w != drect.w){ return Qnil; } \
|
108
|
+
if(s2rect.h != drect.h){ return Qnil; } \
|
109
|
+
int x1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 5)); \
|
110
|
+
int y1 = NUM2INT(*(RSTRUCT_PTR(s1unit) + 6)); \
|
111
|
+
int x2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 5)); \
|
112
|
+
int y2 = NUM2INT(*(RSTRUCT_PTR(s2unit) + 6)); \
|
113
|
+
if(s1rect.x < 0 || s1rect.y < 0 || s2rect.x < 0 || s2rect.y < 0){ return Qnil; } \
|
114
|
+
if(s1rect.w < s2rect.w && (x1+s1rect.x+s1rect.w > s2rect.w)){ return Qnil; } \
|
115
|
+
if(s2rect.w < s1rect.w && (x2+s2rect.x+s2rect.w > s1rect.w)){ return Qnil; } \
|
116
|
+
if(s1rect.h < s2rect.h && (y1+s1rect.y+s1rect.h > s2rect.h)){ return Qnil; } \
|
117
|
+
if(s2rect.h < s1rect.h && (y2+s2rect.y+s2rect.h > s1rect.h)){ return Qnil; } \
|
118
|
+
int dlx = drect.x; \
|
119
|
+
int dly = drect.y; \
|
120
|
+
int dmx = dlx + (s1rect.w < s2rect.w ? s1rect.w : s2rect.w); \
|
121
|
+
int dmy = dly + (s1rect.h < s2rect.h ? s1rect.h : s2rect.h);
|
122
|
+
|
123
|
+
#define MIYAKO_PSET(XX,YY) \
|
124
|
+
pixel = 0; \
|
125
|
+
if(dcolor.a == 0) \
|
126
|
+
{ \
|
127
|
+
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
128
|
+
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
129
|
+
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
130
|
+
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
131
|
+
continue; \
|
132
|
+
} \
|
133
|
+
if(scolor.a > 0) \
|
134
|
+
{ \
|
135
|
+
int a1 = scolor.a + 1; \
|
136
|
+
int a2 = 256 - scolor.a; \
|
137
|
+
scolor.r = (scolor.r * a1 + dcolor.r * a2) >> 8; \
|
138
|
+
scolor.g = (scolor.g * a1 + dcolor.g * a2) >> 8; \
|
139
|
+
scolor.b = (scolor.b * a1 + dcolor.b * a2) >> 8; \
|
140
|
+
*(pdst + YY * dst->w + XX) = (scolor.r >> fmt->Rloss) << fmt->Rshift | \
|
141
|
+
(scolor.g >> fmt->Gloss) << fmt->Gshift | \
|
142
|
+
(scolor.b >> fmt->Bloss) << fmt->Bshift | \
|
143
|
+
(scolor.a >> fmt->Aloss) << fmt->Ashift; \
|
144
|
+
}
|
data/extconf.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
if /mswin32/ =~ CONFIG["arch"]
|
4
|
+
have_library("SDL")
|
5
|
+
else
|
6
|
+
sdl_config = with_config('sdl-config', 'sdl-config')
|
7
|
+
|
8
|
+
$CFLAGS += ' ' + `#{sdl_config} --cflags`.chomp
|
9
|
+
$LOCAL_LIBS += ' ' + `#{sdl_config} --libs`.chomp
|
10
|
+
|
11
|
+
if /-Dmain=SDL_main/ =~ $CFLAGS then
|
12
|
+
def try_func(func, libs, headers = nil, &b)
|
13
|
+
headers = cpp_include(headers)
|
14
|
+
try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
|
15
|
+
#{headers}
|
16
|
+
/*top*/
|
17
|
+
int main(int argc,char** argv) { return 0; }
|
18
|
+
int t() { #{func}(); return 0; }
|
19
|
+
SRC
|
20
|
+
#{COMMON_HEADERS}
|
21
|
+
#{headers}
|
22
|
+
/*top*/
|
23
|
+
int main(int argc,char** argv) { return 0; }
|
24
|
+
int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; }
|
25
|
+
SRC
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
if enable_config("static-libs",false) then
|
31
|
+
have_library("SDL")
|
32
|
+
have_library("freetype")
|
33
|
+
have_library("SGE")
|
34
|
+
end
|
35
|
+
|
36
|
+
if have_library("SDL_ttf","TTF_Init") then
|
37
|
+
$CFLAGS+= " -D HAVE_SDL_TTF "
|
38
|
+
end
|
39
|
+
|
40
|
+
if have_library("SGE","sge_Line") then
|
41
|
+
$CFLAGS+= " -D HAVE_SGE "
|
42
|
+
end
|
43
|
+
|
44
|
+
create_makefile('miyako_no_katana')
|
data/extern.h
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
/*
|
2
|
+
--
|
3
|
+
Miyako v2.0 Extend Library "Miyako no Katana"
|
4
|
+
Copyright (C) 2008 Cyross Makoto
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
++
|
20
|
+
*/
|
21
|
+
|
22
|
+
extern void _miyako_setup_unit(VALUE unit, SDL_Surface *screen, MiyakoBitmap *mb, VALUE x, VALUE y, int use_yield);
|
23
|
+
extern void _miyako_setup_unit_2(VALUE unit_s, VALUE unit_d,
|
24
|
+
SDL_Surface *screen,
|
25
|
+
MiyakoBitmap *mb_s, MiyakoBitmap *mb_d,
|
26
|
+
VALUE x, VALUE y, int use_yield);
|
27
|
+
extern int _miyako_init_rect(MiyakoBitmap *src, MiyakoBitmap *dst, MiyakoSize *size);
|
28
|
+
extern void _miyako_yield_unit_1(MiyakoBitmap *src);
|
29
|
+
extern void _miyako_yield_unit_2(MiyakoBitmap *src, MiyakoBitmap *dst);
|
data/img/cursor.png
ADDED
Binary file
|
data/img/cursors.png
ADDED
Binary file
|
data/img/dice.png
ADDED
Binary file
|
data/img/wait_cursor.png
ADDED
Binary file
|
data/img/win_base.png
ADDED
Binary file
|
data/img/window.png
ADDED
Binary file
|
data/install_miyako.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# Miyako2.0 install script
|
2
|
+
# 2009 Cyross Makoto
|
3
|
+
|
4
|
+
if RUBY_VERSION < '1.9.1'
|
5
|
+
puts 'Sorry. Miyako needs Ruby 1.9.1 or above...'
|
6
|
+
exit
|
7
|
+
end
|
8
|
+
|
9
|
+
begin
|
10
|
+
require 'sdl'
|
11
|
+
rescue
|
12
|
+
puts 'Sorry. Miyako needs Ruby/SDL...'
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
if SDL::VERSION < '2.1'
|
17
|
+
puts 'Sorry. Miyako needs Ruby/SDL 2.1.0 or above...'
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rbconfig'
|
22
|
+
require 'fileutils'
|
23
|
+
require 'optparse'
|
24
|
+
|
25
|
+
option = { :noop => false, :verbose => true }
|
26
|
+
not_force = true
|
27
|
+
|
28
|
+
ARGV.options do |opt|
|
29
|
+
opt.on('--no-harm'){ option[:noop] = true }
|
30
|
+
opt.on('--force'){ not_force = false }
|
31
|
+
opt.on('--quiet'){ option[:verbose] = false }
|
32
|
+
|
33
|
+
opt.parse!
|
34
|
+
end
|
35
|
+
|
36
|
+
ext_dir = "./"
|
37
|
+
osn = Config::CONFIG["target_os"].downcase
|
38
|
+
if osn =~ /mswin|mingw|cygwin|bccwin/
|
39
|
+
ext_dir = "win/"
|
40
|
+
elsif osn =~ /darwin/ # Mac OS X
|
41
|
+
if ENV['SDL_CONFIG_PATH']
|
42
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
43
|
+
else
|
44
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
45
|
+
end
|
46
|
+
else # linux, U*IX...
|
47
|
+
if ENV['SDL_CONFIG_PATH']
|
48
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='#{ENV['SDL_CONFIG_PATH']}'; make")
|
49
|
+
else
|
50
|
+
system(Config::CONFIG["ruby_install_name"] + " extconf.rb --with-sdl-config='sdl-config'; make")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
sitelibdir = Config::CONFIG["sitelibdir"] + "/Miyako"
|
55
|
+
apidir = sitelibdir + "/API"
|
56
|
+
extdir = sitelibdir + "/EXT"
|
57
|
+
|
58
|
+
if FileTest.exist?(sitelibdir) && not_force
|
59
|
+
puts "#{sitelibdir} is arleady exists."
|
60
|
+
puts "Are you sure?(Y/else)"
|
61
|
+
exit unless $stdin.gets.split(//)[0].upcase == 'Y'
|
62
|
+
end
|
63
|
+
|
64
|
+
FileUtils.remove_dir(sitelibdir, true)
|
65
|
+
FileUtils.mkpath(sitelibdir, option)
|
66
|
+
FileUtils.mkpath(apidir, option)
|
67
|
+
FileUtils.mkpath(extdir, option)
|
68
|
+
|
69
|
+
if osn =~ /darwin/ # Mac OS X
|
70
|
+
Dir.glob(ext_dir + "*.bundle"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
71
|
+
else # Windows, linux, U*IX...
|
72
|
+
Dir.glob(ext_dir + "*.so"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
73
|
+
end
|
74
|
+
Dir.glob("lib/Miyako/*.rb"){|fname| FileUtils.install(fname, sitelibdir, option)}
|
75
|
+
Dir.glob("lib/Miyako/API/*.rb"){|fname| FileUtils.install(fname, apidir, option)}
|
76
|
+
Dir.glob("lib/Miyako/EXT/*.rb"){|fname| FileUtils.install(fname, extdir, option)}
|
77
|
+
|
78
|
+
unless osn =~ /mswin|mingw|cygwin|bccwin/
|
79
|
+
FileUtils.chmod(0755, sitelibdir)
|
80
|
+
FileUtils.chmod(0755, apidir)
|
81
|
+
FileUtils.chmod(0755, extdir)
|
82
|
+
FileUtils.chmod(0644, sitelibdir+'/miyako.rb')
|
83
|
+
Dir.glob(sitelibdir+"/*.so"){|fname| FileUtils.chmod(0644, fname)} # for linux,bsd
|
84
|
+
Dir.glob(sitelibdir+"/*.bundle"){|fname| FileUtils.chmod(0644, fname)} # for macosx
|
85
|
+
Dir.glob(apidir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
86
|
+
Dir.glob(extdir+"/*.rb"){|fname| FileUtils.chmod(0644, fname)}
|
87
|
+
end
|