make_binary_distribution
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:10k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. #!/bin/sh
  2. # This is a script to create a TAR or ZIP binary distribution out of a
  3. # built source tree. The output file will be put at the top level of
  4. # the source tree, as "mysql-<vsn>....{tar.gz,zip}"
  5. #
  6. # The temporary directory path given to "--tmp=<path>" has to be
  7. # absolute and with no spaces.
  8. machine=i686
  9. system=pc-linux-gnu
  10. version=4.1.16
  11. SOURCE=`pwd`
  12. CP="cp -p"
  13. MV="mv"
  14. STRIP=1
  15. DEBUG=0
  16. SILENT=0
  17. MACHINE=""
  18. PLATFORM=""
  19. TMP=/tmp
  20. SUFFIX=""
  21. NDBCLUSTER=""
  22. for arg do
  23.   case "$arg" in
  24.     --debug)    DEBUG=1;;
  25.     --tmp=*)    TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
  26.     --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
  27.     --no-strip) STRIP=0 ;;
  28.     --machine=*) MACHINE=`echo "$arg" | sed -e "s;--machine=;;"` ;;
  29.     --platform=*) PLATFORM=`echo "$arg" | sed -e "s;--platform=;;"` ;;
  30.     --silent)   SILENT=1 ;;
  31.     --with-ndbcluster) NDBCLUSTER=1 ;;
  32.     *)
  33.       echo "Unknown argument '$arg'"
  34.       exit 1
  35.       ;;
  36.   esac
  37. done
  38. if [ x"$MACHINE" != x"" ] ; then
  39.   machine=$MACHINE
  40. fi
  41. if [ x"$PLATFORM" != x"" ] ; then
  42.   platform="$PLATFORM"
  43. else
  44.   platform="$system-$machine"
  45. fi
  46. # FIXME This should really be integrated with automake and not duplicate the
  47. # installation list.
  48. BASE=$TMP/my_dist$SUFFIX
  49. if [ -d $BASE ] ; then
  50.  rm -rf $BASE
  51. fi
  52. BS=""
  53. BIN_FILES=""
  54. BASE_SYSTEM="any"
  55. MYSQL_SHARE=$BASE/share/mysql
  56. case $system in
  57.   *netware*)
  58.     BASE_SYSTEM="netware"
  59.     BS=".nlm"
  60.     MYSQL_SHARE=$BASE/share
  61.     ;;
  62. esac
  63. mkdir $BASE $BASE/bin $BASE/docs 
  64.  $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts 
  65.  $BASE/mysql-test $BASE/mysql-test/t  $BASE/mysql-test/r 
  66.  $BASE/mysql-test/include $BASE/mysql-test/std_data $BASE/mysql-test/lib
  67. if [ $BASE_SYSTEM != "netware" ] ; then
  68.  mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man 
  69.   $BASE/man/man1 $BASE/data $BASE/data/mysql $BASE/data/test
  70.  chmod o-rwx $BASE/data $BASE/data/*
  71. fi
  72. # Copy files if they exists, warn for those that don't
  73. copyfileto()
  74. {
  75.   destdir=$1
  76.   shift
  77.   for i
  78.   do
  79.     if [ -f $i ] ; then
  80.       $CP $i $destdir
  81.     elif [ -d $i ] ; then
  82.       echo "Warning: Will not copy directory "$i""
  83.     else
  84.       echo "Warning: Listed file not found   "$i""
  85.     fi
  86.   done
  87. }
  88. copyfileto $BASE/docs ChangeLog Docs/mysql.info
  89. copyfileto $BASE COPYING COPYING.LIB README Docs/INSTALL-BINARY 
  90.          EXCEPTIONS-CLIENT MySQLEULA.txt LICENSE.doc README.NW
  91. # Non platform-specific bin dir files:
  92. BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS 
  93.   extra/resolveip$BS extra/my_print_defaults$BS 
  94.   extra/resolve_stack_dump$BS extra/mysql_waitpid$BS 
  95.   isam/isamchk$BS isam/pack_isam$BS 
  96.   myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS 
  97.   myisam/myisam_ftdump$BS 
  98.   sql/mysqld$BS sql/mysql_tzinfo_to_sql$BS 
  99.   client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS 
  100.   client/mysqldump$BS client/mysqlimport$BS 
  101.   client/mysqltest$BS client/mysqlcheck$BS 
  102.   client/mysqlbinlog$BS 
  103.   tests/mysql_client_test$BS 
  104.   libmysqld/examples/mysql_client_test_embedded$BS 
  105.   libmysqld/examples/mysqltest_embedded$BS 
  106.   ";
  107. # Platform-specific bin dir files:
  108. if [ $BASE_SYSTEM = "netware" ] ; then
  109.   BIN_FILES="$BIN_FILES 
  110.     netware/mysqld_safe$BS netware/mysql_install_db$BS 
  111.     netware/init_db.sql netware/test_db.sql netware/mysql_explain_log$BS 
  112.     netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql
  113.     ";
  114. else
  115.   # For all other platforms:
  116.   BIN_FILES="$BIN_FILES 
  117.     client/mysqlmanagerc 
  118.     client/mysqlmanager-pwgen tools/mysqlmanager 
  119.     client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin 
  120.     client/.libs/mysqldump client/.libs/mysqlimport 
  121.     client/.libs/mysqltest client/.libs/mysqlcheck 
  122.     client/.libs/mysqlbinlog client/.libs/mysqlmanagerc 
  123.     client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager 
  124.     tests/.libs/mysql_client_test 
  125.     libmysqld/examples/.libs/mysql_client_test_embedded 
  126.     libmysqld/examples/.libs/mysqltest_embedded 
  127.   ";
  128. fi
  129. copyfileto $BASE/bin $BIN_FILES
  130. if [ x$STRIP = x1 ] ; then
  131.   strip $BASE/bin/*
  132. fi
  133. # Copy not binary files
  134. copyfileto $BASE/bin sql/mysqld.sym.gz
  135. if [ $BASE_SYSTEM = "netware" ] ; then
  136.     $CP netware/*.pl $BASE/scripts
  137.     $CP scripts/mysqlhotcopy $BASE/scripts/mysqlhotcopy.pl
  138. fi
  139. copyfileto $BASE/lib 
  140.   libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* 
  141.   libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a 
  142.   libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* 
  143.   mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a 
  144.   libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* 
  145.   libmysqld/libmysqld.a netware/libmysql.imp 
  146.   zlib/.libs/libz.a
  147. # convert the .a to .lib for NetWare
  148. if [ $BASE_SYSTEM = "netware" ] ; then
  149.     for i in $BASE/lib/*.a
  150.     do
  151.       libname=`basename $i .a`
  152.       $MV $i $BASE/lib/$libname.lib
  153.     done
  154. fi
  155. copyfileto $BASE/include config.h include/*
  156. rm -f $BASE/include/Makefile* $BASE/include/*.in $BASE/include/config-win.h
  157. if [ $BASE_SYSTEM != "netware" ] ; then
  158.   rm -f $BASE/include/config-netware.h
  159. fi
  160. if [ $BASE_SYSTEM != "netware" ] ; then
  161.   if [ -d tests ] ; then
  162.     $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
  163.   fi
  164.   if [ -d man ] ; then
  165.     $CP man/*.1 $BASE/man/man1
  166.   fi
  167. fi
  168. copyfileto $BASE/support-files support-files/*
  169. copyfileto $BASE/share scripts/*.sql
  170. $CP -r sql/share/* $MYSQL_SHARE
  171. rm -f $MYSQL_SHARE/Makefile* $MYSQL_SHARE/*/*.OLD
  172. copyfileto $BASE/mysql-test 
  173.          mysql-test/mysql-test-run mysql-test/install_test_db 
  174.          mysql-test/mysql-test-run.pl mysql-test/README 
  175.  mysql-test/valgrind.supp 
  176.          netware/mysql_test_run.nlm netware/install_test_db.ncf
  177. $CP mysql-test/lib/*.pl  $BASE/mysql-test/lib
  178. $CP mysql-test/lib/*.sql $BASE/mysql-test/lib
  179. $CP mysql-test/t/*.def $BASE/mysql-test/t
  180. $CP mysql-test/include/*.inc $BASE/mysql-test/include
  181. $CP mysql-test/std_data/*.dat mysql-test/std_data/*.*001 
  182.     $BASE/mysql-test/std_data
  183. $CP mysql-test/std_data/des_key_file $BASE/mysql-test/std_data
  184. $CP mysql-test/t/*test mysql-test/t/*.opt mysql-test/t/*.slave-mi 
  185.     mysql-test/t/*.sh $BASE/mysql-test/t
  186. $CP mysql-test/r/*result mysql-test/r/*.require $BASE/mysql-test/r
  187. if [ $BASE_SYSTEM != "netware" ] ; then
  188.   chmod a+x $BASE/bin/*
  189.   copyfileto $BASE/bin scripts/*
  190.   $BASE/bin/replace @localstatedir@ ./data @bindir@ ./bin @scriptdir@ 
  191.       ./bin @libexecdir@ ./bin @sbindir@ ./bin @prefix@ . @HOSTNAME@ 
  192.       /bin/hostname @pkgdatadir@ ./support-files 
  193.       < scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
  194.   $BASE/bin/replace @prefix@ /usr/local/mysql @bindir@ ./bin 
  195.       @MYSQLD_USER@ root @localstatedir@ /usr/local/mysql/data 
  196.       @HOSTNAME@ /bin/hostname 
  197.       < support-files/mysql.server.sh > $BASE/support-files/mysql.server
  198.   $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/mysqld_safe
  199.   mv $BASE/support-files/binary-configure $BASE/configure
  200.   chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* 
  201.       $BASE/support-files/mysql.server $BASE/configure
  202.   $CP -r sql-bench/* $BASE/sql-bench
  203.   rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
  204.   rm -f $BASE/bin/*.sql
  205. fi
  206. rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh 
  207.     $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution 
  208.     $BASE/bin/setsomevars $BASE/support-files/Makefile* 
  209.     $BASE/support-files/*.sh
  210. #
  211. # Copy system dependent files
  212. #
  213. if [ $BASE_SYSTEM = "netware" ] ; then
  214.   echo "CREATE DATABASE mysql;" > $BASE/bin/init_db.sql
  215.   echo "CREATE DATABASE test;" >> $BASE/bin/init_db.sql
  216.   sh ./scripts/mysql_create_system_tables.sh real "" "%" 0 
  217.       >> $BASE/bin/init_db.sql
  218.   sh ./scripts/mysql_create_system_tables.sh test "" "%" 0 
  219.       > $BASE/bin/test_db.sql
  220.   ./scripts/fill_help_tables < ./Docs/manual.texi >> ./netware/init_db.sql
  221. fi
  222. #
  223. # Remove system dependent files
  224. #
  225. if [ $BASE_SYSTEM = "netware" ] ; then
  226.   rm -f $BASE/support-files/magic 
  227.         $BASE/support-files/mysql.server 
  228.         $BASE/support-files/mysql*.spec 
  229.         $BASE/support-files/mysql-log-rotate 
  230.         $BASE/support-files/binary-configure 
  231.         $BASE/INSTALL-BINARY 
  232.         $BASE/MySQLEULA.txt
  233. else
  234.     rm -f $BASE/README.NW
  235. fi
  236. # Make safe_mysqld a symlink to mysqld_safe for backwards portability
  237. # To be removed in MySQL 4.1
  238. (cd $BASE/bin ; ln -s mysqld_safe safe_mysqld )
  239. # Clean up if we did this from a bk tree
  240. if [ -d $BASE/sql-bench/SCCS ] ; then
  241.   find $BASE/share -name SCCS -print | xargs rm -rf
  242.   find $BASE/sql-bench -name SCCS -print | xargs rm -rf
  243. fi
  244. # NDB Cluster
  245. if [ x$NDBCLUSTER = x1 ]; then
  246.   ( cd ndb            ; make DESTDIR=$BASE/ndb-stage install )
  247.   ( cd mysql-test/ndb ; make DESTDIR=$BASE/ndb-stage install )
  248.   $CP $BASE/ndb-stage/usr/local/bin/* $BASE/bin/.
  249.   $CP $BASE/ndb-stage/usr/local/libexec/* $BASE/bin/.
  250.   $CP $BASE/ndb-stage/usr/local/lib/mysql/* $BASE/lib/.
  251.   $CP -r $BASE/ndb-stage/usr/local/include/mysql/ndb $BASE/include
  252.   $CP -r $BASE/ndb-stage/usr/local/mysql-test/ndb $BASE/mysql-test/. || exit 1
  253.   rm -rf $BASE/ndb-stage
  254. fi
  255. # Change the distribution to a long descriptive name
  256. NEW_NAME=mysql-$version-$platform$SUFFIX
  257. # Print the platform name for build logs
  258. echo "PLATFORM NAME: $platform"
  259. BASE2=$TMP/$NEW_NAME
  260. rm -rf $BASE2
  261. mv $BASE $BASE2
  262. BASE=$BASE2
  263. #
  264. # If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a
  265. #
  266. if [ x"yes" = x"yes" ] ; then
  267.   gcclib=`ccache gcc --print-libgcc-file`
  268.   if [ $? -ne 0 ] ; then
  269.     print "Warning: Couldn't find libgcc.a!"
  270.   else
  271.     $CP $gcclib $BASE/lib/libmygcc.a
  272.   fi
  273. fi
  274. #if we are debugging, do not do tar/gz
  275. if [ x$DEBUG = x1 ] ; then
  276.  exit
  277. fi
  278. # This is needed to prefere gnu tar instead of tar because tar can't
  279. # always handle long filenames
  280. PATH_DIRS=`echo $PATH | 
  281.     sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
  282. which_1 ()
  283. {
  284.   for cmd
  285.   do
  286.     for d in $PATH_DIRS
  287.     do
  288.       for file in $d/$cmd
  289.       do
  290. if [ -x $file -a ! -d $file ] ; then
  291.   echo $file
  292.   exit 0
  293. fi
  294.       done
  295.     done
  296.   done
  297.   exit 1
  298. }
  299. if [ $BASE_SYSTEM != "netware" ] ; then
  300.   #
  301.   # Create the result tar file
  302.   #
  303.   tar=`which_1 gnutar gtar`
  304.   if [ "$?" = "1" -o x"$tar" = x"" ] ; then
  305.     tar=tar
  306.   fi
  307.   echo "Using $tar to create archive"
  308.   OPT=cvf
  309.   if [ x$SILENT = x1 ] ; then
  310.     OPT=cf
  311.   fi
  312.   echo "Creating and compressing archive"
  313.   rm -f $NEW_NAME.tar.gz
  314.   (cd $TMP ; $tar $OPT -  $NEW_NAME) | gzip -9 > $NEW_NAME.tar.gz
  315.   echo "$NEW_NAME.tar.gz created"
  316. else
  317.   #
  318.   # Create a zip file for NetWare users
  319.   #
  320.   rm -f $NEW_NAME.zip
  321.   (cd $TMP; zip -r "$SOURCE/$NEW_NAME.zip" $NEW_NAME)
  322.   echo "$NEW_NAME.zip created"
  323. fi
  324. echo "Removing temporary directory"
  325. rm -rf $BASE