| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# MariaDB SQL server. |
| 4 |
# Copyright (C) 2010 Kristian Nielsen and Monty Program AB |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License as published by |
| 8 |
# the Free Software Foundation; version 2 of the License. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. |
| 18 |
|
| 19 |
|
| 20 |
# This script's purpose is to build the binary tarball packages for MariaDB |
| 21 |
# (currently only on Linux systems). |
| 22 |
# |
| 23 |
# Thus BUILD/compile-bintar from the appropriate source tarball will reproduce |
| 24 |
# such a release, provided the build environment (gcc version etc.) matches |
| 25 |
# (use scripts/make_binary_distribution after running this script to actually |
| 26 |
# create the binary tarball package). |
| 27 |
# |
| 28 |
# Note that packages are built from source tarballs not bzr checkouts. |
| 29 |
# Therefore, this script assumes autotools have already been run. |
| 30 |
# |
| 31 |
# We link libc dynamically, otherwise we get lots of problems loading |
| 32 |
# .so files at runtime (either system stuff like NSS, or server |
| 33 |
# plugins). |
| 34 |
# |
| 35 |
# We link libgcc statically to avoid reduce nasty library version dependencies. |
| 36 |
|
| 37 |
test -f Makefile && make distclean |
| 38 |
|
| 39 |
path=`dirname $0` |
| 40 |
. $path/util.sh |
| 41 |
|
| 42 |
SYSTEM_TYPE="$(uname -o)" |
| 43 |
MACHINE_TYPE="$(uname -m)" |
| 44 |
|
| 45 |
# We cannot have a slash '/' in tarfile name. |
| 46 |
SYSTEM_TYPE="$(echo ${SYSTEM_TYPE} | sed -e 's/GNU\///')" |
| 47 |
|
| 48 |
# Get correct options for architecture into CPUOPT. |
| 49 |
get_cpuopt |
| 50 |
# Get correct -j option into AM_MAKEFLAGS |
| 51 |
get_make_parallel_flag |
| 52 |
|
| 53 |
# Use gcc rather than g++ to avoid linking libstdc++.so (which we don't need). |
| 54 |
FLAGS="-O2 -fno-omit-frame-pointer -g -pipe -Wall $CPUOPT" |
| 55 |
|
| 56 |
# Don't press on in case of error. |
| 57 |
set -e |
| 58 |
|
| 59 |
CC="gcc -static-libgcc" CXX="g++ -static-libgcc" CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" \ |
| 60 |
./configure \ |
| 61 |
--prefix=/usr/local/mysql \ |
| 62 |
--exec-prefix=/usr/local/mysql \ |
| 63 |
--libexecdir=/usr/local/mysql/bin \ |
| 64 |
--localstatedir=/usr/local/mysql/data \ |
| 65 |
\ |
| 66 |
--with-comment="(MariaDB - http://mariadb.com/)" \ |
| 67 |
--with-system-type="${SYSTEM_TYPE}" \ |
| 68 |
--with-machine-type="${MACHINE_TYPE}" \ |
| 69 |
\ |
| 70 |
--enable-shared --enable-static \ |
| 71 |
--with-client-ldflags=-static --with-mysqld-ldflags=-static \ |
| 72 |
--enable-thread-safe-client --enable-local-infile --with-big-tables \ |
| 73 |
--without-docs --with-extra-charsets=all \ |
| 74 |
--with-libwrap --with-ssl --with-readline --with-libevent --with-zlib-dir=bundled \ |
| 75 |
--with-partition --with-embedded-server \ |
| 76 |
--with-plugins=max \ |
| 77 |
--without-plugin-innodb_plugin |
| 78 |
|
| 79 |
make $AM_MAKEFLAGS |