Sort out remaining XQuartz/stdenv issues

We use PKG_CONFIG_LIBDIR to reset the default search path, overriding
whatever is baked into the pkg-config executable. This way, we can later
append XQuartz paths here while still allowing any brewed libs to take
precedence, keg-only or not.

Hopefully this will resolve any remaining issues, and let us get rid of
some per-formula hacks.

c.f. Homebrew/homebrew#14474.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-09-03 21:28:20 -05:00
parent 8094b00b55
commit 2d1a941976

View File

@ -14,12 +14,12 @@ module HomebrewEnvExtension
# it encounters files with mixed character sets
delete('LC_ALL')
self['LC_CTYPE']="C"
# Mountain Lion no longer ships a few .pcs; make sure we pick up our versions
prepend 'PKG_CONFIG_PATH',
HOMEBREW_REPOSITORY/'Library/Homebrew/pkgconfig', ':'
end
# Set the default pkg-config search path, overriding the built-in paths
# Anything in PKG_CONFIG_PATH is searched before paths in this variable
self['PKG_CONFIG_LIBDIR'] = determine_pkg_config_libdir
# make any aclocal stuff installed in Homebrew available
self['ACLOCAL_PATH'] = "#{HOMEBREW_PREFIX}/share/aclocal" if MacOS::Xcode.provides_autotools?
@ -66,6 +66,15 @@ module HomebrewEnvExtension
end
end
def determine_pkg_config_libdir
paths = []
paths << HOMEBREW_PREFIX/'lib/pkgconfig'
paths << HOMEBREW_PREFIX/'share/pkgconfig'
paths << HOMEBREW_REPOSITORY/'Library/Homebrew/pkgconfig' if MacOS.version >= :mountain_lion
paths << '/usr/lib/pkgconfig'
paths.select { |d| File.directory? d }.join(':')
end
def deparallelize
remove 'MAKEFLAGS', /-j\d+/
end
@ -249,10 +258,13 @@ module HomebrewEnvExtension
def x11
# There are some config scripts here that should go in the PATH
prepend 'PATH', MacOS::X11.bin, ':'
append 'PATH', MacOS::X11.bin, ':'
prepend 'PKG_CONFIG_PATH', MacOS::X11.lib/'pkgconfig', ':'
prepend 'PKG_CONFIG_PATH', MacOS::X11.share/'pkgconfig', ':'
# Append these to PKG_CONFIG_LIBDIR so they are searched
# *after* our own pkgconfig directories, as we dupe some of the
# libs in XQuartz.
append 'PKG_CONFIG_LIBDIR', MacOS::X11.lib/'pkgconfig', ':'
append 'PKG_CONFIG_LIBDIR', MacOS::X11.share/'pkgconfig', ':'
append 'LDFLAGS', "-L#{MacOS::X11.lib}"
append 'CMAKE_PREFIX_PATH', MacOS::X11.prefix, ':'