File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1987,6 +1987,24 @@ Available commands are:
1987
1987
message . index ( "\n " ) != nil
1988
1988
end
1989
1989
end
1990
+ # Returns true if the *port* command is in the PATH and identifies
1991
+ # itself with "MacPorts" when run interactively.
1992
+ def macports?
1993
+ `echo quit | port 2>&-` . start_with? 'MacPorts'
1994
+ end
1995
+
1996
+ # Query MacPorts for the path to the latest installed version of
1997
+ # llvm-config that is within the range of supported LLVM versions.
1998
+ def macports_llvm_config
1999
+ supported_versions = ( 3.0 .. 3.5 )
2000
+ installed_ports = `port installed | egrep -o 'llvm-[^ ]+'` . split
2001
+ latest_usable_port = installed_ports . sort . select do |fname |
2002
+ version = fname . match ( /-\K .*/ ) [ 0 ] . to_f
2003
+ supported_versions . include? version
2004
+ end . last
2005
+ avail_binaries = `port contents #{ latest_usable_port } | fgrep llvm-config` . split
2006
+ avail_binaries . reject { |fname | fname . include? 'libexec' } . last
2007
+ end
1990
2008
end
1991
2009
1992
2010
STDOUT . sync = true
You can’t perform that action at this time.
0 commit comments