aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ice.rb
blob: f8564cdb15afa8fad961881018dd15b1337862a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'formula'

class Ice < Formula
  url 'http://www.zeroc.com/download/Ice/3.4/Ice-3.4.1.tar.gz'
  homepage 'http://www.zeroc.com'
  md5 '3aae42aa47dec74bb258c1a1b2847a1a'

  depends_on 'berkeley-db'
  depends_on 'mcpp'

  def patches
    # Patch for Ice-3.4.1 to work with Berkely DB 5.X.
    "http://gist.github.com/raw/459204/44183ae997afb8ec19148fec498a11d67b5ae8bf/Ice-3.4.1-db5.patch"
  end

  def options
    [
      ['--doc', 'Install documentation'],
      ['--demo', 'Build demos']
    ]
  end

  def install
    ENV.O2
    inreplace "cpp/config/Make.rules" do |s|
      s.gsub! "#OPTIMIZE", "OPTIMIZE"
      s.gsub! "/opt/Ice-$(VERSION)", prefix
      s.gsub! "/opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)", prefix
    end

    # what want we build?
    wb = 'config src include'
    wb += ' doc' if ARGV.include? '--doc'
    wb += ' demo' if ARGV.include? '--demo'
    inreplace "cpp/Makefile" do |s|
      s.change_make_var! "SUBDIRS", wb
    end

    inreplace "cpp/config/Make.rules.Darwin" do |s|
      s.change_make_var! "CXXFLAGS", "#{ENV.cflags} -Wall -D_REENTRANT"
    end

    Dir.chdir "cpp" do
      system "make"
      system "make install"
    end
  end
end