2003-02-20 23:05:58 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Script to create a Windows src package
|
|
|
|
#
|
|
|
|
|
|
|
|
version=@VERSION@
|
|
|
|
export version
|
|
|
|
SOURCE=`pwd`
|
|
|
|
CP="cp -p"
|
|
|
|
|
|
|
|
DEBUG=0
|
|
|
|
SILENT=0
|
|
|
|
SUFFIX=""
|
2003-06-15 22:24:37 +02:00
|
|
|
DIRNAME=""
|
2003-09-04 18:56:02 +02:00
|
|
|
OUTTAR="0"
|
|
|
|
OUTZIP="0"
|
2003-02-20 23:05:58 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# This script must run from MySQL top directory
|
|
|
|
#
|
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
if [ ! -f scripts/make_win_src_distribution ]; then
|
2003-02-20 23:05:58 +01:00
|
|
|
echo "ERROR : You must run this script from the MySQL top-level directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
2003-03-02 23:05:51 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
|
|
|
#
|
2003-03-07 19:16:23 +01:00
|
|
|
# Debug print of the status
|
2003-03-02 23:05:51 +01:00
|
|
|
#
|
|
|
|
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug()
|
|
|
|
{
|
|
|
|
for statement
|
|
|
|
do
|
|
|
|
if [ "$DEBUG" = "1" ] ; then
|
|
|
|
echo $statement
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
2003-03-02 23:05:51 +01:00
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
|
|
|
# Usage of the script
|
|
|
|
#
|
|
|
|
|
2003-03-07 19:16:23 +01:00
|
|
|
show_usage()
|
|
|
|
{
|
2003-02-20 23:05:58 +01:00
|
|
|
echo "MySQL utility script to create a Windows src package, and it takes"
|
|
|
|
echo "the following arguments:"
|
|
|
|
echo ""
|
|
|
|
echo " --debug Debug, without creating the package"
|
|
|
|
echo " --tmp Specify the temporary location"
|
2003-06-17 23:29:20 +02:00
|
|
|
echo " --suffix Suffix name for the package"
|
|
|
|
echo " --dirname Directory name to copy files (intermediate)"
|
2003-02-20 23:05:58 +01:00
|
|
|
echo " --silent Do not list verbosely files processed"
|
2003-08-13 19:32:34 +02:00
|
|
|
echo " --tar Create tar.gz package"
|
|
|
|
echo " --zip Create zip package"
|
2003-02-20 23:05:58 +01:00
|
|
|
echo " --help Show this help message"
|
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
exit 0
|
2003-02-20 23:05:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Parse the input arguments
|
|
|
|
#
|
|
|
|
|
|
|
|
parse_arguments() {
|
|
|
|
for arg do
|
|
|
|
case "$arg" in
|
2003-08-13 19:32:34 +02:00
|
|
|
--add-tar) ADDTAR=1 ;;
|
2003-02-20 23:05:58 +01:00
|
|
|
--debug) DEBUG=1;;
|
|
|
|
--tmp=*) TMP=`echo "$arg" | sed -e "s;--tmp=;;"` ;;
|
|
|
|
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
|
2003-06-15 22:24:37 +02:00
|
|
|
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
|
2003-02-20 23:05:58 +01:00
|
|
|
--silent) SILENT=1 ;;
|
|
|
|
--tar) OUTTAR=1 ;;
|
2003-08-13 19:32:34 +02:00
|
|
|
--zip) OUTZIP=1 ;;
|
2003-02-20 23:05:58 +01:00
|
|
|
--help) show_usage ;;
|
|
|
|
*)
|
|
|
|
echo "Unknown argument '$arg'"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
parse_arguments "$@"
|
|
|
|
|
2003-03-07 19:16:23 +01:00
|
|
|
#
|
|
|
|
# Assign the tmp directory if it was set from the environment variables
|
|
|
|
#
|
|
|
|
|
|
|
|
for i in $TMP $TMPDIR $TEMPDIR $TEMP /tmp
|
|
|
|
do
|
2003-08-13 16:36:01 +02:00
|
|
|
if [ "$i" ]; then
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Setting TMP to '$i'"
|
2003-08-13 16:36:01 +02:00
|
|
|
TMP=$i
|
2003-03-07 19:16:23 +01:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2003-08-13 16:36:01 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Convert argument file from unix to DOS text
|
2003-03-07 19:16:23 +01:00
|
|
|
#
|
|
|
|
|
2003-09-15 23:39:50 +02:00
|
|
|
unix_to_dos()
|
|
|
|
{
|
|
|
|
for arg do
|
|
|
|
print_debug "Replacing LF -> CRLF from '$arg'"
|
2003-09-04 18:56:02 +02:00
|
|
|
|
2003-09-15 23:39:50 +02:00
|
|
|
cat $arg | awk '{sub(/$/,"\r");print}' > $arg.tmp
|
|
|
|
rm -f $arg
|
|
|
|
mv $arg.tmp $arg
|
|
|
|
done
|
|
|
|
}
|
2003-08-13 16:36:01 +02:00
|
|
|
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
|
|
|
# Create a tmp dest directory to copy files
|
|
|
|
#
|
|
|
|
|
|
|
|
BASE=$TMP/my_win_dist$SUFFIX
|
|
|
|
|
|
|
|
if [ -d $BASE ] ; then
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Destination directory '$BASE' already exists, deleting it"
|
2003-02-20 23:05:58 +01:00
|
|
|
rm -r -f $BASE
|
|
|
|
fi
|
|
|
|
|
|
|
|
$CP -r $SOURCE/VC++Files $BASE
|
|
|
|
(
|
2003-03-02 23:05:51 +01:00
|
|
|
find $BASE \( -name "*.dsp" -o -name "*.dsw" \) -and -not -path \*SCCS\* -print
|
2003-02-20 23:05:58 +01:00
|
|
|
)|(
|
2003-08-13 16:36:01 +02:00
|
|
|
while read v
|
2003-03-07 19:16:23 +01:00
|
|
|
do
|
2003-08-13 16:36:01 +02:00
|
|
|
unix_to_dos $v
|
2003-03-07 19:16:23 +01:00
|
|
|
done
|
2003-02-20 23:05:58 +01:00
|
|
|
)
|
|
|
|
|
2003-09-15 23:39:50 +02:00
|
|
|
#
|
|
|
|
# Process version tags in InstallShield files
|
|
|
|
#
|
|
|
|
|
|
|
|
vreplace()
|
|
|
|
{
|
|
|
|
for arg do
|
|
|
|
unix_to_dos $arg
|
|
|
|
cat $arg | sed -e 's!@''VERSION''@!@VERSION@!' > $arg.tmp
|
|
|
|
rm -f $arg
|
|
|
|
mv $arg.tmp $arg
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2004-06-26 09:57:00 +02:00
|
|
|
if test -d $BASE/InstallShield
|
|
|
|
then
|
|
|
|
for d in 4.1.XX-gpl 4.1.XX-pro 4.1.XX-classic
|
|
|
|
do
|
|
|
|
cd $BASE/InstallShield/$d/String\ Tables/0009-English
|
|
|
|
vreplace value.shl
|
|
|
|
cd ../../Setup\ Files/Compressed\ Files/Language\ Independent/OS\ Independent
|
|
|
|
vreplace infolist.txt
|
|
|
|
done
|
|
|
|
fi
|
2003-09-15 23:39:50 +02:00
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
#
|
|
|
|
# Move all error message files to root directory
|
|
|
|
#
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
$CP -r $SOURCE/sql/share $BASE/
|
2003-03-07 19:16:23 +01:00
|
|
|
rm -r -f "$BASE/share/Makefile"
|
|
|
|
rm -r -f "$BASE/share/Makefile.in"
|
|
|
|
rm -r -f "$BASE/share/Makefile.am"
|
2003-02-20 23:05:58 +01:00
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
mkdir $BASE/Docs $BASE/extra $BASE/include
|
2003-02-20 23:05:58 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Copy directory files
|
|
|
|
#
|
|
|
|
|
2003-06-15 22:24:37 +02:00
|
|
|
copy_dir_files()
|
|
|
|
{
|
2003-02-20 23:05:58 +01:00
|
|
|
for arg do
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Copying files from directory '$arg'"
|
2003-06-15 22:24:37 +02:00
|
|
|
cd $SOURCE/$arg
|
|
|
|
if [ ! -d $BASE/$arg ]; then
|
|
|
|
print_debug "Creating directory '$arg'"
|
|
|
|
mkdir $BASE/$arg
|
|
|
|
fi
|
2003-04-30 18:42:08 +02:00
|
|
|
for i in *.c *.cpp *.h *.ih *.i *.ic *.asm *.def \
|
2003-08-13 16:36:01 +02:00
|
|
|
README INSTALL* LICENSE
|
|
|
|
do
|
|
|
|
if [ -f $i ]
|
2003-03-02 23:05:51 +01:00
|
|
|
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
|
2003-02-20 23:05:58 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Copy directory contents recursively
|
|
|
|
#
|
|
|
|
|
|
|
|
copy_dir_dirs() {
|
|
|
|
|
|
|
|
for arg do
|
|
|
|
|
2003-08-13 16:36:01 +02:00
|
|
|
cd $SOURCE
|
|
|
|
(
|
|
|
|
find $arg -type d \
|
|
|
|
-and -not -path \*SCCS\* \
|
|
|
|
-and -not -path \*.deps\* \
|
|
|
|
-and -not -path \*autom4te.cache -print
|
|
|
|
)|(
|
|
|
|
while read v
|
|
|
|
do
|
|
|
|
copy_dir_files $v
|
|
|
|
done
|
|
|
|
)
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Input directories to be copied
|
|
|
|
#
|
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
for i in client dbug extra heap include isam \
|
|
|
|
libmysql libmysqld merge myisam \
|
2003-06-15 22:24:37 +02:00
|
|
|
myisammrg mysys regex sql strings sql-common \
|
2003-08-13 17:00:22 +02:00
|
|
|
tools vio zlib
|
2003-03-02 23:05:51 +01:00
|
|
|
do
|
|
|
|
copy_dir_files $i
|
|
|
|
done
|
2003-02-20 23:05:58 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Input directories to be copied recursively
|
|
|
|
#
|
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
for i in bdb innobase
|
|
|
|
do
|
|
|
|
copy_dir_dirs $i
|
|
|
|
done
|
2003-02-20 23:05:58 +01:00
|
|
|
|
2003-03-02 23:05:51 +01:00
|
|
|
#
|
|
|
|
# Create dummy innobase configure header
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ -f $BASE/innobase/ib_config.h ]; then
|
2003-02-20 23:05:58 +01:00
|
|
|
rm -f $BASE/innobase/ib_config.h
|
|
|
|
fi
|
2003-03-02 23:05:51 +01:00
|
|
|
touch $BASE/innobase/ib_config.h
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Copy miscellaneous files
|
|
|
|
#
|
|
|
|
|
|
|
|
cd $SOURCE
|
2003-11-25 17:52:12 +01:00
|
|
|
for i in COPYING ChangeLog README \
|
2003-02-20 23:05:58 +01:00
|
|
|
INSTALL-SOURCE INSTALL-WIN \
|
2003-06-24 11:10:35 +02:00
|
|
|
INSTALL-WIN-SOURCE \
|
2003-02-20 23:05:58 +01:00
|
|
|
Docs/manual_toc.html Docs/manual.html \
|
2003-08-13 04:52:03 +02:00
|
|
|
Docs/manual.txt Docs/mysqld_error.txt \
|
2003-11-18 21:17:41 +01:00
|
|
|
Docs/INSTALL-BINARY Docs/internals.texi
|
2003-08-13 16:36:01 +02:00
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
do
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Copying file '$i'"
|
2003-08-13 16:36:01 +02:00
|
|
|
if [ -f $i ]
|
2003-02-20 23:05:58 +01:00
|
|
|
then
|
2003-03-02 23:05:51 +01:00
|
|
|
$CP $i $BASE/$i
|
2003-02-20 23:05:58 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2004-06-25 17:54:43 +02:00
|
|
|
#
|
|
|
|
# support files
|
|
|
|
#
|
|
|
|
mkdir $BASE/support-files
|
|
|
|
cp support-files/*.cnf $BASE/support-files
|
|
|
|
|
2003-08-13 04:52:03 +02:00
|
|
|
#
|
|
|
|
# Raw dirs from source tree
|
|
|
|
#
|
|
|
|
|
|
|
|
for i in Docs/Flags scripts sql-bench SSL \
|
2003-08-13 17:00:22 +02:00
|
|
|
tests
|
2003-08-13 04:52:03 +02:00
|
|
|
do
|
|
|
|
print_debug "Copying directory '$i'"
|
|
|
|
if [ -d $i ]
|
|
|
|
then
|
|
|
|
$CP -R $i $BASE/$i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2003-05-06 05:20:16 +02:00
|
|
|
#
|
2004-05-27 23:03:19 +02:00
|
|
|
# Fix some windows files to avoid compiler warnings
|
2003-05-06 05:20:16 +02:00
|
|
|
#
|
|
|
|
|
2004-05-27 23:03:19 +02:00
|
|
|
./extra/replace std:: "" < $BASE/sql/sql_yacc.cpp | sed '/^ *switch (yytype)$/ { N; /\n *{$/ { N; /\n *default:$/ { N; /\n *break;$/ { N; /\n *}$/ d; };};};} ' > $BASE/sql/sql_yacc.cpp-new
|
|
|
|
mv $BASE/sql/sql_yacc.cpp-new $BASE/sql/sql_yacc.cpp
|
|
|
|
|
2003-08-13 16:36:01 +02:00
|
|
|
unix_to_dos $BASE/README
|
|
|
|
mv $BASE/README $BASE/README.txt
|
|
|
|
|
2003-12-08 11:25:37 +01:00
|
|
|
#
|
|
|
|
# Clean up if we did this from a bk tree
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ -d $BASE/SSL/SCCS ]
|
|
|
|
then
|
2004-06-25 17:49:36 +02:00
|
|
|
find $BASE/ -type d -name SCCS -printf " \"%p\"" | xargs rm -r -f
|
2003-12-08 11:25:37 +01:00
|
|
|
fi
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
2003-03-02 23:05:51 +01:00
|
|
|
# Initialize the initial data directory
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
|
|
|
|
2003-08-13 16:36:01 +02:00
|
|
|
if [ -f scripts/mysql_install_db ]; then
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Initializing the 'data' directory"
|
2003-06-15 22:24:37 +02:00
|
|
|
scripts/mysql_install_db --no-defaults --windows --datadir=$BASE/data
|
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
Ensured that all projects compile
Removed compiler warnings
Better setting of server_version variable.
Fix that make_win_src_distribution creates the privilege tables.
VC++Files/bdb/bdb.dsp:
Small, automatic changes
VC++Files/client/mysql.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/client/mysqladmin.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/client/mysqlclient.dsp:
Removed files that should only be used with mysql command line client
VC++Files/client/mysqldump.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/client/mysqlimport.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/client/mysqlshow.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/comp_err/comp_err.dsp:
Automatic changes
VC++Files/dbug/dbug.dsp:
Automatic changes
VC++Files/heap/heap.dsp:
automatic changes
VC++Files/innobase/innobase.dsp:
Automatic changes
VC++Files/isam/isam.dsp:
Automatic changes
VC++Files/isamchk/isamchk.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/libmysql/libmysql.dsp:
Automatic changes
VC++Files/libmysqld/examples/test_libmysqld.dsp:
Add missing files
VC++Files/libmysqld/libmysqld.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/libmysqltest/myTest.dsp:
Automatic changes
VC++Files/merge/merge.dsp:
Automatic changes
VC++Files/my_print_defaults/my_print_defaults.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/myisam/myisam.dsp:
automatic changes
VC++Files/myisam_ftdump/myisam_ftdump.dsp:
automatic changes
VC++Files/myisamchk/myisamchk.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/myisamlog/myisamlog.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/myisammrg/myisammrg.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/myisampack/myisampack.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/mysql.dsw:
Automatic changes
VC++Files/mysqlbinlog/mysqlbinlog.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/mysqlcheck/mysqlcheck.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/mysqldemb/mysqldemb.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/mysqlserver/mysqlserver.dsp:
Automatic changes
VC++Files/mysqlshutdown/mysqlshutdown.dsp:
Automatic changes
VC++Files/mysqlwatch/mysqlwatch.dsp:
Automatic changes
VC++Files/mysys/mysys.dsp:
Automatic changes
VC++Files/pack_isam/pack_isam.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/perror/perror.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/regex/regex.dsp:
Automatic changes
VC++Files/replace/replace.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/sql/mysqld.dsp:
Added support for projects 'classic', 'classic nt', 'pro' and 'pro nt'
VC++Files/strings/strings.dsp:
Removed duplicate code for strnlen
VC++Files/test1/test1.dsp:
Automatic changes
VC++Files/thr_test/thr_test.dsp:
Automatic changes
VC++Files/vio/vio.dsp:
Automatic changes
VC++Files/zlib/contrib/asm386/zlibvc.dsp:
Automatic changes
VC++Files/zlib/zlib.dsp:
Automatic changes
extra/my_print_defaults.c:
Fixed bug in --verbose
include/m_string.h:
Portability fix
include/mysql_embed.h:
Better setting of server_version variable
include/mysql_version.h.in:
Better license text handling
innobase/pars/pars0lex.l:
Remove compiler warnings
innobase/trx/trx0sys.c:
Remove compiler warnings
libmysqld/lib_sql.cc:
Better setting of server_version variable
libmysqld/libmysqld.def:
Add functions needed for mysql command line client
myisam/myisam_ftdump.c:
Remove compiler warnings
mysys/sha1.c:
Remove compiler warnings
scripts/make_win_src_distribution.sh:
Safety fix
scripts/mysql_install_db.sh:
Backport from 4.1 to allow make_win_src_distribution create the privilege tables
sql/Makefile.am:
Add new file mysqld_suffix.h
Remove not used file sql_olap.h
sql/ha_innodb.cc:
Remove not used variable
sql/mysqld.cc:
Better setting of server_version variable
sql/set_var.cc:
Fixed bug when showing lower_case_file_system
strings/ctype-tis620.c:
Remove compiler warnings
2004-05-19 15:38:12 +02:00
|
|
|
if test "$?" = 1
|
|
|
|
then
|
|
|
|
exit 1;
|
|
|
|
fi
|
2003-03-02 23:05:51 +01:00
|
|
|
fi
|
|
|
|
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
|
|
|
# Specify the distribution package name and copy it
|
|
|
|
#
|
|
|
|
|
2003-06-15 22:24:37 +02:00
|
|
|
if test -z $DIRNAME
|
|
|
|
then
|
|
|
|
NEW_DIR_NAME=mysql@MYSQL_SERVER_SUFFIX@-$version$SUFFIX
|
|
|
|
else
|
|
|
|
NEW_DIR_NAME=$DIRNAME
|
|
|
|
fi
|
2003-03-07 19:16:23 +01:00
|
|
|
NEW_NAME=$NEW_DIR_NAME-win-src
|
|
|
|
|
|
|
|
BASE2=$TMP/$NEW_DIR_NAME
|
2003-02-20 23:05:58 +01:00
|
|
|
rm -r -f $BASE2
|
|
|
|
mv $BASE $BASE2
|
|
|
|
BASE=$BASE2
|
|
|
|
|
|
|
|
#
|
|
|
|
# If debugging, don't create a zip/tar/gz
|
|
|
|
#
|
|
|
|
|
2003-03-07 19:16:23 +01:00
|
|
|
if [ "$DEBUG" = "1" ] ; then
|
2003-02-20 23:05:58 +01:00
|
|
|
echo "Please check the distribution files from $BASE"
|
|
|
|
echo "Exiting (without creating the package).."
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
2003-03-02 23:05:51 +01:00
|
|
|
# Create the result zip/tar file
|
2003-02-20 23:05:58 +01:00
|
|
|
#
|
|
|
|
|
2003-09-04 18:56:02 +02:00
|
|
|
if [ "$OUTTAR" = "0" ]; then
|
|
|
|
if [ "$OUTZIP" = "0" ]; then
|
|
|
|
OUTZIP=1
|
|
|
|
fi
|
2003-08-13 19:32:34 +02:00
|
|
|
fi
|
|
|
|
|
2003-08-13 16:36:01 +02:00
|
|
|
set_tarzip_options()
|
2003-03-02 23:05:51 +01:00
|
|
|
{
|
2003-08-13 16:36:01 +02:00
|
|
|
for arg
|
2003-03-02 23:05:51 +01:00
|
|
|
do
|
2003-03-07 19:16:23 +01:00
|
|
|
if [ "$arg" = "tar" ]; then
|
2003-03-02 23:05:51 +01:00
|
|
|
ZIPFILE1=gnutar
|
|
|
|
ZIPFILE2=gtar
|
|
|
|
OPT=cvf
|
|
|
|
EXT=".tar"
|
|
|
|
NEED_COMPRESS=1
|
2003-03-07 19:16:23 +01:00
|
|
|
if [ "$SILENT" = "1" ] ; then
|
2003-03-02 23:05:51 +01:00
|
|
|
OPT=cf
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
ZIPFILE1=zip
|
|
|
|
ZIPFILE2=""
|
2003-06-24 11:10:35 +02:00
|
|
|
OPT="-r"
|
2003-03-02 23:05:51 +01:00
|
|
|
EXT=".zip"
|
|
|
|
NEED_COMPRESS=0
|
2003-03-07 19:16:23 +01:00
|
|
|
if [ "$SILENT" = "1" ] ; then
|
2003-06-15 22:24:37 +02:00
|
|
|
OPT="$OPT -q"
|
2003-03-02 23:05:51 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create the archive
|
|
|
|
#
|
2003-08-13 19:32:34 +02:00
|
|
|
create_archive()
|
|
|
|
{
|
2003-03-02 23:05:51 +01:00
|
|
|
|
2003-08-13 19:32:34 +02:00
|
|
|
print_debug "Using $tar to create archive"
|
2003-02-20 23:05:58 +01:00
|
|
|
|
2003-08-13 19:32:34 +02:00
|
|
|
cd $TMP
|
2003-02-20 23:05:58 +01:00
|
|
|
|
2003-08-13 19:32:34 +02:00
|
|
|
rm -f $SOURCE/$NEW_NAME$EXT
|
|
|
|
$tar $OPT $SOURCE/$NEW_NAME$EXT $NEW_DIR_NAME
|
|
|
|
cd $SOURCE
|
2003-02-20 23:05:58 +01:00
|
|
|
|
2003-08-13 19:32:34 +02:00
|
|
|
if [ "$NEED_COMPRESS" = "1" ]
|
|
|
|
then
|
|
|
|
print_debug "Compressing archive"
|
|
|
|
gzip -9 $NEW_NAME$EXT
|
|
|
|
EXT="$EXT.gz"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$SILENT" = "0" ] ; then
|
|
|
|
echo "$NEW_NAME$EXT created successfully !!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$OUTTAR" = "1" ]; then
|
|
|
|
set_tarzip_options 'tar'
|
|
|
|
|
|
|
|
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
|
|
|
|
if test "$?" = "1" -o "$tar" = ""
|
|
|
|
then
|
|
|
|
print_debug "Search failed for '$ZIPFILE1', '$ZIPFILE2', using default 'tar'"
|
|
|
|
tar=tar
|
|
|
|
set_tarzip_options 'tar'
|
|
|
|
fi
|
|
|
|
|
|
|
|
create_archive
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$OUTZIP" = "1" ]; then
|
|
|
|
set_tarzip_options 'zip'
|
|
|
|
|
|
|
|
tar=`which_1 $ZIPFILE1 $ZIPFILE2`
|
|
|
|
if test "$?" = "1" -o "$tar" = ""
|
|
|
|
then
|
|
|
|
echo "Search failed for '$ZIPFILE1', '$ZIPFILE2', cannot create zip!"
|
|
|
|
fi
|
|
|
|
|
|
|
|
create_archive
|
2003-02-20 23:05:58 +01:00
|
|
|
fi
|
|
|
|
|
2003-03-07 19:16:23 +01:00
|
|
|
print_debug "Removing temporary directory"
|
2003-02-20 23:05:58 +01:00
|
|
|
rm -r -f $BASE
|
|
|
|
|
|
|
|
# End of script
|