Commit 21fd4e57 authored by vasil's avatar vasil

Remove the aux build script as they are now in the plugin/ repo.

parent e4ca7e89
#!/usr/bin/perl -w
#
# (C)opyright Oracle/Innobase Oy. 2007.
#
# The purpose of this (simple) script is to create a configure command line
# that can be used to build the InnoDB dynamic plugin. It makes the assumption
# that the configure parameters are quoted like so '--with-innodb'. It uses
# this to split the string on "'".
#
# Usage: dynconfig <path/to/mysqlbug>
#
# RETURNS: 0 OK
use strict;
use warnings;
my $buffer;
# These are the engines whose config parameters we need to remove.
my @engines = (
"ndbcluster",
"innodb",
"csv",
"archive",
"blackhole",
"example",
"federated",
"embedded-server",
"partition"
);
# Map the following variables to something else. If you want to remove any
# parameters from the configure command line, simply add an "" value to the
# hashtable below.
my %mapped = (
"--disable-shared" => "",
"--enable-static" => "--enable-shared"
);
# Variables to use from the environment if defined
my @environment = (
"CC",
"CXX"
);
sub get_value {
my ($line) = @_;
$line =~ s/^CONFIGURE_LINE="(.*)"$/$1/;
return($line);
}
sub is_with_engine {
my ($param) = @_;
foreach my $engine (@engines) {
if ($param =~ /--with-$engine/) {
return($engine);
} elsif ($param =~ /--with-$engine-storage-engine/) {
return($engine);
}
}
return(undef);
}
sub map_param {
my ($param) = @_;
my ($name, $value) = split(/=/, $param);
my $mapped;
if (!defined($value)) {
$mapped = $mapped{$param};
} else {
$mapped = $mapped{$name};
}
return(defined($mapped) ? $mapped: $param);
}
# Remove leading whitespace
sub ltrim($) {
my $string = shift;
$string =~ s/^\s+//;
return $string;
}
# Remove trailing whitespace
sub rtrim($) {
my $string = shift;
$string =~ s/\s+$//;
return $string;
}
# Remove leading and trailing whitespace
sub squeeze($) {
my $string = shift;
return(rtrim(ltrim($string)));
}
if ($#ARGV != 1) {
die "usage: $0 target-arch path/to/mysqlbug\n";
}
my $mysqlbug = $ARGV[1];
my $arch = squeeze($ARGV[0]);
open(F, $mysqlbug) ||
die "Error opening $mysqlbug: $!\n";
read(F, $buffer, 131072) ||
die "Error reading file $mysqlbug: $!\n";
close(F);
my @matched = grep(/^CONFIGURE_LINE=/, split(/\n/, $buffer));
# Check for no match
if ($#matched == -1 ) {
die "CONFIGURE_LINE= not found in : $mysqlbug\n";
# Check if more than one line matched
} elsif ($#matched > 0) {
die "Error: $#matched matches for CONFIGURE_LINE= found.\n";
}
# Since CONFIGURE_LINE is an environment variable we extract the value,
# stripping the "" quotes around the value too.
my $configure = get_value($matched[0]);
# Insert the environment variables if found into the hash table
foreach my $var (@environment) {
if (defined($ENV{$var})) {
$mapped{$var} = "$var=" . $ENV{$var};
}
}
# We don't compile with the PIC flag for i386.
if ($arch =~ /^i[3456]86$/) {
$mapped{"--with-pic"} = "--without-pic";
}
# Set the value to "" for the parameters to be removed.
if (defined($ENV{"MYSQL_CONFIG_DEL"})) {
my $value = $ENV{"MYSQL_CONFIG_DEL"};
($value) =~ s/MYSQL_CONFIG_DEL="(.+)"$/$1/;
foreach my $param (split(/,/, $value)) {
$param = squeeze($param);
if ($param =~ /^'(.+)'$/) {
$param = $1;
}
$mapped{$param} = "";
}
}
my @arr = split("'", $configure);
foreach my $param (@arr) {
# Skip blank lines
if ($param =~ /^\s+$/) {
next;
# We don't want to put quotes around the command
} elsif ($param =~ /.\/configure/) {
print "$param";
next;
# Filter out the --with-engine parameters
} elsif (is_with_engine($param)) {
next;
}
$param = map_param($param);
if (length($param) > 0) {
print " '$param'";
}
}
if (defined($ENV{"MYSQL_CONFIG_ADD"})) {
my $value = $ENV{"MYSQL_CONFIG_ADD"};
$value =~ s/MYSQL_CONFIG_ADD="(.+)"$/$1/;
foreach my $param (split(/,/, $value)) {
$param = squeeze($param);
if ($param =~ /^'(.+)'$/) {
$param = $1;
}
print " '$param'";
}
}
print "\n";
exit(0);
#!/bin/sh
#
# (C)opyright Oracle/Innobase Oy. 2007
#
# Prerequisites: At the minimum rsync, auto{make, conf}, gcc, g++, perl
#
# Purpose: Build a dynamic plugin that can be distributed to users.
#
# Usage: This script takes at the minimum 4 parameters:
# 1. the MySQL source directory,
#
# 2. the plugin build directory - better if this doesn't exist,
#
# 3. an SVN repository URL or path to a tar.gz file that contains
# the plugin source. The tar file should be named such that the
# top level directory in the archive is reflected in the name of
# the tar file. e.g. innodb-1.0-5.1.tar.gz when extracted should
# have a top level directory named "innodb-1.0-5.1".
#
# 4. Target architecture e.g., i386 or amd64
#
# 5. path to the target mysqlbug file or '-', if the third param is
# '-' then all options following it are passed to the configure command.
#
# Note: The mysqlbug file is normally located in the bin directory where you
# will find the MySQL binaries. Remember to use the same mysqlbug file as the
# one used by the target version, run (grep '^VERSION=' mysqlbug) file to check.
set -eu
# Calculate the length of a string
strlen()
{
STRLEN=`echo "$@" | wc -c | cut -c1-8`
STRLEN=`expr $STRLEN - 1`
echo $STRLEN
}
INNODIR="storage/innobase"
DYNTMPFILE="/tmp/configure.$$"
#DYNCONFIG="$INNODIR/scripts/dynconfig"
DYNCONFIG="$HOME/scripts/dynconfig"
SVN_REPO="https://svn.innodb.com/svn/innodb"
SVN_REPO_STRLEN=`strlen $SVN_REPO`
if [ $# -lt 4 ]; then
echo>&2 "Usage: $0 mysql-source-dir build-dir innosrc target-arch (/path/to/mysqlbug | - followed by configure options)"
exit 1
fi
SRC=$1; shift
BLD=$1; shift
SVN=$1; shift
ARH=$1; shift
CFL=$1; shift
# These can be overridden with environment variables.
# For example: MAKE="make -j4" or RSYNC="rsync -v"
: ${RSYNC="rsync --inplace"}
: ${MAKE="make"}
: ${SVN_CO="svn checkout -q"}
# TODO: exclude more
echo "Copying source from $SRC to $BLD ... "
$RSYNC --exclude '*.c' --exclude '*.cc' --exclude 'storage/*/' \
--delete-excluded -a "$SRC/" "$BLD/"
# the dependencies of include/mysqld_error.h
$RSYNC -a "$SRC"/strings "$SRC"/dbug "$SRC"/mysys "$BLD"
$RSYNC -a "$SRC"/extra/comp_err.c "$BLD"/extra/comp_err.c
cd "$BLD"
touch sql/mysqld.cc
rm -rf $INNODIR
# If we are building from the SVN repository then use svn tools
# otherwise the assumption is that we are dealing with a gzipped
# tarball.
REPO=${SVN:0:$SVN_REPO_STRLEN}
if [ "$REPO"x = "$SVN_REPO"x ]; then
$SVN_CO "$SVN" $INNODIR
else
(
echo "Extracting source from tar file $SVN ..."
cd `dirname $INNODIR`
gunzip < $SVN | tar xf -
mv `basename ${SVN%.t*z}` `basename $INNODIR`
)
fi
echo "Creating Makefiles ..."
# Generate ./configure and storage/innobase/Makefile.in
#aclocal
#autoheader
#libtoolize --automake --force --copy
#automake --force --add-missing --copy
#autoconf
autoreconf --force --install
if [ "$CFL" != "-" ]; then
if [ ! -f "$CFL" ]; then
echo "$CFL not found!"
exit 1
fi
if [ ! -f "$DYNCONFIG" ]; then
echo "$DYNCONFIG not found!"
exit 1
fi
trap "{ rm -f $DYNTMPFILE; }" EXIT SIGINT SIGTERM
# Generate storage/innobase/Makefile and other prerequisites
$DYNCONFIG $ARH $CFL > $DYNTMPFILE
if [ $? -ne 0 ]; then
echo "dynconfig failed to get config parameters: $CONFIGURE"
exit 1
fi
# Now run the configure command
chmod +x $DYNTMPFILE
echo
echo "***************************************************************"
echo "Building plugin with " `grep '^VERSION=' $CFL` \
" configure options"
echo "***************************************************************"
echo
# Display the config parameters that will be used
cat $DYNTMPFILE
/bin/sh -c $DYNTMPFILE > /dev/null
else
./configure "$@"
fi
(cd include; $MAKE my_config.h)
if [ ! -f include/mysqld_error.h ]; then
echo "Generating include/mysqld_error.h ..."
# Generate include/mysqld_error.h
(cd strings; $MAKE)
(cd dbug; $MAKE)
(cd mysys; $MAKE)
(cd extra; $MAKE ../include/mysqld_error.h)
fi
# Compile the InnoDB plugin.
cd $INNODIR
exec $MAKE
#!/bin/sh -e
#
# This script is for Innobase internal use.
#
# Create InnoDB source archive that is going to be shipped to users.
#
# This constitutes of:
# (It would have been nice if we can archive branches/zip and ship it,
# but we need to create Makefile.in, so it is a bit more complex. Makefile.in
# is required in order not to require users to have autotools to generate it.
# Users should replace storage/innobase and compile mysql as usual -
# ./configure ; make)
#
# 1. Get the MySQL sources
# 2. Replace storage/innobase from the SVN
# 3. Remove files that need not be shipped
# 4. Create storage/innobase/Makefile.in
# 5. Archive storage/innobase
#
MYSQL_BRANCH="5.1"
MYSQL_VER="${MYSQL_BRANCH}.23-rc"
INNODB_VER="1.0.0"
# end of changeable variables
MYSQL_DIR="mysql-${MYSQL_VER}"
MYSQL_ARCHIVE="${MYSQL_DIR}.tar.gz"
INNODB_DIR="innodb_plugin-${INNODB_VER}-${MYSQL_BRANCH}"
INNODB_SVN_REPO="https://svn.innodb.com/svn/innodb"
REMOVE_FILES="
revert_gen.sh
scripts/dynconfig
scripts/export.sh
scripts/make_binary_release.sh
scripts/make_source_release.sh
"
REMOVE_DIRS="scripts"
# get MySQL sources
# pick one mirror from http://dev.mysql.com/downloads/mirrors.html
#wget ftp://ftp.easynet.be/mysql/Downloads/MySQL-${MYSQL_BRANCH}/${MYSQL_ARCHIVE}
wget ftp://mysql.online.bg/mysql/Downloads/MySQL-${MYSQL_BRANCH}/${MYSQL_ARCHIVE}
# bkf clone -rmysql-${MYSQL_VER%-rc} \
# bk://mysql.bkbits.net/mysql-${MYSQL_BRANCH} ./mysql-${MYSQL_VER}
tar -zxf ${MYSQL_ARCHIVE}
# get InnoDB sources
cd ${MYSQL_DIR}/storage
mv innobase innobase.orig
svn export ${INNODB_SVN_REPO}/tags/${INNODB_DIR} innobase
# "steal" MySQL's ./COPYING (GPLv2)
cp -v ../COPYING innobase/
# Hack the autotools files so users can compile by using ./configure and
# make without having autotools installed. This has the drawback that if
# users build dynamic (ha_innodb.so) on i386 it will (probably) be compiled
# with PIC and thus it will be slower. If we do not do this, MySQL's configure
# will not parse @INNODB_CFLAGS@ and @INNODB_DYNAMIC_CFLAGS@ when creating
# innobase/Makefile from innobase/Makefile.in and subsequently compilation
# will fail on the user's machine with an error like (if he does not have
# autotools):
# gcc: @INNODB_CFLAGS@: No such file or directory
# In the long run we could inject INNODB_DYNAMIC_CFLAGS="-prefer-non-pic"
# into branches/5.1/plug.in so it will be included in standard MySQL
# distributions.
cp innobase.orig/plug.in innobase/plug.in
sed -i '' \
-e 's/\$(INNODB_CFLAGS)//g' \
-e 's/\$(INNODB_DYNAMIC_CFLAGS)/-DMYSQL_DYNAMIC_PLUGIN/g' \
innobase/Makefile.am
rm -fr innobase.orig
# remove unnecessary files and directories
# avoid rm -fr, too dangerous
cd innobase
rm ${REMOVE_FILES}
rmdir ${REMOVE_DIRS}
# create InnoDB's Makefile.in
cd ../..
./BUILD/autorun.sh
# create archive
cd storage
mv innobase ${INNODB_DIR}
tar -cf - ${INNODB_DIR} |gzip -9 > ../../${INNODB_DIR}.tar.gz
# EOF
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