merge the patches to fix build error of Extension and Framework for arm64

http://hipbyte.myjetbrains.com/youtrack/issue/RM-655

Merged below patches into Extension and Framework:
- 1567487...fde9580
This commit is contained in:
Watson
2014-11-06 16:26:32 +09:00
parent b98ed48378
commit a82bafc8c6
2 changed files with 6 additions and 30 deletions

View File

@@ -168,7 +168,6 @@ PLIST
raise "Can't locate kernel file" unless File.exist?(kernel)
# Assembly.
asm = File.join(files_build_dir, "#{path}.#{arch}.s")
arm64 = false
compiler_exec_arch = case arch
when /^arm/
@@ -176,24 +175,13 @@ PLIST
else
arch
end
asm = File.join(files_build_dir, "#{path}.#{arch}.#{arm64 ? 'bc' : 's'}")
sh "/usr/bin/env VM_PLATFORM=\"#{platform}\" VM_KERNEL_PATH=\"#{kernel}\" VM_OPT_LEVEL=\"#{config.opt_level}\" /usr/bin/arch -arch #{compiler_exec_arch} #{ruby} #{rubyc_bs_flags} --emit-llvm \"#{asm}\" #{init_func} \"#{path}\""
# Object
arch_obj = File.join(files_build_dir, "#{path}.#{arch}.o")
if arm64
# At the time of this writing Apple hasn't yet contributed the source code of the LLVM backend for the "arm64" architecture, so the RubyMotion compiler can't emit proper assembly yet. We work around this limitation by generating bitcode instead and giving it to the linker. Ugly but should be temporary (right?).
@dummy_object_file ||= begin
src_path = '/tmp/__dummy_object_file__.c'
obj_path = '/tmp/__dummy_object_file__.o'
File.open(src_path, 'w') { |io| io.puts "static int foo(void) { return 42; }" }
sh "#{cc} -c #{src_path} -o #{obj_path} -arch arm64 -miphoneos-version-min=7.0"
obj_path
end
ld_path = File.join(App.config.xcode_dir, 'Toolchains/XcodeDefault.xctoolchain/usr/bin/ld')
sh "#{ld_path} \"#{asm}\" \"#{@dummy_object_file}\" -arch arm64 -r -o \"#{arch_obj}\""
else
sh "#{cc} -fexceptions -c -arch #{arch} \"#{asm}\" -o \"#{arch_obj}\""
end
arch_obj_flags = arm64 ? "-miphoneos-version-min=#{config.deployment_target}" : ''
sh "#{cc} -fexceptions -c -arch #{arch} #{arch_obj_flags} \"#{asm}\" -o \"#{arch_obj}\""
[asm].each { |x| File.unlink(x) } unless ENV['keep_temps']
arch_objs << arch_obj

View File

@@ -126,7 +126,6 @@ module Motion; module Project
raise "Can't locate kernel file" unless File.exist?(kernel)
# Assembly.
asm = File.join(files_build_dir, "#{path}.#{arch}.s")
arm64 = false
compiler_exec_arch = case arch
when /^arm/
@@ -134,24 +133,13 @@ module Motion; module Project
else
arch
end
asm = File.join(files_build_dir, "#{path}.#{arch}.#{arm64 ? 'bc' : 's'}")
sh "/usr/bin/env VM_PLATFORM=\"#{platform}\" VM_KERNEL_PATH=\"#{kernel}\" VM_OPT_LEVEL=\"#{config.opt_level}\" /usr/bin/arch -arch #{compiler_exec_arch} #{ruby} #{rubyc_bs_flags} --emit-llvm \"#{asm}\" #{init_func} \"#{path}\""
# Object
arch_obj = File.join(files_build_dir, "#{path}.#{arch}.o")
if arm64
# At the time of this writing Apple hasn't yet contributed the source code of the LLVM backend for the "arm64" architecture, so the RubyMotion compiler can't emit proper assembly yet. We work around this limitation by generating bitcode instead and giving it to the linker. Ugly but should be temporary (right?).
@dummy_object_file ||= begin
src_path = '/tmp/__dummy_object_file__.c'
obj_path = '/tmp/__dummy_object_file__.o'
File.open(src_path, 'w') { |io| io.puts "static int foo(void) { return 42; }" }
sh "#{cc} -c #{src_path} -o #{obj_path} -arch arm64 -miphoneos-version-min=7.0"
obj_path
end
ld_path = File.join(App.config.xcode_dir, 'Toolchains/XcodeDefault.xctoolchain/usr/bin/ld')
sh "#{ld_path} \"#{asm}\" \"#{@dummy_object_file}\" -arch arm64 -r -o \"#{arch_obj}\""
else
sh "#{cc} -fexceptions -c -arch #{arch} \"#{asm}\" -o \"#{arch_obj}\""
end
arch_obj_flags = arm64 ? "-miphoneos-version-min=#{config.deployment_target}" : ''
sh "#{cc} -fexceptions -c -arch #{arch} #{arch_obj_flags} \"#{asm}\" -o \"#{arch_obj}\""
[asm].each { |x| File.unlink(x) } unless ENV['keep_temps']
arch_objs << arch_obj