Commit 64f0e428 authored by venu@myvenu.com's avatar venu@myvenu.com

Fix for the windows src distribution script - SCRUM:

  -- To take care of .zip and .tar
  -- Initialization of 'data' directory without any host dependancy data
  -- Incorporate all changes from Monty
parent b381cb04
......@@ -15,18 +15,39 @@ TMP=/tmp
SUFFIX=""
OUTTAR=0
SRCDIR=$SOURCE
DSTDIR=$TMP
#
# This script must run from MySQL top directory
#
if [ ! -f scripts/make_win_src_distribution.sh ]; then
if [ ! -f scripts/make_win_src_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1
fi
#
# Check for source compilation/configuration
#
if [ ! -f sql/sql_yacc.cc ]; then
echo "ERROR : Sorry, you must run this script after the complete build,"
echo " hope you know what you are trying to do !!"
exit 1
fi
#
# Assign the tmp directory if it was set from the environment variables
#
for i in $TMPDIR $TEMPDIR $TEMP
do
if [ $i ]; then
TMP=$i
break
fi
done
#
# Usage of the script
#
......@@ -42,7 +63,7 @@ show_usage() {
echo " --tar Create a tar.gz package instead of .zip"
echo " --help Show this help message"
exit 1
exit 0
}
#
......@@ -68,20 +89,6 @@ parse_arguments() {
parse_arguments "$@"
#
# Currently return an error if --tar is not used
#
if [ x$OUTTAR = x0 ] && [ x$DEBUG = x0 ]
then
echo "ERROR: The default .zip doesn't yet work on Windows, as it can't load"
echo " the workspace files due to LF->CR+LF issues, instead use --tar"
echo " to create a .tar.gz package "
echo ""
show_usage;
exit 1
fi
#
# Create a tmp dest directory to copy files
#
......@@ -89,24 +96,36 @@ fi
BASE=$TMP/my_win_dist$SUFFIX
if [ -d $BASE ] ; then
if [ x$DEBUG = x1 ]; then
echo "Destination directory '$BASE' already exists, deleting it"
fi
rm -r -f $BASE
fi
$CP -r $SOURCE/VC++Files $BASE
(
find $BASE -name *.dsw -and -not -path \*SCCS\* -print
find $BASE -name *.dsp -and -not -path \*SCCS\* -print
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
)|(
while read v
do
sed 's/$'"/`echo -e \\\r`/" $v > $v.tmp
if [ x$DEBUG = x1 ]; then
echo "Replacing LF -> CRLF from '$v'"
fi
# ^M -> type CTRL V + CTRL M
cat $v | sed 's/ //' | sed 's/$/ /' > $v.tmp
rm $v
mv $v.tmp $v
# awk '!/r\r$/ {print $0"\r"} /r\r$/ {print $0}' $v > $v
done
)
# move all error message files to root directory
#
# Move all error message files to root directory
#
$CP -r $SOURCE/sql/share $BASE/
#
......@@ -119,7 +138,6 @@ then
rm -rf "$BASE/InstallShield/Script Files/SCCS"
fi
mkdir $BASE/Docs $BASE/extra $BASE/include
......@@ -130,32 +148,26 @@ mkdir $BASE/Docs $BASE/extra $BASE/include
copy_dir_files() {
for arg do
if [ x$DEBUG = x1 ]; then
echo "Copying files from directory '$arg'"
fi
cd $SOURCE/$arg/
(
ls -A1|grep \\.[ch]$
ls -A1|grep \\.ih$
ls -A1|grep \\.i$
ls -A1|grep \\.ic$
ls -A1|grep \\.asm$
ls -A1|grep README
ls -A1|grep INSTALL
ls -A1|grep LICENSE
)|(
while read v
for i in *.c *.h *.ih *.i *.ic *.asm \
README INSTALL* LICENSE
do
$CP $SOURCE/$arg/$v $BASE/$arg/$v
if [ -f $i ]
then
$CP $SOURCE/$arg/$i $BASE/$arg/$i
fi
done
)
cd $SOURCE/$arg/
(
ls -A1|grep \\.cc$|sed 's/.cc$//g')|(
while read v
for i in *.cc
do
$CP $SOURCE/$arg/$v.cc $BASE/$arg/$v.cpp
if [ -f $i ]
then
i=`echo $i | sed 's/.cc$//g'`
$CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
fi
done
)
done
}
......@@ -172,24 +184,18 @@ copy_dir_dirs() {
if [ ! -d $BASE/$arg ]; then
mkdir $BASE/$arg
fi
copy_dir_files $arg
cd $SOURCE/$arg/
(
ls -l |grep "^d"|awk '{print($9)}' -
)|(
while read dir_name
for i in *
do
if [ x$dir_name != x"SCCS" ]
then
if [ ! -d $BASE/$basedir/$dir_name ]; then
mkdir $BASE/$basedir/$dir_name
if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then
if [ ! -d $BASE/$basedir/$i ]; then
mkdir $BASE/$basedir/$i
fi
copy_dir_files $basedir/$dir_name
copy_dir_files $basedir/$i
fi
done
)
done
}
......@@ -197,49 +203,37 @@ copy_dir_dirs() {
# Input directories to be copied
#
copy_dir_files 'bdb'
copy_dir_files 'bdb/build_win32'
copy_dir_files 'client'
copy_dir_files 'dbug'
copy_dir_files 'extra'
copy_dir_files 'heap'
copy_dir_files 'include'
copy_dir_files 'innobase'
copy_dir_files 'isam'
copy_dir_files 'libmysql'
copy_dir_files 'libmysqld'
copy_dir_files 'merge'
copy_dir_files 'myisam'
copy_dir_files 'myisammrg'
copy_dir_files 'mysys'
copy_dir_files 'regex'
copy_dir_files 'sql'
copy_dir_files 'strings'
copy_dir_files 'vio'
copy_dir_files 'zlib'
for i in client dbug extra heap include isam \
libmysql libmysqld merge myisam \
myisammrg mysys regex sql strings \
vio zlib
do
copy_dir_files $i
done
#
# Input directories to be copied recursively
#
copy_dir_dirs 'bdb'
copy_dir_dirs 'innobase'
for i in bdb innobase
do
copy_dir_dirs $i
done
#
# Create dummy innobase configure header
#
# create dummy innobase configure header
if [ -f $BASE/innobase/ib_config.h ]
then
if [ -f $BASE/innobase/ib_config.h ]; then
rm -f $BASE/innobase/ib_config.h
touch $BASE/innobase/ib_config.h
fi
touch $BASE/innobase/ib_config.h
#
# Copy miscellaneous files
#
$CP $SOURCE/myisam/myisampack.c $BASE/myisampack/
$CP $SOURCE/client/mysqlbinlog.cc $BASE/mysqlbinlog/mysqlbinlog.cpp
$CP $SOURCE/isam/pack_isam.c $BASE/pack_isam/pack_isam.c
cd $SOURCE
for i in COPYING ChangeLog README \
INSTALL-SOURCE INSTALL-WIN \
......@@ -248,6 +242,9 @@ for i in COPYING ChangeLog README \
Docs/mysqld_error.txt Docs/INSTALL-BINARY
do
if [ x$DEBUG = x1 ]; then
echo "Copying file '$i'"
fi
if [ -f $i ]
then
$CP $i $BASE/$i
......@@ -255,9 +252,16 @@ do
done
#
# TODO: Initialize the initial data directory
# Initialize the initial data directory
#
if [ -f scripts/mysql_install_db ]; then
if [ x$DEBUG = x1 ]; then
echo "Initializing the 'data' directory"
fi
scripts/mysql_install_db -WINDOWS --datadir=$BASE/data
fi
#
# Specify the distribution package name and copy it
......@@ -305,10 +309,14 @@ which_1 ()
}
#
# Create the result zip file
# Create the result zip/tar file
#
if [ x$OUTTAR = x1 ]; then
set_tarzip_options()
{
for arg
do
if [ x$arg = x"tar" ]; then
ZIPFILE1=gnutar
ZIPFILE2=gtar
OPT=cvf
......@@ -317,24 +325,40 @@ if [ x$OUTTAR = x1 ]; then
if [ x$SILENT = x1 ] ; then
OPT=cf
fi
else
else
ZIPFILE1=zip
ZIPFILE2=""
OPT="-lvr"
OPT="-vr"
EXT=".zip"
NEED_COMPRESS=0
if [ x$SILENT = x1 ] ; then
OPT="-lr"
OPT="-r"
fi
fi
done
}
if [ x$OUTTAR = x1 ]; then
set_tarzip_options 'tar'
else
set_tarzip_options 'zip'
fi
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
if test "$?" = "1" -o "$tar" = ""
then
tar=tar
set_tarzip_options 'tar'
fi
#
# Create the archive
#
if [ xDEBUG = x1 ]; then
echo "Using $tar to create archive"
fi
echo "Using $tar to create archive"
cd $TMP
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_NAME
......@@ -342,19 +366,21 @@ cd $SOURCE
if [ x$NEED_COMPRESS = x1 ]
then
if [ xDEBUG = x1 ]; then
echo "Compressing archive"
fi
gzip -9 $NEW_NAME$EXT
EXT=".tar.gz"
EXT="$EXT.gz"
fi
echo "Removing temporary directory"
if [ xDEBUG = x1 ]; then
echo "Removing temporary directory"
fi
rm -r -f $BASE
echo "$NEW_NAME$EXT created successfully !!"
#
# End of script
#
......
......@@ -13,6 +13,12 @@ case "$1" in
IN_RPM="1"; shift
;;
esac
windows=0
case "$1" in
-WINDOWS)
windows="1"; shift
;;
esac
defaults=
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
......@@ -94,7 +100,7 @@ fi
mdata=$ldata/mysql
if test ! -x $execdir/mysqld
if test "$windows" -eq 0 -a ! -x $execdir/mysqld
then
if test "$IN_RPM" -eq 1
then
......@@ -110,7 +116,7 @@ fi
hostname=`@HOSTNAME@` # Install this too in the user table
# Check if hostname is valid
if test "$IN_RPM" -eq 0 -a $force -eq 0
if test "$windows" -eq 0 -a "$IN_RPM" -eq 0 -a $force -eq 0
then
resolved=`$bindir/resolveip $hostname 2>&1`
if [ $? -ne 0 ]
......@@ -134,7 +140,7 @@ then
fi
# Create database directories mysql & test
if test "$IN_RPM" -eq 0
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
then
if test ! -d $ldata; then mkdir $ldata; chmod 700 $ldata ; fi
if test ! -d $ldata/mysql; then mkdir $ldata/mysql; chmod 700 $ldata/mysql ; fi
......@@ -247,13 +253,19 @@ then
c_u="$c_u comment='Users and global privileges';"
i_u="INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
REPLACE INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');"
if test "$windows" -eq 0
then
i_u="$i_u INSERT INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
REPLACE INTO user VALUES ('$hostname','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0);
INSERT INTO user (host,user) values ('localhost','');
INSERT INTO user (host,user) values ('$hostname','');"
fi
fi
if test ! -f $mdata/func.frm
......@@ -330,7 +342,7 @@ END_OF_DATA
--basedir=$basedir --datadir=$ldata --skip-innodb --skip-bdb $args"
then
echo ""
if test "$IN_RPM" -eq 0
if test "$IN_RPM" -eq 0 || "$windows" -eq 0
then
echo "To start mysqld at boot time you have to copy support-files/mysql.server"
echo "to the right place for your system"
......@@ -351,7 +363,7 @@ then
echo "able to use the new GRANT command!"
fi
echo
if test "$IN_RPM" -eq 0
if test "$IN_RPM" -eq 0 -a "$windows" -eq 0
then
echo "You can start the MySQL daemon with:"
echo "cd @prefix@ ; $bindir/mysqld_safe &"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment