aboutsummaryrefslogtreecommitdiffstats
path: root/main/mariadb-connector-c/APKBUILD
blob: 5a1bf099685ad156e653ac127d9ace4a4ccbfed7 (plain) (blame)
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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=mariadb-connector-c
pkgver=3.1.13
pkgrel=2
pkgdesc="The MariaDB Native Client library (C driver)"
url="https://mariadb.org/"
arch="all"
license="LGPL-2.1-or-later"
depends_dev="openssl1.1-compat-dev zlib-dev"
makedepends="$depends_dev cmake"
options="!check" # no testsuite
replaces="mariadb-client-libs"
subpackages="$pkgname-dev"
source="https://downloads.mariadb.org/interstitial/connector-c-$pkgver/mariadb-connector-c-$pkgver-src.tar.gz"
builddir="$srcdir/mariadb-connector-c-$pkgver-src"

prepare() {
	default_prepare
	# Patch source to fix error in how the .cmake file was written
	sed -e 's|END()|ENDIF()|' -i cmake/ConnectorName.cmake
}

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi

	# INSTALL_LIBDIR and INSTALL_INCLUDEDIR are relative to CMAKE_INSTALL_PREFIX.
	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DINSTALL_LIBDIR=lib \
		-DINSTALL_INCLUDEDIR=include/mysql \
		\
		-DMARIADB_PORT=3306 \
		-DMARIADB_UNIX_ADDR=/run/mysqld/mysqld.sock \
		-DWITH_EXTERNAL_ZLIB=YES \
		-DWITH_MYSQLCOMPAT=ON \
		-DWITH_SSL=OPENSSL \
		$CMAKE_CROSSOPTS
	make
}

package() {
	make DESTDIR="$pkgdir" install

	# purge static libs
	rm "$pkgdir"/usr/lib/*.a

	# compat symlinks
	ln -s mariadb_config "$pkgdir"/usr/bin/mysql_config
	ln -s mariadb_version.h "$pkgdir"/usr/include/mysql/mysql_version.h
}

dev() {
	default_dev
	replaces="mariadb-dev"
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

sha512sums="a179a4fa689f681d64f926c1f3abfd3912896ec3e39c15be6a330647ded207aa2f110277dc43b90faffa4386365a72babc96264e29ac436e5d212d8b7cef7c32  mariadb-connector-c-3.1.13-src.tar.gz"