2010-03-25 04:45:05 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-07-29 01:23:32 +00:00
|
|
|
def pgm_flags
|
2012-08-25 16:37:21 +00:00
|
|
|
build.include? 'with-pgm' ? '--with-system-pgm' : ''
|
2011-07-29 01:23:32 +00:00
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Zeromq < Formula
|
2010-03-25 04:45:05 +00:00
|
|
|
homepage 'http://www.zeromq.org/'
|
2012-04-07 19:52:16 +00:00
|
|
|
url 'http://download.zeromq.org/zeromq-2.2.0.tar.gz'
|
2012-07-30 20:04:29 +00:00
|
|
|
sha1 'e4bc024c33d3e62f658640625e061ce4e8bd1ff1'
|
|
|
|
|
2012-04-07 19:52:16 +00:00
|
|
|
head 'https://github.com/zeromq/libzmq.git'
|
2010-03-25 04:45:05 +00:00
|
|
|
|
2012-08-19 16:51:41 +00:00
|
|
|
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'
|
|
|
|
|
2012-07-30 20:01:46 +00:00
|
|
|
if build.head?
|
2012-07-07 18:08:22 +00:00
|
|
|
depends_on :automake
|
|
|
|
depends_on :libtool
|
2012-02-28 15:39:22 +00:00
|
|
|
end
|
|
|
|
|
2012-09-29 01:50:05 +00:00
|
|
|
# Remove along with build_fat hack at 3.2.0
|
|
|
|
env :std if build.universal?
|
|
|
|
|
2012-03-18 20:33:24 +00:00
|
|
|
fails_with :llvm do
|
|
|
|
build 2326
|
|
|
|
cause "Segfault while linking"
|
|
|
|
end
|
|
|
|
|
2012-07-30 20:01:46 +00:00
|
|
|
option :universal
|
|
|
|
option 'with-pgm', 'Build with PGM extension'
|
2010-09-30 08:20:45 +00:00
|
|
|
|
2012-08-19 16:51:41 +00:00
|
|
|
# This can be removed at stable >= 3.2.0 because ENV.universal_binary works.
|
2010-09-30 08:20:45 +00:00
|
|
|
def build_fat
|
|
|
|
# make 32-bit
|
2012-05-15 18:31:21 +00:00
|
|
|
system "CFLAGS=\"$CFLAGS -arch i386\" CXXFLAGS=\"$CXXFLAGS -arch i386\" ./configure --disable-dependency-tracking --prefix='#{prefix}' #{pgm_flags}"
|
2010-09-30 08:20:45 +00:00
|
|
|
system "make"
|
|
|
|
system "mv src/.libs src/libs-32"
|
|
|
|
system "make clean"
|
|
|
|
|
|
|
|
# make 64-bit
|
2012-05-15 18:31:21 +00:00
|
|
|
system "CFLAGS=\"$CFLAGS -arch x86_64\" CXXFLAGS=\"$CXXFLAGS -arch x86_64\" ./configure --disable-dependency-tracking --prefix='#{prefix}' #{pgm_flags}"
|
2010-09-30 08:20:45 +00:00
|
|
|
system "make"
|
2011-03-04 01:11:41 +00:00
|
|
|
system "mv src/.libs/libzmq.1.dylib src/.libs/libzmq.64.dylib"
|
2010-09-30 08:20:45 +00:00
|
|
|
|
|
|
|
# merge UB
|
2012-07-30 20:04:29 +00:00
|
|
|
system "lipo", "-create", "src/libs-32/libzmq.1.dylib",
|
|
|
|
"src/.libs/libzmq.64.dylib",
|
|
|
|
"-output", "src/.libs/libzmq.1.dylib"
|
2010-09-30 08:20:45 +00:00
|
|
|
end
|
|
|
|
|
2012-08-19 16:51:41 +00:00
|
|
|
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
|
|
|
|
|
2010-03-25 04:45:05 +00:00
|
|
|
def install
|
2012-07-30 20:01:46 +00:00
|
|
|
system "./autogen.sh" if build.head?
|
2010-10-09 02:16:19 +00:00
|
|
|
|
2012-08-19 16:51:41 +00:00
|
|
|
if build.universal?
|
|
|
|
if build.devel? or build.head?
|
|
|
|
ENV.universal_binary
|
|
|
|
do_config
|
|
|
|
else
|
|
|
|
build_fat
|
|
|
|
end
|
2010-09-30 08:20:45 +00:00
|
|
|
else
|
2012-08-19 16:51:41 +00:00
|
|
|
do_config
|
2010-09-30 08:20:45 +00:00
|
|
|
end
|
|
|
|
|
2011-03-31 06:36:46 +00:00
|
|
|
system "make"
|
2010-03-25 04:45:05 +00:00
|
|
|
system "make install"
|
|
|
|
end
|
2010-09-09 20:17:14 +00:00
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2010-09-30 08:20:45 +00:00
|
|
|
To install the zmq gem on 10.6 with the system Ruby on a 64-bit machine,
|
|
|
|
you may need to do:
|
2011-09-01 12:06:19 +00:00
|
|
|
|
2011-04-04 23:56:47 +00:00
|
|
|
ARCHFLAGS="-arch x86_64" gem install zmq -- --with-zmq-dir=#{HOMEBREW_PREFIX}
|
2010-11-12 15:43:28 +00:00
|
|
|
|
2011-09-01 12:06:19 +00:00
|
|
|
If you want to build the Java bindings from https://github.com/zeromq/jzmq
|
|
|
|
you will need the Java Developer Package from http://connect.apple.com/
|
2010-09-09 20:17:14 +00:00
|
|
|
EOS
|
|
|
|
end
|
2011-03-10 05:11:03 +00:00
|
|
|
end
|