File clickhouse.spec of Package clickhouse
#
# spec file for package clickhouse
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _lto_cflags %{nil}
%define __builder ninja
Name: clickhouse
Version: 0
Release: 0
Summary: Column-oriented database management system
License: Apache-2.0
Group: Productivity/Databases/Servers
URL: https://clickhouse.tech
Source0: %{name}-%{version}.tar.xz
Source1: clickhouse-server.tmpfiles
Source2: clickhouse.sysusers
Patch1: 0001-When-GLIBC_COMPATIBILITY-is-disabled-bundled-libc-he.patch
Patch2: 0001-AVRO-2766-Fix-compilation-error-size_t-does-not-name.patch
Patch3: 0001-harmful-Do-not-install-libharmful.a.patch
Patch4: 0001-Add-lost-include-limits.patch
Patch5: 0002-Add-lost-include-limits.patch
Patch6: 0001-Fix-compilation-with-glibc-2.34-MINSIGSTKSZ-defined-.patch
BuildRequires: binutils-gold
BuildRequires: cmake
BuildRequires: cyrus-sasl-devel
BuildRequires: double-conversion-devel
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: gcc-c++ >= 9
BuildRequires: git
BuildRequires: grpc-devel
BuildRequires: jemalloc-devel
%ifarch %{ix86} x86_64
BuildRequires: hyperscan-devel
%endif
BuildRequires: libboost_context-devel >= 1.71
BuildRequires: libboost_coroutine-devel >= 1.71
BuildRequires: libboost_filesystem-devel >= 1.71
BuildRequires: libboost_iostreams-devel >= 1.71
BuildRequires: libboost_program_options-devel >= 1.71
BuildRequires: libboost_regex-devel >= 1.71
BuildRequires: libboost_system-devel >= 1.71
BuildRequires: libboost_thread-devel >= 1.71
BuildRequires: libbz2-devel
BuildRequires: libcapnp-devel
BuildRequires: libcurl-devel
BuildRequires: libgsasl-devel
BuildRequires: libicu-devel
BuildRequires: liblz4-devel
BuildRequires: libmariadb-devel
BuildRequires: libopenssl-devel >= 1.1
BuildRequires: libpcap-devel
BuildRequires: librdkafka-devel
BuildRequires: libuv-devel
BuildRequires: libxml2-devel
BuildRequires: libzstd-devel
BuildRequires: llvm-devel >= 5
BuildRequires: make
BuildRequires: memory-constraints
BuildRequires: msgpack-devel
BuildRequires: ninja
BuildRequires: pcre-devel
BuildRequires: poco-devel
BuildRequires: poco-redis
BuildRequires: protobuf-devel
BuildRequires: python3-Sphinx
BuildRequires: rapidjson-devel
BuildRequires: re2-devel
BuildRequires: readline-devel
BuildRequires: snappy-devel
BuildRequires: sysuser-tools
BuildRequires: unixODBC-devel
BuildRequires: zlib-devel
%sysusers_requires
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: x86_64 aarch64
%description
ClickHouse is an open-source column-oriented database management system that allows generating analytical data reports in real time.
%package bash-completion
Summary: Bash Completion for %{name}
Requires: bash-completion
Supplements: (%{name} and bash)
BuildArch: noarch
%description bash-completion
The official bash completion script for ClickHouse. It includes support
for every argument that can currently be passed to alacritty.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
%sysusers_generate_pre %{SOURCE2} %{name}
%limit_build -m 5500
%cmake \
-DARCH_NATIVE:BOOL=OFF \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_STATIC_LIBS:BOOL=ON \
-DCOMPILER_PIPE:BOOL=OFF \
-DDISABLE_CPU_OPTIMIZE:BOOL=ON \
-DENABLE_AVRO:BOOL=OFF \
-DENABLE_CCACHE:BOOL=OFF \
-DENABLE_EMBEDDED_COMPILER:BOOL=OFF \
-DENABLE_FASTOPS:BOOL=OFF \
-DENABLE_GRPC:BOOL=OFF \
-DENABLE_PARQUET:BOOL=OFF \
-DENABLE_ROCKSDB:BOOL=OFF \
-DENABLE_S3:BOOL=OFF \
-DENABLE_TESTS:BOOL=OFF \
-DGLIBC_COMPATIBILITY:BOOL=OFF \
-DPARALLEL_COMPILE_JOBS=%jobs \
-DPARALLEL_LINK_JOBS=1 \
-DUNBUNDLED:BOOL=ON \
-DUSE_INTERNAL_BOOST_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_CAPNP_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_CCTZ_LIBRARY:BOOL=ON \
-DUSE_INTERNAL_FARMHASH_LIBRARY:BOOL=ON \
-DUSE_INTERNAL_ICU_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_JEMALLOC_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_LIBCXX_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_LIBGSASL_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_LIBXML2_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_LLVM_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_MYSQL_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_ODBC_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_POCO_LIBRARY:BOOL=ON \
-DUSE_INTERNAL_RDKAFKA_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_RE2_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_SSL_LIBRARY:BOOL=OFF \
-DUSE_INTERNAL_ZLIB_LIBRARY:BOOL=OFF \
-DUSE_LIBCXX:BOOL=OFF \
-DUSE_SIMDJSON:BOOL=OFF \
-DWERROR:BOOL=OFF
%cmake_build
%install
%cmake_install
install -D -m 0644 ./debian/clickhouse-server.service %{buildroot}%{_unitdir}/clickhouse-server.service
mkdir -p %{buildroot}%{_sbindir}
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rcclickhouse-server
install -D -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/clickhouse-server.conf
mkdir -p %{buildroot}%{_localstatedir}/lib/clickhouse
mkdir -p %{buildroot}%{_localstatedir}/log/clickhouse-server
find %{buildroot}%{_datadir}/clickhouse-test -type f -exec sed -i \
-e '0,/#!\/usr\/bin\/env bash/ s//#!\/bin\/bash/' \
-e '0,/#!\/usr\/bin\/env python/ s//#!\/usr\/bin\/python/' \
-e '0,/#!\/usr\/bin\/env perl/ s//#!\/usr\/bin\/perl/' {} \;
rm -rf %{buildroot}/usr/cmake
rm -rf %{buildroot}/usr/lib/libunwind.a
mkdir -p %{buildroot}%{_sysusersdir}
install -m 0644 %{SOURCE2} %{buildroot}%{_sysusersdir}/%{name}-user.conf
%fdupes %{buildroot}
%pre -f %{name}.pre
%service_add_pre clickhouse-server.service
%preun
%service_del_preun clickhouse-server.service
%post
%tmpfiles_create %_tmpfilesdir/clickhouse-server.conf
%service_add_post clickhouse-server.service
%postun
%service_del_postun clickhouse-server.service
%files
%defattr(-,root,root)
%doc AUTHORS CHANGELOG.md CONTRIBUTING.md README.md SECURITY.md
%license LICENSE
%{_sysusersdir}/%{name}-user.conf
%dir %{_sysconfdir}/clickhouse-client
%config(noreplace) %{_sysconfdir}/clickhouse-client/config.xml
%dir %{_sysconfdir}/clickhouse-server
%config(noreplace) %{_sysconfdir}/clickhouse-server/config.xml
%config(noreplace) %{_sysconfdir}/clickhouse-server/users.xml
%dir %{_sysconfdir}/clickhouse-keeper
%config(noreplace) %{_sysconfdir}/clickhouse-keeper/keeper_config.xml
%{_bindir}/clickhouse
%{_bindir}/clickhouse-benchmark
%{_bindir}/clickhouse-client
%{_bindir}/clickhouse-compressor
%{_bindir}/clickhouse-copier
%{_bindir}/clickhouse-extract-from-config
%{_bindir}/clickhouse-format
%{_bindir}/clickhouse-git-import
%{_bindir}/clickhouse-keeper
%{_bindir}/clickhouse-keeper-converter
%{_bindir}/clickhouse-library-bridge
%{_bindir}/clickhouse-local
%{_bindir}/clickhouse-obfuscator
%{_bindir}/clickhouse-odbc-bridge
%{_bindir}/clickhouse-report
%{_bindir}/clickhouse-server
%{_bindir}/clickhouse-test
%dir %{_datadir}/clickhouse-test
%dir %{_datadir}/clickhouse-test/config
%{_datadir}/clickhouse-test/config/*
%dir %{_datadir}/clickhouse-test/performance
%{_datadir}/clickhouse-test/performance/*
%dir %{_datadir}/clickhouse-test/queries
%{_datadir}/clickhouse-test/queries/*
%{_unitdir}/clickhouse-server.service
%{_sbindir}/rcclickhouse-server
%dir %{_tmpfilesdir}
%{_tmpfilesdir}/clickhouse-server.conf
%ghost %dir %{_rundir}/clickhouse-server
%attr(0755, clickhouse, clickhouse) %dir %{_localstatedir}/log/clickhouse-server
%attr(0755, clickhouse, clickhouse) %dir %{_localstatedir}/lib/clickhouse
%files bash-completion
%{_datadir}/bash-completion
%changelog