summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules400
1 files changed, 400 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000000..6462580616b
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,400 @@
+#!/usr/bin/make -f
+
+export SHELL = /bin/bash
+
+export DH_VERBOSE=1
+
+export VER=5.0
+export OLDVER=4.1
+
+include debian/defs.mk
+
+changelog_values := $(shell dpkg-parsechangelog \
+ | awk '/^(Version|Source|Distribution):/ {print $$2}')
+PKGSOURCE := $(word 1, $(changelog_values))
+PKGVERSION := $(word 2, $(changelog_values))
+PKGDISTRO := $(word 3, $(changelog_values))
+PKGFLAVOR := $(shell echo $(PKGSOURCE) | perl -nle 's/mysql-(.*?)-$(PKGDISTRO).*/$$1/ && print ')
+
+soversions := $(shell awk -F= '/SHARED_LIB_MAJOR_VERSION=/ {print $$2}' configure.in)
+
+export MYSOVER=$(word 1, $(soversions))
+export NDBSOVER=$(word 2, $(soversions))
+
+ifeq ("x$(MYSQL_FLAVOR)","x")
+ export MYSQL_FLAVOR=$(PKGFLAVOR)
+endif
+
+ifeq ("x$(MYSQL_FLAVOR)","x")
+ export MYVER=$(VER)
+ export MYOLDVER=$(OLDVER)
+ export MYSRCVER=$(MYVER)
+else
+ export MYVER=$(MYSQL_FLAVOR)-$(VER)
+ export MYOLDVER=$(MYSQL_FLAVOR)-$(OLDVER)
+ export MYSRCVER=$(MYSQL_FLAVOR)-$(PKGDISTRO)-$(VER)
+endif
+
+PACKAGE=mysql-$(MYVER)
+
+PWD=$(shell pwd)
+TMP=$(PWD)/debian/tmp/
+
+
+ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+
+MAKE_J = $(shell if grep -q processor.*3 /proc/cpuinfo; then echo "-j 4"; else echo ""; fi )
+
+ifeq ($(findstring $(ARCH),i386 sparc),$(ARCH))
+ USE_ASSEMBLER=--enable-assembler
+endif
+
+ifeq ($(findstring $(ARCH), arm),$(ARCH))
+ FOMIT_FRAME_POINTER=
+else
+ FOMIT_FRAME_POINTER=-fomit-frame-pointer
+endif
+
+# trying to raise stability on i386. See #116631
+# don't use it on ia64
+ifeq ($(findstring $(ARCH),i386),$(ARCH))
+ FNO_EXCEPTIONS=-fno-exceptions
+endif
+
+# This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf
+# so it is disabled by default although, according to MySQL, it brings >10%
+# performance gain if enabled. See #299382.
+ifeq ($(STATIC_MYSQLD), 1)
+ USE_STATIC_MYSQLD=--with-mysqld-ldflags=-all-static
+endif
+
+
+
+control-file:
+ @echo "## This file is autogenerated you want to edit control.in instead" > debian/control.tmp
+ sed -e "s/@MYVER@/$(MYVER)/g" \
+ -e "s/@VER@/$(VER)/g" \
+ -e "s/@VERSIONSTRING@/$(VERSIONSTRING)/g" \
+ -e "s/@MYOLDVER@/$(MYOLDVER)/g" \
+ -e "s/@MYSRCVER@/$(MYSRCVER)/g" \
+ -e "s/@MYSOVER@/$(MYSOVER)/g" \
+ -e "s/@NDBSOVER@/$(NDBSOVER)/g" \
+ debian/control.in >> debian/control.tmp
+ [ -e debian/control ] \
+ && cmp -s debian/control debian/control.tmp \
+ && rm -f debian/control.tmp && exit 0; \
+ mv debian/control.tmp debian/control
+
+
+missing:
+ ./BUILD/autorun.sh
+
+configure: configure-stamp
+configure-stamp:
+ @echo "RULES.configure-stamp"
+ dh_testdir
+
+ifneq ($(ARCH_OS),hurd)
+ @if [ ! -d /proc/self ]; then echo "/proc IS NEEDED" 1>&2; exit 1; fi
+endif
+
+ ( \
+ CC="$(MYSQL_BUILD_CC)" \
+ CXX="$(MYSQL_BUILD_CXX)" \
+ BUILD_OPTS="${MYSQL_BUILD_OPTS:-''}" \
+ CFLAGS="${MYSQL_BUILD_CFLAGS:-'-DBIG_JOINS=1 -O2'}" \
+ CXXFLAGS="${MYSQL_BUILD_CXXFLAGS:-'-DBIG_JOINS=1 -felide-constructors -fno-rtti -O2'}" \
+ ./configure \
+ --build=${DEB_BUILD_GNU_TYPE} \
+ --host=${DEB_HOST_GNU_TYPE} \
+ \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --libexecdir=/usr/sbin \
+ --datadir=/usr/share \
+ --localstatedir=/var/lib/mysql \
+ --includedir=/usr/include \
+ --infodir=/usr/share/info \
+ --mandir=/usr/share/man \
+ \
+ --with-comment="MySQL Server (custom build)" \
+ --with-server-suffix="-custom" \
+ \
+ --enable-shared \
+ --enable-thread-safe-client \
+ $(USE_ASSEMBLER) \
+ --enable-local-infile \
+ \
+ --with-big-tables \
+ --with-unix-socket-path=/var/run/mysqld/mysqld.sock \
+ --with-mysqld-user=mysql \
+ $(USE_STATIC_MYSQLD) \
+ --without-bench \
+ --with-zlib-dir=bundled \
+ --with-yassl \
+ --with-readline \
+ --with-extra-charsets=all \
+ --with-innodb \
+ --with-blackhole-storage-engine \
+ --with-example-storage-engine \
+ \
+ --with-isam \
+ --with-archive-storage-engine \
+ --with-csv-storage-engine \
+ --with-federated-storage-engine \
+ --without-embedded-server \
+ --with-ndbcluster \
+ --with-ndb-shm \
+ --without-ndb-sci \
+ --without-ndb-test \
+ --with-ndb-docs \
+ $(MYSQL_BUILD_OPTS) \
+ )
+
+ touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure
+ dh_testdir
+
+ $(MAKE) $(MAKE_J)
+
+ if [ -f sql/.libs/mysqld ] ; then \
+ nm --numeric-sort sql/.libs/mysqld > sql/mysqld.sym ; \
+ else \
+ nm --numeric-sort sql/mysqld > sql/mysqld.sym ; \
+ fi
+
+
+ if [ "${MYSQL_BUILD_TEST}" != "no" ] ; then \
+ ( cd mysql-test ;\
+ MTR_BUILD_THREAD=auto ; \
+ export MTR_BUILD_THREAD ; \
+ perl ./mysql-test-run.pl --force --report-features ; \
+ perl ./mysql-test-run.pl --force --ps-protocol ; \
+ true ) \
+ fi
+
+
+ touch build-stamp
+
+stamp-control:
+ # We have to prepare the various control files
+
+ # We have some naming inconsistencies here...
+ for f in debian/*.in debian/po/POTFILES.in.in ; do \
+ f2=`echo $$f | sed "s,MYVER,$(MYVER),g;\
+ s,MYSRCVER,$(MYSRCVER),g;\
+ s,MYOLDVER,$(MYOLDVER),g;\
+ s,NDBSOVER,$(NDBSOVER),g;\
+ s,MYSOVER,$(MYSOVER),g;s,\.in$$,,"`; \
+ if [ $$f2 != debian/control ]; then \
+ sed -e "s/@MYVER@/$(MYVER)/g" \
+ -e "s/@VERSIONSTRING@/$(VERSIONSTRING)/g" \
+ -e "s/@VER@/$(VER)/g" \
+ -e "s/@PRIORITY@/$(PRIORITY)/g" \
+ -e "s/@MYOLDVER@/$(MYOLDVER)/g" \
+ -e "s/@MYSRCVER@/$(MYSRCVER)/g" \
+ -e "s/@MYSOVER@/$(MYSOVER)/g" \
+ -e "s/@NDBSOVER@/$(NDBSOVER)/g" \
+ -e "s,@SCRIPTDIR@,/$(scriptdir),g" \
+ -e "s,@INFO@,$(findstring info, $(doc_dependencies)),g" \
+ <$$f >$$f2; \
+ fi; \
+ done
+
+# depending on two files we expect to be in the root
+# to protect from accidentally deleting a whole bunch of
+# files somewhere else.
+clean: configure.in Makefile.am control-file
+
+ rm -f debian/mysql-server-$(MYVER).mysql.init
+
+ # We depend on this later, and delete the results in the mean time
+ $(MAKE) -f debian/rules stamp-control
+ dh_testdir
+ dh_testroot
+ rm -f configure-stamp
+ rm -f build-stamp
+
+ -make distclean
+
+ debconf-updatepo
+
+ for f in debian/*.in; do \
+ f2=`echo $$f | sed "s,MYVER,$(MYVER),g;\
+ s,MYOLDVER,$(MYOLDVER),g;\
+ s,MYSRCVER,$(MYSRCVER),g;\
+ s,NDBSOVER,$(NDBSOVER),g;\
+ s,MYSOVER,$(MYSOVER),g;s,\.in$$,,"`; \
+ if [ $$f2 != debian/control ]; then \
+ rm -f $$f2; \
+ fi; \
+ done
+ rm -f po/POTFILES.in
+
+ dh_clean -v
+
+
+install:
+install: build stamp-control
+ @echo "RULES.install"
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Sort of hackish way to make sure we have a init script
+ # for dh_installinit
+ cp support-files/mysql.server debian/mysql-server-$(MYVER).mysql.init
+
+ # some self written manpages which hopefully
+ # gets overwritten sooner or later with upstreams
+ mkdir -p $(TMP)/usr/share/man/man1/
+ mkdir -p $(TMP)/usr/share/man/man8/
+ mkdir -p $(TMP)/usr/lib/mysql/mysqld.sym
+ cp debian/additions/*.1 $(TMP)/usr/share/man/man1/
+ ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanager-pwgen.1
+ ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanagerc.1
+ cp sql/mysqld.sym $(TMP)/usr/lib/mysql/mysqld.sym
+
+ # TODO: need real man pages!
+ for f in mysql mysqldump mysqlaccess mysqladmin mysqlshow myisam_ftdump myisamlog myisampack mysql_explain_log mysqld_multi mysqld_safe mysql_fix_privilege_tables mysql_upgrade mysql_tzinfo_to_sql mysql_zap perror replace safe_mysqld ; do touch $(TMP)/usr/share/man/man1/$$f.1 ; done
+ for f in mysqld mysqlmanager ; do touch $(TMP)/usr/share/man/man8/$$f.8 ; done
+ # make install (trailing slash needed for innobase)
+ $(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
+
+ # libmysqlclient: move shared libraries (but not the rest like libheap.a & co)
+ mv $(TMP)/usr/lib/mysql/libmysqlclient* $(TMP)/usr/lib
+ mv $(TMP)/usr/lib/mysql/libndbclient* $(TMP)/usr/lib
+ perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient.la
+ perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient_r.la
+ perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libndbclient.la
+
+ # Check if our beloved versioned symbols are really there
+ if [ "`objdump -T $(TMP)/usr/lib/libmysqlclient.so.15.0.0 | grep -c libmysqlclient_15`" -lt 500 ]; then \
+ echo "ERROR: versioned symbols are absent"; \
+ exit 1; \
+ fi
+ if [ "`objdump -T $(TMP)/usr/lib/libndbclient.so.2.0.0 | grep -c libndbclient_2`" -lt 500 ]; then \
+ echo "ERROR: versioned symbols are absent from libndbclient"; \
+ exit 1; \
+ fi
+
+ # libmysqlclient-dev: forgotten header file since 3.23.25?
+ cp include/my_config.h $(TMP)/usr/include/mysql/
+ cp include/my_dir.h $(TMP)/usr/include/mysql/
+
+ # mysql-common: We now provide our own config file.
+ install -d $(TMP)/etc/mysql
+ install -m 0644 debian/additions/my.cnf $(TMP)/etc/mysql/my.cnf
+
+ pod2man scripts/mysqlhotcopy $(TMP)/usr/share/man/man1/mysqlhotcopy.1
+
+ # mysql-server
+ install -m 0755 scripts/mysqld_safe $(TMP)/usr/bin/mysqld_safe
+ mkdir -p $(TMP)/usr/share/doc/mysql-server-$(MYVER)/examples
+ mv $(TMP)/usr/share/mysql/*cnf $(TMP)/usr/share/doc/mysql-server-$(MYVER)/examples/
+ rm -vf $(TMP)/usr/share/mysql/mi_test_all* \
+ $(TMP)/usr/share/mysql/mysql-log-rotate \
+ $(TMP)/usr/share/mysql/mysql.server \
+ $(TMP)/usr/share/mysql/binary-configure
+
+ # we can't install *.pl into /usr/bin - so we have to rename it.
+ sed "s#filename => 'ndb_size.tmpl#filename => '/usr/share/mysql/ndb_size.tmpl#" < $(TMP)/usr/bin/ndb_size.pl > $(TMP)/usr/bin/ndb_size
+ cp -a mysql-test $(TMP)/usr/share/mysql/
+ cp -a sql-bench $(TMP)/usr/share/mysql/
+ # lintian overrides
+ mkdir -p $(TMP)/usr/share/lintian/overrides/
+ cp debian/mysql-server-$(MYVER).lintian-overrides $(TMP)/usr/share/lintian/overrides/mysql-server-$(MYVER)
+ cp debian/mysql-client-$(MYVER).lintian-overrides $(TMP)/usr/share/lintian/overrides/mysql-client-$(MYVER)
+
+ # For 4.1 -> 5.0 transition
+ d=$(TMP)/usr/share/mysql-common/internal-use-only/; \
+ mkdir -p $$d; \
+ cp debian/mysql-server-$(MYVER).mysql.init $$d/_etc_init.d_mysql; \
+ cp debian/mysql-server-$(MYVER).mysql-server.logrotate $$d/_etc_logrotate.d_mysql-server; \
+
+ dh_movefiles
+
+# Build architecture-independent files here.
+binary-indep: build install
+ @echo "RULES.binary-indep"
+ dh_testdir -i
+ dh_testroot -i
+ dh_installdebconf -i
+ dh_installdocs -i
+ dh_installexamples -i
+ dh_installmenu -i
+ dh_installlogrotate -i
+ dh_installinit -i
+ dh_installcron -i
+ dh_installman -i
+ dh_installinfo -i
+ dh_installlogcheck -i
+ dh_installchangelogs -i
+ dh_link -i
+ dh_compress -i
+ dh_fixperms -i
+ dh_installdeb -i
+ dh_perl -i
+ dh_gencontrol -i
+ dh_md5sums -i
+ dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ @echo "RULES.binary-arch"
+ dh_testdir
+ dh_testroot
+
+ dh_installdebconf -a
+ dh_installdocs -a
+ dh_installexamples -a
+ dh_installmenu -a
+ dh_installlogrotate -a --name mysql-server
+ # Start mysql in runlevel 19 before 20 where apache, proftpd etc gets
+ # started which might depend on a running database server.
+ dh_installinit -a --name=mysql-storage -- defaults 19 21
+ dh_installinit -a --name=mysql -- defaults 19 21
+ dh_installinit -a --name=mysql-management -- defaults 20
+ dh_installcron -a --name mysql-server
+ dh_installman -a
+ dh_installinfo -a
+ dh_installlogcheck -a
+ dh_installchangelogs -a
+ dh_strip -a
+ dh_link -a # .so muss nach .so.1.2.3 installier werden!
+ dh_compress -a
+ dh_fixperms -a
+ dh_makeshlibs -a
+ dh_makeshlibs -plibmysqlclient$(MYSOVER) -V"libmysqlclient$(MYSOVER) (>= $(PKGVERSION))"
+ dh_makeshlibs -plibndbclient$(NDBSOVER) -V"libndbclient2 (>= $(PKGVERSION))"
+ dh_installdeb -a
+ dh_perl -a
+ dh_shlibdeps -a -l debian/libmysqlclient$(MYSOVER)/usr/lib -L libmysqlclient$(MYSOVER)
+ dh_shlibdeps -a -l debian/libndbclient$(NDBSOVER)/usr/lib -L libndbclient$(NDBSOVER)
+ dh_gencontrol -a
+ dh_md5sums -a
+ dh_builddeb -a
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: clean stamp-control control-file configure build binary binary-indep binary-arch install
+
+# vim: ts=8