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