home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / MySql / scripts / make_binary_distribution next >
Encoding:
Text File  |  2001-01-01  |  5.1 KB  |  200 lines

  1. #!/bin/sh
  2. # The default path should be /usr/local
  3.  
  4. # Get some info from configure
  5. # chmod +x ./scripts/setsomevars
  6.  
  7. machine=m68k
  8. system=cbm-amigaos
  9. version=3.23.37
  10. export machine system version
  11. SOURCE=`pwd` 
  12. CP="cp -p"
  13.  
  14. # Debug option must come first
  15. DEBUG=0
  16. if test x$1 = x"--debug"
  17. then
  18.   DEBUG=1
  19.   shift 1
  20. fi  
  21.  
  22. # Save temporary distribution here (must be full path) 
  23. TMP=/tmp
  24. if test $# -gt 0
  25. then
  26.   TMP=$1
  27.   shift 1
  28. fi
  29.  
  30. # Get optional suffix for distribution
  31. SUFFIX=""
  32. if test $# -gt 0
  33. then
  34.   SUFFIX=$1
  35.   shift 1
  36. fi
  37.  
  38.  
  39. #make
  40.  
  41. # This should really be integrated with automake and not duplicate the
  42. # installation list.
  43.  
  44. BASE=$TMP/my_dist$SUFFIX
  45.  
  46. if [ -d $BASE ] ; then
  47.  rm -r -f $BASE
  48. fi
  49.  
  50. mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \
  51.  $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/share/mysql \
  52.  $BASE/tests $BASE/scripts $BASE/sql-bench $BASE/mysql-test \
  53.  $BASE/mysql-test/t  $BASE/mysql-test/r \
  54.  $BASE/mysql-test/include $BASE/mysql-test/std_data
  55.  
  56. chmod o-rwx $BASE/data $BASE/data/*
  57.  
  58. for i in sql/ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \
  59.          Docs/manual.html Docs/manual.txt Docs/manual_toc.html
  60. do
  61.   $CP $i $BASE
  62. done
  63.  
  64. for i in extra/comp_err extra/replace extra/perror extra/resolveip \
  65.   extra/my_print_defaults isam/isamchk isam/pack_isam myisam/myisamchk \
  66.   myisam/myisampack sql/mysqld sql/mysqlbinlog \
  67.   client/mysql sql/mysqld client/mysqlshow \
  68.   client/mysqladmin client/mysqldump client/mysqlimport client/mysqltest \
  69.   client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \
  70.   client/.libs/mysqldump client/.libs/mysqlimport client/.libs/mysqltest
  71. do
  72.   if [ -f $i ]
  73.   then
  74.     $CP $i $BASE/bin
  75.   fi
  76. done
  77. strip $BASE/bin/*
  78.  
  79. for i in sql/mysqld.sym.gz
  80. do
  81.   if [ -f $i ]
  82.   then
  83.     $CP $i $BASE/bin
  84.   fi
  85. done
  86.  
  87. for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a $BASE/lib
  88. do
  89.   if [ -f $i ]
  90.   then
  91.     $CP $i $BASE/lib
  92.    fi
  93. done
  94.  
  95. $CP config.h include/* $BASE/include
  96. rm $BASE/include/Makefile*; rm $BASE/include/*.in
  97.  
  98. $CP tests/*.res tests/*.tst tests/*.pl $BASE/tests
  99. $CP support-files/* $BASE/support-files
  100.  
  101. $CP -r sql/share/* $BASE/share/mysql
  102. rm -f $BASE/share/mysql/Makefile* $BASE/share/mysql/*/*.OLD
  103.  
  104. $CP mysql-test/mysql-test-run mysql-test/install_test_db $BASE/mysql-test/
  105. $CP mysql-test/README $BASE/mysql-test/README
  106. $CP mysql-test/include/*.inc $BASE/mysql-test/include
  107. $CP mysql-test/std_data/*.dat $BASE/mysql-test/std_data
  108. $CP mysql-test/t/*.test mysql-test/t/*.opt $BASE/mysql-test/t
  109. $CP mysql-test/r/*.result mysql-test/r/*.require $BASE/mysql-test/r
  110.  
  111. $CP scripts/* $BASE/bin
  112. rm -f $BASE/bin/Makefile* $BASE/bin/*.in $BASE/bin/*.sh $BASE/bin/mysql_install_db $BASE/bin/make_binary_distribution $BASE/bin/setsomevars $BASE/support-files/Makefile* $BASE/support-files/*.sh
  113.  
  114. $BASE/bin/replace \@localstatedir\@ ./data \@bindir\@ ./bin \@scriptdir\@ ./bin \@libexecdir\@ ./bin \@sbindir\@ ./bin \@prefix\@ . \@HOSTNAME\@ /bin/hostname < $SOURCE/scripts/mysql_install_db.sh > $BASE/scripts/mysql_install_db
  115. $BASE/bin/replace \@prefix\@ /usr/local/mysql \@bindir\@ ./bin \@MYSQLD_USER\@ root \@localstatedir\@ /usr/local/mysql/data < $SOURCE/support-files/mysql.server.sh > $BASE/support-files/mysql.server
  116. $BASE/bin/replace /my/gnu/bin/hostname /bin/hostname -- $BASE/bin/safe_mysqld
  117.  
  118. mv $BASE/support-files/binary-configure $BASE/configure
  119. chmod a+x $BASE/bin/* $BASE/scripts/* $BASE/support-files/mysql-* $BASE/configure
  120. $CP -r sql-bench/* $BASE/sql-bench
  121. rm -f $BASE/sql-bench/*.sh $BASE/sql-bench/Makefile* $BASE/lib/*.la
  122.  
  123. # Clean up if we did this from a bk tree
  124. if [ -d $BASE/sql-bench/SCCS ] ; then 
  125.   find $BASE/share -name SCCS -print | xargs rm -r -f
  126.   find $BASE/sql-bench -name SCCS -print | xargs rm -r -f
  127. fi
  128.  
  129. # Change the distribution to a long descriptive name
  130. NEW_NAME=mysql-$version-$system-$machine$SUFFIX
  131. BASE2=$TMP/$NEW_NAME
  132. rm -r -f $BASE2
  133. mv $BASE $BASE2
  134. BASE=$BASE2
  135. #
  136. # If we are compiling with gcc, copy libgcc.a to the distribution as libmygcc.a
  137. #
  138.  
  139. if test "yes" = "yes"
  140. then
  141.   cd $BASE/lib
  142.   gcclib=`gcc --print-libgcc-file`
  143.   if test $? -ne 0
  144.   then
  145.     print "Warning: Couldn't find libgcc.a!"
  146.   else
  147.     $CP $gcclib libmygcc.a
  148.   fi
  149.   cd $SOURCE
  150. fi
  151.  
  152. #if we are debugging, do not do tar/gz
  153. if [ x$DEBUG = x1 ] ; then
  154.  exit
  155. fi
  156.  
  157. # This is needed to prefere gnu tar instead of tar because tar can't
  158. # always handle long filenames
  159.  
  160. PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
  161. which_1 ()
  162. {
  163.   for cmd
  164.   do
  165.     for d in $PATH_DIRS
  166.     do
  167.       for file in $d/$cmd
  168.       do
  169.     if test -x $file -a ! -d $file
  170.     then
  171.       echo $file
  172.       exit 0
  173.     fi
  174.       done
  175.     done
  176.   done
  177.   exit 1
  178. }
  179.  
  180. #
  181. # Create the result tar file
  182. #
  183.  
  184. tar=`which_1 gtar`
  185. if test "$?" = "1" -o "$tar" = ""
  186. then
  187.   tar=tar
  188. fi
  189.  
  190. echo "Using $tar to create archive"
  191. cd $TMP
  192. $tar cvf $SOURCE/$NEW_NAME.tar $NEW_NAME
  193. cd $SOURCE
  194. echo "Compressing archive"
  195. gzip -9 $NEW_NAME.tar
  196. echo "Removing temporary directory"
  197. rm -r -f $BASE
  198.  
  199. echo "$NEW_NAME.tar.gz created"
  200.