summaryrefslogtreecommitdiff
path: root/Build-tools/Do-win-build
blob: b446ba6f601e92f1bd26d08c8c7e2753c672c96c (plain)
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
#!/usr/bin/perl -w

use Getopt::Long;

$opt_help=0;
$opt_tarball=$opt_builddir="";

GetOptions(
    "help",
	"tarball=s",
	"builddir=s",
) || print_help();

print_help() if ($opt_help);

chomp($MSDEV=`which msdev`);

if (!$opt_builddir) {
  $opt_builddir = "/cygdrive/c/mysql-win-build";
}

$opt_tarball =~ /(mysql[^\/]*)-win-src\.tar/;
$mysqlver=$1;
$basedir = "$opt_builddir/$mysqlver";

# Make sure build dir exists
mkdir($opt_builddir);
# Clean out any previous build
system("rm -rf $basedir");
mkdir($basedir);
mkdir("$basedir/tarball");

system("cp $opt_tarball $basedir/tarball");

if (!chdir($basedir))
{
  print "Do-win-build error: Could not change to $opt_builddir";
  exit 1;
}

mkdir("build");
chdir("build");

system("tar -zxvf ../tarball/$mysqlver-win-src.tar.gz");

chdir($mysqlver);

system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");

#
# Print a help text message
#
sub print_help
{
	print <<EOF;
Usage: Do-compile-win [options] source-tarball

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.


Options:

--help
Print this text.

--builddir=<dir>
Set the Cygwin path to build under; the tarball will actually 
be moved to <builddir>/mysql-<version>/tarball and extracted under 
<builddir>/mysql-<version>/build.
Default: /cygdrive/c/mysql-win-build

--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)

EOF
	exit 1;
}