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

pkgname=mysql-shell
pkgver=8.0.18
pkgrel=3
pkgdesc='An interface supporting development and administration for the MySQL Server'
arch=('x86_64' 'i686')
url="https://dev.mysql.com/downloads/shell/"
license=('GPL')
GTEST_VERSION="1.8.0"
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"
  "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"
  "googletest-release-$GTEST_VERSION.zip::https://github.com/google/googletest/archive/release-$GTEST_VERSION.zip"
)
noextract=("googletest-release-$GTEST_VERSION.zip")
md5sums=(
  "1e04f2c53ed21a220e93f1d96e06aeda"
  "SKIP"
  "b63e84d8ba2bbd6f82df12fc6dfb8d51"
  "SKIP"
  "adfafc8512ab65fd3cf7955ef0100ff5"
)
validpgpkeys=('A4A9406876FCBD3C456770C88C718D3B5072E1F5')
depends=('python2' 'openssl')
makedepends=('v8-6.7-static' 'cmake' 'clang' 'zip' 'zlib' 'libsasl' 'rpcsvc-proto' 'python2' 'python2-colorama' 'python2-pylint' 'python2-lazy-object-proxy' 'python2-singledispatch' 'python2-wrapt' 'ninja' 'git' 'wget')

build() {
  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 $_
  build_tests=0
  if [[ "$MYSQL_SHELL_RUN_TESTS" ]]; then
    build_tests=1
  fi
  protobuf_dir="$(basename "$(find $srcdir/mysql-$pkgver/extra/protobuf -maxdepth 1 -type d -name 'protobuf-*')")"
  cmake .. \
    -DWITH_TESTS="$build_tests" \
    -DWITH_GMOCK="${srcdir}/googletest-release-$GTEST_VERSION.zip" \
    -DCMAKE_C_COMPILER=/usr/bin/clang \
    -DCMAKE_CXX_COMPILER=/usr/bin/clang++ \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DMYSQL_SOURCE_DIR="$srcdir/mysql-$pkgver" \
    -DMYSQL_BUILD_DIR="$srcdir/mysql-$pkgver/bld" \
    -DHAVE_PYTHON=1 \
    -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" \
    -DCMAKE_C_FLAGS="-I $srcdir/mysql-$pkgver/extra/protobuf/$protobuf_dir/src" \
    -DCMAKE_CXX_FLAGS="-I $srcdir/mysql-$pkgver/extra/protobuf/$protobuf_dir/src" \
    -DCMAKE_LIBRARY_PATH="$srcdir/mysql-$pkgver/bld/extra/protobuf/$protobuf_dir/cmake"
  make
}

check() {
  # requires MySQL server, disabled by default
  if [[ "$MYSQL_SHELL_RUN_TESTS" ]]; then
    cd "$srcdir/$pkgname-$pkgver-src/bld/shell-tests"
    sed 's/python/python2/' -i mysqlx-test-run.py
    sed 's/bld"/bld\/bin"/' -i mysqlx-test-run.py
    ./mxtr
  fi
}

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: