mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
5665709bb9
* Fix internal compiler includes with new clang * debug copy_headers.sh * Fix copy_headers.sh * Use copy-headers from cmake * Update rules
125 lines
3.6 KiB
Makefile
Executable File
125 lines
3.6 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# -*- makefile -*-
|
|
|
|
# Uncomment this to turn on verbose mode.
|
|
export DH_VERBOSE=1
|
|
|
|
# -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
|
|
CURDIR = $(shell pwd)
|
|
DESTDIR = $(CURDIR)/debian/tmp
|
|
|
|
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
|
|
|
|
#TODO: why it not working? (maybe works in debhelper 10+)
|
|
ifndef THREADS_COUNT
|
|
THREADS_COUNT=$(shell nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu || echo 4)
|
|
endif
|
|
DEB_BUILD_OPTIONS+=parallel=$(THREADS_COUNT)
|
|
|
|
ifndef ENABLE_TESTS
|
|
CMAKE_FLAGS += -DENABLE_TESTS=0
|
|
endif
|
|
|
|
#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)
|
|
|
|
#DEB_CC ?= gcc-7
|
|
#DEB_CXX ?= g++-7
|
|
|
|
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)
|
|
ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
|
|
CC := $(DEB_CC)
|
|
CXX := $(DEB_CXX)
|
|
else
|
|
CC := $(DEB_HOST_GNU_TYPE)-$(DEB_CC)
|
|
CXX := $(DEB_HOST_GNU_TYPE)-$(DEB_CXX)
|
|
endif
|
|
endif
|
|
|
|
CMAKE_FLAGS += -DCMAKE_CXX_COMPILER=`which $(CXX)` -DCMAKE_C_COMPILER=`which $(CC)`
|
|
|
|
ifndef DISABLE_NINJA
|
|
NINJA=$(shell which ninja)
|
|
ifneq ($(NINJA),)
|
|
CMAKE_FLAGS += -GNinja
|
|
export MAKE=$(NINJA)
|
|
endif
|
|
endif
|
|
|
|
ifndef DH_VERBOSE
|
|
CMAKE_FLAGS += -DCMAKE_VERBOSE_MAKEFILE=0
|
|
endif
|
|
|
|
# Useful for bulding on low memory systems
|
|
ifndef DISABLE_PARALLEL
|
|
DH_FLAGS += --parallel
|
|
else
|
|
THREADS_COUNT = 1
|
|
endif
|
|
|
|
%:
|
|
dh $@ $(DH_FLAGS) --buildsystem=cmake --builddirectory=$(BUILDDIR)
|
|
|
|
override_dh_auto_configure:
|
|
dh_auto_configure -- $(CMAKE_FLAGS)
|
|
|
|
override_dh_auto_build:
|
|
# Fix fir ninja. Do not add -O.
|
|
cd $(BUILDDIR) && $(MAKE) -j$(THREADS_COUNT)
|
|
|
|
override_dh_auto_test:
|
|
#TODO, use ENABLE_TESTS=1
|
|
#./debian/tests_wrapper.sh
|
|
|
|
override_dh_clean:
|
|
rm -rf $(BUILDDIR)
|
|
rm -rf $(DESTDIR)
|
|
rm -rf debian/copyright debian/clickhouse-client.docs debian/clickhouse-common-static.docs
|
|
dh_clean
|
|
|
|
override_dh_strip:
|
|
dh_strip -pclickhouse-common-static --dbg-package=clickhouse-common-static-dbg
|
|
|
|
override_dh_install:
|
|
# Making docs
|
|
cp LICENSE debian/copyright
|
|
|
|
ln -sf clickhouse-server.docs debian/clickhouse-client.docs
|
|
ln -sf clickhouse-server.docs debian/clickhouse-common-static.docs
|
|
|
|
mkdir -p $(DESTDIR)/etc/security/limits.d
|
|
cp debian/clickhouse.limits $(DESTDIR)/etc/security/limits.d/clickhouse.conf
|
|
|
|
# systemd compatibility
|
|
mkdir -p $(DESTDIR)/etc/systemd/system/
|
|
cp debian/clickhouse-server.service $(DESTDIR)/etc/systemd/system/
|
|
|
|
# In case building clickhouse-server, adding to package binary of clang, ld and header files - for dynamic compilation.
|
|
mkdir -p $(DESTDIR)/usr/share/clickhouse/headers
|
|
|
|
# fake metrika files when private dir is empty
|
|
mkdir -p $(DESTDIR)/etc/clickhouse-server/metrika
|
|
touch $(DESTDIR)/etc/clickhouse-server/metrika/config.xml
|
|
touch $(DESTDIR)/etc/clickhouse-server/metrika/users.xml
|
|
|
|
# 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
|
|
|
|
dh_install --list-missing --sourcedir=$(DESTDIR)
|
|
|
|
override_dh_auto_install:
|
|
env DESTDIR=$(DESTDIR) $(MAKE) -C $(BUILDDIR) install
|
|
|
|
override_dh_shlibdeps:
|
|
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.
|