Skip to content

Commit acfcc96

Browse files
committed
add MySQL 5.7.35 source code
0 parents  commit acfcc96

File tree

27,290 files changed

+10442200
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

27,290 files changed

+10442200
-0
lines changed

BUILD/README

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
This directory used to contain lots of build scripts for building
2+
MySQL on various platforms. They are mostly gone, use cmake instead.
3+
4+
Some scripts have been kept for backward compatibility (other scripts
5+
depend on them). Others have been kept to illustrate how to enable
6+
gcov or gprof, or explicitly selecting 64bit architecture. If you
7+
want to use these scripts for building, you may want to speed things
8+
up a bit by setting environment variable MAKEFLAGS="-j8"
9+
(or some other number/flag depending on your environment)
10+
11+
The recommended way to build MySQL for developers:
12+
13+
cd <some build directory>
14+
cmake <path to source directory>
15+
make
16+
17+
This will give you a release build, with compiler options taken from
18+
../cmake/build_configurations/compiler_options.cmake
19+
and "feature set" taken from
20+
../cmake/build_configurations/feature_set.cmake
21+
22+
Adding -DWITH_DEBUG=1 to the cmake command line gives you a debug build.
23+
24+
25+
Building on Windows is slightly different:
26+
cd <some build directory>
27+
cmake <path to source directory>
28+
29+
cmake --build . --config Debug
30+
or
31+
cmake --build . --config RelWithDebInfo
32+
33+
34+
If you have special needs, you can disable the defaults by setting
35+
these cmake variables off:
36+
37+
WITH_DEFAULT_COMPILER_OPTIONS
38+
WITH_DEFAULT_FEATURE_SET
39+
40+
Note: For building with unit tests, you need to tell cmake where to find
41+
the sources, see ../unittest/gunit/CMakeLists.txt
42+
You should *not* 'make install' googletest/googlemock on your system,
43+
the libraries must be built from source, with the unit tests.
44+
45+
Note: You need to tell cmake where to find boost, see ../cmake/boost.cmake

BUILD/SETUP.sh

