1+ #! /bin/bash
2+
3+ # Load stack utils
4+ . /usr/bin/stack-utils
5+
6+ # Implement build function
7+ function build() {
8+ generate-stack-path
9+
10+ MYSQL_VERSION=$STACK_VERSION
11+ MYSQL_MAJOR=$( echo " ${MYSQL_VERSION} " | cut -d" ." -f1-2)
12+
13+ mkdir -p /opt/drycc/mysql-${MYSQL_MAJOR} /
14+
15+ # computer cpu numbers
16+ numcpu=$( cat /proc/cpuinfo | grep processor | wc -l)
17+ if [ $numcpu -le 2 ]
18+ then
19+ numcpu=2
20+ fi
21+
22+ DEBIAN_FRONTEND=" noninteractive"
23+
24+ # # install packages
25+ install-packages \
26+ libaio-dev \
27+ libsasl2-modules-gssapi-mit \
28+ libkrb5-dev \
29+ libsasl2-dev \
30+ libldap2-dev \
31+ bison \
32+ autoconf \
33+ automake \
34+ libtool
35+
36+ # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.40.0
37+ # # download mysql.tar
38+ curl https://cdn.mysql.com/Downloads/MySQL-${MYSQL_MAJOR} /mysql-${MYSQL_VERSION} .tar.gz --output mysql-${MYSQL_VERSION} .tar.gz
39+ # # untar mysql.tar
40+ tar --no-same-owner -xf mysql-${MYSQL_VERSION} .tar.gz
41+ cd mysql-${MYSQL_VERSION}
42+
43+ cmake -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/tmp/boost/ -DBUILD_CONFIG=mysql_release -DWITH_AUTHENTICATION_LDAP=1 -DCMAKE_INSTALL_PREFIX=/opt/drycc/mysql-${MYSQL_MAJOR} -DSYSCONFDIR=/opt/drycc/mysql-${MYSQL_MAJOR} /conf -DDEFAULT_SYSCONFDIR=/opt/drycc/mysql-${MYSQL_MAJOR} /conf -DFORCE_INSOURCE_BUILD=1
44+ make --jobs=$numcpu
45+ make install --jobs=$numcpu
46+ make clean
47+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/comp_err
48+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/ibd2sdi
49+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/innochecksum
50+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/lz4_decompress
51+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/my_print_defaults
52+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/myisam_ftdump
53+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/myisamchk
54+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/myisamlog
55+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/myisampack
56+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql
57+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_config_editor
58+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_migrate_keyring
59+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_secure_installation
60+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_ssl_rsa_setup
61+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_tzinfo_to_sql
62+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysql_upgrade
63+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqladmin
64+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlbinlog
65+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlcheck
66+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqld
67+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqldump
68+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlimport
69+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlpump
70+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlrouter
71+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlrouter_keyring
72+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlrouter_passwd
73+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlrouter_plugin_info
74+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlshow
75+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/mysqlslap
76+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/perror
77+ strip /opt/drycc/mysql-${MYSQL_MAJOR} /bin/zlib_decompress
78+
79+ # copy mysql build files to data dir
80+ cp -r /opt/drycc/mysql-${MYSQL_MAJOR} / ${DATA_DIR} /
81+
82+ # clean tmp data
83+ cd .. && rm -rf mysql-${MYSQL_VERSION} mysql-${MYSQL_VERSION} .tar.gz
84+ }
85+
86+ # call build stack
87+ build-stack " ${1} "
0 commit comments