-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·99 lines (69 loc) · 2.42 KB
/
build.sh
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
#!/bin/bash -ex
MARIADB_MAJOR=10.0
PINBA_ENGINE_COMMIT=5c72ed9956ba3a2f831ba19db2da26ee60fb246a
# add mysql source repo to sources.list
echo "deb-src http://ftp.osuosl.org/pub/mariadb/repo/$MARIADB_MAJOR/debian jessie main" > /etc/apt/sources.list.d/mariadb.list
# update cache
apt-get update
# install dependencies
apt-get install -y --force-yes \
libjudydebian1 \
libprotobuf9 \
libprotobuf-lite9 \
libevent-2.0-5 \
libevent-core-2.0-5 \
libevent-extra-2.0-5 \
libevent-openssl-2.0-5 \
libevent-pthreads-2.0-5
# install build dependencies
apt-get build-dep -y --force-yes mariadb-$MARIADB_MAJOR
DEPENDENCY_PACKAGES="cmake dpkg-dev libncurses5-dev lsb-release wget libjudy-dev libprotobuf-dev libevent-dev automake make libtool libtool-bin g++"
apt-get install -y --force-yes $DEPENDENCY_PACKAGES
#====================================
# get mysql source
#====================================
mkdir mysql-source
pushd mysql-source
apt-get source -y --force-yes mariadb-$MARIADB_MAJOR
pushd `find . -maxdepth 1 -type d | grep "mariadb-" | head -n1`
# getting source directory of mariadb
MYSQL_SOURCE_PATH="`pwd`"
# prevent testing MariaDB :)
touch testsuite-stamp
# configure and build
dpkg-buildpackage -T configure
# copy configured headers to common include directory
for i in `ls -1 builddir/include/*.h`; do
cp -p $i include/
done
popd
popd
#====================================
# get pinba-engine code and compile
#====================================
mkdir pinba-engine
pushd pinba-engine
# get specified commit of pinba_engine
wget --progress=dot:mega https://github.com/tony2001/pinba_engine/archive/${PINBA_ENGINE_COMMIT}.tar.gz -O pinba-engine.tar.gz
tar xzf pinba-engine.tar.gz
pushd pinba_engine-${PINBA_ENGINE_COMMIT}
# configure, build and install pinba_engine
./buildconf.sh
./configure \
--with-mysql=${MYSQL_SOURCE_PATH} \
--libdir=/usr/lib/mysql/plugin
make install
popd
popd
# purge development libraries from image
apt-get purge -y --force-yes $DEPENDENCY_PACKAGES
apt-get purge -y --force-yes man-db gcc gawk cpp autoconf manpages manpages-dev m4 bison \
libmariadb-client-lgpl-dev libaio-dev libc-dev-bin libc6-dev libjemalloc-dev libpam0g-dev \
libreadline-gplv2-dev libssl-dev libtinfo-dev libwrap0-dev linux-libc-dev zlib1g-dev bsdmainutils \
|| true
# autoremove all automaticaly installed packages
apt-get -y --force-yes autoremove
# clean cache
apt-get clean
# remove build directories
rm -rf pinba-engine mysql-source