1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
#!/bin/sh
# The default path should be /usr/local
# Get some info from configure
# chmod +x ./scripts/setsomevars
machine=@MACHINE_TYPE@
system=@SYSTEM_TYPE@
version=@VERSION@
export machine system version
SOURCE=`pwd`
CP="cp -p"
RM=rm
MV=mv
CHMOD=chmod
SED=sed
DEBUG=0
TMP=/tmp
SILENT=0
# This script must run from MyODBC top directory
if ! test -f driver/myodbc3.c
then
echo "ERROR : You must run this script from the MyODBC top-level directory"
exit 1
fi
parse_arguments() {
for arg do
case "$arg" in
--debug) DEBUG=1;;
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
--silent) SILENT=1 ;;
*)
echo "Unknown argument '$arg'"
exit 1
;;
esac
done
}
parse_arguments "$@"
# This should really be integrated with automake and not duplicate the
# installation list.
BASE=$TMP/mysql-connector-odbc-3.51
if [ -d $BASE ] ; then
rm -r -f $BASE
fi
mkdir $BASE
for i in ChangeLog COPYING EXCEPTIONS README odbc.ini
do
if [ -f $i ]
then
$CP $i $BASE
fi
done
for i in driver/.libs/*
do
if [ -f $i ]
then
$CP $i $BASE
fi
done
# for i in driver_r/.libs/*
# do
# if [ -f $i ]
# then
# $CP $i $BASE
# fi
# done
if test -f $BASE/libmyodbc3-$version.so
then
$RM -f $BASE/libmyodbc3.so
cd $BASE
ln -s libmyodbc3-$version.so libmyodbc3.so
cd $SOURCE
fi
if test -f $BASE/libmyodbc3_r-$version.so
then
$RM -f $BASE/libmyodbc3_r.so
cd $BASE
ln -s libmyodbc3_r-$version.so libmyodbc3_r.so
cd $SOURCE
fi
# Change the distribution to a long descriptive name
NEW_NAME=mysql-connector-odbc-$version-$system-$machine
BASE2=$TMP/$NEW_NAME
$RM -r -f $BASE2
$MV $BASE $BASE2
BASE=$BASE2
#if we are debugging, do not do tar/gz
if [ x$DEBUG = x1 ] ; then
echo "Debug mode, no archiving, check the files from $BASE"
echo "`ls -al $BASE`"
echo "exiting..."
exit
fi
# This is needed to prefere gnu tar instead of tar because tar can't
# always handle long filenames
PATH_DIRS=`echo $PATH | $SED -e 's/^:/. /' -e 's/:$/ ./' -e 's/::/ . /g' -e 's/:/ /g' `
which_1 ()
{
for cmd
do
for d in $PATH_DIRS
do
for file in $d/$cmd
do
if test -x $file -a ! -d $file
then
echo $file
exit 0
fi
done
done
done
exit 1
}
#
# Create the result tar file
#
tar=`which_1 gtar`
if test "$?" = "1" -o "$tar" = ""
then
tar=tar
fi
echo "Using $tar to create archive"
cd $TMP
OPT=cvf
if [ x$SILENT = x1 ] ; then
OPT=cf
fi
if test -f $SOURCE/$NEW_NAME.tar.gz
then
echo "Cleaning the old file..."
$RM -f $SOURCE/$NEW_NAME.tar.gz
fi
$tar $OPT $SOURCE/$NEW_NAME.tar $NEW_NAME
cd $SOURCE
echo "Compressing archive"
gzip -9 $NEW_NAME.tar
echo "Removing temporary directory"
rm -r -f $BASE
echo "$NEW_NAME.tar.gz created"
|