Skip to content

Commit 63c7ff3

Browse files
authored
Merge pull request mruby#4965 from mimaki/remove-cygwin_filename
Merged `cygwin_filename()` into `filename()`.
2 parents 7ab5353 + a8ab74a commit 63c7ff3

2 files changed

Lines changed: 11 additions & 44 deletions

File tree

lib/mruby/build.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,6 @@ def filename(name)
276276
end
277277
end
278278

279-
def cygwin_filename(name)
280-
if name.is_a?(Array)
281-
name.flatten.map { |n| cygwin_filename(n) }
282-
else
283-
'"%s"' % `cygpath -w "#{filename(name)}"`.strip
284-
end
285-
end
286-
287279
def exefile(name)
288280
if name.is_a?(Array)
289281
name.flatten.map { |n| exefile(n) }

lib/mruby/build/command.rb

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module MRuby
44
class Command
55
include Rake::DSL
66
extend Forwardable
7-
def_delegators :@build, :filename, :objfile, :libfile, :exefile, :cygwin_filename
7+
def_delegators :@build, :filename, :objfile, :libfile, :exefile
88
attr_accessor :build, :command
99

1010
def initialize(build)
@@ -79,25 +79,16 @@ def search_header(name)
7979
def all_flags(_defines=[], _include_paths=[], _flags=[])
8080
define_flags = [defines, _defines].flatten.map{ |d| option_define % d }
8181
include_path_flags = [include_paths, _include_paths].flatten.map do |f|
82-
if MRUBY_BUILD_HOST_IS_CYGWIN
83-
option_include_path % cygwin_filename(f)
84-
else
85-
option_include_path % filename(f)
86-
end
82+
option_include_path % filename(f)
8783
end
8884
[flags, define_flags, include_path_flags, _flags].flatten.join(' ')
8985
end
9086

9187
def run(outfile, infile, _defines=[], _include_paths=[], _flags=[])
9288
mkdir_p File.dirname(outfile)
9389
_pp "CC", infile.relative_path, outfile.relative_path
94-
if MRUBY_BUILD_HOST_IS_CYGWIN
95-
_run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
96-
:infile => cygwin_filename(infile), :outfile => cygwin_filename(outfile) }
97-
else
98-
_run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
99-
:infile => filename(infile), :outfile => filename(outfile) }
100-
end
90+
_run compile_options, { :flags => all_flags(_defines, _include_paths, _flags),
91+
:infile => filename(infile), :outfile => filename(outfile) }
10192
end
10293

10394
def define_rules(build_dir, source_dir='')
@@ -191,11 +182,7 @@ def initialize(build)
191182

192183
def all_flags(_library_paths=[], _flags=[])
193184
library_path_flags = [library_paths, _library_paths].flatten.map do |f|
194-
if MRUBY_BUILD_HOST_IS_CYGWIN
195-
option_library_path % cygwin_filename(f)
196-
else
197-
option_library_path % filename(f)
198-
end
185+
option_library_path % filename(f)
199186
end
200187
[flags, library_path_flags, _flags].flatten.join(' ')
201188
end
@@ -209,19 +196,11 @@ def run(outfile, objfiles, _libraries=[], _library_paths=[], _flags=[], _flags_b
209196
library_flags = [libraries, _libraries].flatten.map { |d| option_library % d }
210197

211198
_pp "LD", outfile.relative_path
212-
if MRUBY_BUILD_HOST_IS_CYGWIN
213-
_run link_options, { :flags => all_flags(_library_paths, _flags),
214-
:outfile => cygwin_filename(outfile) , :objs => cygwin_filename(objfiles).join(' '),
215-
:flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
216-
:flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
217-
:libs => library_flags.join(' ') }
218-
else
219-
_run link_options, { :flags => all_flags(_library_paths, _flags),
220-
:outfile => filename(outfile) , :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' '),
221-
:flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
222-
:flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
223-
:libs => library_flags.join(' ') }
224-
end
199+
_run link_options, { :flags => all_flags(_library_paths, _flags),
200+
:outfile => filename(outfile) , :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' '),
201+
:flags_before_libraries => [flags_before_libraries, _flags_before_libraries].flatten.join(' '),
202+
:flags_after_libraries => [flags_after_libraries, _flags_after_libraries].flatten.join(' '),
203+
:libs => library_flags.join(' ') }
225204
end
226205
end
227206

@@ -237,11 +216,7 @@ def initialize(build)
237216
def run(outfile, objfiles)
238217
mkdir_p File.dirname(outfile)
239218
_pp "AR", outfile.relative_path
240-
if MRUBY_BUILD_HOST_IS_CYGWIN
241-
_run archive_options, { :outfile => cygwin_filename(outfile), :objs => cygwin_filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
242-
else
243-
_run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
244-
end
219+
_run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
245220
end
246221
end
247222

0 commit comments

Comments
 (0)