summaryrefslogtreecommitdiffhomepage
path: root/tasks/mruby_build_commands.rake
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-03-14 08:15:40 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2013-03-14 08:15:40 -0700
commitad11d3144efc34e6fdc6deb24fb073f1ccd99fdb (patch)
treece2a1551956bb8ee1c5b51fa70c366766fbbe0d3 /tasks/mruby_build_commands.rake
parent08a0c9f32843d4ebe17476608d6b2f3d8d703313 (diff)
parentd2f74c7c46c6cb3c4eb278b5adb1c766013d3b6c (diff)
downloadmruby-ad11d3144efc34e6fdc6deb24fb073f1ccd99fdb.tar.gz
mruby-ad11d3144efc34e6fdc6deb24fb073f1ccd99fdb.zip
Merge pull request #975 from crimsonwoods/modify_build_script
Improve Android platform support.
Diffstat (limited to 'tasks/mruby_build_commands.rake')
-rw-r--r--tasks/mruby_build_commands.rake47
1 files changed, 36 insertions, 11 deletions
diff --git a/tasks/mruby_build_commands.rake b/tasks/mruby_build_commands.rake
index 1e806e5da..b647ccf98 100644
--- a/tasks/mruby_build_commands.rake
+++ b/tasks/mruby_build_commands.rake
@@ -4,7 +4,7 @@ module MRuby
class Command
include Rake::DSL
extend Forwardable
- def_delegators :@build, :filename, :objfile, :libfile, :exefile
+ def_delegators :@build, :filename, :objfile, :libfile, :exefile, :cygwin_filename
attr_accessor :build, :command
def initialize(build)
@@ -49,7 +49,11 @@ module MRuby
def all_flags(_defineds=[], _include_paths=[], _flags=[])
define_flags = [defines, _defineds].flatten.map{ |d| option_define % d }
include_path_flags = [include_paths, _include_paths].flatten.map do |f|
- option_include_path % filename(f)
+ if MRUBY_BUILD_HOST_IS_CYGWIN
+ option_include_path % cygwin_filename(f)
+ else
+ option_include_path % filename(f)
+ end
end
[flags, define_flags, include_path_flags, _flags].flatten.join(' ')
end
@@ -61,8 +65,13 @@ module MRuby
option_include_path % filename(f)
end
_pp "CC", infile.relative_path, outfile.relative_path
- _run compile_options, { :flags => all_flags(_defineds, _include_paths, _flags),
- :infile => filename(infile), :outfile => filename(outfile) }
+ if MRUBY_BUILD_HOST_IS_CYGWIN
+ _run compile_options, { :flags => all_flags(_defineds, _include_paths, _flags),
+ :infile => cygwin_filename(infile), :outfile => cygwin_filename(outfile) }
+ else
+ _run compile_options, { :flags => all_flags(_defineds, _include_paths, _flags),
+ :infile => filename(infile), :outfile => filename(outfile) }
+ end
end
def define_rules(build_dir, source_dir='')
@@ -127,7 +136,11 @@ module MRuby
def all_flags(_library_paths=[], _flags=[])
library_path_flags = [library_paths, _library_paths].flatten.map do |f|
- option_library_path % filename(f)
+ if MRUBY_BUILD_HOST_IS_CYGWIN
+ option_library_path % cygwin_filename(f)
+ else
+ option_library_path % filename(f)
+ end
end
[flags, library_path_flags, _flags].flatten.join(' ')
end
@@ -142,11 +155,19 @@ module MRuby
library_path_flags = [library_paths, _library_paths].flatten.map { |f| option_library_path % filename(f) }
_pp "LD", outfile.relative_path
- _run link_options, { :flags => all_flags(_library_paths, _flags),
- :outfile => filename(outfile) , :objs => filename(objfiles).join(' '),
- :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
- :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
- :libs => library_flags.join(' ') }
+ if MRUBY_BUILD_HOST_IS_CYGWIN
+ _run link_options, { :flags => all_flags(_library_paths, _flags),
+ :outfile => cygwin_filename(outfile) , :objs => cygwin_filename(objfiles).join(' '),
+ :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
+ :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
+ :libs => library_flags.join(' ') }
+ else
+ _run link_options, { :flags => all_flags(_library_paths, _flags),
+ :outfile => filename(outfile) , :objs => filename(objfiles).join(' '),
+ :flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
+ :flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
+ :libs => library_flags.join(' ') }
+ end
end
end
@@ -162,7 +183,11 @@ module MRuby
def run(outfile, objfiles)
FileUtils.mkdir_p File.dirname(outfile)
_pp "AR", outfile.relative_path
- _run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).join(' ') }
+ if MRUBY_BUILD_HOST_IS_CYGWIN
+ _run archive_options, { :outfile => cygwin_filename(outfile), :objs => cygwin_filename(objfiles).join(' ') }
+ else
+ _run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).join(' ') }
+ end
end
end