summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9f2b74191965dc8b812d072e1a577c2942967b9b (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
# Maintainer: Frederick Zhang <frederick888@tsundere.moe>
# Contributor: Raphaƫl Doursenaud <rdoursenaud@free.fr>

pkgname=mysql-shell
pkgver=8.0.19
pkgrel=1
pkgdesc='An interface supporting development and administration for the MySQL Server'
arch=('x86_64' 'i686')
url="https://dev.mysql.com/downloads/shell/"
license=('GPL')
source=(
  "https://dev.mysql.com/get/Downloads/MySQL-Shell/mysql-shell-$pkgver-src.tar.gz"
  "mysql-shell-$pkgver-src.tar.gz.asc::https://dev.mysql.com/downloads/gpg/?file=mysql-shell-$pkgver-src.tar.gz&p=43"
  "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-boost-$pkgver.tar.gz"
  "mysql-boost-$pkgver.tar.gz.asc::https://dev.mysql.com/downloads/gpg/?file=mysql-boost-$pkgver.tar.gz&p=23"
)
md5sums=('c775d0a15a7f5dd4398f7605b17c6fc5'
         'SKIP'
         '1e42b9bd431059430c7617f24608609a'
         'SKIP')
validpgpkeys=('A4A9406876FCBD3C456770C88C718D3B5072E1F5')
depends=('python37' 'openssl' 'curl')
makedepends=('v8-6.7-static' 'cmake' 'zip' 'zlib' 'libsasl' 'rpcsvc-proto' 'git' 'wget')

prepare() {
    cd "${srcdir}/${pkgname}-${pkgver}-src/"
    sed 's/\(FIND_PACKAGE(PythonLibs .*\) REQUIRED)/\1 EXACT REQUIRED)/' -i CMakeLists.txt
}

build() {
  export CC="gcc"
  export CXX="g++"

  cd "$srcdir/mysql-$pkgver"
  mkdir -p bld && cd $_
  cmake .. -DWITH_BOOST="../boost" -DWITH_SSL=system -DWITH_PROTOBUF=bundled -Dprotobuf_BUILD_SHARED_LIBS=OFF
  cmake --build . --target mysqlclient
  cmake --build . --target mysqlxclient

  cd "$srcdir/$pkgname-$pkgver-src"
  mkdir -p bld && cd $_
  protobuf_dir="$(basename "$(find $srcdir/mysql-$pkgver/extra/protobuf -maxdepth 1 -type d -name 'protobuf-*')")"
  cmake .. \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DMYSQL_SOURCE_DIR="$srcdir/mysql-$pkgver" \
    -DMYSQL_BUILD_DIR="$srcdir/mysql-$pkgver/bld" \
    -DHAVE_PYTHON=1 \
    -DUSE_PYTHON_VERSION=3.7 \
    -DHAVE_V8=1 \
    -DV8_INCLUDE_DIR="/usr/include" \
    -DV8_LIB_DIR="/usr/lib" \
    -DWITH_SSL=system \
    -DWITH_STATIC_LINKING=1 \
    -DWITH_PROTOBUF="$srcdir/mysql-$pkgver/extra/protobuf/$protobuf_dir/src" \
    -DPROTOBUF_INCLUDE_DIR="$srcdir/mysql-$pkgver/extra/protobuf/$protobuf_dir/src" \
    -DPROTOBUF_LIBRARY="$srcdir/mysql-$pkgver/bld/extra/protobuf/$protobuf_dir/cmake/libprotobuf.a"
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver-src/bld"
  make DESTDIR="$pkgdir/" install
  install -Dm644 "$srcdir/$pkgname-$pkgver-src/doc/man/mysqlsh.1" "$pkgdir/usr/share/man/man1/mysqlsh.1"
  cd "$srcdir/$pkgname-$pkgver-src"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim: set tabstop=4 shiftwidth=2 expandtab smarttab autoindent: