~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to scripts/make_win_bin_dist

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright (C) 2006 MySQL AB
 
3
 
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.
 
7
 
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.
 
12
 
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
 
16
 
 
17
# Exit if failing to copy, we want exact specifications, not
 
18
# just "what happen to be built".
 
19
set -e
 
20
 
 
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.
 
24
#
 
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
# ----------------------------------------------------------------------
 
28
 
 
29
# FIXME why "libmysql.dll" installed both in "bin" and "lib/opt"?
 
30
 
 
31
usage()
 
32
{
 
33
  echo <<EOF
 
34
Usage: make_win_bin_dist [ options ] package-base-name [ copy-defs... ]
 
35
 
 
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
 
38
 
 
39
  mysql-noinstall-5.0.25-win32  (or winx64)
 
40
 
 
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.
 
44
 
 
45
Options are
 
46
 
 
47
  --embedded       Pack the embedded server and give error if not built.
 
48
                   The default is to pack it if it is built.
 
49
 
 
50
  --no-embedded    Don't pack the embedded server even if built
 
51
 
 
52
  --debug          Pack the debug binaries and give error if not built.
 
53
                   The default is to pack them if they are built.
 
54
 
 
55
  --no-debug       Don't pack the debug binaries even if built
 
56
 
 
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.
 
60
 
 
61
  --exe-suffix=SUF Add a suffix to the filename part of the "mysqld" binary.
 
62
 
 
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
 
66
form
 
67
 
 
68
  relative-dest-name=source-name .....
 
69
 
 
70
i.e. can be something like
 
71
 
 
72
  bin/mysqld-max.exe=../my-max-build/sql/release/mysqld.exe
 
73
 
 
74
If you specify a directory the whole directory will be copied.
 
75
 
 
76
EOF
 
77
  exit 1
 
78
}
 
79
 
 
80
# ----------------------------------------------------------------------
 
81
# We need to be at the top of a source tree, check that we are
 
82
# ----------------------------------------------------------------------
 
83
 
 
84
if [ ! -d "sql" ] ; then
 
85
  echo "You need to run this script from inside the source tree"
 
86
  usage
 
87
fi
 
88
 
 
89
# ----------------------------------------------------------------------
 
90
# Actual argument processing, first part
 
91
# ----------------------------------------------------------------------
 
92
 
 
93
NOINST_NAME=""
 
94
TARGET="release"
 
95
PACK_EMBEDDED=""                # Could be "no", "yes" or empty
 
96
PACK_DEBUG=""                   # Could be "no", "yes" or empty
 
97
EXE_SUFFIX=""
 
98
 
 
99
for arg do
 
100
  shift
 
101
  case "$arg" in
 
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=,,"` ;;
 
108
    -*)
 
109
      echo "Unknown argument '$arg'"
 
110
      usage
 
111
      ;;
 
112
    *)
 
113
      NOINST_NAME="$arg"
 
114
      break
 
115
  esac
 
116
done
 
117
 
 
118
if [ x"$NOINST_NAME" = x"" ] ; then
 
119
  echo "No base package name given"
 
120
  usage
 
121
fi
 
122
DESTDIR=`echo $NOINST_NAME | sed 's/-noinstall-/-/'`
 
123
 
 
124
if [ -e $DESTDIR ] ; then
 
125
  echo "Please remove the old $DESTDIR before running this script"
 
126
  usage
 
127
fi
 
128
 
 
129
trap 'echo "Cleaning up and exiting..." ; rm -fr $DESTDIR; exit 1' ERR
 
130
 
 
131
# ----------------------------------------------------------------------
 
132
# Adjust target name if needed, release with debug info has another name
 
133
# ----------------------------------------------------------------------
 
134
 
 
135
if [ x"$TARGET" = x"release" -a -f "client/relwithdebinfo/mysql.exe" ]
 
136
then
 
137
  TARGET="relwithdebinfo"
 
138
fi
 
139
 
 
140
# ----------------------------------------------------------------------
 
141
# Copy executables, and client DLL
 
142
# ----------------------------------------------------------------------
 
143
 
 
144
mkdir $DESTDIR
 
145
mkdir $DESTDIR/bin
 
