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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#! /bin/bash
# Build generic binaries.
# Abort on error
set -e
BAKERY_BASE_DIR="$(dirname $(readlink -f ${0}))"
TARBALL="${1}"
if [ -z "$TARBALL" ]; then
echo 1>&2 "Usage: $0 tarball.tar.gz"
exit 1
fi
WORKDIR="build-temp-$$"
if [ ! -f "$TARBALL" ]; then
echo 1>&2 "Can't find tarball: $TARBALL"
exit 1
else
TARBALL="$(readlink -f "$TARBALL")"
fi
pushd ${BAKERY_BASE_DIR}/..
if [ ! -f .bzr-version ]; then
echo "No bzr version info. You are not running this script from a"
echo "properly exported bakery. Please do so. I will now quit."
exit 1
else
source .bzr-version
fi
popd
# Determine source name
#
SOURCE_DIR=$(basename ${TARBALL} .tar.gz)
echo "For the record, we are using autoconf version:"
autoconf --version
echo
echo
echo "Unpacking sources..."
mkdir "$WORKDIR"
cd "$WORKDIR"
tar zxf "$TARBALL"
cd "$SOURCE_DIR"
# Set version info
#
if [ -e .mysql-version ]; then
source .mysql-version
export MYSQLFORK # Name that the binary tar file will begin with
else
echo "No .mysql-version found in source tarball. This is ok, building with default values."
fi
echo "Compiling ..."
# Lets not default to make -j6, but actually check the number of cores.
AM_MAKEFLAGS="-j$(if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi)"
if [ ${AM_MAKEFLAGS} = -j0 ]; then
AM_MAKEFLAGS=-j1
fi
export AM_MAKEFLAGS
echo "Building binary distribution..."
BUILD/compile-bintar > ../../../build.log 2>&1
scripts/make_binary_distribution >> ../../../build.log 2>&1
# Now rename the tarball (and content) to omit the redundant -MariaDB suffix.
# Bintar produced by make_binary_distribution above is
# one of mysql-*.tar.gz or mariadb-*.tar.gz or mepsql-*tar.gz etc...
# Since there is only one .tar.gz, just lookup that one and hope for the best
ORIG_TAR=$(ls *.tar.gz)
ORIG_DIR=$(basename ${ORIG_TAR} .tar.gz)
# configure.in:AC_INIT has package name mysql and version string 5.1.nn-<MySQLfork>
# We change the package name to mysqlfork, so remove the redundant name from
# version string. Note case *insensitive* match as $MYSQLFORK is often lower case
# and the AC_INIT version is often not.
NEW_DIR="$(echo "${ORIG_DIR}" | sed -e "s/-${MYSQLFORK}//I" )"
NEW_TAR="${NEW_DIR}.tar.gz"
#if [ "$ORIG_TAR" = "$NEW_TAR" ]; then
# # This happens if you build from Oracle/MySQL sources.
# echo "$0: Built $ORIG_TAR and it is already the name we want."
#else
# echo "Finished building $ORIG_TAR, now repacking as $NEW_TAR."
# rm -Rf $ORIG_DIR
# tar zxf $ORIG_TAR
# mv $ORIG_DIR "${NEW_DIR}"
# tar zcf "${NEW_TAR}" "${NEW_DIR}/"
#fi
#mv $NEW_TAR ../../
echo "Finished building $ORIG_TAR, now repacking as $NEW_TAR."
rm -Rf $ORIG_DIR
tar zxf $ORIG_TAR
if [ ! "$ORIG_TAR" = "$NEW_TAR" ]; then
mv $ORIG_DIR "${NEW_DIR}"
fi
# TODO: Terrible terrible hack, fix this in makefile, then fall back to the above uncommented code.
mv ${NEW_DIR}/share/mysql/*.sql ${NEW_DIR}/share/
tar zcf "${NEW_TAR}" "${NEW_DIR}/"
mv $NEW_TAR ../../
# Record the basename of the tar so that Buildbot system can get it
echo $NEW_DIR > ../../bindistname.txt
echo "Successfully build generic bintar package $NEW_TAR"
exit 0
|