Have gx/cc/cc call through to the next in PATH

This commit is contained in:
Max Howell 2022-11-10 17:18:57 -05:00
parent f3f0c659bb
commit 2cb4d01d7a
2 changed files with 15 additions and 3 deletions

View file

@ -15,6 +15,18 @@ args = ARGV.map do |arg|
arg unless arg == "-Wl,-rpath,#$tea_prefix"
end.compact
# find next example of ourselves
# this will either pick the Apple provided clang or the tea one
exe_path = ENV['PATH'].split(":").filter { |path|
path != File.dirname(__FILE__)
}.map { |path|
"#{path}/#{exe}"
}.find { |path|
File.exist?(path)
}
abort "couldnt find #{exe} in `PATH`" unless exe_path
for arg in args do
# figuring out what “mode” we are operating in is hard
# we dont want to add this linker command always because it causes a warning to be
@ -23,8 +35,8 @@ for arg in args do
# we aren't sure what the rules are TBH, possibly it is as simple as if the output (`-o`)
# is a .o then we dont add the rpath
if arg.start_with? '-l' or arg.end_with? '.dylib'
exec "/usr/bin/#{exe}", *args, "-Wl,-rpath,#$tea_prefix"
exec exe_path, *args, "-Wl,-rpath,#$tea_prefix"
end
end
exec "/usr/bin/#{exe}", *args
exec exe_path, *args

View file

@ -3,7 +3,7 @@ distributable: ~
# FIXME we want the c version eg. c99
# or should that be some kind of option? so you specify you want a cc that support c99
versions:
- 0.1.0
- 0.1.1
dependencies:
linux: