require "formula" # Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook # /usr/local/Library/Contributions/example-formula.rb # PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST! class Odb < Formula homepage "http://www.codesynthesis.com/products/odb/" url "http://www.codesynthesis.com/download/odb/2.4/odb-2.4.0.tar.gz" sha1 "ad39f381cd2ebc07fa08e3464a44a6ef31ccd2d1" depends_on "gcc" => :build depends_on "libcutl" => :build def install gcc_short_version = `echo $CXX | cut -d- -f2`.strip gcc_plugin_dir = `echo $(dirname $($CXX -print-libgcc-file-name))/plugin/include`.strip if !File.exist?("#{gcc_plugin_dir}/libiberty.h") ln_s "#{gcc_plugin_dir}/libiberty-#{gcc_short_version}.h", "#{gcc_plugin_dir}/libiberty.h", :force => true end File.open("doc/default.options", 'w') {|f| f << "# Default ODB options file. This file is automatically loaded by the ODB\n" f << "# compiler and can be used for installation-wide customizations, such as\n" f << "# adding an include search path for a commonly used library. For example:\n" f << "#\n" f << "# -I /opt/boost_1_45_0\n" f << "#\n" } system "./configure", "--prefix=#{prefix}", "--libexecdir=#{lib}", "--with-options-file=#{prefix}/etc/odb/default.options", "CXXFLAGS=-fno-devirtualize" system "make", "install" # if this fails, try separate make/make install steps (prefix/"etc/odb").install "doc/default.options" end fails_with :clang do cause <<-EOS.undent Oh! It seems that you only have clang available, or GCC wasn't found! Make sure you GCC is installed and recognized by homebrew. EOS end test do system "odb", "-v" end end