Commit e3875ae8 authored by Dominic Sisneros's avatar Dominic Sisneros

build when directories and files have spaces

Modified the build to quote filenames so that it builds when files have spaces
parent 5acd802d
......@@ -30,9 +30,9 @@ MRuby::Build.new do |conf|
# cc.flags = [ENV['CFLAGS'] || %w()]
# cc.include_paths = ["#{root}/include"]
# cc.defines = %w()
# cc.option_include_path = '-I%s'
# cc.option_include_path = %q[-I"%s"]
# cc.option_define = '-D%s'
# cc.compile_options = "%{flags} -MMD -o %{outfile} -c %{infile}"
# cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
# end
# mrbc settings
......@@ -50,25 +50,25 @@ MRuby::Build.new do |conf|
# linker.library_paths = []
# linker.option_library = '-l%s'
# linker.option_library_path = '-L%s'
# linker.link_options = "%{flags} -o %{outfile} %{objs} %{libs}"
# linker.link_options = "%{flags} -o "%{outfile}" %{objs} %{libs}"
# end
# Archiver settings
# conf.archiver do |archiver|
# archiver.command = ENV['AR'] || 'ar'
# archiver.archive_options = 'rs %{outfile} %{objs}'
# archiver.archive_options = 'rs "%{outfile}" %{objs}'
# end
# Parser generator settings
# conf.yacc do |yacc|
# yacc.command = ENV['YACC'] || 'bison'
# yacc.compile_options = '-o %{outfile} %{infile}'
# yacc.compile_options = %q[-o "%{outfile}" "%{infile}"]
# end
# gperf settings
# conf.gperf do |gperf|
# gperf.command = 'gperf'
# gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
# gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
# end
# file extensions
......
......@@ -42,7 +42,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
cc.flags = %w(-g -Os -w -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500
-Dprintf=iprintf -mcpu=cortex-m3 -DF_CPU=84000000L -DARDUINO=156 -DARDUINO_SAM_DUE -DARDUINO_ARCH_SAM
-D__SAM3X8E__ -mthumb -DUSB_PID=0x003e -DUSB_VID=0x2341 -DUSBCON -DUSB_MANUFACTURER="Unknown" -DUSB_PRODUCT="Arduino Due")
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
......@@ -64,7 +64,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
conf.archiver do |archiver|
archiver.command = "#{BIN_PATH}/arm-none-eabi-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
......
......@@ -32,7 +32,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
cc.flags = %w(-m32 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -mstackrealign -fno-omit-frame-pointer)
cc.flags << %w(-O2 -pipe -g -feliminate-unused-debug-types)
cc.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
cc.defines = %w(ENABLE_READLINE)
end
......@@ -47,7 +47,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
conf.archiver do |archiver|
archiver.command = "#{POKY_EDISON_BIN_PATH}/i586-poky-linux-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
conf.linker do |linker|
......
......@@ -39,7 +39,7 @@ MRuby::CrossBuild.new("Galileo") do |conf|
cc.flags = %w(-m32 -march=i586 -c -g -Os -w
-ffunction-sections -fdata-sections -MMD -DARDUINO=153)
cc.flags << "--sysroot=#{GALILEO_SYSROOT}"
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
end
conf.cxx do |cxx|
......@@ -54,7 +54,7 @@ MRuby::CrossBuild.new("Galileo") do |conf|
conf.archiver do |archiver|
archiver.command = "#{GALILEO_BIN_PATH}/i586-poky-linux-uclibc-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
conf.linker do |linker|
......
......@@ -27,7 +27,7 @@ MRuby::CrossBuild.new("RX630") do |conf|
conf.cc do |cc|
cc.command = "#{BIN_PATH}/rx-elf-gcc"
cc.flags = "-Wall -g -O2 -flto -mcpu=rx600 -m64bit-doubles"
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_USE_FLOAT)
......@@ -53,7 +53,7 @@ MRuby::CrossBuild.new("RX630") do |conf|
conf.archiver do |archiver|
archiver.command = "#{BIN_PATH}/rx-elf-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
......
......@@ -39,7 +39,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf|
cc.flags = %w(-O2 -mno-smart-io -w -ffunction-sections -fdata-sections -g -mdebugger -Wcast-align
-fno-short-double -mprocessor=32MX795F512L -DF_CPU=80000000L -DARDUINO=23 -D_BOARD_MEGA_
-DMPIDEVER=0x01000202 -DMPIDE=23)
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
#configuration for low memory environment
cc.defines << %w(MRB_HEAP_PAGE_SIZE=64)
......@@ -60,7 +60,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf|
conf.archiver do |archiver|
archiver.command = "#{PIC32_PATH}/compiler/pic32-tools/bin/pic32-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
#no executables
......
......@@ -37,7 +37,7 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
cc.command = "#{BIN_PATH}/sh-elf-gcc"
cc.include_paths << ["#{KOS_PATH}/include", "#{KOS_PATH}/kernel/arch/dreamcast/include", "#{KOS_PATH}/addons/include", "#{KOS_PATH}/../kos-ports/include"]
cc.flags << ["-O2", "-fomit-frame-pointer", "-ml", "-m4-single-only", "-ffunction-sections", "-fdata-sections", "-Wall", "-g", "-fno-builtin", "-ml", "-m4-single-only", "-Wl,-Ttext=0x8c010000", "-Wl,--gc-sections", "-T#{KOS_PATH}/utils/ldscripts/shlelf.xc", "-nodefaultlibs"]
cc.compile_options = "%{flags} -o %{outfile} -c %{infile}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
cc.defines << %w(_arch_dreamcast)
cc.defines << %w(_arch_sub_pristine)
end
......@@ -65,7 +65,7 @@ MRuby::CrossBuild.new("dreamcast") do |conf|
# Archiver
conf.archiver do |archiver|
archiver.command = "#{BIN_PATH}/sh-elf-ar"
archiver.archive_options = 'rcs %{outfile} %{objs}'
archiver.archive_options = 'rcs "%{outfile}" %{objs}'
end
# No executables
......
......@@ -36,9 +36,14 @@ module MRuby
private
def _run(options, params={})
return sh command + ' ' + ( options % params ) if NotFoundCommands.key? @command
cmd_string = if NotFoundCommands.key?(@command)
command + ' ' + ( options % params )
else
build.filename(command) + ' ' + ( options % params )
end
begin
sh build.filename(command) + ' ' + ( options % params )
sh cmd_string
rescue RuntimeError
NotFoundCommands[@command] = true
_run options, params
......@@ -58,9 +63,9 @@ module MRuby
@source_exts = source_exts
@include_paths = ["#{MRUBY_ROOT}/include"]
@defines = %w()
@option_include_path = '-I%s'
@option_define = '-D%s'
@compile_options = '%{flags} -o %{outfile} -c %{infile}'
@option_include_path = %q[-I"%s"]
@option_define = %q[-D"%s"]
@compile_options = %q[%{flags} -o "%{outfile}" -c "%{infile}"]
@cxx_invalid_flags = []
end
......@@ -184,9 +189,9 @@ module MRuby
@flags_before_libraries, @flags_after_libraries = [], []
@libraries = []
@library_paths = []
@option_library = '-l%s'
@option_library_path = '-L%s'
@link_options = "%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
@option_library = %q[-l"%s"]
@option_library_path = %q[-L"%s"]
@link_options = %Q[%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}]
end
def all_flags(_library_paths=[], _flags=[])
......@@ -217,7 +222,7 @@ module MRuby
:libs => library_flags.join(' ') }
else
_run link_options, { :flags => all_flags(_library_paths, _flags),
:outfile => filename(outfile) , :objs => filename(objfiles).join(' '),
:outfile => filename(outfile) , :objs => filename(objfiles).map{|f| %Q["#{f}"]}.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(' ') }
......@@ -231,16 +236,16 @@ module MRuby
def initialize(build)
super
@command = ENV['AR'] || 'ar'
@archive_options = 'rs %{outfile} %{objs}'
@archive_options = 'rs "%{outfile}" %{objs}'
end
def run(outfile, objfiles)
mkdir_p File.dirname(outfile)
_pp "AR", outfile.relative_path
if MRUBY_BUILD_HOST_IS_CYGWIN
_run archive_options, { :outfile => cygwin_filename(outfile), :objs => cygwin_filename(objfiles).join(' ') }
_run archive_options, { :outfile => cygwin_filename(outfile), :objs => cygwin_filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
else
_run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).join(' ') }
_run archive_options, { :outfile => filename(outfile), :objs => filename(objfiles).map{|f| %Q["#{f}"]}.join(' ') }
end
end
end
......@@ -251,7 +256,7 @@ module MRuby
def initialize(build)
super
@command = 'bison'
@compile_options = '-o %{outfile} %{infile}'
@compile_options = %q[-o "%{outfile}" "%{infile}"]
end
def run(outfile, infile)
......@@ -267,7 +272,7 @@ module MRuby
def initialize(build)
super
@command = 'gperf'
@compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
@compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
end
def run(outfile, infile)
......@@ -341,7 +346,7 @@ module MRuby
infiles.each do |f|
_pp "MRBC", f.relative_path, nil, :indent => 2
end
cmd = "#{filename @command} #{@compile_options % {:funcname => funcname}} #{filename(infiles).join(' ')}"
cmd = %Q["#{filename @command}" #{@compile_options % {:funcname => funcname}} #{filename(infiles).map{|f| %Q["#{f}"]}.join(' ')}]
puts cmd if Rake.verbose
IO.popen(cmd, 'r+') do |io|
out.puts io.read
......
......@@ -12,9 +12,9 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
compiler.command = ENV['CC'] || default_command
compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]]
end
compiler.option_include_path = '-I%s'
compiler.option_include_path = %q[-I"%s"]
compiler.option_define = '-D%s'
compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
compiler.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
compiler.cxx_compile_flag = '-x c++ -std=gnu++03'
compiler.cxx_exception_flag = '-fexceptions'
compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
......@@ -27,7 +27,7 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
linker.library_paths = []
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
end
[[conf.cc, 'c'], [conf.cxx, 'c++']].each do |cc, lang|
......
......@@ -5,18 +5,18 @@ MRuby::Toolchain.new(:openwrt) do |conf|
cc.command = ENV['TARGET_CC']
cc.flags = ENV['TARGET_CFLAGS']
cc.include_paths = ["#{MRUBY_ROOT}/include"]
cc.option_include_path = '-I%s'
cc.option_include_path = %q[-I"%s"]
cc.option_define = '-D%s'
cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
cc.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
end
[conf.cxx].each do |cxx|
cxx.command = ENV['TARGET_CXX']
cxx.flags = ENV['TARGET_CXXFLAGS']
cxx.include_paths = ["#{MRUBY_ROOT}/include"]
cxx.option_include_path = '-I%s'
cxx.option_include_path = %q[-I"%s"]
cxx.option_define = '-D%s'
cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
cxx.compile_options = %q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"]
end
conf.linker do |linker|
......@@ -26,11 +26,11 @@ MRuby::Toolchain.new(:openwrt) do |conf|
linker.library_paths = []
linker.option_library = '-l%s'
linker.option_library_path = '-L%s'
linker.link_options = '%{flags} -o %{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
linker.link_options = '%{flags} -o "%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}'
end
conf.archiver do |archiver|
archiver.command = ENV['TARGET_AR']
archiver.archive_options = 'rs %{outfile} %{objs}'
archiver.archive_options = 'rs "%{outfile}" %{objs}'
end
end
......@@ -4,9 +4,9 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
# C4013: implicit function declaration
cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /D_CRT_SECURE_NO_WARNINGS)]
cc.defines = %w(MRB_STACK_EXTEND_DOUBLING)
cc.option_include_path = '/I%s'
cc.option_include_path = %q[/I"%s"]
cc.option_define = '/D%s'
cc.compile_options = "%{flags} /Fo%{outfile} %{infile}"
cc.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
cc.cxx_compile_flag = '/TP'
cc.cxx_exception_flag = '/EHs'
end
......@@ -15,9 +15,9 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
cxx.command = ENV['CXX'] || 'cl.exe'
cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /D_CRT_SECURE_NO_WARNINGS)]
cxx.defines = %w(MRB_STACK_EXTEND_DOUBLING)
cxx.option_include_path = '/I%s'
cxx.option_include_path = %q[/I"%s"]
cxx.option_define = '/D%s'
cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}"
cxx.compile_options = %Q[%{flags} /Fo"%{outfile}" "%{infile}"]
cxx.cxx_compile_flag = '/TP'
cxx.cxx_exception_flag = '/EHs'
end
......@@ -29,22 +29,22 @@ MRuby::Toolchain.new(:visualcpp) do |conf, _params|
linker.library_paths = %w()
linker.option_library = '%s.lib'
linker.option_library_path = '/LIBPATH:%s'
linker.link_options = "%{flags} /OUT:%{outfile} %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
linker.link_options = "%{flags} /OUT:"%{outfile}" %{objs} %{flags_before_libraries} %{libs} %{flags_after_libraries}"
end
conf.archiver do |archiver|
archiver.command = ENV['AR'] || 'lib.exe'
archiver.archive_options = '/nologo /OUT:%{outfile} %{objs}'
archiver.archive_options = '/nologo /OUT:"%{outfile}" %{objs}'
end
conf.yacc do |yacc|
yacc.command = ENV['YACC'] || 'bison.exe'
yacc.compile_options = '-o %{outfile} %{infile}'
yacc.compile_options = %q[-o "%{outfile}" "%{infile}"]
end
conf.gperf do |gperf|
gperf.command = 'gperf.exe'
gperf.compile_options = '-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" %{infile} > %{outfile}'
gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"]
end
conf.exts do |exts|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment