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.3/odb-2.3.0.tar.gz" sha1 "53c851e3f3724b72d7c7a74c497c50c195729ad1" depends_on "gcc" => :build depends_on "libcutl" => :build patch do url "http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=97281fd4454596834142fa43f83af38695b38e5b" sha1 "3542604d943aeea80cd4a26b366297eab9116c0e" end patch do url "http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=4617f8f3b0c07a40d46bb04ab4b66e8446a8250b" sha1 "d47e879f8c52ebc985d1cff54a89ca2da5aee3ea" end patch do url "http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=4f54aea0a7a1735502c845524ae5d650eb630181" sha1 "8f957dc997cf5249cf102382bc02e02715c8daaa" end 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