aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamillo Lugaresi2012-06-05 22:21:15 +0200
committerJack Nagel2012-07-01 12:10:32 -0500
commit63415cccaecf9cccf204570ea2242b56ce0ffdc4 (patch)
tree3f40e2499f4bf0914234d33755586349edb2e805
parent344005f8021eba9d9114735ec44a2e9f165a295b (diff)
downloadhomebrew-63415cccaecf9cccf204570ea2242b56ce0ffdc4.tar.bz2
use XQuartz when present
-rw-r--r--Library/Formula/pkg-config.rb1
-rw-r--r--Library/Homebrew/extend/ENV.rb44
-rw-r--r--Library/Homebrew/macos.rb11
3 files changed, 35 insertions, 21 deletions
diff --git a/Library/Formula/pkg-config.rb b/Library/Formula/pkg-config.rb
index d61c83698..ffc8d0374 100644
--- a/Library/Formula/pkg-config.rb
+++ b/Library/Formula/pkg-config.rb
@@ -18,7 +18,6 @@ class PkgConfig < Formula
#{HOMEBREW_PREFIX}/share/pkgconfig
/usr/local/lib/pkgconfig
/usr/lib/pkgconfig
- /usr/X11/lib/pkgconfig
].uniq
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
diff --git a/Library/Homebrew/extend/ENV.rb b/Library/Homebrew/extend/ENV.rb
index 374243343..8bc759323 100644
--- a/Library/Homebrew/extend/ENV.rb
+++ b/Library/Homebrew/extend/ENV.rb
@@ -310,25 +310,33 @@ Please take one of the following actions:
def x11
opoo "You do not have X11 installed, this formula may not build." unless MacOS.x11_installed?
- if MacOS.clt_installed?
- # For Xcode < 4.3 clt_installed? is true. So here is the old style /usr/X11:
- # There are some config scripts (e.g. freetype) here that should go in the path
- # (note we don't use MacOS.sdk_path here, because there is no ./usr/bin in there)
- prepend 'PATH', "/usr/X11/bin", ':'
- # CPPFLAGS are the C-PreProcessor flags, *not* C++!
- append 'CPPFLAGS', "-I/usr/X11/include"
- # Even without Xcode or the CLTs, /usr/X11/lib is there
- append 'LDFLAGS', "-L/usr/X11/lib"
+ # There are some config scripts here that should go in the PATH. This
+ # path is always under MacOS.x11_prefix, even for Xcode-only systems.
+ prepend 'PATH', MacOS.x11_prefix/'bin', ':'
+
+ # Similarily, pkgconfig files are only found under MacOS.x11_prefix.
+ prepend 'PKG_CONFIG_PATH', MacOS.x11_prefix/'lib/pkgconfig', ':'
+ prepend 'PKG_CONFIG_PATH', MacOS.x11_prefix/'share/pkgconfig', ':'
+
+ append 'LDFLAGS', "-L#{MacOS.x11_prefix}/lib"
+ append 'CMAKE_PREFIX_PATH', MacOS.x11_prefix, ':'
+
+ # We prefer XQuartz if it is installed. Otherwise, we look for Apple's
+ # X11. For Xcode-only systems, the headers are found in the SDK.
+ prefix = if MacOS.x11_prefix.to_s == '/opt/X11' or MacOS.clt_installed?
+ MacOS.x11_prefix
else
- # For Xcode 4.3 and above *without* CLT, we find the includes in the SDK:
- # Only the SDK has got include files. (they are no longer in /usr/X11/include !)
- # Todo: do we need to add cairo, fontconfig, GL, libpng15, pixman-1, VG, xcb, too?
- append 'CFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include"
- append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include"
- append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/X11/include/freetype2"
- # The libs are still in /usr/X11/lib but to be consistent with the includes, we use the SDK, right?
- append 'LDFLAGS', "-L#{MacOS.sdk_path}/usr/X11/lib"
- append 'CMAKE_INCLUDE_PATH', "#{MacOS.sdk_path}/usr/X11/include", ':'
+ MacOS.sdk_path/'usr/X11'
+ end
+
+ append 'CPPFLAGS', "-I#{prefix}/include"
+
+ append 'CMAKE_PREFIX_PATH', prefix, ':'
+ append 'CMAKE_INCLUDE_PATH', prefix/'include', ':'
+
+ unless MacOS.clt_installed?
+ append 'CPPFLAGS', "-I#{prefix}/include/freetype2"
+ append 'CFLAGS', "-I#{prefix}/include"
end
end
alias_method :libpng, :x11
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index 766e07218..632077dbf 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -313,9 +313,16 @@ module MacOS extend self
end
end
+ def x11_prefix
+ @x11_prefix ||= if Pathname.new('/opt/X11/lib/libpng.dylib').exist?
+ Pathname.new('/opt/X11')
+ elsif Pathname.new('/usr/X11/lib/libpng.dylib').exist?
+ Pathname.new('/usr/X11')
+ end
+ end
+
def x11_installed?
- # Even if only Xcode (without CLT) is installed, this dylib is there.
- Pathname.new('/usr/X11/lib/libpng.dylib').exist?
+ not x11_prefix.nil?
end
def macports_or_fink_installed?