| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
# Copyright (c) 2004, 2005, 2007 MySQL AB |
| 4 |
# Use is subject to license terms |
| 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 |
if [ ! -f "sql/mysqld.cc" ]; then |
| 20 |
echo "You must run this script from the MySQL top-level directory." |
| 21 |
exit 1 |
| 22 |
fi |
| 23 |
|
| 24 |
cflags="-64 -mips4" |
| 25 |
config_args= |
| 26 |
if [ "$#" != 0 ]; then |
| 27 |
case "$1" in |
| 28 |
--help) |
| 29 |
echo "Usage: $0 [options]" |
| 30 |
echo "Options:" |
| 31 |
echo "--help print this message" |
| 32 |
echo "-32 build 32-bit binary" |
| 33 |
echo "-64 build 64-bit binary [default]" |
| 34 |
exit 0 |
| 35 |
;; |
| 36 |
-64) |
| 37 |
echo "Building 64-bit binary" |
| 38 |
;; |
| 39 |
-32) |
| 40 |
echo "Building 32-bit binary" |
| 41 |
cflags="" |
| 42 |
;; |
| 43 |
*) |
| 44 |
config_args="$config_args $1"; shift |
| 45 |
;; |
| 46 |
esac |
| 47 |
else |
| 48 |
echo "Building 64-bit binary" |
| 49 |
fi |
| 50 |
|
| 51 |
set -x |
| 52 |
make maintainer-clean |
| 53 |
|
| 54 |
path=`dirname $0` |
| 55 |
. "$path/autorun.sh" |
| 56 |
|
| 57 |
# C options: |
| 58 |
# -apo - auto-parallelize for multiprocessors (implies -mp) |
| 59 |
# -mp - generate multiprocessor code |
| 60 |
# These two common optimization options apparently use 'sproc' model of |
| 61 |
# threading, which is not compatible with PTHREADS: don't add them unless you |
| 62 |
# know what you're doing. |
| 63 |
# |
| 64 |
# -c99 - enable C features standardized in C99, such as long long, |
| 65 |
# strtoll, stroull etc. |
| 66 |
# This option is vital to compile MySQL. |
| 67 |
# -woff - turn off some warnings |
| 68 |
# -64 - generate 64 bit object (implies -mips4) |
| 69 |
# -mips4 - produce code for MIPS R10000, MIPS R12000 and further 64 bit |
| 70 |
# processors |
| 71 |
# -OPT:Olimit=0 - no limits exists to size of function for compiler to optimize |
| 72 |
# it |
| 73 |
nowarn="-woff 1064,1188,1460,1552,1681,1682,3303" |
| 74 |
cflags="$cflags $nowarn -O3 -c99 -OPT:Olimit=0" |
| 75 |
|
| 76 |
# C++ only options: |
| 77 |
# -LANG:exceptions=OFF - don't generate exception handling code |
| 78 |
# MySQL doesn't use exceptions. |
| 79 |
# -LANG:std=OFF - don't link standard C++ library, such as |
| 80 |
# <iostream>, <complex>, etc. |
| 81 |
# -LANG:libc_in_namespace_std=OFF - libstdc functions can be |
| 82 |
# declared in namespace 'std', when included |
| 83 |
# into C++ code. Switch this feature off. |
| 84 |
# This option is vital to compile MySQL |
| 85 |
|
| 86 |
cxxflags="$cflags -LANG:exceptions=OFF -LANG:std=OFF" |
| 87 |
cxxflags="$cxxflags -LANG:libc_in_namespace_std=OFF" |
| 88 |
|
| 89 |
CC=cc CXX=CC CFLAGS="$cflags" CXXFLAGS="$cxxflags" \ |
| 90 |
./configure --prefix=/usr/local/mysql --disable-shared \ |
| 91 |
--with-extra-charsets=complex --enable-thread-safe-client \ |
| 92 |
--without-extra-tools --disable-dependency-tracking \ |
| 93 |
$config_args |
| 94 |
|
| 95 |
make |