+255
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) 2000, 2021, Oracle and/or its affiliates.
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License, version 2.0,
7+
# as published by the Free Software Foundation.
8+
#
9+
# This program is also distributed with certain software (including
10+
# but not limited to OpenSSL) that is licensed under separate terms,
11+
# as designated in a particular file or component or in included license
12+
# documentation. The authors of MySQL hereby grant you an additional
13+
# permission to link the program and your derivative works with the
14+
# separately licensed software that they have included with MySQL.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License, version 2.0, for more details.
20+
#
21+
# You should have received a copy of the GNU Library General Public
22+
# License along with this library; if not, write to the Free
23+
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24+
# MA 02110-1301, USA
25+
26+
########################################################################
27+
28+
get_key_value()
29+
{
30+
echo "$1" | sed 's/^--[a-zA-Z_-]*=//'
31+
}
32+
33+
usage()
34+
{
35+
cat <<EOF
36+
Usage: $0 [-h|-n] [configure-options]
37+
-h, --help Show this help message.
38+
-n, --just-print Don't actually run any commands; just print them.
39+
-c, --just-configure Stop after running configure.
40+
--with-debug=full Build with full debug(no optimizations, keep call stack).
41+
--warning-mode=[old|pedantic|maintainer]
42+
Influences the debug flags. Old is default.
43+
--prefix=path Build with prefix 'path'.
44+
45+
Note: this script is intended for internal use by MySQL developers.
46+
EOF
47+
}
48+
49+
parse_options()
50+
{
51+
while test $# -gt 0
52+
do
53+
case "$1" in
54+
--prefix=*)
55+
prefix=`get_key_value "$1"`;;
56+
--with-debug=full)
57+
full_debug="=full";;
58+
--warning-mode=*)
59+
warning_mode=`get_key_value "$1"`;;
60+
-c | --just-configure)
61+
just_configure=1;;
62+
-n | --just-print | --print)
63+
just_print=1;;
64+
-h | --help)
65+
usage
66+
exit 0;;
67+
*)
68+
echo "Unknown option '$1'"
69+
exit 1;;
70+
esac
71+
shift
72+
done
73+
}
74+
75+
########################################################################
76+
77+
if test ! -f sql/mysqld.cc
78+
then
79+
echo "You must run this script from the MySQL top-level directory"
80+
exit 1
81+
fi
82+
83+
prefix="/usr/local/mysql"
84+
just_print=
85+
just_configure=
86+
warning_mode=
87+
maintainer_mode=
88+
full_debug=
89+
90+
parse_options "$@"
91+
92+
if test -n "$MYSQL_BUILD_PREFIX"
93+
then
94+
prefix="$MYSQL_BUILD_PREFIX"
95+
fi
96+
97+
set -e
98+
99+
#
100+
# Check for the CPU and set up CPU specific flags. We may reset them
101+
# later.
102+
#
103+
path=`dirname $0`
104+
. "$path/check-cpu"
105+
106+
export AM_MAKEFLAGS
107+
AM_MAKEFLAGS="-j 6"
108+
109+
# SSL library to use.
110+
SSL_LIBRARY=--with-ssl=system
111+
112+
if [ "x$warning_mode" = "xpedantic" ]; then
113+
warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE"
114+
c_warnings="$warnings"
115+
cxx_warnings="$warnings -std=c++98"
116+
# NOTE: warning mode should not influence optimize/debug mode.
117+
# Please feel free to add a separate option if you don't feel it's an overkill.
118+
debug_extra_cflags="-O0"
119+
# Reset CPU flags (-mtune), they don't work in -pedantic mode
120+
check_cpu_cflags=""
121+
elif [ "x$warning_mode" = "xmaintainer" ]; then
122+
c_warnings="-Wall -Wextra"
123+
cxx_warnings="$c_warnings -Wno-unused-parameter"
124+
maintainer_mode="--enable-mysql-maintainer-mode"
125+
debug_extra_cflags="-g3"
126+
else
127+
# Both C and C++ warnings
128+
warnings="-Wall -Wextra -Wunused -Wwrite-strings"
129+
130+
# For more warnings, uncomment the following line
131+
# warnings="$warnings -Wshadow"
132+
133+
# C warnings
134+
c_warnings="$warnings"
135+
# C++ warnings
136+
cxx_warnings="$warnings -Wno-unused-parameter"
137+
# cxx_warnings="$cxx_warnings -Woverloaded-virtual -Wsign-promo"
138+
cxx_warnings="$cxx_warnings -Wnon-virtual-dtor"
139+
debug_extra_cflags="-O0 -g3 -gdwarf-2"
140+
fi
141+
142+
# Set flags for various build configurations.
143+
# Used in -valgrind builds
144+
valgrind_flags="-DMYSQL_SERVER_SUFFIX=-valgrind-max"
145+
valgrind_configs="--with-valgrind"
146+
#
147+
# Used in -debug builds
148+
debug_cflags="-DEXTRA_DEBUG "
149+
debug_cflags="$debug_cflags -DSAFE_MUTEX"
150+
error_inject="--with-error-inject "
151+
#
152+
# Base C++ flags for all builds
153+
base_cxxflags="-felide-constructors"
154+
#
155+
# Flags for optimizing builds.
156+
# Be as fast as we can be without losing our ability to backtrace.
157+
fast_cflags="-O3 -fno-omit-frame-pointer"
158+
159+
debug_configs="--with-debug"
160+
if [ -z "$full_debug" ]
161+
then
162+
debug_cflags="$debug_cflags $debug_extra_cflags"
163+
fi
164+
165+
166+
#
167+
# Configuration options.
168+
#
169+
base_configs="--prefix=$prefix --enable-assembler "
170+
base_configs="$base_configs --with-extra-charsets=complex "
171+
base_configs="$base_configs --enable-thread-safe-client "
172+
base_configs="$base_configs --with-big-tables $maintainer_mode"
173+
174+
175+
if test -d "$path/../cmd-line-utils/libedit"
176+
then
177+
base_configs="$base_configs --with-libedit"
178+
fi
179+
180+
static_link="--with-mysqld-ldflags=-all-static "
181+
static_link="$static_link --with-client-ldflags=-all-static"
182+
# we need local-infile in all binaries for rpl000001
183+
# if you need to disable local-infile in the client, write a build script
184+
# and unset local_infile_configs
185+
local_infile_configs="--enable-local-infile"
186+
187+
188+
max_no_embedded_configs="$SSL_LIBRARY --with-plugins=max"
189+
max_no_ndb_configs="$SSL_LIBRARY --with-plugins=max-no-ndb --with-embedded-server"
190+
max_configs="$SSL_LIBRARY --with-plugins=max --with-embedded-server"
191+
192+
#
193+
# CPU and platform specific compilation flags.
194+
#
195+
alpha_cflags="$check_cpu_cflags -Wa,-m$cpu_flag"
196+
amd64_cflags="$check_cpu_cflags"
197+
amd64_cxxflags="" # If dropping '--with-big-tables', add here "-DBIG_TABLES"
198+
pentium_cflags="$check_cpu_cflags"
199+
pentium64_cflags="$check_cpu_cflags -m64"
200+
ppc_cflags="$check_cpu_cflags"
201+
sparc_cflags=""
202+
203+
if gmake --version > /dev/null 2>&1
204+
then
205+
make=gmake
206+
else
207+
make=make
208+
fi
209+
210+
if test -z "$CC" ; then
211+
CC=gcc
212+
fi
213+
214+
if test -z "$CXX" ; then
215+
CXX=g++
216+
fi
217+
218+
# If ccache (a compiler cache which reduces build time)
219+
# (http://samba.org/ccache) is installed, use it.
220+
# We use 'grep' and hope 'grep' will work as expected
221+
# (returns 0 if finds lines)
222+
if test "$USING_GCOV" != "1"
223+
then
224+
# Not using gcov; Safe to use ccache
225+
CCACHE_GCOV_VERSION_ENABLED=1
226+
fi
227+
228+
if ccache -V > /dev/null 2>&1 && test "$CCACHE_GCOV_VERSION_ENABLED" = "1"
229+
then
230+
echo "$CC" | grep "ccache" > /dev/null || CC="ccache $CC"
231+
echo "$CXX" | grep "ccache" > /dev/null || CXX="ccache $CXX"
232+
fi
233+
234+
# gcov
235+
236+
# The -fprofile-arcs and -ftest-coverage options cause GCC to instrument the
237+
# code with profiling information used by gcov.
238+
# The -DHAVE_gcov enables code to write out coverage info even when crashing.
239+
240+
gcov_compile_flags="-fprofile-arcs -ftest-coverage"
241+
gcov_compile_flags="$gcov_compile_flags -DMYSQL_SERVER_SUFFIX=-gcov -DHAVE_gcov"
242+
243+
# GCC4 needs -fprofile-arcs -ftest-coverage on the linker command line (as well
244+
# as on the compiler command line), and this requires setting LDFLAGS for BDB.
245+
246+
gcov_link_flags="-fprofile-arcs -ftest-coverage"
247+
248+
gcov_configs="--with-gcov"
249+
250+
# gprof
251+
252+
gprof_compile_flags="-O2 -pg -g"
253+
254+
gprof_link_flags="--disable-shared $static_link"
255+