146
cp client/$TARGET/*.exe                                  $DESTDIR/bin/
 
147
cp extra/$TARGET/*.exe                                   $DESTDIR/bin/
 
148
cp storage/myisam/$TARGET/*.exe                          $DESTDIR/bin/
 
149
cp server-tools/instance-manager/$TARGET/*.{exe,map}     $DESTDIR/bin/
 
150
if [ x"$TARGET" != x"release" ] ; then
 
151
  cp server-tools/instance-manager/$TARGET/*.pdb         $DESTDIR/bin/
 
152
  cp client/$TARGET/mysql.pdb                            $DESTDIR/bin/
 
153
  cp client/$TARGET/mysqladmin.pdb                       $DESTDIR/bin/
 
154
  cp client/$TARGET/mysqlbinlog.pdb                      $DESTDIR/bin/
 
155
  cp client/$TARGET/mysqldump.pdb                        $DESTDIR/bin/
 
156
  cp client/$TARGET/mysqlimport.pdb                      $DESTDIR/bin/
 
157
  cp client/$TARGET/mysqlshow.pdb                        $DESTDIR/bin/
 
158
fi
 
159
cp tests/$TARGET/*.exe                                   $DESTDIR/bin/
 
160
cp libmysql/$TARGET/libmysql.dll                         $DESTDIR/bin/
 
161
 
 
162
cp sql/$TARGET/mysqld.exe                $DESTDIR/bin/mysqld$EXE_SUFFIX.exe
 
163
cp sql/$TARGET/mysqld.map                $DESTDIR/bin/mysqld$EXE_SUFFIX.map
 
164
if [ x"$TARGET" != x"release" ] ; then
 
165
  cp sql/$TARGET/mysqld.pdb              $DESTDIR/bin/mysqld$EXE_SUFFIX.pdb
 
166
fi
 
167
 
 
168
if [ x"$PACK_DEBUG" = x"" -a -f "sql/debug/mysqld.exe" -o \
 
169
     x"$PACK_DEBUG" = x"yes" ] ; then
 
170
  cp sql/debug/mysqld.exe                $DESTDIR/bin/mysqld-debug.exe
 
171
  cp sql/debug/mysqld.pdb                $DESTDIR/bin/mysqld-debug.pdb
 
172
  cp sql/debug/mysqld.map                $DESTDIR/bin/mysqld-debug.map
 
173
fi
 
174
 
 
175
# ----------------------------------------------------------------------
 
176
# Copy data directory, readme files etc
 
177
# ----------------------------------------------------------------------
 
178
 
 
179
if [ -d win/data ] ; then
 
180
  cp -pR win/data $DESTDIR/
 
181
fi
 
182
 
 
183
mkdir $DESTDIR/Docs
 
184
cp Docs/INSTALL-BINARY    $DESTDIR/Docs/
 
185
cp Docs/manual.chm        $DESTDIR/Docs/ || /bin/true
 
186
cp ChangeLog              $DESTDIR/Docs/ || /bin/true
 
187
cp support-files/my-*.ini $DESTDIR/
 
188
 
 
189
if [ -f COPYING ] ; then
 
190
  cp COPYING EXCEPTIONS-CLIENT $DESTDIR/
 
191
  cp COPYING                   $DESTDIR/Docs/
 
192
fi
 
193
 
 
194
# ----------------------------------------------------------------------
 
195
# These will be filled in when we enable embedded. Note that if no
 
196
# argument is given, it is copied if exists, else a check is done.
 
197
# ----------------------------------------------------------------------
 
198
 
 
199
copy_embedded()
 
200
{
 
201
  mkdir -p $DESTDIR/Embedded/DLL/release \
 
202
           $DESTDIR/Embedded/static/release \
 
203
           $DESTDIR/include
 
204
  cp libmysqld/libmysqld.def           $DESTDIR/include/
 
205
  cp libmysqld/$TARGET/mysqlserver.lib $DESTDIR/Embedded/static/release/
 
206
  cp libmysqld/$TARGET/libmysqld.dll   $DESTDIR/Embedded/DLL/release/
 
207
  cp libmysqld/$TARGET/libmysqld.exp   $DESTDIR/Embedded/DLL/release/
 
208
  cp libmysqld/$TARGET/libmysqld.lib   $DESTDIR/Embedded/DLL/release/
 
209
  if [ x"$TARGET" != x"release" ] ; then
 
210
    cp libmysqld/$TARGET/mysqlserver.pdb $DESTDIR/Embedded/static/release/
 
211
    cp libmysqld/$TARGET/libmysqld.pdb   $DESTDIR/Embedded/DLL/release/
 
212
  fi
 
213
 
 
214
  if [ x"$PACK_DEBUG" = x"" -a -f "libmysqld/debug/libmysqld.lib" -o \
 
215
       x"$PACK_DEBUG" = x"yes" ] ; then
 
216
    mkdir -p $DESTDIR/Embedded/DLL/debug \
 
217
             $DESTDIR/Embedded/static/debug
 
218
    cp libmysqld/debug/mysqlserver.lib   $DESTDIR/Embedded/static/debug/
 
219
    cp libmysqld/debug/mysqlserver.pdb   $DESTDIR/Embedded/static/debug/
 
220
    cp libmysqld/debug/libmysqld.dll     $DESTDIR/Embedded/DLL/debug/
 
221
    cp libmysqld/debug/libmysqld.exp     $DESTDIR/Embedded/DLL/debug/
 
222
    cp libmysqld/debug/libmysqld.lib     $DESTDIR/Embedded/DLL/debug/
 
223
    cp libmysqld/debug/libmysqld.pdb     $DESTDIR/Embedded/DLL/debug/
 
224
  fi
 
225
}
 
226
 
 
227
if [ x"$PACK_EMBEDDED" = x"" -a \
 
228
     -f "libmysqld/$TARGET/mysqlserver.lib" -a \
 
229
     -f "libmysqld/$TARGET/libmysqld.lib" -o \
 
230
     x"$PACK_EMBEDDED" = x"yes" ] ; then
 
231
  copy_embedded
 
232
fi
 
233
 
 
234
# ----------------------------------------------------------------------
 
235
# Note: Make sure to sync with include/Makefile.am and WiX installer
 
236
# XML specifications
 
237
# ----------------------------------------------------------------------
 
238
 
 
239
mkdir -p $DESTDIR/include
 
240
cp include/mysql.h \
 
241
   include/mysql_com.h \
 
242
   include/mysql_time.h \
 
243
   include/my_list.h \
 
244
   include/my_alloc.h \
 
245
   include/typelib.h \
 
246
   include/my_dbug.h \
 
247
   include/m_string.h \
 
248
   include/my_sys.h \
 
249
   include/my_xml.h \
 
250
   include/mysql_embed.h \
 
251
   include/my_pthread.h \
 
252
   include/my_no_pthread.h \
 
253
   include/decimal.h \
 
254
   include/errmsg.h \
 
255
   include/my_global.h \
 
256
   include/my_net.h \
 
257
   include/my_getopt.h \
 
258
   include/sslopt-longopts.h \
 
259
   include/my_dir.h \
 
260
   include/sslopt-vars.h \
 
261
   include/sslopt-case.h \
 
262
   include/sql_common.h \
 
263
   include/keycache.h \
 
264
   include/m_ctype.h \
 
265
   include/my_attribute.h \
 
266
   include/mysqld_error.h \
 
267
   include/sql_state.h \
 
268
   include/mysqld_ername.h \
 
269
   include/mysql_version.h \
 
270
   include/config-win.h \
 
271
   libmysql/libmysql.def \
 
272
   $DESTDIR/include/
 
273
 
 
274
mkdir -p $DESTDIR/include/mysql
 
275
cp include/mysql/plugin.h $DESTDIR/include/mysql/
 
276
 
 
277
# ----------------------------------------------------------------------
 
278
# Client libraries, and other libraries
 
279
# ----------------------------------------------------------------------
 
280
 
 
281
mkdir -p $DESTDIR/lib/opt
 
282
mkdir -p $DESTDIR/lib/plugin
 
283
cp sql/$TARGET/mysqld.lib $DESTDIR/lib/
 
284
cp libmysql/$TARGET/libmysql.dll \
 
285
   libmysql/$TARGET/libmysql.lib \
 
286
   libmysql/$TARGET/mysqlclient.lib \
 
287
   mysys/$TARGET/mysys.lib \
 
288
   regex/$TARGET/regex.lib \
 
289
   strings/$TARGET/strings.lib \
 
290
   zlib/$TARGET/zlib.lib $DESTDIR/lib/opt/
 
291
if [ -d storage/innodb_plugin ]; then
 
292
  cp storage/innodb_plugin/$TARGET/ha_innodb_plugin.dll \
 
293
     $DESTDIR/lib/plugin/
 
294
fi
 
295
 
 
296
if [ x"$TARGET" != x"release" ] ; then
 
297
  cp libmysql/$TARGET/libmysql.pdb \
 
298
     libmysql/$TARGET/mysqlclient.pdb \
 
299
     mysys/$TARGET/mysys.pdb \
 
300
     regex/$TARGET/regex.pdb \
 
301
     strings/$TARGET/strings.pdb \
 
302
     zlib/$TARGET/zlib.pdb $DESTDIR/lib/opt/
 
303
  if [ -d storage/innodb_plugin ]; then
 
304
    cp storage/innodb_plugin/$TARGET/ha_innodb_plugin.pdb \
 
305
       $DESTDIR/lib/plugin/
 
306
  fi
 
307
fi
 
308
 
 
309
 
 
310
if [ x"$PACK_DEBUG" = x"" -a -f "libmysql/debug/libmysql.lib" -o \
 
311
     x"$PACK_DEBUG" = x"yes" ] ; then
 
312
  mkdir -p $DESTDIR/lib/debug
 
313
  mkdir -p $DESTDIR/lib/plugin/debug
 
314
  cp libmysql/debug/libmysql.dll \
 
315
     libmysql/debug/libmysql.lib \
 
316
     libmysql/debug/libmysql.pdb \
 
317
     libmysql/debug/mysqlclient.lib \
 
318
     libmysql/debug/mysqlclient.pdb \
 
319
     mysys/debug/mysys.lib \
 
320
     mysys/debug/mysys.pdb \
 
321
     regex/debug/regex.lib \
 
322
     regex/debug/regex.pdb \
 
323
     strings/debug/strings.lib \
 
324
     strings/debug/strings.pdb \
 
325
     zlib/debug/zlib.lib \
 
326
     zlib/debug/zlib.pdb $DESTDIR/lib/debug/
 
327
  if [ -d storage/innodb_plugin ]; then
 
328
    cp storage/innodb_plugin/debug/ha_innodb_plugin.dll \
 
329
       storage/innodb_plugin/debug/ha_innodb_plugin.lib \
 
330
       storage/innodb_plugin/debug/ha_innodb_plugin.pdb \
 
331
       $DESTDIR/lib/plugin/debug/
 
332
  fi
 
333
fi
 
334
 
 
335
# ----------------------------------------------------------------------
 
336
# Copy the test directory
 
337
# ----------------------------------------------------------------------
 
338
 
 
339
mkdir $DESTDIR/mysql-test
 
340
cp mysql-test/mysql-test-run.pl $DESTDIR/mysql-test/
 
341
cp mysql-test/mysql-stress-test.pl $DESTDIR/mysql-test/
 
342
cp mysql-test/README $DESTDIR/mysql-test/
 
343
cp -R mysql-test/{t,r,include,suite,std_data,lib,collections} $DESTDIR/mysql-test/
 
344
 
 
345
# Note that this will not copy "extra" if a soft link
 
346
if [ -d mysql-test/extra ] ; then
 
347
  mkdir $DESTDIR/mysql-test/extra
 
348
  cp -pR mysql-test/extra/* $DESTDIR/mysql-test/extra/
 
349
fi
 
350
 
 
351
# ----------------------------------------------------------------------
 
352
# Copy what could be usable in the "scripts" directory
 
353
# ----------------------------------------------------------------------
 
354
 
 
355
mysql_scripts="\
 
356
mysql_config.pl \
 
357
mysql_convert_table_format.pl \
 
358
mysql_install_db.pl \
 
359
mysql_secure_installation.pl \
 
360
mysqld_multi.pl \
 
361
mysqldumpslow.pl \
 
362
mysqlhotcopy.pl \
 
363
"
 
364
 
 
365
mkdir -p $DESTDIR/scripts
 
366
 
 
367
for i in $mysql_scripts
 
368
do
 
369
  cp scripts/$i $DESTDIR/scripts/$i
 
370
done
 
371
 
 
372
cp -pR sql/share $DESTDIR/
 
373
cp -pR sql-bench $DESTDIR/
 
374
rm -f $DESTDIR/sql-bench/*.sh $DESTDIR/sql-bench/Makefile*
 
375
 
 
376
# The SQL initialisation code is to be in "share"
 
377
cp scripts/*.sql $DESTDIR/share/
 
378
 
 
379
# ----------------------------------------------------------------------
 
380
# Clean up from possibly copied SCCS directories
 
381
# ----------------------------------------------------------------------
 
382
 
 
383
rm -rf `find $DISTDIR -type d -name SCCS -print`
 
384
 
 
385
# ----------------------------------------------------------------------
 
386
# Copy other files specified on command line DEST=SOURCE
 
387
# ----------------------------------------------------------------------
 
388
 
 
389
for arg do
 
390
  dst=`echo $arg | sed 's/=.*$//'`
 
391
  src=`echo $arg | sed 's/^.*=//'`
 
392
 
 
393
  if [ x"$dst" = x"" -o x"$src" = x"" ] ; then
 
394
    echo "Invalid specification of what to copy"
 
395
    usage
 
396
  fi
 
397
 
 
398
  mkdir -p `dirname $DESTDIR/$dst`
 
399
  cp -pR "$src" $DESTDIR/$dst
 
400
done
 
401
 
 
402
# ----------------------------------------------------------------------
 
403
# Finally create the ZIP archive
 
404
# ----------------------------------------------------------------------
 
405
 
 
406
rm -f $NOINST_NAME.zip
 
407
zip -r $NOINST_NAME.zip $DESTDIR
 
408
rm -Rf $DESTDIR