mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
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
This commit is contained in:
parent
b381cb0423
commit
64f0e4289d
2 changed files with 169 additions and 131 deletions
|
@ -15,17 +15,38 @@ 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
|
||||
rm $v
|
||||
mv $v.tmp $v
|
||||
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/
|
||||
|
||||
#
|
||||
|
@ -118,9 +137,8 @@ then
|
|||
find $BASE/ -name SCCS -print | xargs rm -r -f
|
||||
rm -rf "$BASE/InstallShield/Script Files/SCCS"
|
||||
fi
|
||||
|
||||
|
||||
mkdir $BASE/Docs $BASE/extra $BASE/include
|
||||
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
|
||||
do
|
||||
$CP $SOURCE/$arg/$v $BASE/$arg/$v
|
||||
done
|
||||
)
|
||||
|
||||
cd $SOURCE/$arg/
|
||||
(
|
||||
ls -A1|grep \\.cc$|sed 's/.cc$//g')|(
|
||||
while read v
|
||||
do
|
||||
$CP $SOURCE/$arg/$v.cc $BASE/$arg/$v.cpp
|
||||
done
|
||||
)
|
||||
for i in *.c *.h *.ih *.i *.ic *.asm \
|
||||
README INSTALL* LICENSE
|
||||
do
|
||||
if [ -f $i ]
|
||||
then
|
||||
$CP $SOURCE/$arg/$i $BASE/$arg/$i
|
||||
fi
|
||||
done
|
||||
for i in *.cc
|
||||
do
|
||||
if [ -f $i ]
|
||||
then
|
||||
i=`echo $i | sed 's/.cc$//g'`
|
||||
$CP $SOURCE/$arg/$i.cc $BASE/$arg/$i.cpp
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
|
@ -169,27 +181,21 @@ copy_dir_dirs() {
|
|||
|
||||
basedir=$arg
|
||||
|
||||
if [ ! -d $BASE/$arg ]; then
|
||||
if [ ! -d $BASE/$arg ]; then
|
||||
mkdir $BASE/$arg
|
||||
fi
|
||||
|
||||
fi
|
||||
copy_dir_files $arg
|
||||
|
||||
cd $SOURCE/$arg/
|
||||
(
|
||||
ls -l |grep "^d"|awk '{print($9)}' -
|
||||
)|(
|
||||
while read dir_name
|
||||
do
|
||||
if [ x$dir_name != x"SCCS" ]
|
||||
then
|
||||
if [ ! -d $BASE/$basedir/$dir_name ]; then
|
||||
mkdir $BASE/$basedir/$dir_name
|
||||
fi
|
||||
copy_dir_files $basedir/$dir_name
|
||||
cd $SOURCE/$arg/
|
||||
for i in *
|
||||
do
|
||||
if [ -d $SOURCE/$basedir/$i ] && [ "$i" != "SCCS" ]; then
|
||||
if [ ! -d $BASE/$basedir/$i ]; then
|
||||
mkdir $BASE/$basedir/$i
|
||||
fi
|
||||
done
|
||||
)
|
||||
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
|
||||
if [ -f $BASE/innobase/ib_config.h ]
|
||||
then
|
||||
#
|
||||
# Create dummy innobase configure header
|
||||
#
|
||||
|
||||
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,16 +242,26 @@ 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
|
||||
$CP $i $BASE/$i
|
||||
fi
|
||||
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,36 +309,56 @@ which_1 ()
|
|||
}
|
||||
|
||||
#
|
||||
# Create the result zip file
|
||||
# Create the result zip/tar file
|
||||
#
|
||||
|
||||
set_tarzip_options()
|
||||
{
|
||||
for arg
|
||||
do
|
||||
if [ x$arg = x"tar" ]; then
|
||||
ZIPFILE1=gnutar
|
||||
ZIPFILE2=gtar
|
||||
OPT=cvf
|
||||
EXT=".tar"
|
||||
NEED_COMPRESS=1
|
||||
if [ x$SILENT = x1 ] ; then
|
||||
OPT=cf
|
||||
fi
|
||||
else
|
||||
ZIPFILE1=zip
|
||||
ZIPFILE2=""
|
||||
OPT="-vr"
|
||||
EXT=".zip"
|
||||
NEED_COMPRESS=0
|
||||
if [ x$SILENT = x1 ] ; then
|
||||
OPT="-r"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ x$OUTTAR = x1 ]; then
|
||||
ZIPFILE1=gnutar
|
||||
ZIPFILE2=gtar
|
||||
OPT=cvf
|
||||
EXT=".tar"
|
||||
NEED_COMPRESS=1
|
||||
if [ x$SILENT = x1 ] ; then
|
||||
OPT=cf
|
||||
fi
|
||||
set_tarzip_options 'tar'
|
||||
else
|
||||
ZIPFILE1=zip
|
||||
ZIPFILE2=""
|
||||
OPT="-lvr"
|
||||
EXT=".zip"
|
||||
NEED_COMPRESS=0
|
||||
if [ x$SILENT = x1 ] ; then
|
||||
OPT="-lr"
|
||||
fi
|
||||
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
|
||||
echo "Compressing archive"
|
||||
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 &"
|
||||
|
|
Loading…
Add table
Reference in a new issue