2010-03-25 04:45:05 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-07-29 01:23:32 +00:00
|
|
|
def pgm_flags
|
|
|
|
return ARGV.include?('--with-pgm') ? "--with-pgm" : ""
|
|
|
|
end
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Zeromq < Formula
|
2011-10-03 23:02:55 +00:00
|
|
|
url 'http://download.zeromq.org/zeromq-2.1.10.tar.gz'
|
2011-06-05 00:18:11 +00:00
|
|
|
head 'https://github.com/zeromq/libzmq.git'
|
2010-03-25 04:45:05 +00:00
|
|
|
homepage 'http://www.zeromq.org/'
|
2011-10-03 23:02:55 +00:00
|
|
|
md5 'f034096095fa76041166a8861e9d71b7'
|
2010-03-25 04:45:05 +00:00
|
|
|
|
2011-09-01 12:06:19 +00:00
|
|
|
fails_with_llvm "Compiling with LLVM gives a segfault while linking.",
|
|
|
|
:build => 2326 if MacOS.snow_leopard?
|
2011-03-21 21:24:22 +00:00
|
|
|
|
2010-09-30 08:20:45 +00:00
|
|
|
def options
|
2011-07-29 01:23:32 +00:00
|
|
|
[
|
|
|
|
['--with-pgm', 'Build with PGM extension'],
|
|
|
|
['--universal', 'Build as a Universal Intel binary.']
|
|
|
|
]
|
2010-09-30 08:20:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def build_fat
|
|
|
|
# make 32-bit
|
2011-07-29 01:23:32 +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
|
2011-07-29 01:23:32 +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
|
2011-03-04 01:11:41 +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
|
|
|
|
|
2010-03-25 04:45:05 +00:00
|
|
|
def install
|
2010-10-09 02:16:19 +00:00
|
|
|
system "./autogen.sh" if ARGV.build_head?
|
|
|
|
|
2011-04-21 16:42:27 +00:00
|
|
|
if ARGV.build_universal?
|
2010-09-30 08:20:45 +00:00
|
|
|
build_fat
|
|
|
|
else
|
2011-07-29 01:23:32 +00:00
|
|
|
args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
|
|
|
|
args << "--with-pgm" if ARGV.include? '--with-pgm'
|
|
|
|
system "./configure", *args
|
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
|