mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
906cc45eda
- Imported mkruby and chkruby from r1 - Some minor changes in r_lang for it
39 lines
784 B
Ruby
39 lines
784 B
Ruby
# setup with ruby!
|
|
|
|
require 'mkmf'
|
|
INCDIR = Config::CONFIG['rubylibdir'] + "/"+Config::CONFIG['arch']
|
|
LIBDIR = Config::CONFIG['LIBRUBY_ARG_SHARED']
|
|
#LIBS = Config::CONFIG['LIBS'] -lpthread...
|
|
LIBNAM = Config::CONFIG['RUBY_INSTALL_NAME']
|
|
#LDSHARED=compilername -shared..."
|
|
|
|
rb_so = '_test.so'
|
|
rb_c = '_test.c'
|
|
inc = '../..'
|
|
|
|
$cc=ENV["CC"]
|
|
if $cc == nil then
|
|
$cc="cc"
|
|
end
|
|
|
|
tobeup=false
|
|
begin
|
|
d0 = File.stat(rb_so).mtime.to_i
|
|
d1 = File.stat(rb_c).mtime.to_i
|
|
if d1 > d0 then
|
|
tobeup=true
|
|
end
|
|
rescue
|
|
tobeup=true
|
|
end
|
|
|
|
ret = false
|
|
if tobeup then
|
|
system("echo 'main(){}' > #{rb_c}");
|
|
$line="#{$cc} -I #{inc} -I#{INCDIR} #{rb_c} -shared #{LIBDIR}" \
|
|
" -l#{LIBNAM} #{ENV['CFLAGS']} #{ENV['LDFLAGS']} -o #{rb_so}"
|
|
ret = system($line)
|
|
system("rm -f #{rb_so} #{rb_c}");
|
|
end
|
|
exit ret
|