-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunypkg-mariadb-build.sh
159 lines (122 loc) · 4.58 KB
/
unypkg-mariadb-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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC1091,SC2154
set -vx
######################################################################################################################
### Setup Build System and GitHub
apt install -y jq
wget -qO- uny.nu/pkg | bash -s buildsys
### Installing build dependencies
unyp install cmake libxml2 pcre2 libevent openssl curl boost fmt procps liburing lz4 jemalloc ncurses systemd
#cp -a /uny/pkg/ncurses/*/include/*/* /uny/pkg/ncurses/*/include/
#pip3_bin=(/uny/pkg/python/*/bin/pip3)
#"${pip3_bin[0]}" install --upgrade pip
#"${pip3_bin[0]}" install docutils pygments
### Getting Variables from files
UNY_AUTO_PAT="$(cat UNY_AUTO_PAT)"
export UNY_AUTO_PAT
GH_TOKEN="$(cat GH_TOKEN)"
export GH_TOKEN
source /uny/git/unypkg/fn
uny_auto_github_conf
######################################################################################################################
### Timestamp & Download
uny_build_date
mkdir -pv /uny/sources
cd /uny/sources || exit
latest_stable_ver_start="$(wget -O- -q https://downloads.mariadb.org/rest-api/mariadb/ |
jq -r '[.major_releases[] | select(.release_status=="Stable") | select(.release_support_type=="Long Term Support")][0].release_id')"
pkgname="mariadb"
pkggit="https://github.com/MariaDB/server.git"
refs="refs/tags/mariadb-$latest_stable_ver_start.*"
gitdepth="--depth=1"
### Get version info from git remote
# shellcheck disable=SC2086
latest_head="$(git ls-remote --refs --tags --sort="v:refname" $pkggit | grep "$refs" | tail --lines=1)"
latest_ver="$(echo "$latest_head" | grep -o "mariadb-[0-9.].*" | sed "s|mariadb-||")"
latest_commit_id="$(echo "$latest_head" | cut --fields=1)"
version_details
# Release package no matter what:
echo "newer" >release-"$pkgname"
git_clone_source_repo
#cd "$pkg_git_repo_dir" || exit
#cd /uny/sources || exit
archiving_source
######################################################################################################################
### Build
# unyc - run commands in uny's chroot environment
# shellcheck disable=SC2154
unyc <<"UNYEOF"
set -vx
source /uny/git/unypkg/fn
pkgname="mariadb"
version_verbose_log_clean_unpack_cd
get_env_var_values
get_include_paths
####################################################
### Start of individual build script
unset LD_RUN_PATH
mkdir build
cd build || exit
ncurses_path=(/uny/pkg/ncurses/*)
libxml2_path=(/uny/pkg/libxml2/*)
pcre2_path=(/uny/pkg/pcre2/*)
liburing_path=(/uny/pkg/liburing/*)
export CFLAGS="-I${ncurses_path[0]}/include/ncursesw -I${pcre2_path[0]}/include" #-I${liburing_path[0]}/include
export CXXFLAGS="${CFLAGS}"
cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_CONFIG=mysql_release \
-DWITH_LIBFMT=system \
-Wno-dev \
-DWITH_PCRE=system \
-DPCRE_LIBRARY_DIRS="${pcre2_path[0]}"/lib \
-DPCRE_INCLUDE_DIRS="${pcre2_path[0]}"/include \
-DCMAKE_INSTALL_PREFIX=/uny/pkg/"$pkgname"/"$pkgver" \
-DCURSES_INCLUDE_PATH="${ncurses_path[0]}"/include/ncursesw \
-DLIBXML2_INCLUDE_DIR="${libxml2_path[0]}"/include \
-DWITH_URING=ON \
-DURING_LIBRARIES="${liburing_path[0]}"/lib/liburing.so \
-DURING_INCLUDE_DIRS="${liburing_path[0]}"/include \
-DGRN_LOG_PATH=/var/log/groonga.log \
-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock \
-DMYSQL_DATADIR=/var/lib/mysql \
-DINSTALL_SYSCONFDIR=/etc/uny/mariadb \
-DDEFAULT_CHARSET=utf8mb4 \
-DCONC_DEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_unicode_ci \
-DENABLED_LOCAL_INFILE=ON \
-DPLUGIN_EXAMPLE=NO \
-DPLUGIN_FEDERATED=NO \
-DPLUGIN_FEEDBACK=NO \
-DWITH_EMBEDDED_SERVER=OFF \
-DWITH_EXTRA_CHARSETS=complex \
-DWITH_JEMALLOC=ON \
-DWITH_LIBWRAP=OFF \
-DWITH_READLINE=ON \
-DWITH_SSL=system \
-DWITH_UNIT_TESTS=OFF \
-DCONC_WITH_UNIT_TESTS=OFF \
-DWITH_ZLIB=system \
-DSKIP_TESTS=ON \
-DTOKUDB_OK=0 \
-DWITH_COMMENT="unypkg" \
-DINSTALL_MYSQLTESTDIR="" \
-DINSTALL_SQLBENCHDIR="" \
-DPLUGIN_AUTH_PAM=NO \
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
-DWITH_SYSTEMD=yes \
..
# -DWITHOUT_CLIENTLIBS=YES \
make -j"$(nproc)"
make -j"$(nproc)" install
mkdir -pv /uny/pkg/"$pkgname"/"$pkgver"/etc
cp -a /etc/uny/mariadb/* /uny/pkg/"$pkgname"/"$pkgver"/etc
sed "s|/etc/my.cnf.d|/etc/uny/mariadb/my.cnf.d|" -i /uny/pkg/"$pkgname"/"$pkgver"/etc/my.cnf
####################################################
### End of individual build script
add_to_paths_files
dependencies_file_and_unset_vars
cleanup_verbose_off_timing_end
UNYEOF
######################################################################################################################
### Packaging
package_unypkg