summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 06cfb103fd245dbbe296c834dff3b5e53cb89fd8 (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: Christian Hesse <eworm@archlinux.org>

_android_arch=aarch64

pkgname=android-${_android_arch}-mariadb
pkgdesc="Fast SQL database server, derived from MySQL (Android ${_android_arch})"
pkgver=11.5.2
pkgrel=1
arch=('any')
license=('GPL')
url='https://mariadb.org/'
groups=('android-mariadb')
depends=("android-${_android_arch}-bzip2"
         "android-${_android_arch}-jemalloc"
         "android-${_android_arch}-liburing"
         "android-${_android_arch}-libxcrypt"
         "android-${_android_arch}-libxml2"
         "android-${_android_arch}-lz4"
         "android-${_android_arch}-lzo"
         "android-${_android_arch}-ncurses"
         "android-${_android_arch}-openssl"
         "android-${_android_arch}-pcre2"
         "android-${_android_arch}-snappy"
         "android-${_android_arch}-zlib"
         "android-${_android_arch}-zstd")
makedepends=('android-cmake'
             "android-${_android_arch}-boost"
             "android-${_android_arch}-bzip2"
             "android-${_android_arch}-cracklib"
             "android-${_android_arch}-curl"
             "android-${_android_arch}-jemalloc"
             "android-${_android_arch}-judy"
             "android-${_android_arch}-liburing"
             "android-${_android_arch}-libxcrypt"
             "android-${_android_arch}-libxml2"
             "android-${_android_arch}-lz4"
             "android-${_android_arch}-openssl"
             "android-${_android_arch}-pcre2"
             "android-${_android_arch}-xz"
             "android-${_android_arch}-zlib"
             "android-${_android_arch}-zstd")
optdepends=("android-${_android_arch}-cracklib: for cracklib plugin"
            "android-${_android_arch}-curl: for ha_s3 plugin"
            "android-${_android_arch}-judy: for Open Query GRAPH (OQGraph) computation engine"
            "android-${_android_arch}-xz: lzma provider")
options=(!strip !buildflags staticlibs !emptydirs)
# The default links with mirror redirection fail for signatures, specific
# mirrors may be out of date every now and then. Let's use the upstream
# rsync source via https and hope it does not hurt them too much.
# https://mariadb.com/kb/en/library/mirror-sites-for-mariadb/
source=("https://rsync.osuosl.org/pub/mariadb/mariadb-${pkgver}/source/mariadb-${pkgver}.tar.gz"{,.asc}
        '0001-Disable-gssapi.patch'
        '0002-Remove-setpwent.patch'
        '0003-Remove-strchr.patch'
        '0004-Dont-read-PEM-keys.patch'
        '0005-Add-missing-headers.patch'
        '0006-Remove-endpwent.patch'
        '0008-Fix-ncurses-headers.patch')
md5sums=('b1387fc485b7c802615ea6b9835b6b9c'
         'SKIP'
         'fe9715a2a09603a0e95d087481a3dfc8'
         '8f2f84a58b52e348ebdb9a1cf385eb00'
         '068a65705c097321d40cadaaafe37429'
         '05ce29a22db5d51618eb62fd01cf77ed'
         '7b53dfa88c8b7a83fad76c454222d9f7'
         '481e93621e4c2e040b4eb380904e1865'
         'bd8ebd1967c42f660dcd59503ca0213d')
validpgpkeys=('177F4010FE56CA3336300305F1656F24C74CD1D8') # MariaDB Signing Key <signing-key@mariadb.org>

prepare() {
    cd "${srcdir}/mariadb-${pkgver}"
    source android-env ${_android_arch}

    patch -Np1 -i ../0001-Disable-gssapi.patch
    patch -Np1 -i ../0003-Remove-strchr.patch
    patch -Np1 -i ../0004-Dont-read-PEM-keys.patch
    patch -Np1 -i ../0005-Add-missing-headers.patch
    patch -Np1 -i ../0008-Fix-ncurses-headers.patch

    if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 26 ]; then
        patch -Np1 -i ../0002-Remove-setpwent.patch
        patch -Np1 -i ../0006-Remove-endpwent.patch
    fi

    sed -i 's|ushort|unsigned short|g' libmariadb/plugins/auth/my_auth.c
    sed -i 's|ushort|unsigned short|g' libmariadb/libmariadb/mariadb_lib.c
    sed -i 's|ushort|unsigned short|g' libmariadb/libmariadb/mariadb_stmt.c
    sed -i 's|ushort|unsigned short|g' libmariadb/libmariadb/ma_stmt_codec.c

    rm -rf plugin/auth_gssapi
    rm -f libmariadb/cmake/FindGSSAPI.cmake

#     CMake Error: try_run() invoked in cross-compiling mode, please set the following cache variables appropriately:
#     HAVE_SYSTEM_LIBFMT_EXITCODE (advanced)
#     For details see /home/hipersayan_x/Documentos/CarpetaPersonal/Proyectos/ArchPackages/android-mariadb/android-aarch64-mariadb/src/mariadb-11.5.2/build/TryRunResults.cmake

}

