|
| 1 | +class Clickhouse < Formula |
| 2 | + desc "ClickHouse is a free analytic DBMS for big data." |
| 3 | + homepage "https://clickhouse.yandex" |
| 4 | + url "https://github.com/yandex/ClickHouse.git", :tag => "v1.1.54343-stable" |
| 5 | + version "v1.1.54343" |
| 6 | + |
| 7 | + head "https://github.com/yandex/ClickHouse.git" |
| 8 | + |
| 9 | + depends_on "gcc" |
| 10 | + depends_on "llvm" => :build |
| 11 | + depends_on "mysql" => :build |
| 12 | + depends_on "icu4c" => :build |
| 13 | + depends_on "cmake" => :build |
| 14 | + depends_on "openssl" => :build |
| 15 | + depends_on "unixodbc" =>:build |
| 16 | + depends_on "gettext" => :build |
| 17 | + depends_on "libtool" => :build |
| 18 | + depends_on "readline" => :build |
| 19 | + |
| 20 | + bottle do |
| 21 | + root_url 'https://github.com/arduanov/homebrew-clickhouse/releases/download/v1.1.54343' |
| 22 | + sha256 "e7aff6a3db6159b6e749d185da8bfed4013eee53f62245178b5b4e8ae129a5dd" => :high_sierra |
| 23 | + sha256 "e7aff6a3db6159b6e749d185da8bfed4013eee53f62245178b5b4e8ae129a5dd" => :sierra |
| 24 | + end |
| 25 | + |
| 26 | + def install |
| 27 | + mkdir "#{var}/clickhouse" |
| 28 | + |
| 29 | + inreplace "dbms/src/Server/config.xml" do |s| |
| 30 | + s.gsub! "/var/lib/", "#{var}/lib/" |
| 31 | + s.gsub! "/var/log/", "#{var}/log/" |
| 32 | + s.gsub! "<!-- <max_open_files>262144</max_open_files> -->", "<max_open_files>262144</max_open_files>" |
| 33 | + end |
| 34 | + |
| 35 | + # force sierra |
| 36 | + inreplace "libs/libcommon/CMakeLists.txt", "APPLE_SIERRA_OR_NEWER 0", "APPLE_SIERRA_OR_NEWER 1" |
| 37 | + |
| 38 | + args = %W[ |
| 39 | + -DENABLE_ICU=0, |
| 40 | + -DENABLE_TESTS=0, |
| 41 | + -DENABLE_TCMALLOC=0, |
| 42 | + -DUSE_INTERNAL_BOOST_LIBRARY=1 |
| 43 | + ] |
| 44 | + |
| 45 | + mkdir "build" do |
| 46 | + system "cmake", "..", *std_cmake_args, *args |
| 47 | + system "make", "install" |
| 48 | + end |
| 49 | + end |
| 50 | + |
| 51 | + def plist; <<~EOS |
| 52 | + <?xml version="1.0" encoding="UTF-8"?> |
| 53 | + <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 54 | + <plist version="1.0"> |
| 55 | + <dict> |
| 56 | + <key>Label</key> |
| 57 | + <string>#{plist_name}</string> |
| 58 | + <key>RunAtLoad</key> |
| 59 | + <true/> |
| 60 | + <key>KeepAlive</key> |
| 61 | + <false/> |
| 62 | + <key>ProgramArguments</key> |
| 63 | + <array> |
| 64 | + <string>#{opt_bin}/clickhouse-server</string> |
| 65 | + <string>--config-file</string> |
| 66 | + <string>#{etc}/clickhouse-server/config.xml</string> |
| 67 | + </array> |
| 68 | + <key>WorkingDirectory</key> |
| 69 | + <string>#{HOMEBREW_PREFIX}</string> |
| 70 | + </dict> |
| 71 | + </plist> |
| 72 | + EOS |
| 73 | + end |
| 74 | + |
| 75 | + test do |
| 76 | + system "#{bin}/clickhouse-client", "--version" |
| 77 | + end |
| 78 | +end |
0 commit comments