| 1 |
MRuby::Gem::Specification.new('mruby-file-stat') do |spec| |
| 2 |
spec.license = 'MIT' |
| 3 |
spec.author = 'ksss <[email protected]>' |
| 4 |
spec.add_dependency('mruby-time') |
| 5 |
spec.add_test_dependency('mruby-io') |
| 6 |
|
| 7 |
env = { |
| 8 |
'CC' => "#{build.cc.command} #{build.cc.flags.join(' ')}", |
| 9 |
'CXX' => "#{build.cxx.command} #{build.cxx.flags.join(' ')}", |
| 10 |
'LD' => "#{build.linker.command} #{build.linker.flags.join(' ')}", |
| 11 |
'AR' => build.archiver.command |
| 12 |
} |
| 13 |
config = "#{build_dir}/config.h" |
| 14 |
|
| 15 |
file config do |
| 16 |
FileUtils.mkdir_p build_dir, :verbose => true |
| 17 |
Dir.chdir build_dir do |
| 18 |
if ENV['OS'] == 'Windows_NT' |
| 19 |
_pp 'on Windows', dir |
| 20 |
FileUtils.touch "#{build_dir}/config.h", :verbose => true |
| 21 |
else |
| 22 |
_pp './configure', dir |
| 23 |
host = '' |
| 24 |
if build.kind_of?(MRuby::CrossBuild) && build.host_target |
| 25 |
host = "--host #{build.host_target}" |
| 26 |
end |
| 27 |
system env, "#{dir}/configure #{host}" |
| 28 |
end |
| 29 |
end |
| 30 |
end |
| 31 |
|
| 32 |
# build hook |
| 33 |
file "#{dir}/src/file-stat.c" => config |
| 34 |
|
| 35 |
task :clean do |
| 36 |
FileUtils.rm_f config, :verbose => true |
| 37 |
end |
| 38 |
|
| 39 |
cc.include_paths << build_dir |
| 40 |
end |