2016-02-07 20:02:44 +00:00
|
|
|
#!/usr/bin/make -f
|
|
|
|
# -*- makefile -*-
|
|
|
|
|
|
|
|
# Uncomment this to turn on verbose mode.
|
2017-05-03 15:21:16 +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
|
|
|
|
DESTDIR = debian/tmp
|
|
|
|
|
|
|
|
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
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
DEB_CC ?= gcc-6
|
|
|
|
DEB_CXX ?= g++-6
|
2017-05-24 12:32:51 +00:00
|
|
|
DEB_CLANG ?= $(shell which clang)
|
2017-01-10 18:28:24 +00:00
|
|
|
|
|
|
|
DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
|
|
|
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
|
|
|
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
|
2017-04-10 17:43:30 +00:00
|
|
|
CC := $(DEB_CC)
|
|
|
|
CXX := $(DEB_CXX)
|
2017-01-10 18:28:24 +00:00
|
|
|
else
|
2017-04-10 17:43:30 +00:00
|
|
|
CC := $(DEB_HOST_GNU_TYPE)-$(DEB_CC)
|
|
|
|
CXX := $(DEB_HOST_GNU_TYPE)-$(DEB_CXX)
|
2017-01-10 18:28:24 +00:00
|
|
|
endif
|
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
CMAKE_FLAGS ?= -DCMAKE_CXX_COMPILER=`which $(CXX)` -DCMAKE_C_COMPILER=`which $(CC)` -DENABLE_TESTS=0 $(CMAKE_FLAGS_ADD)
|
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)
|
2017-04-18 10:03:16 +00:00
|
|
|
rm -rf debian/copyright debian/clickhouse-server-common.docs debian/clickhouse-client.docs
|
2016-02-07 20:02:44 +00:00
|
|
|
dh_clean
|
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
override_dh_strip:
|
|
|
|
dh_strip -pclickhouse-server-base --dbg-package=clickhouse-common-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
|
|
|
|
|
|
|
|
ln -sf clickhouse-server-base.docs debian/clickhouse-client.docs
|
|
|
|
ln -sf clickhouse-server-base.docs debian/clickhouse-server-common.docs
|
|
|
|
|
|
|
|
mkdir -p $(DESTDIR)/etc/security/limits.d
|
|
|
|
cp debian/clickhouse.limits $(DESTDIR)/etc/security/limits.d/clickhouse.conf
|
|
|
|
|
|
|
|
# todo: remove after renaming package:
|
|
|
|
mkdir -p $(DESTDIR)/etc/init.d
|
|
|
|
cp debian/clickhouse-server.init $(DESTDIR)/etc/init.d/clickhouse-server
|
|
|
|
mkdir -p $(DESTDIR)/etc/cron.d
|
|
|
|
cp debian/clickhouse-server.cron.d $(DESTDIR)/etc/cron.d/clickhouse-server
|
2016-02-07 20:02:44 +00:00
|
|
|
|
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-04-10 17:43:30 +00:00
|
|
|
mkdir -p $(DESTDIR)/usr/share/clickhouse/bin $(DESTDIR)/usr/share/clickhouse/headers
|
2017-05-22 21:05:54 +00:00
|
|
|
CLANG=$(DEB_CLANG) debian/copy_clang_binaries.sh $(DESTDIR)/usr/share/clickhouse/bin/
|
|
|
|
CLANG=$(DEB_CLANG) ./copy_headers.sh . $(DESTDIR)/usr/share/clickhouse/headers
|
2016-02-07 20:02:44 +00:00
|
|
|
|
2016-06-10 14:11:45 +00:00
|
|
|
|
2017-04-10 17:43:30 +00:00
|
|
|
# fake metrika files when private dir is empty
|
|
|
|
mkdir -p debian/tmp/etc/clickhouse-server/metrika
|
|
|
|
touch debian/tmp/etc/clickhouse-server/metrika/config.xml
|
|
|
|
touch debian/tmp/etc/clickhouse-server/metrika/users.xml
|
|
|
|
|
|
|
|
dh_install --list-missing --sourcedir=$(DESTDIR)
|
2017-04-10 18:13:24 +00:00
|
|
|
|
|
|
|
override_dh_shlibdeps:
|
|
|
|
dh_shlibdeps -Xdebian/clickhouse-server-base/usr/share/clickhouse/bin/*
|