-
Notifications
You must be signed in to change notification settings - Fork 12
/
jubatus.rb
86 lines (74 loc) · 2.48 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
class ZooKeeperRequirement < Requirement
def initialize
super
@zk = Formula['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` first.
EOS
else
<<-EOS.undent
ZooKeeper build was requested, but ZooKeeper is not installed.
You will need to `brew install zookeeper` first.
EOS
end
end
end
class Jubatus < Formula
url 'https://github.com/jubatus/jubatus/archive/1.1.1.tar.gz'
head 'https://github.com/jubatus/jubatus.git'
homepage 'http://jubat.us/'
sha256 'bbca350cbd5235eae55c726abd0fdf65caabf6573fbbf88f89c45626ebe8cae4'
version '1.1.1'
option 'enable-mecab', 'Enable mecab for Japanese NLP'
option 'enable-zookeeper', 'Enable ZooKeeper for distributed environemnt'
depends_on 'log4cxx'
depends_on 'pkg-config' => :build
depends_on 'jubatus-core'
depends_on 'jubatus-msgpack-rpc'
depends_on ZooKeeperRequirement.new if build.include? 'enable-zookeeper'
depends_on 'mecab' if build.include? "enable-mecab"
# snow leopard default gcc version is 4.2
depends_on 'gcc' if build.include? 'snow-leopard'
def install
if ENV.compiler == :gcc
gcc = Formula['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
if MacOS.version >= :mavericks
ENV['CXXFLAGS'] = "-std=c++11 -DMP_FUNCTIONAL_STANDARD -DMP_MEMORY_STANDARD -DMP_UNORDERED_MAP_STANDARD"
end
STDERR.puts ENV['CC'], ENV['CXX']
args = []
args << "--prefix=#{prefix}"
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