File: rules

package info (click to toggle)
mysql-5.7 5.7.26-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 484,864 kB
  • sloc: cpp: 2,358,410; ansic: 541,419; pascal: 59,308; perl: 28,135; yacc: 14,261; sql: 7,085; sh: 5,389; xml: 5,365; makefile: 857; lex: 759; python: 675; java: 111; lisp: 89
file content (229 lines) | stat: -rwxr-xr-x 8,285 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/usr/bin/make -f

export DH_VERBOSE=1

# enable Debian Hardening
# see: https://wiki.debian.org/Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
ARCH_OS := $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
BUILDDIR := builddir
builddir = $(BUILDDIR)
DEBVERSION := $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' )
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_GNU_SYSTEM ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':'))
DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p')
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DISTRIBUTION := $(shell lsb_release -i -s)
EXPORTED_SOURCE_TARBALL := debian/mysql-source-5.7.tar.gz
TMP := $(CURDIR)/debian/tmp/
NUMJOBS=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
TESTJOBS=$(NUMJOBS)
# Some tests will fail on platforms that are not tested by upstream
ifneq (,$(filter $(ARCH), amd64 i386))
    TESTSUITE_FAIL_CMD:=exit 1
else
    TESTSUITE_FAIL_CMD:=true
endif

ifeq (,$(NUMJOBS))
	NUMJOBS=1
endif

MAKEFLAGS += -j $(NUMJOBS)

# The below system setting constrains how many servers can be run in parallel
# A server with default config needs a bit over 5300 slots, so we assume 6000 to be sure
AIOMAX := $(shell cat /proc/sys/fs/aio-max-nr)
AIOPER := 6000
PARMAX := $(shell echo $$(( $(AIOMAX)/$(AIOPER))))

ifeq ($(shell test $(TESTJOBS) -gt $(PARMAX); echo $$?),0)
	TESTJOBS:=$(shell echo $(PARMAX) )
endif

export MYSQL_BUILD_CC=$(DEB_HOST_GNU_TYPE)-gcc
export MYSQL_BUILD_CXX=$(DEB_HOST_GNU_TYPE)-g++

# The full upstream test suite takes a very long time to run, so we run
# only the main test suite unless fulltest is specified.
ifeq ($(findstring fulltest,$(DEB_BUILD_OPTIONS)),)
    MTR_SUITE=--suite=main
endif


override_dh_auto_clean:
	@echo "RULES.$@"
	dh_testdir 
	dh_testroot
	[ ! -d mysql-test/var ] || rm -rf mysql-test/var
	rm -rf $(BUILDDIR)
	debconf-updatepo
	rm -f $(EXPORTED_SOURCE_TARBALL)

override_dh_prep: 

override_dh_auto_configure: configure-stamp


configure-stamp:
	@echo "RULES.$@"
	dh_testdir
	( test -d $(builddir) || mkdir $(builddir) ) && cd $(builddir) && \
	sh -c  'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin"} \
		CC=$${MYSQL_BUILD_CC:-gcc} \
		CXX=$${MYSQL_BUILD_CXX:-g++} \
		cmake -DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DBUILD_CONFIG=mysql_release \
		-DWITH_LIBWRAP=ON \
		-DWITH_ZLIB=system \
		-DWITH_LZ4=system \
		-DWITH_EDITLINE=system \
		-DWITH_LIBEVENT=system \
		-DWITH_SSL=bundled \
		-DWITH_MECAB=system \
		-DWITH_BOOST=../boost \
		-DCOMPILATION_COMMENT="($(DISTRIBUTION))" \
		-DMYSQL_SERVER_SUFFIX="-$(DEBVERSION)" \
		-DINSTALL_LAYOUT=DEB \
		-DINSTALL_DOCDIR=share/mysql/docs \
		-DINSTALL_DOCREADMEDIR=share/mysql \
		-DINSTALL_INCLUDEDIR=include/mysql \
		-DINSTALL_INFODIR=share/mysql/docs \
		-DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
		-DINSTALL_MANDIR=share/man \
		-DINSTALL_MYSQLSHAREDIR=share/mysql \
		-DINSTALL_MYSQLTESTDIR=lib/mysql-test \
		-DINSTALL_PLUGINDIR=lib/mysql/plugin \
		-DINSTALL_SBINDIR=sbin \
		-DINSTALL_SCRIPTDIR=bin \
		-DINSTALL_SUPPORTFILESDIR=share/mysql \
		-DSYSCONFDIR=/etc/mysql \
		-DWITH_EMBEDDED_SERVER=ON \
		-DWITH_ARCHIVE_STORAGE_ENGINE=ON \
		-DWITH_BLACKHOLE_STORAGE_ENGINE=ON \
		-DWITH_FEDERATED_STORAGE_ENGINE=ON \
		-DWITH_INNODB_MEMCACHED=1 \
		-DWITH_EXTRA_CHARSETS=all ..'
	touch $@

override_dh_auto_build: build-stamp

