Extract repeated conditional to a method
This commit is contained in:
parent
943978a955
commit
f2738dbe96
@ -95,34 +95,28 @@ module OS
|
|||||||
# found in the SDK, so we use sdk_path for both the headers and libraries.
|
# found in the SDK, so we use sdk_path for both the headers and libraries.
|
||||||
# Confusingly, executables (e.g. config scripts) are only found under
|
# Confusingly, executables (e.g. config scripts) are only found under
|
||||||
# /opt/X11/bin or /usr/X11/bin in all cases.
|
# /opt/X11/bin or /usr/X11/bin in all cases.
|
||||||
|
def effective_prefix
|
||||||
|
if provided_by_apple? && Xcode.without_clt?
|
||||||
|
Pathname.new("#{OS::Mac.sdk_path}/usr/X11")
|
||||||
|
else
|
||||||
|
prefix
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def bin
|
def bin
|
||||||
Pathname.new("#{prefix}/bin")
|
prefix/"bin"
|
||||||
end
|
end
|
||||||
|
|
||||||
def include
|
def include
|
||||||
@include ||= if use_sdk?
|
effective_prefix/"include"
|
||||||
Pathname.new("#{MacOS.sdk_path}/usr/X11/include")
|
|
||||||
else
|
|
||||||
Pathname.new("#{prefix}/include")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def lib
|
def lib
|
||||||
@lib ||= if use_sdk?
|
effective_prefix/"lib"
|
||||||
Pathname.new("#{MacOS.sdk_path}/usr/X11/lib")
|
|
||||||
else
|
|
||||||
Pathname.new("#{prefix}/lib")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def share
|
def share
|
||||||
Pathname.new("#{prefix}/share")
|
prefix/"share"
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def use_sdk?
|
|
||||||
provided_by_apple? && Xcode.without_clt?
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user