From 43e306f612f3ba2e266f3c7f14d9a2723c5a18df Mon Sep 17 00:00:00 2001 From: nibbles 2bits Date: Sun, 19 Aug 2012 09:51:41 -0700 Subject: [PATCH] zeromq: fix errors, use external libpgm, add devel zeromq gets a makeover to fix build errors and to offer the devel version. This has been tested with clang and llvm from XCode-4.4.1. * Add a devel block * Add a dep on libpgm, a new formula. The internal libpgm is b0rked * Add a `do_config` function that gets run for devel or head builds. * Add ENV.universal_binary for devel and head, it works. * Add conditionals so that the manual lipo to UB is only for stable Fixes Homebrew/homebrew#14210 Closes Homebrew/homebrew#14292. Signed-off-by: Adam Vandenberg --- Formula/zeromq.rb | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Formula/zeromq.rb b/Formula/zeromq.rb index 421552e49e7..56ea1b7cc9a 100644 --- a/Formula/zeromq.rb +++ b/Formula/zeromq.rb @@ -1,7 +1,7 @@ require 'formula' def pgm_flags - return ARGV.include?('--with-pgm') ? "--with-pgm" : "" + return build.include? '--with-pgm' ? '--with-system-pgm' : '' end class Zeromq < Formula @@ -11,6 +11,14 @@ class Zeromq < Formula head 'https://github.com/zeromq/libzmq.git' + devel do + url 'http://download.zeromq.org/zeromq-3.2.0-rc1.tar.gz' + sha1 '1a5195a61150c0a653798e5babde70f473a8a3b0' + end + + depends_on 'pkg-config' => :build + depends_on 'libpgm' if build.include? 'with-pgm' + if build.head? depends_on :automake depends_on :libtool @@ -24,6 +32,7 @@ class Zeromq < Formula option :universal option 'with-pgm', 'Build with PGM extension' + # This can be removed at stable >= 3.2.0 because ENV.universal_binary works. def build_fat # make 32-bit system "CFLAGS=\"$CFLAGS -arch i386\" CXXFLAGS=\"$CXXFLAGS -arch i386\" ./configure --disable-dependency-tracking --prefix='#{prefix}' #{pgm_flags}" @@ -42,15 +51,29 @@ class Zeromq < Formula "-output", "src/.libs/libzmq.1.dylib" end + def do_config + args = ["--disable-dependency-tracking", "--prefix=#{prefix}"] + if build.include? 'with-pgm' + # Use HB libpgm-5.2 because their internal 5.1 is b0rked. + ENV['OpenPGM_CFLAGS'] = %x[pkg-config --cflags openpgm-5.2].chomp + ENV['OpenPGM_LIBS'] = %x[pkg-config --libs openpgm-5.2].chomp + args << "--with-system-pgm" + end + system "./configure", *args + end + def install system "./autogen.sh" if build.head? - if ARGV.build_universal? - build_fat + if build.universal? + if build.devel? or build.head? + ENV.universal_binary + do_config + else + build_fat + end else - args = ["--disable-dependency-tracking", "--prefix=#{prefix}"] - args << "--with-pgm" if build.include? 'with-pgm' - system "./configure", *args + do_config end system "make"