homebrew-core/Formula/libgcrypt.rb
Max Howell 49aa2d9116 Fix superenv libgcrypt
This started happening because I undefined CC. Now a lot of tools pick gcc. The problem here is that we add to cflags before configure, and during configure we are 'servile' so when configure uses gcc it *is* llvm-gcc and not clang, which we will be during make because then we are *not* servile.

So we have to assign these cflags during make only, which is easy enough. Code is neater now too.

I am now working on superenv so that it can determine if a tool cannot use certain flags and then pick another. The last stage of always-just-works.
2012-08-31 15:25:14 -04:00

35 lines
994 B
Ruby

require 'formula'
class Libgcrypt < Formula
homepage 'http://gnupg.org/'
url 'ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.5.0.tar.bz2'
sha1 '3e776d44375dc1a710560b98ae8437d5da6e32cf'
depends_on 'libgpg-error'
def patches
if ENV.compiler == :clang
{:p0 =>
"https://trac.macports.org/export/85232/trunk/dports/devel/libgcrypt/files/clang-asm.patch"}
end
end
def cflags
cflags = "#{ENV['CFLAGS']}"
cflags += '-std=gnu89 -fheinous-gnu-extensions' if ENV.compiler == :clang
cflags
end
def install
ENV.universal_binary # build fat so wine can use it
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-asm",
"--with-gpg-error-prefix=#{HOMEBREW_PREFIX}"
# Parallel builds work, but only when run as separate steps
system "make", "CFLAGS=#{cflags}"
system "make check"
system "make install"
end
end