archrelease: copy trunk to extra-x86_64
[arch-packages.git] / mariadb / trunk / PKGBUILD
blobe2f90084de51f0a50c42f6e032a86d09e13b59b6
1 # Maintainer: BartÅ‚omiej Piotrowski <bpiotrowski@archlinux.org>
2 # Maintainer: Christian Hesse <mail@eworm.de>
4 pkgbase=mariadb
5 pkgname=('mariadb-libs' 'mariadb-clients' 'mariadb' 'mytop')
6 pkgdesc='Fast SQL database server, derived from MySQL'
7 pkgver=10.11.3
8 pkgrel=1
9 arch=('x86_64')
10 license=('GPL')
11 url='https://mariadb.org/'
12 makedepends=('boost' 'bzip2' 'cmake' 'cracklib' 'curl' 'jemalloc' 'judy' 'krb5' 'liburing'
13              'libxcrypt' 'libxml2' 'lz4' 'openssl' 'systemd' 'zlib' 'zstd' 'xz')
14 validpgpkeys=('177F4010FE56CA3336300305F1656F24C74CD1D8') # MariaDB Signing Key <signing-key@mariadb.org>
15 # The default links with mirror redirection fail for signatures, specific
16 # mirrors may be out of date every now and then. Let's use the upstream
17 # rsync source via https and hope it does not hurt them too much.
18 # https://mariadb.com/kb/en/library/mirror-sites-for-mariadb/
19 source=("https://rsync.osuosl.org/pub/mariadb/mariadb-${pkgver}/source/mariadb-${pkgver}.tar.gz"{,.asc}
20         '0001-arch-specific.patch')
21 sha256sums=('b065b0f32a6e9fd479e566fd6671450379886d8dda2d9a7ef930af1e5c26c0c7'
22             'SKIP'
23             '3289efb3452d199aec872115f35da3f1d6fd4ce774615076690e9bc8afae1460')
25 prepare() {
26   cd $pkgbase-$pkgver/
28   # Arch Linux specific patches:
29   #  * enable PrivateTmp for a little bit more security
30   #  * force preloading jemalloc for memory management
31   #  * make systemd-tmpfiles create MYSQL_DATADIR
32   patch -Np1 < ../0001-arch-specific.patch
35 build() {
36   local _cmake_options=(
37     # build options
38     -DCOMPILATION_COMMENT="Arch Linux"
39     -DCMAKE_BUILD_TYPE=RelWithDebInfo
40     -Wno-dev
42     # file paths
43     # /etc
44     -DINSTALL_SYSCONFDIR=/etc
45     -DINSTALL_SYSCONF2DIR=/etc/my.cnf.d
46     # /run
47     -DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock
48     # /usr
49     -DCMAKE_INSTALL_PREFIX=/usr
50     # /usr/bin /usr/include
51     -DINSTALL_SCRIPTDIR=bin
52     -DINSTALL_INCLUDEDIR=include/mysql
53     # /usr/lib
54     -DINSTALL_PLUGINDIR=lib/mysql/plugin
55     -DINSTALL_SYSTEMD_UNITDIR=/usr/lib/systemd/system/
56     -DINSTALL_SYSTEMD_SYSUSERSDIR=/usr/lib/sysusers.d/
57     -DINSTALL_SYSTEMD_TMPFILESDIR=/usr/lib/tmpfiles.d/
58     # /usr/share
59     -DINSTALL_SHAREDIR=share
60     -DINSTALL_SUPPORTFILESDIR=share/mysql
61     -DINSTALL_MYSQLSHAREDIR=share/mysql
62     -DINSTALL_DOCREADMEDIR=share/doc/mariadb
63     -DINSTALL_DOCDIR=share/doc/mariadb
64     -DINSTALL_MANDIR=share/man
65     # /var
66     -DMYSQL_DATADIR=/var/lib/mysql
68     # default settings
69     -DDEFAULT_CHARSET=utf8mb4
70     -DDEFAULT_COLLATION=utf8mb4_unicode_ci
72     # features
73     -DENABLED_LOCAL_INFILE=ON
74     -DPLUGIN_EXAMPLE=NO
75     -DPLUGIN_FEDERATED=NO
76     -DPLUGIN_FEEDBACK=NO
77     -DWITH_EMBEDDED_SERVER=ON
78     -DWITH_EXTRA_CHARSETS=complex
79     -DWITH_JEMALLOC=ON
80     -DWITH_LIBWRAP=OFF
81     -DWITH_PCRE=bundled
82     -DWITH_READLINE=ON
83     -DWITH_SSL=system
84     -DWITH_SYSTEMD=yes
85     -DWITH_UNIT_TESTS=OFF
86     -DWITH_ZLIB=system
87   )
89   mkdir build
90   cd build
92   cmake ../"$pkgbase-$pkgver" "${_cmake_options[@]}"
94   make
97 check() {
98   cd build/mysql-test
100   # Takes *really* long, so disabled by default.
101   #./mtr --parallel=5 --mem --force --max-test-fail=0
104 package_mariadb-libs() {
105   pkgdesc='MariaDB libraries'
106   depends=('liburing' 'libxcrypt' 'libcrypt.so' 'openssl' 'zlib' 'zstd')
107   optdepends=('krb5: for gssapi authentication')
108   conflicts=('libmysqlclient' 'libmariadbclient' 'mariadb-connector-c')
109   provides=('libmariadbclient' 'mariadb-connector-c' 'libmariadb.so' 'libmariadbd.so')
110   replaces=('libmariadbclient')
112   cd build
114   for dir in libmariadb libmysqld libservices include; do
115     make -C "$dir" DESTDIR="$pkgdir" install
116   done
118   # remove static libraries
119   rm "${pkgdir}"/usr/lib/*.a
121   # remove man pages
122   rm -r "${pkgdir}"/usr/share/man
123   
124   ln -s mariadb_config "$pkgdir"/usr/bin/mariadb-config
125   ln -s mariadb_config "$pkgdir"/usr/bin/mysql_config
126   install -D -m0644 "$srcdir"/"$pkgbase-$pkgver"/man/mysql_config.1 "$pkgdir"/usr/share/man/man1/mysql_config.1
127   ln -s mysql_config.1 "$pkgdir"/usr/share/man/man1/mariadb_config.1
128   ln -s mysql_config.1 "$pkgdir"/usr/share/man/man1/mariadb-config.1
130   install -D -m0644 support-files/mariadb.pc "$pkgdir"/usr/share/pkgconfig/mariadb.pc
131   install -D -m0644 "$srcdir"/"$pkgbase-$pkgver"/support-files/mysql.m4 "$pkgdir"/usr/share/aclocal/mysql.m4
135 package_mariadb-clients() {
136   pkgdesc='MariaDB client tools'
137   depends=("mariadb-libs=${pkgver}" 'jemalloc' 'ncurses')
138   conflicts=('mysql-clients')
139   provides=("mysql-clients=$pkgver")
141   make -C build/client DESTDIR="${pkgdir}" install
142   
143   # install man pages
144   make -C build/man DESTDIR="${srcdir}"/client-man install
145   install -d -m0755 "${pkgdir}"/usr/share/man/man1/
146   for man in $(find "${pkgdir}"/usr/bin/ ! -type d); do
147     install -D -m0644 -t "${pkgdir}"/usr/share/man/man1/ "${srcdir}"/client-man/usr/share/man/man1/"$(basename "${man}")".1
148   done    
151 package_mariadb() {
152   pkgdesc='Fast SQL database server, derived from MySQL'
153   backup=('etc/my.cnf'
154           'etc/my.cnf.d/client.cnf'
155           'etc/my.cnf.d/enable_encryption.preset'
156           'etc/my.cnf.d/mysql-clients.cnf'
157           'etc/my.cnf.d/provider_bzip2.cnf'
158           'etc/my.cnf.d/provider_lz4.cnf'
159           'etc/my.cnf.d/provider_lzma.cnf'
160           'etc/my.cnf.d/s3.cnf'
161           'etc/my.cnf.d/server.cnf'
162           'etc/my.cnf.d/spider.cnf'
163           'etc/security/user_map.conf')
164   install=mariadb.install
165   depends=("mariadb-clients=${pkgver}" 'bzip2' 'libxml2' 'lz4' 'systemd-libs' 'libxml2' 'zstd')
166   optdepends=('cracklib: for cracklib plugin'
167               'curl: for ha_s3 plugin'
168               'galera: for MariaDB cluster with Galera WSREP'
169               'judy: for Open Query GRAPH (OQGraph) computation engine'
170               'perl-dbd-mariadb: for mariadb-hotcopy, mariadb-convert-table-format and mariadb-setpermission'
171               'python-mysqlclient: for myrocks_hotbackup'
172               'xz: lzma provider')
173   conflicts=('mysql')
174   provides=("mysql=$pkgver")
175   options=('emptydirs')
177   cd build
179   make DESTDIR="$pkgdir" install
181   cd "$pkgdir"
183   # no SysV init, please!
184   rm -r etc/logrotate.d
185   rm usr/bin/rcmysql
186   rm usr/share/mysql/{binary-configure,mysql{,d_multi}.server}
188   # move to proper licenses directories
189   install -d usr/share/licenses/mariadb
190   mv usr/share/doc/mariadb/COPYING* usr/share/licenses/mariadb/
192   # move it where one might look for it
193   mv usr/share/{groonga{,-normalizer-mysql},doc/mariadb/}
195   # move to pam directories
196   install -d {etc,usr/lib}/security
197   mv usr/share/user_map.conf etc/security/
198   mv usr/share/pam_user_map.so usr/lib/security/
200   # already installed to real systemd unit directory or useless
201   rm -r usr/share/mysql/systemd/
202   rm -r usr/lib/systemd/system/mariadb@bootstrap.service.d
204   # provided by mariadb-libs
205   rm usr/bin/{mariadb{_,-},mysql_}config
206   rm -r usr/include/
207   rm usr/share/man/man1/{mariadb,mysql}_config.1
208   rm -r usr/share/aclocal
209   rm usr/lib/lib*
210   rm -r usr/lib/pkgconfig
211   rm usr/lib/mysql/plugin/{auth_gssapi_client,caching_sha2_password,client_ed25519,dialog,mysql_clear_password,sha256_password,zstd}.so
213   # provided by mariadb-clients
214   for bin in $(find "${pkgdir}"/../mariadb-clients/usr/bin/ ! -type d); do
215     rm "${pkgdir}"/usr/bin/"$(basename "${bin}")" "${pkgdir}"/usr/share/man/man1/"$(basename "${bin}")".1
216   done
218   # provided by mytop
219   rm usr/bin/mytop
221   # not needed
222   rm -r usr/{mysql-test,sql-bench}
223   rm usr/share/man/man1/mysql-test-run.pl.1
226 package_mytop() {
227   pkgdesc='Top clone for MariaDB'
228   depends=('perl' 'perl-dbd-mariadb' 'perl-term-readkey')
230   install -D -m0755 build/scripts/mytop "$pkgdir"/usr/bin/mytop