Skip to content

Commit

Permalink
19.17.5.18-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
deem0n committed Dec 17, 2019
1 parent 1f53766 commit 6b91354
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 39 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This is an unofficial Homebrew repository for the Yandex's [ClickHouse](https://clickhouse.yandex/) DBMS.

Stable version is v1.1.54284 and it is building fine on the Sierra.
Stable version is 19.17.5.18 and it is building fine on the Mojave. It is built Without MySQL support.

It is relatively new and isn't tested well.
Please consider appending the `--verbose` and `--debug` parameters to the `brew install` command to make it easier to debug the package installation.
Expand All @@ -12,7 +12,7 @@ Issues and pull requests are always welcome!

## Note on the test (development) build

The dev version is v1.1.54288-testing and it is not building :-()
The dev version is v19.19.1.1902-testing and it was not tested yet.

## Usage

Expand Down
87 changes: 50 additions & 37 deletions clickhouse.rb
Original file line number Diff line number Diff line change
@@ -1,66 +1,78 @@
class Clickhouse < Formula
target_version = "19.17.5.18"
desc "is an open-source column-oriented database management system."
homepage "https://clickhouse.yandex/"
url "https://github.com/yandex/ClickHouse/archive/v1.1.54284-stable.zip"
version "1.1.54284"
sha256 "2985575609980d94bb75d67a20880e3a6c09490fe0f65b31ae130b9c451560da"
version "#{target_version}-stable"
url "https://github.com/ClickHouse/ClickHouse.git", :using => :git, :tag => "v#{version}"
sha256 "0895c24e2d10b46f2c0eb391797aeac342b39a89fb4350efdaa1601d0b1e50a6"

devel do
url "https://github.com/yandex/ClickHouse/archive/v1.1.54288-testing.zip"
version "1.1.54214"
target_version = "19.19.1.1902"
version "#{target_version}-testing"
url "https://github.com/ClickHouse/ClickHouse.git", :using => :git, :tag => "v#{version}"
sha256 "44c0aa152a9c0c4b99e17bba55a69d839d1a12c0346679eb681508eba9896ad2"
end

# --HEAD
head "https://github.com/ClickHouse/ClickHouse.git", :using => :git, :tag => "v19.19.1.1902-testing"

bottle do
rebuild 1
root_url 'https://github.com/deem0n/homebrew-clickhouse/releases/download/v1.1.54284'
sha256 "4a35a4c2cb2c9e4066a30be79e250428ee98c1f0c5aacbae4a9470e9dc9f2fb9" => :sierra
root_url "https://github.com/deem0n/homebrew-clickhouse/releases/download/v#{target_version}/"
sha256 "f9f871f85761bfbe6ea9338746b11e73398a95256da4c59dc50b4a8170bf2c9d" => :mojave
end

head "https://github.com/yandex/ClickHouse.git"

depends_on "cmake" => :build
depends_on "gcc@6" => :build

depends_on "boost" => :build
depends_on "icu4c" => :build
depends_on "mysql" => :build
depends_on "openssl" => :build
depends_on "unixodbc" => :build
depends_on "libtool" => :build
depends_on "gettext" => :build
depends_on "zlib" => :build
depends_on "readline" => :recommended
depends_on "ninja" => :build
#depends_on "mariadb" => :build


# depends_on "boost" => :build
# depends_on "icu4c" => :build
# depends_on "mysql" => :build
# depends_on "openssl" => :build
# depends_on "unixodbc" => :build
# depends_on "libtool" => :build
# depends_on "gettext" => :build
# depends_on "zlib" => :build
# depends_on "readline" => :recommended

def install
ENV["ENABLE_MONGODB"] = "0"
#ENV["LDFLAGS"] = "-all_load"


