3
# Script to produce MariaDB source tarball from Launchpad bzr repo for OurDelta builds.
5
# Kristian Nielsen <knielsen@knielsen-hq.org>
6
# Arjen Lentz (arjen@openquery.com)
11
BAKERY_BASE_DIR="$(dirname $(readlink -f ${0}))"
13
# For a release, it is important to know which bzr revision was used
14
# to do the release. So fail if none specified, rather than default to
17
# (One can specify last:1 for latest version).
19
# Also, it is best to use revid: specifications, as revno: numbers are
20
# not stable, and can change whenever new stuff is merged.
22
# After the release, the revision specified here should be tagged (or
23
# can specify tag: revision if placing tag before release).
26
if [ -z "$BZR_REVSPEC" ]; then
27
echo 1>&2 "Usage: $0 bzr-revisionspec"
31
if [ -z "$BZR_BRANCH" ]; then
32
BZR_BRANCH="lp:maria/5.1"
35
. ${BAKERY_BASE_DIR}/../.bzr-version
37
echo "Checking out sources from bzr repo..."
39
# this can do terrible things if you run it in ~ (find a better way)
40
## Make sure we have a shared repository, so we don't have to download
41
## everything every time.
43
#bzr info . >/dev/null 2>&1 || bzr init-repo .
45
WORKDIR="build-temp-$$"
46
test -d "$WORKDIR" && rm -Rf "$WORKDIR"
47
#using export rather than checkout now, note that needs param swap
48
bzr export "$WORKDIR" "$BZR_BRANCH"
52
# Lets not default to make -j4, but actually check the number of cores.
53
MAKE_J="-j$(if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi)"
54
if [ ${MAKE_J} = -j0 ]; then
58
# Yes, we need to build mysqld just to make a source tarball :-(
60
# At least historically, the reason for this is that the windows build
61
# needs the sources to contain initial table files for installing the
62
# initial database (on Posix systems these are generated after
63
# building on the target system). And to generate them we need mysqld.
65
# Not sure if this has been fixed, if not we really ought to fix it ...
67
BUILD/autorun.sh > ../build.log 2>&1
68
CC=gcc CXX=gcc CFLAGS="-O0" CXXFLAGS="-O0" ./configure --prefix=/usr/local/mysql --exec-prefix=/usr/local/mysql --libexecdir=/usr/local/mysql/bin --localstatedir=/usr/local/mysql/data --enable-static --enable-thread-safe-client --enable-local-infile --with-big-tables --with-libwrap --with-ssl --without-docs --with-readline --with-extra-charsets=all --with-embedded-server --with-libevent --with-partition --with-zlib-dir=bundled --with-plugins=max-no-ndb --without-plugin-innodb_plugin >> ../build.log 2>&1
69
make ${MAKE_J} >> ../build.log 2>&1
71
echo "Making source tarball..."
73
make dist >> ../build.log 2>&1
75
# Grab the version info from configure.in to know tarball names.
76
set $(perl -ne 'print "$1 $2" if /AM_INIT_AUTOMAKE\((.*), (.*)\)/' configure.in)
78
echo >.mariadb-version "PACKAGE_NAME=mariadb"
79
echo >>.mariadb-version "VERSION=$2"
80
echo >>.mariadb-version "RELEASE_NAME=ourdelta"
81
echo >>.mariadb-version "RELEASE_EXTRA="
83
source .mariadb-version
85
# Now re-pack the source tarball with a mariadb- prefix and an
86
# -ourdeltaN suffix so we can distinguish different builds from the
87
# same MariaDB upstream source.
88
BASEDIR="${ORIG_NAME}-${VERSION}"
90
tar zxf "${BASEDIR}.tar.gz"
91
NEWBASE="${PACKAGE_NAME}-${VERSION}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}${REPO_VERSION}"
93
mv "${BASEDIR}" "${NEWBASE}"
94
# put .mariadb-version file into source tarball
95
cp .mariadb-version "${NEWBASE}/"
96
TARBALL="${NEWBASE}.tar.gz"
97
tar zcf "${TARBALL}" "${NEWBASE}/"
102
echo "Successfully made source tarball $TARBALL"