build() {
    cd "${srcdir}/mariadb-${pkgver}"

    unset CC
    unset CXX
    unset CFLAGS
    unset CPPFLAGS
    unset CXXFLAGS
    unset LDFLAGS
    unset AR
    unset LD
    unset NM
    unset OBJCOPY
    unset OBJDUMP
    unset RANLIB
    unset STRIP

    cmake -S . -B cross-build
    make -C cross-build import_executables

    source android-env ${_android_arch}

    export CFLAGS="${CFLAGS} -I${PWD}/include"
    export CXXFLAGS="${CXXFLAGS} -I${PWD}/include"
    export PATH="${PWD}/cross-build/strings:${PATH}"

    android-${_android_arch}-cmake \
        -S . \
        -B build \
        -DCOMPILATION_COMMENT="Android ${ANDROID_MINIMUM_PLATFORM} ${_android_arch}" \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -Wno-dev \
        -DIMPORT_EXECUTABLES="${PWD}/cross-build/import_executables.cmake" \
        -DINSTALL_SYSCONFDIR="${ANDROID_PREFIX_ETC}" \
        -DINSTALL_SYSCONF2DIR="${ANDROID_PREFIX_ETC}/my.cnf.d" \
        -DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock \
        -DINSTALL_SCRIPTDIR=bin \
        -DINSTALL_INCLUDEDIR=include/mysql \
        -DINSTALL_PLUGINDIR=lib/mysql/plugin \
        -DINSTALL_SHAREDIR=share \
        -DINSTALL_SUPPORTFILESDIR=share/mysql \
        -DINSTALL_MYSQLSHAREDIR=share/mysql \
        -DINSTALL_DOCREADMEDIR=share/doc/mariadb \
        -DINSTALL_DOCDIR=share/doc/mariadb \
        -DINSTALL_MANDIR=share/man \
        -DMYSQL_DATADIR="${ANDROID_PREFIX_VAR}/lib/mysql" \
        -DDEFAULT_CHARSET=utf8mb4 \
        -DDEFAULT_COLLATION=utf8mb4_unicode_ci \
        -DENABLED_LOCAL_INFILE=ON \
        -DPLUGIN_EXAMPLE=NO \
        -DPLUGIN_FEDERATED=NO \
        -DPLUGIN_FEEDBACK=NO \
        -DWITH_EXTRA_CHARSETS=complex \
        -DWITH_JEMALLOC=ON \
        -DWITH_LIBFMT=system \
        -DWITH_LIBWRAP=OFF \
        -DWITH_PCRE2=system \
        -DWITH_READLINE=ON \
        -DWITH_SSL=system \
        -DWITH_UNIT_TESTS=OFF \
        -DWITH_ZLIB=system \
        -DWITH_SYSTEMD=no \
        -DWITHOUT_SERVER=ON \
        -DAUTH_GSSAPI_PLUGIN_TYPE=OFF \
        -DCMAKE_C_FLAGS="${CFLAGS}" \
        -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
        -DCMAKE_EXE_LINKER_FLAGS="${LDFLAGS}" \
        -DOPENSSL_ROOT_DIR="${ANDROID_PREFIX}" \
        -DOPENSSL_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DOPENSSL_CRYPTO_LIBRARY="${ANDROID_PREFIX_LIB}/libcrypto.so" \
        -DOPENSSL_SSL_LIBRARY="${ANDROID_PREFIX_LIB}/libssl.so" \
        -DCURSES_INCLUDE_PATH="${ANDROID_PREFIX_INCLUDE}" \
        -DCURSES_LIBRARY="${ANDROID_PREFIX_LIB}/libcurses.so" \
        -DCURL_LIBRARY="${ANDROID_PREFIX_LIB}/libcurl.so" \
        -DCURL_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DZSTD_LIBRARIES="${ANDROID_PREFIX_LIB}/libzstd.so" \
        -DZSTD_INCLUDE_DIRS="${ANDROID_PREFIX_INCLUDE}" \
        -DLIBXML2_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DBoost_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DBZIP2_LIBRARIES="${ANDROID_PREFIX_LIB}/libbz2.so" \
        -DBZIP2_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DLZ4_LIBRARIES="${ANDROID_PREFIX_LIB}/liblz4.so" \
        -DLZ4_INCLUDE_DIRS="${ANDROID_PREFIX_INCLUDE}" \
        -DLZO_LIBRARIES="${ANDROID_PREFIX_LIB}/liblzo2.so" \
        -DLZO_INCLUDE_DIRS="${ANDROID_PREFIX_INCLUDE}" \
        -DLIBLZMA_LIBRARY="${ANDROID_PREFIX_LIB}/liblzma.so" \
        -DLIBLZMA_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}" \
        -DSNAPPY_LIBRARIES="${ANDROID_PREFIX_LIB}/libsnappy.so" \
        -DSNAPPY_INCLUDE_DIRS="${ANDROID_PREFIX_INCLUDE}" \
        -DJudy_INCLUDE_DIRS="${ANDROID_PREFIX_INCLUDE}" \
        -DJudy_LIBRARIES="${ANDROID_PREFIX_LIB}/libljudy.so" \
        -DLIBFMT_INCLUDE_DIR="${ANDROID_PREFIX_INCLUDE}"
    make -C build $MAKEFLAGS
}

package() {
    cd "${srcdir}/mariadb-${pkgver}"
    source android-env ${_android_arch}

    make -C build DESTDIR="${pkgdir}" install
    files=(mariadb
           mariadb_config
           mariadb-admin
           mariadb-binlog
           mariadb-check
           mariadb-config
           mariadb-conv
           mariadb-dump
           mariadb-import
           mariadb-plugin
           mariadb-show
           mariadb-slap
           mariadb-test
           mariadb-waitpid
           my_print_defaults
           mysql
           mysql_plugin
           mysql_waitpid
           mysqladmin
           mysqlbinlog
           mysqlcheck
           mysqldump
           mysqlimport
           mysqlshow
           mysqlslap
           mysqltest
           replace
           resolve_stack_dump)

    for f in "${files[@]}"; do
        rm -f "${pkgdir}/${ANDROID_PREFIX_BIN}/${f}"
    done

    rm -rf "${pkgdir}/${ANDROID_PREFIX_SHARE}"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a
}