Commit 0786eb65 authored by greg@mysql.com's avatar greg@mysql.com

Major work on Windows build automation-- add binary packaging, suffixes

parent e1fee022
......@@ -3,12 +3,13 @@
use Getopt::Long;
$opt_help=0;
$opt_tarball=$opt_builddir="";
$opt_tarball=$opt_builddir=$opt_suffix="";
GetOptions(
"help",
"tarball=s",
"builddir=s",
"tarball=s",
"builddir=s",
"suffix=s"
) || print_help();
print_help() if ($opt_help);
......@@ -28,27 +29,54 @@ $scriptdir = `pwd`;
mkdir($opt_builddir);
# Clean out any previous build
system("rm -rf $basedir");
mkdir($basedir);
mkdir("$basedir/tarball");
system("cp $opt_tarball $basedir/tarball");
# Unpack in the script directory
system("tar -zxvf $opt_tarball");
# Move to the build directory
system("mv $mysqlver $opt_builddir");
if (!chdir($basedir))
{
print "Do-win-build error: Could not change to $opt_builddir";
print "Do-win-build error: Could not change to $basedir";
exit 1;
}
mkdir("build");
chdir("build");
# Check whether this is a classic edition build
if ($opt_suffix =~ /-classic/)
{
# Blank out ha_innodb.cpp
chmod 0644, 'sql/ha_innodb.cpp';
open(OUT, '>', 'sql/ha_innodb.cpp');
close(OUT);
# Remove HAVE_INNOBASE_DB from the requisite project files
for $dspfile ('libmysqld/libmysqld.dsp', 'mysqldemb/mysqldemb.dsp', 'mysqlserver/mysqlserver.dsp', 'sql/mysqld.dsp', 'sql/mysqldmax.dsp')
{
open(IN, '<', $dspfile);
open(OUT, '>', "$dspfile.tmp");
while (readline IN)
{
s/\D \"HAVE_INNOBASE_DB\" //g;
print OUT $_;
}
close(IN);
close(OUT);
unlink $dspfile;
rename "$dspfile.tmp", $dspfile;
}
}
system("tar -zxvf ../tarball/$mysqlver-win-src.tar.gz");
# Perform compilation
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");
chdir($mysqlver);
# Package binary
system("./scripts/make_win_binary_distribution --suffix=$opt_suffix");
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");
# Copy log back to script directory
system("cp $mysqlver$suffix-build.log $scriptdir");
system("cp $mysqlver-build.log $scriptdir");
# Move binary package to script directory
system("mv *.zip $scriptdir");
#
# Print a help text message
......@@ -62,7 +90,11 @@ Unpacks a Windows source distribution on the local machine and
compiles it using VC++ 6.0.
This script is intended for Cygwin Perl. You must have a working
MSDEV.EXE in your path for compilation.
MSDEV.EXE in your path for compilation, as well as the following:
sed
tar (GNU tar)
which
Options:
......@@ -76,6 +108,13 @@ be moved to <builddir>/mysql-<version>/tarball and extracted under
<builddir>/mysql-<version>/build.
Default: /cygdrive/c/mysql-win-build
--suffix=<suffix>
If specified, the resulting binary will have the specified suffix
in its name. If the suffix is "-classic", the project files will
be stripped of all occurrences of HAVE_INNOBASE_DB and
ha_innodb.cpp will be blanked out, to create classic edition
server binaries.
--tarball=<file>
Windows source tarball to use for this build. Must be of the form
mysql[com]-x.x.x-win-src.tar.gz (REQUIRED)
......
......@@ -7,24 +7,24 @@
CFG=comp_err - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "comp_err.mak".
!MESSAGE
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "comp_err.mak" CFG="comp_err - Win32 Release"
!MESSAGE
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE
!MESSAGE "comp_err - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
......@@ -44,9 +44,9 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib_release\mysys.lib wsock32.lib ..\lib_release\strings.lib ..\lib_release\dbug.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC.lib" /out:"Release/comp-err.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib_release\mysys.lib wsock32.lib ..\lib_release\strings.lib ..\lib_release\dbug.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC.lib" /out:"../client_release/comp-err.exe"
# Begin Target
# Name "comp_err - Win32 Release"
......
......@@ -7,25 +7,25 @@
CFG=my_print_defaults - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "my_print_defaults.mak".
!MESSAGE
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "my_print_defaults.mak" CFG="my_print_defaults - Win32 Debug"
!MESSAGE
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE
!MESSAGE "my_print_defaults - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "my_print_defaults - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "my_print_defaults - Win32 Release"
......@@ -39,6 +39,7 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
......@@ -47,9 +48,9 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/my_print_defaults.exe"
!ELSEIF "$(CFG)" == "my_print_defaults - Win32 Debug"
......@@ -71,11 +72,11 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /out:"../client_debug/my_print_defaults.exe" /pdbtype:sept
!ENDIF
!ENDIF
# Begin Target
......
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/myisam_ftdump.exe"
!ELSEIF "$(CFG)" == "myisam_ftdump - Win32 Debug"
......@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisam_ftdump.exe" /pdbtype:sept
!ENDIF
......
......@@ -7,19 +7,19 @@
CFG=myisampack - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "myisampack.mak".
!MESSAGE
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE
!MESSAGE NMAKE /f "myisampack.mak" CFG="myisampack - Win32 Debug"
!MESSAGE
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE
!MESSAGE "myisampack - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "myisampack - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/myisampack.exe"
!ELSEIF "$(CFG)" == "myisampack - Win32 Debug"
......@@ -75,9 +75,9 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisampack.exe" /pdbtype:sept
!ENDIF
!ENDIF
# Begin Target
......
......@@ -33,11 +33,13 @@ bin_SCRIPTS = @server_scripts@ \
mysql_explain_log \
mysql_tableinfo \
mysqld_multi \
make_win_src_distribution
make_win_src_distribution \
make_win_binary_distribution
EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \
make_win_src_distribution.sh \
make_win_binary_distribution.sh \
msql2mysql.sh \
mysql_config.sh \
mysql_fix_privilege_tables.sh \
......
#!/bin/sh
#
# Script to create a Windows binary package
#
# This is intended to be used under Cygwin, and will generate
# an archive named in the form mysql<suffix>-<version>-noinstall.zip
version=@VERSION@
DEBUG=0
SUFFIX=""
DIRNAME=""
EXTRA=""
#
# This script must run from MySQL top directory
#
if [ ! -f scripts/make_win_binary_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1
fi
#
# Debug print of the status
#
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
}
#
# Usage of the script
#
show_usage()
{
echo "MySQL utility script to create a Windows binary package"
echo ""
echo "This is intended to be used under Cygwin, and will generate"
echo "an archive named in the form mysql<suffix>-<version>-noinstall.zip"
echo "Takes the following arguments:"
echo ""
echo " --dirname Directory to use for copying files"
echo " --extra Directory to get extra files from"
echo " --suffix Name to append to 'mysql' for this binary"
echo " --help Show this help message"
exit 0
}
#
# Parse the input arguments
#
parse_arguments() {
for arg do
case "$arg" in
--debug) DEBUG=1;;
--extra=*) EXTRA=`echo "$arg" | sed -e "s;--extra=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
--help) show_usage ;;
*)
echo "Unknown argument '$arg'"
exit 1
;;
esac
done
}
parse_arguments "$@"
if [ -z "$DIRNAME" ]; then
$DIRNAME="dist"
fi
print_debug "Making directories"
mkdir $DIRNAME
$DIRNAME="$DIRNAME/mysql-$version"
mkdir $DIRNAME
for dir in bin lib lib/opt lib/debug Embedded Embedded/DLL Embedded/DLL/debug Embedded/DLL/release Embedded/static Embedded/static/release examples examples/libmysqltest
do
mkdir $DIRNAME/$dir
done
if [ $EXTRA ]; then
print_debug "Copying extra files"
cp -fr $EXTRA/* $DIRNAME
fi
# Dirs to be copied as-is
for dir in data Docs include scripts share
do
print_debug "Copying $dir to $DIRNAME/"
cp -fr $dir $DIRNAME
done
print_debug "Copying tests to $DIRNAME/examples/"
cp -fr tests $DIRNAME/examples
print_debug "Copying sql-bench to $DIRNAME/bench"
mkdir $DIRNAME/bench
cp -fr sql-bench/* $DIRNAME/bench
# Files for bin
for i in client_release/* client_debug/mysqld.exe lib_release/libmySQL.dll
do
print_debug "Copying $i to $DIRNAME/bin"
cp $i $DIRNAME/bin
done
# Files for include
for i in libmysql/libmysql.def libmysqld/libmysqld.def
do
print_debug "Copying $i to $DIRNAME/include"
cp $i $DIRNAME/include
done
# Windows users are used to having dbug.h
cp include/my_dbug.h $DIRNAME/include/dbug.h
# Libraries found in lib_release and lib_debug
for i in libmySQL.dll libmysql.lib zlib.lib mysqlclient.lib mysys.lib regex.lib strings.lib
do
print_debug "Copying lib_release/$i to $DIRNAME/lib/opt"
cp lib_release/$i $DIRNAME/lib/opt
print_debug "Copying lib_debug/$i to $DIRNAME/lib/debug"
cp lib_debug/$i $DIRNAME/lib/debug
done
print_debug "Copying lib_release/mysys-max.lib to $DIRNAME/lib/opt"
cp lib_release/mysys-max.lib $DIRNAME/lib/opt
# Embedded server
for i in libmysqld.dll libmysqld.lib libmysqld.exp
do
print_debug "Copying lib_release/$i to $DIRNAME/Embedded/DLL/release"
cp lib_release/$i $DIRNAME/Embedded/DLL/release
print_debug "Copying lib_debug/$i to $DIRNAME/Embedded/DLL/debug"
cp lib_debug/$i $DIRNAME/Embedded/DLL/debug
done
# Static embedded
print_debug "Copying lib_release/mysqlserver.lib to $DIRNAME/Embedded/static/release"
cp lib_release/mysqlserver.lib $DIRNAME/Embedded/static/release
# libmysqltest
for i in mytest.c mytest.dsp mytest.dsw mytest.exe
do
print_debug "Copying libmysqltest/release/$i to $DIRNAME/examples/libmysqltest"
cp libmysqltest/release/$i $DIRNAME/examples/libmysqltest
done
print_debug "Copying README.txt"
cp README.txt $DIRNAME
if [ -f MySQLEULA.txt ]; then
print_debug "Commercial version: copying MySQLEULA.txt"
cp MySQLEULA.txt $DIRNAME
rm $DIRNAME/Docs/COPYING
else
print_debug "GPL version: copying COPYING"
cp Docs/COPYING $DIRNAME
fi
print_debug "Invoking zip to package the binary"
zip -r mysql$SUFFIX-$version-win-noinstall.zip $DIRNAME
print_debug "Deleting intermediate directory"
rm -rf $DIRNAME
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