mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
- added more files to support-files/MacOSX and added them to the
distribution - added Bootstrap, logger.pm and Do-pkg to Build-tools: Bootstrap is used to build the source distribution for the binary builds logger.pm includes some helper functions Do-pkg converts a binary distribution into a Mac OS X PKG (still needs some polishing)
This commit is contained in:
424
Build-tools/Bootstrap
Executable file
424
Build-tools/Bootstrap
Executable file
@@ -0,0 +1,424 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# Bootstrap
|
||||||
|
#
|
||||||
|
# Script to export a given BK source tree into a separate directory
|
||||||
|
# and create the source distribution to be used for all binary builds
|
||||||
|
#
|
||||||
|
# Use the "--help" option for more info!
|
||||||
|
#
|
||||||
|
# written by Lenz Grimmer <lenz@mysql.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
Getopt::Long::Configure ("bundling");
|
||||||
|
|
||||||
|
# Include logging function
|
||||||
|
$LOGGER= "$ENV{HOME}/bin/logger.pm";
|
||||||
|
if (-f $LOGGER)
|
||||||
|
{
|
||||||
|
do "$LOGGER";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
die "ERROR: $LOGGER cannot be found!\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Some predefined settings
|
||||||
|
$build_command= "BUILD/compile-pentium-max";
|
||||||
|
chomp ($logfile= `pwd`);
|
||||||
|
$logfile.= "/Bootstrap.log";
|
||||||
|
chomp ($opt_directory= `pwd`);
|
||||||
|
$opt_docdir= $opt_directory . "/mysqldoc";
|
||||||
|
$opt_changelog= undef;
|
||||||
|
$opt_delete= undef;
|
||||||
|
$opt_dry_run= undef;
|
||||||
|
$opt_export_only= undef;
|
||||||
|
$opt_help= $opt_verbose= 0;
|
||||||
|
$opt_log= undef;
|
||||||
|
$opt_mail= "";
|
||||||
|
$opt_suffix= "";
|
||||||
|
$opt_test= undef;
|
||||||
|
$opt_skip_check= undef;
|
||||||
|
$opt_skip_manual= undef;
|
||||||
|
$version= "unknown";
|
||||||
|
|
||||||
|
GetOptions(
|
||||||
|
"changelog|c:s",
|
||||||
|
"directory|d=s",
|
||||||
|
"delete",
|
||||||
|
"docdir=s",
|
||||||
|
"dry-run",
|
||||||
|
"export-only|e",
|
||||||
|
"help|h",
|
||||||
|
"log|l:s",
|
||||||
|
"mail|m=s",
|
||||||
|
"revision|r=s",
|
||||||
|
"revision|r=s",
|
||||||
|
"skip-check|s",
|
||||||
|
"skip-manual",
|
||||||
|
"suffix=s",
|
||||||
|
"test|t",
|
||||||
|
"verbose|v"
|
||||||
|
) || print_help("");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Override predefined Log file name
|
||||||
|
#
|
||||||
|
if (defined $opt_log)
|
||||||
|
{
|
||||||
|
if ($opt_log ne "")
|
||||||
|
{
|
||||||
|
if ($opt_log =~ /^\/.*/)
|
||||||
|
{
|
||||||
|
$logfile= $opt_log;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
chomp ($logfile= `pwd`);
|
||||||
|
$logfile.= "/" . $opt_log;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print_help("") if ($opt_help);
|
||||||
|
defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!");
|
||||||
|
|
||||||
|
&logger("Starting build");
|
||||||
|
&abort("The directory \"$REPO\" could not be found!") if (!-d $REPO);
|
||||||
|
&logger("Using $REPO as the BK parent repository");
|
||||||
|
system ("bk help > /dev/null") == 0 or &abort("Cannot execute BitKeeper binary!");
|
||||||
|
system ("bk root $REPO > /dev/null 2>&1") == 0 or &abort("$REPO does not seem to be a valid BK repository!");
|
||||||
|
|
||||||
|
if (($opt_directory ne ".") && (!-d $opt_directory && !$opt_dry_run))
|
||||||
|
{
|
||||||
|
&abort("Could not find target directory \"$opt_directory\"!");
|
||||||
|
}
|
||||||
|
|
||||||
|
&logger("Logging to $logfile") if (defined $opt_log);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use a temporary name until we know the version number
|
||||||
|
#
|
||||||
|
$target_dir= $opt_directory . "/mysql-" . $$ . "-" . time() . ".tmp";
|
||||||
|
&logger("Using temporary directory $target_dir");
|
||||||
|
&abort("Target directory $target_dir already exists!") if (-d $target_dir && !$opt_dry_run);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Export the BK tree
|
||||||
|
#
|
||||||
|
$command= "bk export ";
|
||||||
|
$command.= "-r " . $opt_revision . " " if $opt_revision;
|
||||||
|
$command.= "-v " if ($opt_verbose || defined $opt_log);
|
||||||
|
$command.= $REPO . " " . $target_dir;
|
||||||
|
&logger("Exporting $REPO");
|
||||||
|
&run_command($command, "Could not create $target_dir!");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Make sure we can write all files
|
||||||
|
#
|
||||||
|
$command= "find $target_dir -type f -print0 | xargs --null chmod u+w";
|
||||||
|
&run_command($command, "Failed to fix file permissions!");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Try to obtain version number from newly extracted configure.in
|
||||||
|
#
|
||||||
|
$CONF="$target_dir/configure.in";
|
||||||
|
&abort("Could not find \"$CONF\" to determine version!") if (!-f $CONF && !$opt_dry_run);
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following can only be done, if the tree has actually been
|
||||||
|
# exported - it cannot be performed in a dry run.
|
||||||
|
#
|
||||||
|
if (!$opt_dry_run)
|
||||||
|
{
|
||||||
|
open (CONF, $CONF) or &abort("Unable to open \"$CONF\": $!");
|
||||||
|
@conf= <CONF>;
|
||||||
|
close CONF;
|
||||||
|
|
||||||
|
foreach (@conf)
|
||||||
|
{
|
||||||
|
m/^AM_INIT_AUTOMAKE\(mysql, ([1-9]\.[0-9]{1,2}\.[0-9]{1,2}.*)\)/;
|
||||||
|
$version= $1;
|
||||||
|
}
|
||||||
|
&logger("Found version string: $version");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add suffix to version string and write out the modified file
|
||||||
|
#
|
||||||
|
if ($opt_suffix)
|
||||||
|
{
|
||||||
|
$opt_suffix= "-" . &ymd() if ($opt_suffix eq "YMD");
|
||||||
|
|
||||||
|
&logger("Replacing $version with $version$opt_suffix");
|
||||||
|
foreach (@conf)
|
||||||
|
{
|
||||||
|
s/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE\(mysql, $version$opt_suffix\)/;
|
||||||
|
}
|
||||||
|
open(CONF,">$CONF") or &abort("Unable to open \"$CONF\": $!");
|
||||||
|
print CONF @conf;
|
||||||
|
close(CONF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Rename directory according to the version number found in configure.in
|
||||||
|
# of the extracted tree (plus suffix, if requested)
|
||||||
|
#
|
||||||
|
$temp_name= $target_dir;
|
||||||
|
$target_dir= $opt_directory . "/mysql-" . $version . $opt_suffix . "-build";
|
||||||
|
if (-d $target_dir)
|
||||||
|
{
|
||||||
|
&logger("Target directory $target_dir already exists!");
|
||||||
|
if ($opt_delete)
|
||||||
|
{
|
||||||
|
&logger("Deleting $target_dir...");
|
||||||
|
$command= "rm ";
|
||||||
|
$command.= "-v " if ($opt_verbose || defined $opt_log);
|
||||||
|
$command.= "$target_dir";
|
||||||
|
&run_command($command, "Could not delete $target_dir!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&logger("Renaming $target_dir to $target_dir.old." . $$);
|
||||||
|
$command= "mv ";
|
||||||
|
$command.= "-v " if ($opt_verbose || defined $opt_log);
|
||||||
|
$command.= "$target_dir $target_dir.old." . $$;
|
||||||
|
&run_command($command, "Could not rename $target_dir!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&logger("Renaming temporary directory to $target_dir");
|
||||||
|
$command= "mv ";
|
||||||
|
$command.= "-v " if ($opt_verbose || defined $opt_log);
|
||||||
|
$command.= "$temp_name $target_dir";
|
||||||
|
&run_command($command, "Could not rename $temp_name!");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add a ChangeLog (make dist will pick it up automatically)
|
||||||
|
#
|
||||||
|
if (defined $opt_changelog)
|
||||||
|
{
|
||||||
|
#
|
||||||
|
# Use some magic to obtain the correct ChangeSet number that identifies
|
||||||
|
# the last tagged ChangeSet (this relies heavily on our current tagging
|
||||||
|
# practice!)
|
||||||
|
#
|
||||||
|
my $revision= "";
|
||||||
|
if ($opt_changelog eq "last")
|
||||||
|
{
|
||||||
|
if (!$opt_revision)
|
||||||
|
{
|
||||||
|
$revision= `bk changes -t -d':REV:' -n $REPO | head -1`;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$revision= `bk changes -r..$opt_revision -t -d':REV:' -n $REPO | head -2 | tail -1`;
|
||||||
|
}
|
||||||
|
chomp($revision);
|
||||||
|
$opt_changelog= $revision;
|
||||||
|
}
|
||||||
|
|
||||||
|
$msg= "Adding $target_dir/ChangeLog";
|
||||||
|
$msg.= " (down to revision $opt_changelog)" if $opt_changelog ne "";
|
||||||
|
&logger($msg);
|
||||||
|
$command= "bk changes -v";
|
||||||
|
$command.= " -r" if ($opt_changelog ne "" || $opt_revision);
|
||||||
|
$command.= $opt_changelog if $opt_changelog ne "";
|
||||||
|
$command.= ".." if ($opt_changelog ne "" && !$opt_revision);
|
||||||
|
$command.= ".." . $opt_revision if $opt_revision;
|
||||||
|
$command.= " " . $REPO . " > $target_dir/ChangeLog";
|
||||||
|
&logger($command);
|
||||||
|
# We cannot use run_command here because of output redirection
|
||||||
|
if (!$opt_dry_run)
|
||||||
|
{
|
||||||
|
system($command) == 0 or &abort("Could not create $target_dir/ChangeLog!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add the latest manual from the mysqldoc tree
|
||||||
|
#
|
||||||
|
if (!$opt_skip_manual)
|
||||||
|
{
|
||||||
|
$msg= "Adding manual.texi";
|
||||||
|
&logger($msg);
|
||||||
|
$command= "install -m 644 $opt_docdir/Docs/{manual,reservedwords}.texi";
|
||||||
|
$command.= " $target_dir/Docs/";
|
||||||
|
&run_command($command, "Could not update the manual in $target_dir/Docs/!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Abort here, if we just wanted to export the tree
|
||||||
|
#
|
||||||
|
if ($opt_export_only)
|
||||||
|
{
|
||||||
|
&logger("SUCCESS: Export finished successfully.");
|
||||||
|
exit 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Enter the target directory first
|
||||||
|
#
|
||||||
|
&logger("Entering $target_dir");
|
||||||
|
if (!$opt_dry_run)
|
||||||
|
{
|
||||||
|
chdir($target_dir) or &abort("Cannot chdir to $target_dir: $!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Now build the source distribution
|
||||||
|
#
|
||||||
|
&logger("Compiling");
|
||||||
|
$command= $build_command;
|
||||||
|
&run_command($command, "Compilation failed!");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Testing the built binary by running "make test" (optional)
|
||||||
|
#
|
||||||
|
if ($opt_test)
|
||||||
|
{
|
||||||
|
&logger ("Running test suite");
|
||||||
|
$command= "make test";
|
||||||
|
&run_command($command, "\"make test\" failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pack it all up
|
||||||
|
#
|
||||||
|
&logger("Creating source distribution");
|
||||||
|
$command= "make dist";
|
||||||
|
&run_command($command, "make dist failed!");
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run "make distcheck" to verify the source archive
|
||||||
|
#
|
||||||
|
if (!$opt_skip_check)
|
||||||
|
{
|
||||||
|
&logger ("Checking source distribution");
|
||||||
|
$command= "make distcheck";
|
||||||
|
&run_command($command, "make distcheck failed!");
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# All done when we came down here
|
||||||
|
#
|
||||||
|
&logger("SUCCESS: Build finished successfully.") if (!$opt_dry_run);
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
# Helper functions
|
||||||
|
|
||||||
|
#
|
||||||
|
# run_command(<command>,<error message>)
|
||||||
|
# Execute the given command or die with the respective error message
|
||||||
|
# Just print out the command when doing a dry run
|
||||||
|
#
|
||||||
|
sub run_command
|
||||||
|
{
|
||||||
|
my $command= $_[0];
|
||||||
|
my $errormsg= $_[1];
|
||||||
|
if ($opt_dry_run)
|
||||||
|
{
|
||||||
|
print "$command\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
&logger($command);
|
||||||
|
$command.= " >> $logfile 2>&1" if defined $opt_log;
|
||||||
|
$command.= " > /dev/null" if (!$opt_verbose && !$opt_log);
|
||||||
|
system($command) == 0 or &abort("$errormsg\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# abort(<message>)
|
||||||
|
# Exit with giving out the given error message or by sending
|
||||||
|
# it via email to the given mail address (including a log file snippet,
|
||||||
|
# if available)
|
||||||
|
#
|
||||||
|
sub abort
|
||||||
|
{
|
||||||
|
my $message= $_[0];
|
||||||
|
my $messagefile;
|
||||||
|
$message= "ERROR: " . $message;
|
||||||
|
&logger($message);
|
||||||
|
|
||||||
|
if ($opt_mail && !$opt_dry_run)
|
||||||
|
{
|
||||||
|
$messagefile= "/tmp/message.$$";
|
||||||
|
$subject= "Bootstrap of $REPO failed";
|
||||||
|
open(TMP,">$messagefile");
|
||||||
|
print TMP "$message\n\n";
|
||||||
|
close TMP;
|
||||||
|
if (defined $opt_log)
|
||||||
|
{
|
||||||
|
system("tail -n 40 $logfile >> $messagefile");
|
||||||
|
}
|
||||||
|
system("mail -s \"$subject\" $opt_mail < $messagefile");
|
||||||
|
unlink($messagefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Print the help text message (with an optional message on top)
|
||||||
|
#
|
||||||
|
sub print_help
|
||||||
|
{
|
||||||
|
my $message= $_[0];
|
||||||
|
if ($message ne "")
|
||||||
|
{
|
||||||
|
print "\n";
|
||||||
|
print "ERROR: $message\n";
|
||||||
|
}
|
||||||
|
print <<EOF;
|
||||||
|
|
||||||
|
Usage: Bootstrap [options] <bk repository>
|
||||||
|
|
||||||
|
Checks out (exports) a clear-text version of the given local BitKeeper
|
||||||
|
repository, creates and adds a Changelog file (if requested), adds the
|
||||||
|
latest manual.texi from the mysqldoc tree and builds a source distribution
|
||||||
|
(*.tar.gz) file. Optionally, the test suite can be run before the source
|
||||||
|
archive is being created.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-c, --changelog[=<rev>] Add a ChangeLog [down to revision <rev>]
|
||||||
|
This will automatically be included in the source
|
||||||
|
distribution. To get a ChangeLog down to the last
|
||||||
|
tagged Changeset, simply use "last" as the revision
|
||||||
|
number.
|
||||||
|
--delete Delete an already existing distribution directory
|
||||||
|
in the target directory instead of renaming it.
|
||||||
|
-d, --directory=<dir> Specify the target directory
|
||||||
|
(default is "$opt_directory")
|
||||||
|
--docdir=<dir> Use the MySQL documentation BK tree located in in <dir>
|
||||||
|
(default is "$opt_docdir")
|
||||||
|
--dry-run Dry run without executing
|
||||||
|
-e, --export-only Just export (and add the ChangeLog, if requested),
|
||||||
|
do not build or test the source distribution
|
||||||
|
-h, --help Print this help message
|
||||||
|
-l, --log[=<filename>] Write a log file [to <filename>]
|
||||||
|
(default is "$logfile")
|
||||||
|
-m, --mail=<address> Mail a failure report to the given address (and
|
||||||
|
include a log file snippet, if logging is enabled)
|
||||||
|
Note that the \@-Sign needs to be quoted!
|
||||||
|
Example: --mail=user\\\@domain.com
|
||||||
|
-r, --revision=<rev> Export the tree as of revision <rev>
|
||||||
|
(default is up to the latest revision)
|
||||||
|
-s, --skip-check Skip checking the distribution with "make distcheck"
|
||||||
|
--skip-manual Skip updating the manual from the mysqldoc tree
|
||||||
|
--suffix=<suffix> Append <suffix> to the version number in configure.in.
|
||||||
|
Using the special suffix "YMD" will add the current
|
||||||
|
date as the suffix (e.g. "-20020518").
|
||||||
|
-t, --test Run the test suite after build
|
||||||
|
-v, --verbose Be verbose
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Bootstrap -c last -v -l -- mysql-4.0
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 1;
|
||||||
|
}
|
147
Build-tools/Do-pkg
Executable file
147
Build-tools/Do-pkg
Executable file
@@ -0,0 +1,147 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
#
|
||||||
|
# Do-pkg - convert a binary distribution into a Mac OS X PKG and put it
|
||||||
|
# inside a Disk Image (.dmg)
|
||||||
|
#
|
||||||
|
# Use the "--help" option for more info!
|
||||||
|
#
|
||||||
|
# written by Lenz Grimmer <lenz@mysql.com>
|
||||||
|
#
|
||||||
|
|
||||||
|
use Getopt::Long;
|
||||||
|
|
||||||
|
$opt_help= undef;
|
||||||
|
$opt_suffix= undef;
|
||||||
|
$opt_version= undef;
|
||||||
|
|
||||||
|
GetOptions(
|
||||||
|
"help|h",
|
||||||
|
"suffix=s",
|
||||||
|
"version=s",
|
||||||
|
) || &print_help;
|
||||||
|
|
||||||
|
&print_help if ($opt_help || !$opt_suffix || !$opt_version);
|
||||||
|
|
||||||
|
$PM= "/Developer/Applications/PackageMaker.app/Contents/MacOS/PackageMaker";
|
||||||
|
$HOME= $ENV{HOME};
|
||||||
|
$TMP= "/tmp/PKGBUILD";
|
||||||
|
$PKGROOT= "$TMP/PMROOT";
|
||||||
|
$PKGDEST= "$TMP/PKG";
|
||||||
|
$RESOURCE_DIR= "$TMP/Resources";
|
||||||
|
$SUFFIX= $opt_suffix;
|
||||||
|
$VERSION= $opt_version;
|
||||||
|
$NAME= "mysql$SUFFIX-$VERSION";
|
||||||
|
chomp($HOST= `hostname`);
|
||||||
|
$HOST=~ /^([^.-]*)/;
|
||||||
|
$HOST= $1;
|
||||||
|
$BUILDDIR= "$HOME/$HOST";
|
||||||
|
$SUPFILEDIR= <$BUILDDIR/mysql*-$VERSION/support-files/MacOSX>;
|
||||||
|
$TAR= <$BUILDDIR/$NAME-apple-darwin*-powerpc.tar.gz>;
|
||||||
|
$INFO= <$SUPFILEDIR/Info.plist>;
|
||||||
|
$DESC= <$SUPFILEDIR/Description.plist>;
|
||||||
|
@RESOURCES= qw/ ReadMe.txt postinstall preinstall /;
|
||||||
|
|
||||||
|
print "TAR: $TAR\nINFO: $INFO\nDESC: $DESC\n";
|
||||||
|
|
||||||
|
# Creating the UFS disk image requires root privileges
|
||||||
|
chomp($ID= `whoami`);
|
||||||
|
die "You must be root to run this script!\nUse \"sudo\" or become root first.\n" if ($ID ne "root");
|
||||||
|
|
||||||
|
foreach $file ($TAR, $INFO, $DESC)
|
||||||
|
{
|
||||||
|
die "Unable to find $file!\n" if (!-f $file);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove old temporary build directories first
|
||||||
|
system ("rm -rf $TMP");
|
||||||
|
print "Creating temp directories\n";
|
||||||
|
foreach $dir ($TMP, $PKGROOT, $PKGDEST, $RESOURCE_DIR)
|
||||||
|
{
|
||||||
|
if (!-d $dir)
|
||||||
|
{
|
||||||
|
mkdir $dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $resfile (@RESOURCES)
|
||||||
|
{
|
||||||
|
system ("cp $SUPFILEDIR/$resfile $RESOURCE_DIR") == 0 or die "Error while copying $SUPFILEDIR/$resfile to $RESOURCE_DIR: ?!";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Extract the binary tarball and create the "mysql" symlink
|
||||||
|
print "Extracting $TAR to $PKGROOT\n";
|
||||||
|
system("gnutar zxf $TAR -C $PKGROOT") if (-f $TAR);
|
||||||
|
system("cd $PKGROOT ; ln -s mysql* ./mysql");
|
||||||
|
system("chown -R root.wheel $PKGROOT/*");
|
||||||
|
|
||||||
|
# Now build the PGK using PackageMaker
|
||||||
|
print "Running PackageMaker\n";
|
||||||
|
system("$PM -build -p $PKGDEST/$NAME.pkg -f $PKGROOT -r $RESOURCE_DIR -i $INFO -d $DESC") or die "Error while building package: $!\n";
|
||||||
|
|
||||||
|
print "Removing $PKGROOT\n";
|
||||||
|
system("rm -rf $PKGROOT");
|
||||||
|
|
||||||
|
# Determine the size of the Disk image to be created and add a 5% safety
|
||||||
|
# margin for filesystem overhead
|
||||||
|
print "Determining required disk image size for $PKGDEST: ";
|
||||||
|
chomp($_= `du -sk $PKGDEST`);
|
||||||
|
@size= split();
|
||||||
|
$size= int($size[0]+($size[0]*0.05));
|
||||||
|
print "$size KB\n";
|
||||||
|
|
||||||
|
die "Zero bytes? Something is wrong here!\n" if ($size == 0);
|
||||||
|
|
||||||
|
# Now create and mount the disk image
|
||||||
|
$TMPNAME= $NAME . ".tmp";
|
||||||
|
print "Creating temporary Disk image $TMPNAME\n";
|
||||||
|
system("hdiutil create $TMPNAME -size ${size}k -ov -fs UFS -volname $NAME");
|
||||||
|
print "Result: $!\n";
|
||||||
|
print "Attaching Disk image $TMPNAME.dmg\n";
|
||||||
|
system("hdid $TMPNAME.dmg");
|
||||||
|
print "Result: $!\n";
|
||||||
|
|
||||||
|
# Install the PKG into the .dmg
|
||||||
|
chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f3 -d" "`);
|
||||||
|
print "Copying $PKGDEST/$NAME.pkg to Disk image /Volumes/$NAME\n";
|
||||||
|
system("ditto $PKGDEST /Volumes/$NAME");
|
||||||
|
system("ditto $RESOURCE_DIR/ReadMe.txt /Volumes/$NAME");
|
||||||
|
chomp($mountpoint=`mount | grep "\/Volumes\/$NAME" | cut -f1 -d" "`);
|
||||||
|
die "/Volumes/$NAME not attached!\n" if (!$mountpoint);
|
||||||
|
print "Unmounting $mountpoint\n";
|
||||||
|
system("hdiutil detach $mountpoint");
|
||||||
|
print "Result: $!\n";
|
||||||
|
unlink ("$NAME.dmg") if (-f "$NAME.dmg");
|
||||||
|
print "Compressing disk image\n";
|
||||||
|
system("hdiutil convert $TMPNAME.dmg -format UDZO -imagekey zlib-level=9 -o $NAME.dmg");
|
||||||
|
|
||||||
|
# Final cleanups
|
||||||
|
print "Removing $TMPNAME.dmg\n";
|
||||||
|
unlink ("$TMPNAME.dmg");
|
||||||
|
print "Removing $TMP\n";
|
||||||
|
system("rm -rf $TMP");
|
||||||
|
|
||||||
|
print "$NAME.dmg created.\n";
|
||||||
|
exit 0;
|
||||||
|
|
||||||
|
sub print_help
|
||||||
|
{
|
||||||
|
print <<EOF;
|
||||||
|
|
||||||
|
Usage: Do-pkg --suffix=<suffix> --version=<version>
|
||||||
|
|
||||||
|
Creates a Mac OS X installation package (PKG) and stores it inside
|
||||||
|
a Disk Image (.dmg) file. You need to create a binary distribution
|
||||||
|
tarball with scripts/make_binary_distribution first!
|
||||||
|
|
||||||
|
NOTE: You need to run this script with root privileges (required
|
||||||
|
to create the disk image)
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
-h, --help Print this help
|
||||||
|
--suffix=<suffix> The package suffix (e.g. "-standard" or "-pro)
|
||||||
|
--version=<version> The MySQL version number (e.g. 4.0.11-gamma)
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 1;
|
||||||
|
}
|
51
Build-tools/logger.pm
Normal file
51
Build-tools/logger.pm
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
#
|
||||||
|
# Create a log entry
|
||||||
|
#
|
||||||
|
sub logger
|
||||||
|
{
|
||||||
|
my $message=$_[0];
|
||||||
|
print timestamp() . " " . $message . "\n" if $opt_verbose;
|
||||||
|
if (defined $opt_log && !$opt_dry_run)
|
||||||
|
{
|
||||||
|
open LOG, ">>$logfile" or die "Can't open logfile $logfile!";
|
||||||
|
print LOG timestamp() . " " . $message . "\n";
|
||||||
|
close LOG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a time stamp for logging purposes
|
||||||
|
sub timestamp
|
||||||
|
{
|
||||||
|
return &ymd() . " " . &hms();
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# return the current time as a string (HH:MM:SS)
|
||||||
|
#
|
||||||
|
sub hms
|
||||||
|
{
|
||||||
|
my @ta= localtime(time());
|
||||||
|
my $h= $ta[2];
|
||||||
|
$h= "0" . "$h" if ($h <= 9);
|
||||||
|
my $m= $ta[1];
|
||||||
|
$m= "0" . "$m" if ($m <= 9);
|
||||||
|
my $s= $ta[0];
|
||||||
|
$s="0" . "$s" if ($s <= 9);
|
||||||
|
|
||||||
|
return "$h:$m:$s";
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# return the current date as a string (YYYYMMDD)
|
||||||
|
#
|
||||||
|
sub ymd
|
||||||
|
{
|
||||||
|
my @ta=localtime(time());
|
||||||
|
my $d=$ta[3];
|
||||||
|
$d="0" . "$d" if ($d <= 9);
|
||||||
|
my $m=$ta[4]+1;
|
||||||
|
$m="0" . "$m" if ($m <= 9);
|
||||||
|
my $y=1900+$ta[5];
|
||||||
|
|
||||||
|
return "$y$m$d";
|
||||||
|
}
|
@@ -5,7 +5,7 @@
|
|||||||
<key>IFPkgDescriptionDeleteWarning</key>
|
<key>IFPkgDescriptionDeleteWarning</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>IFPkgDescriptionDescription</key>
|
<key>IFPkgDescriptionDescription</key>
|
||||||
<string>This package provides a binary installation of MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X.</string>
|
<string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X</string>
|
||||||
<key>IFPkgDescriptionTitle</key>
|
<key>IFPkgDescriptionTitle</key>
|
||||||
<string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X</string>
|
<string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@ for Mac OS X</string>
|
||||||
<key>IFPkgDescriptionVersion</key>
|
<key>IFPkgDescriptionVersion</key>
|
||||||
|
@@ -17,19 +17,34 @@
|
|||||||
|
|
||||||
## Process this file with automake to create Makefile.in
|
## Process this file with automake to create Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = Info.plist.sh Description.plist.sh
|
EXTRA_DIST = Info.plist.sh \
|
||||||
|
Description.plist.sh \
|
||||||
|
StartupParameters.plist.sh \
|
||||||
|
postinstall.sh \
|
||||||
|
preinstall.sh \
|
||||||
|
ReadMe.txt
|
||||||
|
|
||||||
pkgdata_DATA = Info.plist Description.plist
|
pkgdata_DATA = Info.plist \
|
||||||
|
Description.plist \
|
||||||
|
StartupParameters.plist \
|
||||||
|
postinstall \
|
||||||
|
preinstall
|
||||||
|
|
||||||
CLEANFILES = Info.plist Description.plist
|
CLEANFILES = Info.plist \
|
||||||
|
Description.plist \
|
||||||
|
StartupParameters.plist \
|
||||||
|
postinstall \
|
||||||
|
preinstall
|
||||||
|
|
||||||
SUFFIXES = .sh
|
SUFFIXES = .sh
|
||||||
|
|
||||||
.sh:
|
.sh:
|
||||||
@RM@ -f $@ $@-t
|
@RM@ -f $@ $@-t
|
||||||
@SED@ \
|
@SED@ \
|
||||||
|
-e 's!@''prefix''@!$(prefix)!g' \
|
||||||
-e 's!@''VERSION''@!@VERSION@!' \
|
-e 's!@''VERSION''@!@VERSION@!' \
|
||||||
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
|
-e 's!@''MYSQL_SERVER_SUFFIX''@!@MYSQL_SERVER_SUFFIX@!' \
|
||||||
|
-e 's!@''MYSQLD_USER''@!@MYSQLD_USER@!' \
|
||||||
$< > $@-t
|
$< > $@-t
|
||||||
@MV@ $@-t $@
|
@MV@ $@-t $@
|
||||||
|
|
||||||
|
80
support-files/MacOSX/ReadMe.txt
Normal file
80
support-files/MacOSX/ReadMe.txt
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
Installation notes for MySQL on Mac OS X
|
||||||
|
|
||||||
|
PLEASE READ!
|
||||||
|
|
||||||
|
For more details about installing and running
|
||||||
|
MySQL on Mac OS X, also refer to the manual,
|
||||||
|
which is available online:
|
||||||
|
|
||||||
|
http://www.mysql.com/doc/en/Mac_OS_X_installation.html
|
||||||
|
|
||||||
|
NOTE: Before proceeding with the installation, please
|
||||||
|
make sure that no other MySQL server is running!
|
||||||
|
|
||||||
|
Please shut down all running MySQL instances before
|
||||||
|
continuing by either using the MySQL Manager
|
||||||
|
Application (on Mac OS X Server) or via "mysqladmin
|
||||||
|
shutdown" on the command line.
|
||||||
|
|
||||||
|
This MySQL package will be installed into
|
||||||
|
"/usr/local/mysql-<version>" and will also create a
|
||||||
|
symbolic link "/usr/local/mysql", pointing to the new
|
||||||
|
location.
|
||||||
|
|
||||||
|
A previously existing /usr/local/mysql directory will
|
||||||
|
be renamed to /usr/local/mysql.bak before proceeding
|
||||||
|
with the installation.
|
||||||
|
|
||||||
|
Additionally, it will install the mysql grant tables by
|
||||||
|
executing "mysql_install_db" after the installation.
|
||||||
|
|
||||||
|
If you are running Mac OS X Server, you already have a
|
||||||
|
version MySQL installed. Make sure to read Apple's help
|
||||||
|
about installing MySQL (Run the "Help View" application,
|
||||||
|
select "Mac OS X Server help", and do a search for MySQL
|
||||||
|
and read the item entitled "Installing MySQL").
|
||||||
|
|
||||||
|
If you previously used Marc Liyanage's MySQL packages
|
||||||
|
for MacOS X from http://www.entropy.ch, you can simply
|
||||||
|
follow the update instructions given on his pages.
|
||||||
|
|
||||||
|
After the installation (and restoring the old database
|
||||||
|
files, if necessary), you can start up MySQL by running
|
||||||
|
the following commands in a terminal window:
|
||||||
|
|
||||||
|
cd /usr/local/mysql
|
||||||
|
sudo ./bin/mysqld_safe
|
||||||
|
(Enter your password)
|
||||||
|
(Press CTRL+Z)
|
||||||
|
(Press CTRL+D to exit the shell)
|
||||||
|
bg
|
||||||
|
|
||||||
|
You should now be able to connect to the MySQL server,
|
||||||
|
e.g. by running /usr/local/mysql/bin/mysql
|
||||||
|
|
||||||
|
If you installed MySQL for the first time,
|
||||||
|
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!
|
||||||
|
This is done with the following two commands:
|
||||||
|
|
||||||
|
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
|
||||||
|
|
||||||
|
/usr/local/mysql/bin/mysqladmin -u root -h $hostname password 'new-password'
|
||||||
|
|
||||||
|
Please note, that after upgrading from MySQL 3.23 to
|
||||||
|
MySQL 4.0 it is recommended to convert the MySQL
|
||||||
|
privilege tables using the mysql_fix_privilege_tables
|
||||||
|
script, since some new security privileges have been
|
||||||
|
added.
|
||||||
|
|
||||||
|
Please see
|
||||||
|
http://www.mysql.com/doc/en/Upgrading-from-3.23.html
|
||||||
|
for more information on how to upgrade from MySQL 3.23.
|
||||||
|
|
||||||
|
If you do not want to have to type the full path
|
||||||
|
"/usr/local/mysql/bin" in front of every command, you
|
||||||
|
can to add this directory to your PATH environment
|
||||||
|
variable in your login script. For the default shell
|
||||||
|
"tcsh", you can do this by running this command once:
|
||||||
|
|
||||||
|
echo 'setenv PATH $PATH:/usr/local/mysql/bin' >> ~/.tcshrc
|
||||||
|
|
19
support-files/MacOSX/StartupParameters.plist.sh
Normal file
19
support-files/MacOSX/StartupParameters.plist.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>Description</key>
|
||||||
|
<string>MySQL @VERSION@@MYSQL_SERVER_SUFFIX@</string>
|
||||||
|
<key>OrderPreference</key>
|
||||||
|
<string>None</string>
|
||||||
|
<key>Provides</key>
|
||||||
|
<array>
|
||||||
|
<string>MySQL</string>
|
||||||
|
</array>
|
||||||
|
<key>Uses</key>
|
||||||
|
<array>
|
||||||
|
<string>Network</string>
|
||||||
|
<string>Resolver</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
18
support-files/MacOSX/postinstall.sh
Normal file
18
support-files/MacOSX/postinstall.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# postinstall - this script will be executed after the MySQL PKG
|
||||||
|
# installation has been performed.
|
||||||
|
#
|
||||||
|
# This script will install the MySQL privilege tables using the
|
||||||
|
# "mysql_install_db" script and will correct the ownerships of these files
|
||||||
|
# afterwards.
|
||||||
|
#
|
||||||
|
|
||||||
|
cd @prefix@
|
||||||
|
if [ ! -f data/mysql/db.frm ] ; then
|
||||||
|
./scripts/mysql_install_db
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d data ] ; then
|
||||||
|
chown -R @MYSQLD_USER@ data
|
||||||
|
fi
|
18
support-files/MacOSX/preinstall.sh
Normal file
18
support-files/MacOSX/preinstall.sh
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# preinstall - this script will be executed before the MySQL PKG
|
||||||
|
# installation will be performed.
|
||||||
|
#
|
||||||
|
# If this package has been compiled with a prefix ending with "mysql" (e.g.
|
||||||
|
# /usr/local/mysql or /opt/mysql), it will rename any previosuly existing
|
||||||
|
# directory with this name before installing the new package (which includes
|
||||||
|
# a symlink named "mysql", pointing to the newly installed directory, which
|
||||||
|
# is named mysql-<version>)
|
||||||
|
#
|
||||||
|
|
||||||
|
PREFIX="@prefix@"
|
||||||
|
BASENAME=`basename $PREFIX`
|
||||||
|
|
||||||
|
if [ -d $PREFIX -a ! -L $PREFIX -a $BASENAME = "mysql" ] ; then
|
||||||
|
mv $PREFIX $PREFIX.bak
|
||||||
|
fi
|
Reference in New Issue
Block a user