Revision
4506
Author
lsansonetti@apple.com
Date
2010-09-10 17:36:29 -0700 (Fri, 10 Sep 2010)

Log Message

grab the kernel bitcode from SDK if it exists

Modified Paths

Diff

Modified: MacRuby/trunk/bin/rubyc (4505 => 4506)


--- MacRuby/trunk/bin/rubyc	2010-09-10 22:41:36 UTC (rev 4505)
+++ MacRuby/trunk/bin/rubyc	2010-09-11 00:36:29 UTC (rev 4506)
@@ -158,9 +158,18 @@
 
     tmp_objs = []
     @archs.each do |arch|
+      # Locate the kernel bitcode file if needed.
+      env = ''
+      if @sdk
+        kernel_path = File.join(@sdk, "usr/lib/libmacruby-kernel-#{arch}.bc")
+        if File.exist?(kernel_path)
+          env = "/usr/bin/env VM_KERNEL_PATH=\"#{kernel_path}\""
+        end
+      end
+
       # Compile the file into LLVM bitcode.
       bc = gen_tmpfile(base + arch, 'bc')
-      execute("arch -#{arch} #{@macruby} #{@uses_bs_flags} --emit-llvm \"#{bc}\" #{init_func} \"#{path}\"")
+      execute("#{env} arch -#{arch} #{@macruby} #{@uses_bs_flags} --emit-llvm \"#{bc}\" #{init_func} \"#{path}\"")
 
       # Compile the bitcode as assembly.
       asm = gen_tmpfile(base + arch, 's')