2011-10-29 06:33:41 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Field3d < Formula
|
|
|
|
homepage 'https://sites.google.com/site/field3d/'
|
2012-02-21 06:04:21 +00:00
|
|
|
url 'https://github.com/imageworks/Field3D/tarball/v1.3.2'
|
2012-02-14 03:35:24 +00:00
|
|
|
sha1 '6f4de442869587f7fa5ce6f5f8bd0630b6ae7192'
|
2011-10-29 06:33:41 +00:00
|
|
|
|
|
|
|
depends_on 'cmake' => :build
|
|
|
|
depends_on 'scons' => :build
|
|
|
|
depends_on 'doxygen' => :build
|
|
|
|
depends_on 'boost'
|
|
|
|
depends_on 'ilmbase'
|
|
|
|
depends_on 'hdf5'
|
|
|
|
|
|
|
|
def install
|
2012-02-14 03:35:24 +00:00
|
|
|
# When compiling with Clang, remove flags that SCons can't parse
|
|
|
|
if ENV.compiler == :clang then
|
|
|
|
ENV.remove_from_cflags '-Xclang -target-feature -Xclang -aes'
|
|
|
|
end
|
|
|
|
|
2011-10-29 06:33:41 +00:00
|
|
|
# Set the compilers for Homebrew - was fixed to gcc & g++
|
|
|
|
inreplace 'SConstruct', 'env = Environment()',
|
|
|
|
<<-EOS.undent
|
|
|
|
env = Environment()\n
|
|
|
|
env.Replace(CC = "#{ENV.cc}")
|
|
|
|
env.Replace(CXX = "#{ENV.cxx}")
|
|
|
|
EOS
|
2011-12-12 03:45:20 +00:00
|
|
|
|
|
|
|
inreplace 'BuildSupport.py' do |s|
|
|
|
|
s.gsub! '/opt/local/include', "#{HOMEBREW_PREFIX}/include"
|
|
|
|
s.gsub! '/opt/local/lib', "#{HOMEBREW_PREFIX}/lib"
|
|
|
|
# Merge Homebrew's CFLAGS into the build's CCFLAGS passed to CC and CXX
|
|
|
|
s.gsub! 'env.Append(CCFLAGS = ["-Wall"])', "env.MergeFlags(['#{ENV.cflags}'])"
|
|
|
|
end
|
2011-10-29 06:33:41 +00:00
|
|
|
|
|
|
|
# Build the software with scons.
|
2011-12-12 03:45:20 +00:00
|
|
|
if MacOS.prefer_64_bit?
|
|
|
|
system "scons do64=1"
|
|
|
|
else
|
|
|
|
system "scons"
|
|
|
|
end
|
|
|
|
|
2011-10-29 06:33:41 +00:00
|
|
|
# Build the docs with cmake
|
2012-02-22 04:48:36 +00:00
|
|
|
mkdir 'macbuild' do
|
2011-10-29 06:33:41 +00:00
|
|
|
system "cmake .."
|
|
|
|
system "make doc"
|
|
|
|
end
|
2011-12-12 03:45:20 +00:00
|
|
|
|
2011-10-29 06:33:41 +00:00
|
|
|
# Install the libraries and docs.
|
2011-12-12 03:45:20 +00:00
|
|
|
b = if MacOS.prefer_64_bit?
|
|
|
|
'install/darwin/m64/release/'
|
|
|
|
else
|
|
|
|
'install/darwin/m32/release/'
|
|
|
|
end
|
|
|
|
|
|
|
|
lib.install Dir[b+'lib/*']
|
|
|
|
include.install Dir[b+'include/*']
|
2011-10-29 06:33:41 +00:00
|
|
|
doc.install Dir['docs/html/*']
|
|
|
|
end
|
|
|
|
end
|