BUILD/autorun.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) 2005, 2021, Oracle and/or its affiliates.
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License, version 2.0,
7+
# as published by the Free Software Foundation.
8+
#
9+
# This program is also distributed with certain software (including
10+
# but not limited to OpenSSL) that is licensed under separate terms,
11+
# as designated in a particular file or component or in included license
12+
# documentation. The authors of MySQL hereby grant you an additional
13+
# permission to link the program and your derivative works with the
14+
# separately licensed software that they have included with MySQL.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License, version 2.0, for more details.
20+
#
21+
# You should have received a copy of the GNU Library General Public
22+
# License along with this library; if not, write to the Free
23+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24+
# MA 02110-1301, USA
25+
26+
# Create MySQL cmake configure wrapper
27+
28+
die() { echo "$@"; exit 1; }
29+
30+
# Use a configure script that will call CMake.
31+
path=`dirname $0`
32+
cp $path/cmake_configure.sh $path/../configure
33+
chmod +x $path/../configure

BUILD/cmake_configure.sh

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
3+
# Copyright (c) 2009, 2021, Oracle and/or its affiliates.
4+
#
5+
# This program is free software; you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License, version 2.0,
7+
# as published by the Free Software Foundation.
8+
#
9+
# This program is also distributed with certain software (including
10+
# but not limited to OpenSSL) that is licensed under separate terms,
11+
# as designated in a particular file or component or in included license
12+
# documentation. The authors of MySQL hereby grant you an additional
13+
# permission to link the program and your derivative works with the
14+
# separately licensed software that they have included with MySQL.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License, version 2.0, for more details.
20+
#
21+
# You should have received a copy of the GNU Library General Public
22+
# License along with this library; if not, write to the Free
23+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24+
# MA 02110-1301, USA
25+
26+
# Ensure cmake and perl are there
27+
cmake -P cmake/check_minimal_version.cmake >/dev/null 2>&1 || HAVE_CMAKE=no
28+
perl --version >/dev/null 2>&1 || HAVE_PERL=no
29+
scriptdir=`dirname $0`
30+
if test "$HAVE_CMAKE" = "no"
31+
then
32+
echo "CMake is required to build MySQL."
33+
exit 1
34+
elif test "$HAVE_PERL" = "no"
35+
then
36+
echo "Perl is required to build MySQL using the configure to CMake translator."
37+
exit 1
38+
else
39+
perl $scriptdir/cmake/configure.pl "$@"
40+
fi
41+

0 commit comments

Comments
 (0)