Permalink
Browse files

Edited a little bit for building Shoes with Ruby 1.8.7. Now you can b…

…uild Shoes both with Ruby 1.9.1 and 1.8.7. You can confirm Shoes version included Ruby version by `shoes -v`.
  • Loading branch information...
ashbb committed Apr 11, 2010
1 parent 666124a commit 248027f1baffed6d206aef7f50f16977bd4c449e
Showing with 25 additions and 9 deletions.
  1. +15 −7 Rakefile
  2. +8 −0 req/binject/ext/binject_c/binject.c
  3. +2 −2 shoes/http/windownload.c
View
@@ -112,9 +112,15 @@ end
ruby_so = Config::CONFIG['RUBY_SO_NAME']
ruby_v = Config::CONFIG['ruby_version']
RUBY_1_9 = (ruby_v =~ /^1\.9/)
-ext_ruby = "deps/ruby"
-unless File.exists? ext_ruby
- ext_ruby = Config::CONFIG['prefix']
+
+case RUBY_PLATFORM
+when /mingw/
+ ext_ruby = "C:/shoes_dev/sandbox/mingw"
+else
+ ext_ruby = "deps/ruby"
+ unless File.exists? ext_ruby
+ ext_ruby = Config::CONFIG['prefix']
+ end
end
desc "Same as `rake build'"
@@ -131,7 +137,7 @@ end
task "dist/VERSION.txt" do |t|
File.open(t.name, 'w') do |f|
- f << %{shoes #{RELEASE_NAME.downcase} (0.r#{REVISION}) [#{RUBY_PLATFORM}]}
+ f << %{shoes #{RELEASE_NAME.downcase} (0.r#{REVISION}) [#{RUBY_PLATFORM} Ruby#{ruby_v}]}
%w[VIDEO DEBUG].each { |x| f << " +#{x.downcase}" if ENV[x] }
f << "\n"
end
@@ -465,9 +471,10 @@ else
end
when /mingw/
DLEXT = 'dll'
- LINUX_CFLAGS << ' -I. -I/mingw/include -I/mingw/include/ruby-1.9.1/ruby'
+ LINUX_CFLAGS << ' -I. -I/mingw/include'
+ LINUX_CFLAGS << ' -I/mingw/include/ruby-1.9.1/ruby' if RUBY_1_9
LINUX_CFLAGS << " -DXMD_H -DHAVE_BOOLEAN -DSHOES_WIN32 -D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500 -DWINVER=0x0500 -DCOBJMACROS"
- LINUX_LDFLAGS =" -DBUILD_DLL -lungif -ljpeg -lglib-2.0 -lgobject-2.0 -fPIC -shared"
+ LINUX_LDFLAGS = " -DBUILD_DLL -lungif -ljpeg -lglib-2.0 -lgobject-2.0 -fPIC -shared"
LINUX_LDFLAGS << ' -lshell32 -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lole32 -loleaut32 -ladvapi32 -loleacc -lwinhttp'
else
DLEXT = "so"
@@ -504,7 +511,8 @@ else
sh "#{CC} -Ldist -o #{bin} bin/main.o shoes/appwin32.o #{LINUX_LIBS} -lshoes #{Config::CONFIG['LDFLAGS']} -mwindows"
if RUBY_PLATFORM !~ /darwin/
rewrite "platform/nix/shoes.launch", t.name, %r!/shoes!, "/#{NAME}"
- sh %{echo 'cd "$OLDPWD"\nLD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{t.name}}
+ sh %{echo 'cd "$OLDPWD"'}
+ sh %{echo 'LD_LIBRARY_PATH=$APPPATH $APPPATH/#{File.basename(bin)} "$@"' >> #{t.name}}
chmod 0755, t.name
end
cp "platform/msw/shoes.exe.manifest", "dist/#{NAME}.exe.manifest"
@@ -260,7 +260,11 @@ binject_exe_file_size(VALUE obj)
FILE *fres;
GetOpenFile(obj, fptr);
rb_io_check_readable(fptr);
+#ifdef RUBY_1_9
fres = rb_io_stdio_file(fptr);
+#else
+ fres = GetReadFile(fptr);
+#endif
fstat(fileno(fres), &st);
return (unsigned int)st.st_size;
}
@@ -445,7 +449,11 @@ binject_exe_rewrite(binject_exe_t *binj, char *buf, char *out, int offset, int o
rb_io_t *fptr;
rdat->Size = binject_exe_file_size(obj);
GetOpenFile(obj, fptr);
+#ifdef RUBY_1_9
binject_exe_file_copy(rb_io_stdio_file(fptr), binj->out, rdat->Size, 0, binj->datapos, binj->proc);
+#else
+ binject_exe_file_copy(GetReadFile(fptr), binj->out, rdat->Size, 0, binj->datapos, binj->proc);
+#endif
}
binj->datapos += rdat->Size;
padlen = BINJ_PAD(rdat->Size, 4) - rdat->Size;
View
@@ -90,8 +90,8 @@ shoes_http_headers(VALUE hsh)
if (RARRAY_LEN(keys) > 0)
{
VALUE headers = rb_str_new2("");
- //for (i = 0; i < RARRAY_LEN(keys); i++ )
- for (i = 0; i < RARRAY(keys)->as.heap.len; i++ )
+ //for (i = 0; i < RARRAY(keys)->as.heap.len; i++ )
+ for (i = 0; i < RARRAY_LEN(keys); i++ )
{
VALUE key = rb_ary_entry(keys, i);
rb_str_append(headers, key);

0 comments on commit 248027f

Please sign in to comment.