#ENV["ENABLE_MYSQL"] = "1"
ENV["CC"] = "#{Formula["gcc@6"].bin}/gcc-6"
ENV["CXX"] = "#{Formula["gcc@6"].bin}/g++-6"
ENV["CFLAGS"] = "-I/usr/local/include"
ENV["CXXFLAGS"] = "-I/usr/local/include"
ENV["LDFLAGS"] = "-L/usr/local/lib"
#ENV["CC"] = "#{Formula["gcc"].bin}/gcc-9"
#ENV["CXX"] = "#{Formula["gcc"].bin}/g++-9"
#ENV["CFLAGS"] = "-I/usr/local/include"
#ENV["CXXFLAGS"] = "-I/usr/local/include"
#ENV["LDFLAGS"] = "-L/usr/local/lib"

cmake_args = %w[]
cmake_args << "-DUSE_STATIC_LIBRARIES=0" if MacOS.version >= :sierra
cmake_args << "-DENABLE_MYSQL=1"
cmake_args << "-DUSE_STATIC_LIBRARIES=1" if MacOS.version >= :sierra
cmake_args << "-DENABLE_MYSQL=0"
cmake_args << "-DENABLE_IPO=0" # WE have -- IPO/LTO not enabled.
# cmake_args << "-DLLVM_ENABLE_LTO=Thin" # ????

mkdir "build"
# boost somehow is not populated with standard git commands, do manual forced fetch!
system "git", "submodule", "update", "--init", "--recursive", "--force", "contrib/boost"
cd "build" do
system "cmake", "..", *cmake_args
system "make"
system "ninja"
if MacOS.version >= :sierra
lib.install Dir["#{buildpath}/build/dbms/*.dylib"]
lib.install Dir["#{buildpath}/build/contrib/libzlib-ng/*.dylib"]
#lib.install Dir["#{buildpath}/build/dbms/*.dylib"]
#lib.install Dir["#{buildpath}/build/contrib/libzlib-ng/*.dylib"]
end
bin.install "#{buildpath}/build/dbms/src/Server/clickhouse"
bin.install "#{buildpath}/build/dbms/programs/clickhouse"
bin.install_symlink "clickhouse" => "clickhouse-server"
bin.install_symlink "clickhouse" => "clickhouse-client"
end

mkdir "#{var}/clickhouse"

inreplace "#{buildpath}/dbms/src/Server/config.xml" do |s|
inreplace "#{buildpath}/dbms/programs/server/config.xml" do |s|
s.gsub! "/var/lib/clickhouse/", "#{var}/clickhouse/"
s.gsub! "/var/log/clickhouse-server/", "#{var}/log/clickhouse/"
s.gsub! "<!-- <max_open_files>262144</max_open_files> -->", "<max_open_files>262144</max_open_files>"
Expand All @@ -74,11 +86,11 @@ def install

#there is no client config as of Sept 2017
#(etc/"clickhouse-client").install "#{buildpath}/dbms/src/Client/config.xml"
(etc/"clickhouse-server").install "#{buildpath}/dbms/src/Server/config.xml"
(etc/"clickhouse-server").install "#{buildpath}/dbms/src/Server/users.xml"
(etc/"clickhouse-server").install "#{buildpath}/dbms/programs/server/config.xml"
(etc/"clickhouse-server").install "#{buildpath}/dbms/programs/server/users.xml"
end

def plist; <<-EOS.undent
def plist; <<-EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
Expand All @@ -102,7 +114,7 @@ def plist; <<-EOS.undent
EOS
end

def caveats; <<-EOS.undent
def caveats; <<-EOS
The configuration files are available at:
#{etc}/clickhouse-client/
#{etc}/clickhouse-server/
Expand All @@ -115,6 +127,7 @@ def caveats; <<-EOS.undent
end

test do
system "#{bin}/clickhouse-client", "--version"
assert_equal "ClickHouse client version #{target_version}.", shell_output("#{bin}/clickhouse-client --version").strip
assert_equal "ClickHouse server version #{target_version}.", shell_output("#{bin}/clickhouse-server --version").strip
end
end

0 comments on commit 6b91354

Please sign in to comment.