-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjubatus.rb
86 lines (74 loc) · 2.44 KB
/
jubatus.rb
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require 'formula'
class ZooKeeperLib < Requirement
def initialize
@zk = Formula.factory('zookeeper')
end
def fatal?
true
end
def satisfied?
@zk.installed? and File.exist?(@zk.lib + 'libzookeeper_mt.dylib')
end
def message
return nil if satisfied?
if @zk.installed?
<<-EOS.undent
ZooKeeper build was requested, but Zookeeper was already built without `--c` option.
You will need to `brew uninstall zookeeper; brew install zookeeper --c` first.
EOS
else
<<-EOS.undent
ZooKeeper build was requested, but Zookeeper is not installed.
You will need to `brew install zookeeper --c` first.
EOS
end
end
end
class Jubatus < Formula
url 'https://github.com/jubatus/jubatus/tarball/0.4.2'
head 'https://github.com/jubatus/jubatus.git'
homepage 'http://jubat.us/'
md5 'c68dd45f9d46722d51d1efa44f642fcb'
version '0.4.2'
option 'enable-zookeeper', 'Using zookeeper for distributed environemnt'
option 'enable-mecab', 'Using mecab for Japanese NLP'
option 'enable-re2', 'Using re2 for regx'
depends_on 'glog'
depends_on 'pkg-config'
depends_on 'pficommon'
depends_on 'jubatus-msgpack-rpc'
depends_on ZooKeeperLib.new if build.include? 'enable-zookeeper'
depends_on 'mecab' if build.include? 'enable-mecab'
depends_on 're2' if build.include? 'enable-re2'
# snow leopard default gcc version is 4.2
depends_on 'gcc' if build.include? 'snow-leopard'
def install
if ENV.compiler == :gcc
gcc = Formula.factory('gcc')
version = '4.7'
if File.exist?(gcc.bin)
bin = gcc.bin.to_s
ENV['CC'] = bin+"/gcc-#{version}"
ENV['LD'] = bin+"/gcc-#{version}"
ENV['CXX'] = bin+"/g++-#{version}"
end
end
STDERR.puts ENV['CC'], ENV['CXX']
args = []
args << "--prefix=#{prefix}"
args << "--disable-re2" unless build.include? "enable-re2"
args << "--enable-mecab" if build.include? "enable-mecab"
args << "--enable-zookeeper" if build.include? "enable-zookeeper"
system "./waf", "configure", *args
system "./waf", "build"
system "./waf", "install"
end
def test
# This test will fail and we won't accept that! It's enough to just
# replace "false" with the main program this formula installs, but
# it'd be nice if you were more thorough. Test the test with
# `brew test jubatus`. Remove this comment before submitting
# your pull request!
system "false"
end
end