homebrew-core/Formula/pkg-config.rb
Nibbles 2bits 383fb6b537 pkg-config: Add gnu89 fixes Lion + Clang
pkg-config append to cflags -std=gnu89 on Lion fixes duplicate
symbols linking libglib when compiling with Clang-3.0 from
XCode-4.2 (4D199).  Add make check to confirm success, given the
critical nature of the software.  The flag is appended only on
Lion, though it successfully tests on Snow Leopard in 64bit, too.
EDIT: checks if lion and if clang before switching to gnu89.

Closes Homebrew/homebrew#8631.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2011-11-17 12:15:41 -08:00

29 lines
941 B
Ruby

require 'formula'
class PkgConfig < Formula
homepage 'http://pkg-config.freedesktop.org'
# yes we know pkg-config 0.26 is now out, however it depends on glib
# this is totally ridiculous dependency and we refuse to upgrade until
# someone can prove we must.
url 'http://pkg-config.freedesktop.org/releases/pkg-config-0.25.tar.gz'
md5 'a3270bab3f4b69b7dc6dbdacbcae9745'
def install
# fixes compile error on Lion with Clang duplicate symbols in libglib
ENV.append_to_cflags '-std=gnu89' if MacOS.lion? and ENV.compiler == :clang
paths = %W[
#{HOMEBREW_PREFIX}/lib/pkgconfig
/usr/local/lib/pkgconfig
/usr/lib/pkgconfig
/usr/X11/lib/pkgconfig
].uniq
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--with-pc-path=#{paths*':'}"
system "make"
system "make check"
system "make install"
end
end