summaryrefslogtreecommitdiff
path: root/BUILD/compile-bintar
blob: 94d1371f69d89facc959c319bc2bc728adc35eb0 (plain)
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
#!/bin/bash
#
# MariaDB SQL server.
# Copyright (C) 2010 Kristian Nielsen and Monty Program AB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA.


# This script's purpose is to build the binary tarball packages for MariaDB
# (currently only on Linux systems).
#
# Thus BUILD/compile-bintar from the appropriate source tarball will reproduce
# such a release, provided the build environment (gcc version etc.) matches
# (use scripts/make_binary_distribution after running this script to actually
# create the binary tarball package).
#
# Note that packages are built from source tarballs not bzr checkouts.
# Therefore, this script assumes autotools have already been run.
#
# We link libc dynamically, otherwise we get lots of problems loading
# .so files at runtime (either system stuff like NSS, or server
# plugins).
#
# We link libgcc statically to avoid reduce nasty library version dependencies.

test -f Makefile && make distclean

path=`dirname $0`
. $path/util.sh

SYSTEM_TYPE="$(uname -o)"
MACHINE_TYPE="$(uname -m)"

# We cannot have a slash '/' in tarfile name.
SYSTEM_TYPE="$(echo ${SYSTEM_TYPE} | sed -e 's/GNU\///')"

# Get correct options for architecture into CPUOPT.
get_cpuopt
# Get correct -j option into AM_MAKEFLAGS
get_make_parallel_flag

# Use gcc rather than g++ to avoid linking libstdc++.so (which we don't need).
FLAGS="-O2 -fno-omit-frame-pointer -g -pipe -Wall $CPUOPT"

# Don't press on in case of error.
set -e

CC="gcc -static-libgcc" CXX="g++ -static-libgcc" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" \
	./configure \
	--prefix=/usr/local/mysql \
	--exec-prefix=/usr/local/mysql \
	--libexecdir=/usr/local/mysql/bin \
	--localstatedir=/usr/local/mysql/data \
	\
	--with-comment="(MariaDB - http://mariadb.com/)" \
	--with-system-type="${SYSTEM_TYPE}" \
	--with-machine-type="${MACHINE_TYPE}" \
	\
	--enable-shared --enable-static \
	--with-client-ldflags=-static --with-mysqld-ldflags=-static \
	--enable-thread-safe-client --enable-local-infile --with-big-tables \
	--without-docs --with-extra-charsets=all \
	--with-libwrap --with-ssl --with-readline --with-libevent --with-zlib-dir=bundled \
	--with-partition --with-embedded-server \
	--with-plugins=max \
	--without-plugin-innodb_plugin

make $AM_MAKEFLAGS