2
# Copyright (C) 2006 MySQL AB
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; version 2 of the License.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
# Exit if failing to copy, we want exact specifications, not
18
# just "what happen to be built".
21
# ----------------------------------------------------------------------
22
# Read first argument that is the base name of the resulting TAR file.
23
# See usage() function below for a description on the arguments.
25
# NOTE: We will read the rest of the command line later on.
26
# NOTE: Pattern matching with "{..,..}" can't be used, not portable.
27
# ----------------------------------------------------------------------
29
# FIXME why "libmysql.dll" installed both in "bin" and "lib/opt"?
34
Usage: make_win_bin_dist [ options ] package-base-name [ copy-defs... ]
36
This is a script to run from the top of a source tree built on Windows.
37
The "package-base-name" argument should be something like
39
mysql-noinstall-5.0.25-win32 (or winx64)
41
and will become the name of the directory of the unpacked ZIP (stripping
42
away the "noinstall" part of the ZIP file name if any) and the base
43
for the resulting package name.
47
--embedded Pack the embedded server and give error if not built.
48
The default is to pack it if it is built.
50
--no-embedded Don't pack the embedded server even if built
52
--debug Pack the debug binaries and give error if not built.
53
The default is to pack them if they are built.
55
--no-debug Don't pack the debug binaries even if built
57
--only-debug The target for this build was "Debug", and we just
58
want to replace the normal binaries with debug
59
versions, i.e. no separate "debug" directories.
61
--exe-suffix=SUF Add a suffix to the filename part of the "mysqld" binary.
63
As you might want to include files of directories from other builds
64
(like a "mysqld-max.exe" server), you can instruct this script to copy
65
them in for you. This is the "copy-def" arguments, and they are of the
68
relative-dest-name=source-name .....
70
i.e. can be something like
72
bin/mysqld-max.exe=../my-max-build/sql/release/mysqld.exe
74
If you specify a directory the whole directory will be copied.
80
# ----------------------------------------------------------------------
81
# We need to be at the top of a source tree, check that we are
82
# ----------------------------------------------------------------------
84
if [ ! -d "sql" ] ; then
85
echo "You need to run this script from inside the source tree"
89
# ----------------------------------------------------------------------
90
# Actual argument processing, first part
91
# ----------------------------------------------------------------------
95
PACK_EMBEDDED="" # Could be "no", "yes" or empty
96
PACK_DEBUG="" # Could be "no", "yes" or empty
102
--embedded) PACK_EMBEDDED="yes" ;;
103
--no-embedded) PACK_EMBEDDED="no" ;;
104
--debug) PACK_DEBUG="yes" ;;
105
--no-debug) PACK_DEBUG="no" ;;
106
--only-debug) TARGET="debug" ; PACK_DEBUG="no" ;;
107
--exe-suffix=*) EXE_SUFFIX=`echo "$arg" | sed -e "s,--exe-suffix=,,"` ;;
109
echo "Unknown argument '$arg'"
118
if [ x"$NOINST_NAME" = x"" ] ; then
119
echo "No base package name given"
122
DESTDIR=`echo $NOINST_NAME | sed 's/-noinstall-/-/'`
124
if [ -e $DESTDIR ] ; then
125
echo "Please remove the old $DESTDIR before running this script"
129
trap 'echo "Clearning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR
131
# ----------------------------------------------------------------------
132
# Adjust target name if needed, release with debug info has another name
133
# ----------------------------------------------------------------------
135
if [ x"$TARGET" = x"release" -a -f "client/relwithdebinfo/mysql.exe" ]
137
TARGET="relwithdebinfo"
140
# ----------------------------------------------------------------------
141
# Copy executables, and client DLL
142
# ----------------------------------------------------------------------
146
cp client/$TARGET/*.exe $DESTDIR/bin/
147
cp extra/$TARGET/*.exe $DESTDIR/bin/
148
cp storage/myisam/$TARGET/*.exe $DESTDIR/bin/
149
if [ x"$TARGET" != x"release" ] ; then
150
cp client/$TARGET/mysql.pdb $DESTDIR/bin/
151
cp client/$TARGET/mysqladmin.pdb $DESTDIR/bin/
152
cp client/$TARGET/mysqlbinlog.pdb $DESTDIR/bin/
153
cp client/$TARGET/mysqldump.pdb $DESTDIR/bin/
154
cp client/$TARGET/mysqlimport.pdb $DESTDIR/bin/
155
cp client/$TARGET/mysqlshow.pdb $DESTDIR/bin/
157
cp tests/$TARGET/*.exe $DESTDIR/bin/
158
cp libmysql/$TARGET/libmysql.dll $DESTDIR/bin/
160
cp sql/$TARGET/mysqld.exe $DESTDIR/bin/mysqld$EXE_SUFFIX.exe
161
cp sql/$TARGET/mysqld.map $DESTDIR/bin/mysqld$EXE_SUFFIX.map
162
if [ x"$TARGET" != x"release" ] ; then
163
cp sql/$TARGET/mysqld.pdb $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb
166
if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/mysqld.exe" -o \
167
x"$PACK_DEBUG" = x"yes" ] ; then
168
cp sql/debug/mysqld.exe $DESTDIR/bin/mysqld-debug.exe
169
cp sql/debug/mysqld.pdb $DESTDIR/bin/mysqld-debug.pdb
170
cp sql/debug/mysqld.map $DESTDIR/bin/mysqld-debug.map
173
# ----------------------------------------------------------------------
174
# Copy data directory, readme files etc
175
# ----------------------------------------------------------------------
177
if [ -d win/data ] ; then
178
cp -pR win/data $DESTDIR/
182
cp Docs/INSTALL-BINARY $DESTDIR/Docs/
183
cp Docs/manual.chm $DESTDIR/Docs/ || /bin/true
184
cp ChangeLog $DESTDIR/Docs/ || /bin/true
185
cp support-files/my-*.ini $DESTDIR/
187
if [ -f COPYING ] ; then
188
cp COPYING EXCEPTIONS-CLIENT $DESTDIR/
189
cp COPYING $DESTDIR/Docs/
192
# ----------------------------------------------------------------------
193
# These will be filled in when we enable embedded. Note that if no
194
# argument is given, it is copied if exists, else a check is done.
195
# ----------------------------------------------------------------------
199
mkdir -p $DESTDIR/Embedded/DLL/release \
200
$DESTDIR/Embedded/static/release \
202
cp libmysqld/libmysqld.def $DESTDIR/include/
203
cp libmysqld/$TARGET/mysqlserver.lib $DESTDIR/Embedded/static/release/
204
cp libmysqld/$TARGET/libmysqld.dll $DESTDIR/Embedded/DLL/release/
205
cp libmysqld/$TARGET/libmysqld.exp $DESTDIR/Embedded/DLL/release/
206
cp libmysqld/$TARGET/libmysqld.lib $DESTDIR/Embedded/DLL/release/
207
if [ x"$TARGET" != x"release" ] ; then
208
cp libmysqld/$TARGET/mysqlserver.pdb $DESTDIR/Embedded/static/release/
209
cp libmysqld/$TARGET/libmysqld.pdb $DESTDIR/Embedded/DLL/release/
212
if [ x"$PACK_DEBUG" = x"" -a -f "libmysqld/debug/libmysqld.lib" -o \
213
x"$PACK_DEBUG" = x"yes" ] ; then
214
mkdir -p $DESTDIR/Embedded/DLL/debug \
215
$DESTDIR/Embedded/static/debug
216
cp libmysqld/debug/mysqlserver.lib $DESTDIR/Embedded/static/debug/
217
cp libmysqld/debug/mysqlserver.pdb $DESTDIR/Embedded/static/debug/
218
cp libmysqld/debug/libmysqld.dll $DESTDIR/Embedded/DLL/debug/
219
cp libmysqld/debug/libmysqld.exp $DESTDIR/Embedded/DLL/debug/
220
cp libmysqld/debug/libmysqld.lib $DESTDIR/Embedded/DLL/debug/
221
cp libmysqld/debug/libmysqld.pdb $DESTDIR/Embedded/DLL/debug/
225
if [ x"$PACK_EMBEDDED" = x"" -a \
226
-f "libmysqld/$TARGET/mysqlserver.lib" -a \
227
-f "libmysqld/$TARGET/libmysqld.lib" -o \
228
x"$PACK_EMBEDDED" = x"yes" ] ; then
232
# ----------------------------------------------------------------------
233
# Note: Make sure to sync with include/Makefile.am and WiX installer
235
# ----------------------------------------------------------------------
237
mkdir -p $DESTDIR/include
239
include/mysql_com.h \
240
include/mysql_time.h \
248
include/mysql_embed.h \
249
include/my_pthread.h \
250
include/my_no_pthread.h \
253
include/my_global.h \
255
include/my_getopt.h \
256
include/sslopt-longopts.h \
258
include/sslopt-vars.h \
259
include/sslopt-case.h \
260
include/sql_common.h \
263
include/my_attribute.h \
264
include/mysqld_error.h \
265
include/sql_state.h \
266
include/mysqld_ername.h \
267
include/mysql_version.h \
268
include/config-win.h \
269
libmysql/libmysql.def \
272
mkdir -p $DESTDIR/include/mysql
273
cp include/mysql/plugin.h $DESTDIR/include/mysql/
275
# ----------------------------------------------------------------------
276
# Client libraries, and other libraries
277
# ----------------------------------------------------------------------
279
mkdir -p $DESTDIR/lib/opt
280
cp libmysql/$TARGET/libmysql.dll \
281
libmysql/$TARGET/libmysql.lib \
282
libmysql/$TARGET/mysqlclient.lib \
283
mysys/$TARGET/mysys.lib \
284
regex/$TARGET/regex.lib \
285
strings/$TARGET/strings.lib \
286
zlib/$TARGET/zlib.lib $DESTDIR/lib/opt/
288
if [ x"$TARGET" != x"release" ] ; then
289
cp libmysql/$TARGET/libmysql.pdb \
290
libmysql/$TARGET/mysqlclient.pdb \
291
mysys/$TARGET/mysys.pdb \
292
regex/$TARGET/regex.pdb \
293
strings/$TARGET/strings.pdb \
294
zlib/$TARGET/zlib.pdb $DESTDIR/lib/opt/
297
if [ x"$PACK_DEBUG" = x"" -a -f "libmysql/debug/libmysql.lib" -o \
298
x"$PACK_DEBUG" = x"yes" ] ; then
299
mkdir -p $DESTDIR/lib/debug
300
cp libmysql/debug/libmysql.dll \
301
libmysql/debug/libmysql.lib \
302
libmysql/debug/libmysql.pdb \
303
libmysql/debug/mysqlclient.lib \
304
libmysql/debug/mysqlclient.pdb \
305
mysys/debug/mysys.lib \
306
mysys/debug/mysys.pdb \
307
regex/debug/regex.lib \
308
regex/debug/regex.pdb \
309
strings/debug/strings.lib \
310
strings/debug/strings.pdb \
311
zlib/debug/zlib.lib \
312
zlib/debug/zlib.pdb $DESTDIR/lib/debug/
315
# ----------------------------------------------------------------------
316
# Copy the test directory
317
# ----------------------------------------------------------------------
319
mkdir $DESTDIR/mysql-test
320
cp mysql-test/mysql-test-run.pl $DESTDIR/mysql-test/
321
cp mysql-test/README $DESTDIR/mysql-test/
322
cp -R mysql-test/{t,r,include,suite,std_data,lib} $DESTDIR/mysql-test/
324
# Note that this will not copy "extra" if a soft link
325
if [ -d mysql-test/extra ] ; then
326
mkdir $DESTDIR/mysql-test/extra
327
cp -pR mysql-test/extra/* $DESTDIR/mysql-test/extra/
330
# ----------------------------------------------------------------------
331
# Copy what could be usable in the "scripts" directory
332
# ----------------------------------------------------------------------
336
mysql_convert_table_format.pl \
337
mysql_install_db.pl \
338
mysql_secure_installation.pl \
344
mkdir -p $DESTDIR/scripts
346
for i in $mysql_scripts
348
cp scripts/$i $DESTDIR/scripts/$i
351
cp -pR sql/share $DESTDIR/
352
cp -pR sql-bench $DESTDIR/
353
rm -f $DESTDIR/sql-bench/*.sh $DESTDIR/sql-bench/Makefile*
355
# The SQL initialisation code is to be in "share"
356
cp scripts/*.sql $DESTDIR/share/
358
# ----------------------------------------------------------------------
359
# Clean up from possibly copied SCCS directories
360
# ----------------------------------------------------------------------
362
rm -rf `find $DISTDIR -type d -name SCCS -print`
364
# ----------------------------------------------------------------------
365
# Copy other files specified on command line DEST=SOURCE
366
# ----------------------------------------------------------------------
369
dst=`echo $arg | sed 's/=.*$//'`
370
src=`echo $arg | sed 's/^.*=//'`
372
if [ x"$dst" = x"" -o x"$src" = x"" ] ; then
373
echo "Invalid specification of what to copy"
377
mkdir -p `dirname $DESTDIR/$dst`
378
cp -pR "$src" $DESTDIR/$dst
381
# ----------------------------------------------------------------------
382
# Finally create the ZIP archive
383
# ----------------------------------------------------------------------
385
rm -f $NOINST_NAME.zip
386
zip -r $NOINST_NAME.zip $DESTDIR