2016-02-07 20:02:44 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
# Uncomment this to turn on verbose mode.
|
2018-03-23 16:05:14 +00:00
|
|
|
export DH_VERBOSE=1
|
2017-04-10 17:43:30 +00:00
|
|
|
|
|
|
|
# -pie only for static mode
|
|
|
|
export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
|
|
|
|
|
|
|
|
# because copy_headers.sh have hardcoded path to build/include_directories.txt
|
|
|
|
BUILDDIR = build
|
2018-03-28 12:17:23 +00:00
|
|
|
CURDIR = $(shell pwd)
|
|
|
|
DESTDIR = $(CURDIR)/debian/tmp
|
2017-04-10 17:43:30 +00:00
|
|
|
|
|
|
|
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
#TODO: why it not working? (maybe works in debhelper 10+)
|
|
|
|
#ifndef THREADS_COUNT
|
|
|
|
# THREADS_COUNT:=$(shell nproc || grep -c ^processor /proc/cpuinfo)
|
|
|
|
#endif
|
|
|
|
#DEB_BUILD_OPTIONS+=parallel=$(THREADS_COUNT)
|
2016-11-15 10:25:08 +00:00
|
|
|
|
2018-02-07 15:58:48 +00:00
|
|
|
ifndef ENABLE_TESTS
|
|
|
|
CMAKE_FLAGS += -DENABLE_TESTS=0
|
|
|
|
endif
|
2017-08-30 14:08:19 +00:00
|
|
|
|
2017-12-08 18:30:22 +00:00
|
|
|
#DEB_CLANG ?= $(shell which clang-6.0 || which clang-5.0 || which clang-4.0 || which clang || which clang-3.9 || which clang-3.8)
|
2017-08-30 14:08:19 +00:00
|
|
|
|
2017-11-16 17:47:54 +00:00
|
|
|
#DEB_CC ?= gcc-7
|
|
|
|
#DEB_CXX ?= g++-7
|
2017-01-10 18:28:24 +00:00
|
|
|
|
2017-08-30 14:08:19 +00:00
|
|
|
ifdef DEB_CXX
|
|
|
|
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
|
|
|
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
2017-01-10 18:28:24 +00:00
|
|
|
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
|
2017-08-30 14:08:19 +00:00
|
|
|
CC := $(DEB_CC)
|
|
|
|
CXX := $(DEB_CXX)
|
2017-01-10 18:28:24 +00:00
|
|
|
else
|
2017-08-30 14:08:19 +00:00
|
|
|
CC := $(DEB_HOST_GNU_TYPE)-$(DEB_CC)
|
|
|
|
CXX := $(DEB_HOST_GNU_TYPE)-$(DEB_CXX)
|
|
|
|
endif
|
2017-01-10 18:28:24 +00:00
|
|
|
endif
|
|
|
|
|
2017-08-30 14:08:19 +00:00
|
|
|
CMAKE_FLAGS += -DCMAKE_CXX_COMPILER=`which $(CXX)` -DCMAKE_C_COMPILER=`which $(CC)`
|
2018-03-29 12:57:23 +00:00
|
|
|
|
|
|
|
NINJA=$(shell which ninja)
|
|
|
|
ifneq ($(NINJA),)
|
|
|
|
CMAKE_FLAGS += -GNinja
|
|
|
|
export MAKE=$(NINJA)
|
|
|
|
endif
|
2017-08-30 14:08:19 +00:00
|
|
|
|
2017-05-03 15:21:16 +00:00
|
|
|
ifndef DH_VERBOSE
|
|
|
|
CMAKE_FLAGS += -DCMAKE_VERBOSE_MAKEFILE=0
|
|
|
|
endif
|
2017-01-10 18:28:24 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
%:
|
|
|
|
dh $@ --parallel --buildsystem=cmake --builddirectory=$(BUILDDIR)
|
2017-01-10 18:28:24 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
override_dh_auto_configure:
|
|
|
|
dh_auto_configure -- $(CMAKE_FLAGS)
|
2017-01-10 18:28:24 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
override_dh_auto_test:
|
|
|
|
#TODO, use ENABLE_TESTS=1
|
|
|
|
#./debian/tests_wrapper.sh
|
|
|
|
|
|
|
|
override_dh_clean:
|
|
|
|
rm -rf $(BUILDDIR)
|
|
|
|
rm -rf $(DESTDIR)
|
2018-04-01 12:33:39 +00:00
|
|
|
rm -rf debian/copyright debian/clickhouse-client.docs debian/clickhouse-common-static.docs
|
2016-02-07 20:02:44 +00:00
|
|
|
dh_clean
|
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
override_dh_strip:
|
2018-04-02 18:44:19 +00:00
|
|
|
dh_strip -pclickhouse-common-static --dbg-package=clickhouse-common-static-dbg
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
override_dh_install:
|
|
|
|
# Making docs
|
|
|
|
cp LICENSE debian/copyright
|
|
|
|
|
2018-04-01 12:33:39 +00:00
|
|
|
ln -sf clickhouse-server.docs debian/clickhouse-client.docs
|
|
|
|
ln -sf clickhouse-server.docs debian/clickhouse-common-static.docs
|
2017-04-10 17:43:30 +00:00
|
|
|
|
|
|
|
mkdir -p $(DESTDIR)/etc/security/limits.d
|
|
|
|
cp debian/clickhouse.limits $(DESTDIR)/etc/security/limits.d/clickhouse.conf
|
|
|
|
|
2017-11-10 13:52:23 +00:00
|
|
|
# systemd compatibility
|
|
|
|
mkdir -p $(DESTDIR)/etc/systemd/system/
|
|
|
|
cp debian/clickhouse-server.service $(DESTDIR)/etc/systemd/system/
|
|
|
|
|
2017-01-31 19:53:05 +00:00
|
|
|
# In case building clickhouse-server, adding to package binary of clang, ld and header files - for dynamic compilation.
|
2017-11-12 12:58:40 +00:00
|
|
|
mkdir -p $(DESTDIR)/usr/share/clickhouse/headers
|
|
|
|
|
2017-12-08 18:30:22 +00:00
|
|
|
# CLANG=$(DEB_CLANG) ./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers
|
|
|
|
CLANG=$(DESTDIR)/usr/bin/clickhouse-clang ./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers
|
2016-06-10 14:11:45 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
# fake metrika files when private dir is empty
|
2018-03-28 12:17:23 +00:00
|
|
|
mkdir -p $(DESTDIR)/etc/clickhouse-server/metrika
|
|
|
|
touch $(DESTDIR)/etc/clickhouse-server/metrika/config.xml
|
|
|
|
touch $(DESTDIR)/etc/clickhouse-server/metrika/users.xml
|
2017-04-10 17:43:30 +00:00
|
|
|
|
2018-04-06 20:49:42 +00:00
|
|
|
# todo: remove after removing clickhouse-server-base package:
|
|
|
|
mkdir -p $(DESTDIR)/etc/init.d $(DESTDIR)/etc/cron.d
|
|
|
|
cp debian/clickhouse-server.init $(DESTDIR)/etc/init.d/clickhouse-server
|
|
|
|
cp debian/clickhouse-server.cron.d $(DESTDIR)/etc/cron.d/clickhouse-server
|
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
dh_install --list-missing --sourcedir=$(DESTDIR)
|
2017-04-10 18:13:24 +00:00
|
|
|
|
2018-03-28 12:17:23 +00:00
|
|
|
override_dh_auto_install:
|
2018-03-29 12:57:23 +00:00
|
|
|
env DESTDIR=$(DESTDIR) $(MAKE) -C $(BUILDDIR) install
|
2018-03-28 12:17:23 +00:00
|
|
|
|
2017-04-10 18:13:24 +00:00
|
|
|
override_dh_shlibdeps:
|
2017-09-15 09:18:52 +00:00
|
|
|
true # We depend only on libc and dh_shlibdeps gives us wrong (too strict) dependency.
|
|
|
|
|
|
|
|
override_dh_builddeb:
|
|
|
|
dh_builddeb -- -Z gzip # Older systems don't have "xz", so use "gzip" instead.
|