~knielsen/ourdelta/bug_484127_484120_2

« back to all changes in this revision

Viewing changes to bakery/tarbake51.sh

  • Committer: Arjen Lentz
  • Date: 2009-10-28 03:20:03 UTC
  • mfrom: (54.4.30 ourdelta-mariadb51-2)
  • Revision ID: arjen@openquery.com-20091028032003-3ebv58q8zin6xxbd
Merge from 5.1 bakery branch
Made autobake-deb.sh from 5.1 branch into separate autobake51-deb.sh (nasty merge)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
# Script to produce MariaDB source tarball from Launchpad bzr repo for OurDelta builds.
 
4
#
 
5
# Kristian Nielsen <knielsen@knielsen-hq.org>
 
6
# Arjen Lentz (arjen@openquery.com)
 
7
 
 
8
# Abort on error.
 
9
set -e
 
10
 
 
11
BAKERY_BASE_DIR="$(dirname $(readlink -f ${0}))"
 
12
 
 
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
 
15
# latest.
 
16
#
 
17
# (One can specify last:1 for latest version).
 
18
#
 
19
# Also, it is best to use revid: specifications, as revno: numbers are
 
20
# not stable, and can change whenever new stuff is merged.
 
21
#
 
22
# After the release, the revision specified here should be tagged (or
 
23
# can specify tag: revision if placing tag before release).
 
24
 
 
25
BZR_REVSPEC="${1}"
 
26
if [ -z "$BZR_REVSPEC" ]; then
 
27
        echo 1>&2 "Usage: $0 bzr-revisionspec"
 
28
        exit 1
 
29
fi
 
30
BZR_BRANCH="${2}"
 
31
if [ -z "$BZR_BRANCH" ]; then
 
32
        BZR_BRANCH="lp:maria/5.1"
 
33
fi
 
34
 
 
35
. ${BAKERY_BASE_DIR}/../.bzr-version
 
36
 
 
37
echo "Checking out sources from bzr repo..."
 
38
 
 
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.
 
42
#
 
43
#bzr info . >/dev/null 2>&1 || bzr init-repo .
 
44
 
 
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"
 
49
 
 
50
echo "Building..."
 
51
 
 
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
 
55
  MAKE_J=-j1
 
56
fi
 
57
 
 
58
# Yes, we need to build mysqld just to make a source tarball :-(
 
59
#
 
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.
 
64
#
 
65
# Not sure if this has been fixed, if not we really ought to fix it ...
 
66
cd "$WORKDIR"
 
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
 
70
 
 
71
echo "Making source tarball..."
 
72
 
 
73
make dist >> ../build.log 2>&1
 
74
 
 
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)
 
77
ORIG_NAME="mysql"
 
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="
 
82
 
 
83
source .mariadb-version
 
84
 
 
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}"
 
89
rm -Rf "${BASEDIR}/"
 
90
tar zxf "${BASEDIR}.tar.gz"
 
91
NEWBASE="${PACKAGE_NAME}-${VERSION}-${RELEASE_NAME}${RELEASE_EXTRA:+-${RELEASE_EXTRA}}${REPO_VERSION}"
 
92
rm -Rf "${NEWBASE}"
 
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}/"
 
98
mv "$TARBALL" ..
 
99
cd ..
 
100
rm -Rf "$WORKDIR"
 
101
 
 
102
echo "Successfully made source tarball $TARBALL"