You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
2.7 KiB

  1. #!/bin/sh
  2. # Copyright (C) 2003-2004, 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. # The default path should be /usr/local
  17. # Get some info from configure
  18. # chmod +x ./scripts/setsomevars
  19. machine=@MACHINE_TYPE@
  20. system=@SYSTEM_TYPE@
  21. version=@VERSION@
  22. export machine system version
  23. SOURCE=`pwd`
  24. CP="cp -p"
  25. MV="mv"
  26. STRIP=1
  27. DEBUG=0
  28. SILENT=0
  29. TMP=/tmp
  30. SUFFIX=""
  31. parse_arguments() {
  32. for arg do
  33. case "$arg" in
  34. --debug) DEBUG=1;;
  35. --tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
  36. --suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
  37. --no-strip) STRIP=0 ;;
  38. --silent) SILENT=1 ;;
  39. *)
  40. echo "Unknown argument '$arg'"
  41. exit 1
  42. ;;
  43. esac
  44. done
  45. }
  46. parse_arguments "$@"
  47. BASE=$TMP/my_dist$SUFFIX
  48. if [ -d $BASE ] ; then
  49. rm -r -f $BASE
  50. fi
  51. mkdir -p $BASE/lib
  52. for i in \
  53. libmysql/.libs/libmysqlclient.so* \
  54. libmysql/.libs/libmysqlclient.sl* \
  55. libmysql/.libs/libmysqlclient*.dylib \
  56. libmysql_r/.libs/libmysqlclient_r.so* \
  57. libmysql_r/.libs/libmysqlclient_r.sl* \
  58. libmysql_r/.libs/libmysqlclient_r*.dylib
  59. do
  60. if [ -f $i ]
  61. then
  62. $CP $i $BASE/lib
  63. fi
  64. done
  65. # Change the distribution to a long descriptive name
  66. NEW_NAME=mysql-shared-$version-$system-$machine$SUFFIX
  67. BASE2=$TMP/$NEW_NAME
  68. rm -r -f $BASE2
  69. mv $BASE $BASE2
  70. BASE=$BASE2
  71. #if we are debugging, do not do tar/gz
  72. if [ x$DEBUG = x1 ] ; then
  73. exit
  74. fi
  75. # This is needed to prefer GNU tar instead of tar because tar can't
  76. # always handle long filenames
  77. PATH_DIRS=`echo $PATH | sed -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
  78. which_1 ()
  79. {
  80. for cmd
  81. do
  82. for d in $PATH_DIRS
  83. do
  84. for file in $d/$cmd
  85. do
  86. if test -x $file -a ! -d $file
  87. then
  88. echo $file
  89. exit 0
  90. fi
  91. done
  92. done
  93. done
  94. exit 1
  95. }
  96. #
  97. # Create the result tar file
  98. #
  99. tar=`which_1 gnutar gtar`
  100. if test "$?" = "1" -o "$tar" = ""
  101. then
  102. tar=tar
  103. fi
  104. echo "Using $tar to create archive"
  105. cd $TMP
  106. OPT=cvf
  107. if [ x$SILENT = x1 ] ; then
  108. OPT=cf
  109. fi
  110. $tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
  111. cd $SOURCE
  112. echo "Compressing archive"
  113. gzip -9 $NEW_NAME.tar
  114. echo "Removing temporary directory"
  115. rm -r -f $BASE
  116. echo "$NEW_NAME.tar.gz created"