1 # Executed by dev-tramp only!
3 prefix = File.dirname ENV['BUILDDIR']
4 my_name = ENV['PROGNAME']
6 my_name = "rubinius" if my_name == "dev-tramp"
8 real = File.join(prefix, 'shotgun/rubinius.local.bin')
10 # Setup all the crazy library path stuff so that librubinus is picked
16 addition = "#{@prefix}/shotgun/lib"
19 ENV[name] = "#{addition}:#{cur}"
25 set_env 'LD_LIBRARY_PATH'
26 set_env 'LD_LIBRARY_PATH_64'
30 set_env 'DYLD_LIBRARY_PATH'
31 set_env 'DYLD_FALLBACK_LIBRARY_PATH'
33 ENV['RBX_IN_BUILDDIR'] = "1"
35 ENV['RBX_PREFIX'] = "#{prefix}/"
37 unless ENV['RBX_BOOTSTRAP']
38 ENV['RBX_BOOTSTRAP'] = "#{prefix}/runtime/bootstrap"
41 unless ENV['RBX_CORE']
42 ENV['RBX_CORE'] = "#{prefix}/runtime/core"
45 unless ENV['RBX_PLATFORM']
46 ENV['RBX_PLATFORM'] = "#{prefix}/runtime/platform"
49 unless ENV['RBX_LOADER']
50 ENV['RBX_LOADER'] = "#{prefix}/runtime/loader.rbc"
53 unless ENV['RBX_PLATFORM_CONF']
54 ENV['RBX_PLATFORM_CONF'] = "#{prefix}/runtime/platform.conf"
57 ENV['RUBYLIB'] = %w(lib stdlib).map { |dir| File.join(prefix, dir) }.join(":")
62 ENV['PATH'] = "#{prefix}/shotgun:#{ENV['PATH']}"
63 args = ['-x', "#{prefix}/shotgun/gdbcommands"]
64 if `uname -s` == "Darwin" and `uname -r`.split(".")[0].to_i < 9
65 args << '-x' << "#{prefix}/shotgun/gdbenvironment"
67 args << '--args' << "/dev/null"
69 exec "gdb", *(args + ARGV)
70 elsif ARGV[0] == "--valgrind"
73 exec 'valgrind', *(args + ARGV)
74 elsif ARGV[0] == "--shark"
76 puts "Starting up rubinius, then pausing for shark to start"
77 pid = fork { sleep 5; exec real, *ARGV }
78 exec "shark -o rbxshark -i -1 -a #{pid}"
79 elsif ARGV[0] == "--dtrace"
81 puts "Starting up rubinius, then pausing for dtrace to start"
82 pid = fork { sleep 5; exec real, *ARGV }
83 exec "dtrace -s #{ENV['SCRIPT']} -p #{pid}"
85 exec [real, my_name], *ARGV