Address some style issues in MacOS module
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
parent
4aed55cccb
commit
cfe58531ee
@ -128,34 +128,28 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def xctoolchain_path
|
def xctoolchain_path
|
||||||
# Beginning with Xcode 4.3, clang and some other tools are located in a xctoolchain dir.
|
# As of Xcode 4.3, some tools are located in the "xctoolchain" directory
|
||||||
@xctoolchain_path ||= begin
|
@xctoolchain_path ||= begin
|
||||||
path = Pathname.new("#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain")
|
path = Pathname.new("#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain")
|
||||||
if path.exist?
|
# If only the CLT are installed, all tools will be under dev_tools_path,
|
||||||
path
|
# and this path will be nil.
|
||||||
else
|
path if path.exist?
|
||||||
# ok, there are no Toolchains in xcode_prefix
|
|
||||||
# and that's ok as long as everything is in dev_tools_path="/usr/bin" (i.e. clt_installed?)
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def sdk_path(v=MacOS.version)
|
def sdk_path(v=MacOS.version)
|
||||||
# The path of the MacOSX SDK.
|
@sdk_path ||= begin
|
||||||
if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make"
|
path = if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make"
|
||||||
path = `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip
|
`#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip
|
||||||
elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk'
|
elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk'
|
||||||
# the old default (or wild wild west style)
|
# the old default (or wild wild west style)
|
||||||
path = "/Developer/SDKs/MacOS#{v}.sdk"
|
"/Developer/SDKs/MacOS#{v}.sdk"
|
||||||
elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
|
elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
|
||||||
# xcode_prefix is pretty smart, so lets look inside to find the sdk
|
# xcode_prefix is pretty smart, so lets look inside to find the sdk
|
||||||
path = "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
|
"#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
|
||||||
end
|
end
|
||||||
if path.nil? or path.empty? or not File.directory? path
|
|
||||||
nil
|
Pathname.new(path) unless path.nil? or path.empty? or not File.directory? path
|
||||||
else
|
|
||||||
Pathname.new path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user