# $(EXPORTED_SOURCE_TARBALL) must be built before the builds commence, since
# the builds change some of the files picked up by this tar invocation, and
# this can race against tar with an error like "tar:
# ./builddir-pic/strings/CMakeFiles/strings.dir: file changed as we read it".
# So define the rule for building it here, and have the build rules depend on
# it.
$(EXPORTED_SOURCE_TARBALL):
	GZIP=-n tar -zcf $(EXPORTED_SOURCE_TARBALL) \
	    --exclude=debian . \
	    --transform="s,^\./,mysql-5.7/,"

build-stamp: $(EXPORTED_SOURCE_TARBALL)
	@echo "RULES.$@"
	cd $(builddir) && $(MAKE)
	touch $@

override_dh_auto_test:
	@echo "RULES.$@"
ifeq ($(findstring nocheck,$(DEB_BUILD_OPTIONS)),)
	cp -r mysql-test/* $(builddir)/mysql-test/
	cp -r sql/share/* $(builddir)/sql/share/
	cp -r scripts/*sql $(builddir)/scripts/
ifeq ($(ARCH_OS),hurd)
	# Tests not fully working under Hurd, see
	# http://bugs.mysql.com/bug.php?id=64685. Run unit tests only.
	cd $(builddir) && $(MAKE) test || $(TESTSUITE_FAIL_CMD) ;
else
	touch $(builddir)/mysql-test/skiplist
	# Tests that are known to be unstable on all platforms are skipped
	# http://bugs.mysql.com/bug.php?id=83340
	echo "main.xa_prepared_binlog_off	: unstable test" >> $(builddir)/mysql-test/skiplist
	echo "main.type_float			: fails on ppc64el. Ref https://bugs.mysql.com/bug.php?id=92375" >> $(builddir)/mysql-test/skiplist
	echo "main.type_newdecimal		: Same as above" >> $(builddir)/mysql-test/skiplist
	echo "main.type_ranges			: Same as above" >> $(builddir)/mysql-test/skiplist

	# Skip replication tests since they are timing sensitive and may
	# result in false positives.
	cd $(builddir)/mysql-test && ./mtr --report-unstable-tests --parallel=$(TESTJOBS) --skip-rpl $(MTR_SUITE) --force --skip-test-list=./skiplist || $(TESTSUITE_FAIL_CMD) ;
endif
endif

override_dh_auto_install: auto_install-stamp

auto_install-stamp:
	@echo "RULES.$@"
	dh_testdir
	dh_testroot
	# make install (trailing slash needed for innobase)
	cd $(builddir) && $(MAKE) install DESTDIR=$(TMP)/
	# After installing, remove rpath to make lintian happy.
	set +e; \
	find ./debian/tmp/ -type f -print0 \
		| xargs -0 --no-run-if-empty chrpath -k 2>/dev/null \
		| fgrep RPATH= \
		| cut -d: -f 1 \
		| xargs --no-run-if-empty chrpath -d; \
	set -e
	install -d -m 0755 -o root -g root $(TMP)/usr/lib/mysql
	mkdir -p $(TMP)/usr/share/doc/mysql-server-5.7
	nm -n $(BUILDDIR)/sql/mysqld |gzip -n -9 > $(TMP)/usr/share/doc/mysql-server-5.7/mysqld.sym.gz
	# This seems to be the only safe place to fix permissions issues
        # not handled by dh_fixperms.
	install -m 0755 debian/additions/echo_stderr $(TMP)/usr/share/mysql/
	mkdir -p $(TMP)/etc/mysql
	install -m 0755 debian/additions/debian-start $(TMP)/etc/mysql/
	install -m 0644 debian/additions/mysql_embedded.1 $(TMP)/usr/share/man/man1
	install -m 0644 debian/additions/debian_create_root_user.sql $(TMP)/usr/share/mysql/
	# These files are incorrectly marked as executable. Upstream bug: http://bugs.mysql.com/bug.php?id=80571
	chmod 0644 $(TMP)/usr/lib/mysql-test/t/mysqld_safe.sh
	chmod 0644 $(TMP)/usr/lib/mysql-test/suite/innodb/t/alter_rename_existing.test
	chmod 0644 $(TMP)/usr/lib/mysql-test/suite/innodb/r/alter_rename_existing.result
	chmod 0644 $(TMP)/usr/share/mysql/mysql-log-rotate
	# install AppArmor profile
	install -D -m 644 debian/additions/apparmor-profile $(TMP)/etc/apparmor.d/usr.sbin.mysqld
	touch $@


override_dh_installlogrotate-arch:
	dh_installlogrotate --name mysql-server

override_dh_install:
	dh_install --list-missing		\
		-Xusr/share/man			\
		-Xusr/share/mysql/mysql.server
	dh_apparmor -pmysql-server-5.7 --profile-name=usr.sbin.mysqld

override_dh_installchangelogs:
	dh_installchangelogs Docs/ChangeLog

override_dh_systemd_enable:
	dh_systemd_enable --name=mysql

# Start mysql in runlevel 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server.
override_dh_installinit-arch:
	dh_installinit --name=mysql -- defaults 19 21
	dh_systemd_start --restart-after-upgrade

override_dh_installcron-arch:
	dh_installcron --name mysql-server

get-orig-source:
	uscan --force-download --verbose

%:
	dh $@ --parallel --with systemd