summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d62994a78fa4566b3feb953c21332b19d870e860 (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
# Maintainer : Maƫl Kerbiriou <m431.ker.biriou+aur at gmail dot com>

pkgbase=duckdb-git
pkgname=('duckdb-git' 'python-duckdb-git')
pkgver=v0.2.1.r52.gd40fc014c
pkgrel=1
pkgdesc="Embeddable SQL OLAP Database Management System"
arch=('x86_64')
url="https://www.duckdb.org/"
license=('MIT')
makedepends=('git' 'cmake' 'python-setuptools' 'pybind11' 'python-numpy' 'python-pandas')
checkdepends=('python-pytest')
depends=('gcc-libs')
source=("${pkgbase}::git+https://github.com/cwida/${pkgbase%-git}.git")
md5sums=('SKIP')

pkgver() {
  cd "${srcdir}/${pkgbase}"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${srcdir}/${pkgbase}"
  python "scripts/amalgamation.py"

  cmake -S . -B "${srcdir}/build" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DAMALGAMATION_BUILD=1 \
    -DTREAT_WARNINGS_AS_ERRORS=1 \
    -DBUILD_PARQUET_EXTENSION=1 \
    -DBUILD_TESTING=ON
}

build() {
  cmake --build "${srcdir}/build"

  python "${srcdir}/${pkgbase}/tools/pythonpkg/setup.py" build
}

check() {
  cd "${srcdir}/${pkgbase}"
  "${srcdir}/build/test/unittest"

  cd "${srcdir}/${pkgbase}/tools/pythonpkg"
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-3.8" pytest
}

package_duckdb-git() {
  provides=('duckdb')

  DESTDIR="${pkgdir}" cmake --install "${srcdir}/build"

  # Command line and tools do not have a install() decl yet
  for bin in duckdb tools/rest/duckdb_rest_server; do
      install -D -m755 "${srcdir}/build/$bin" \
        "${pkgdir}/usr/bin/$(basename $bin)"
  done

  install -D -m755 "${srcdir}/build/tools/sqlite3_api_wrapper/libsqlite3_api_wrapper.so" \
    "${pkgdir}/usr/lib/libsqlite3_api_wrapper.so"

  install -D -m644 "${srcdir}/${pkgbase}/LICENSE" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

package_python-duckdb-git() {
  optdepends=('python-numpy' 'python-pandas')
  provides=('python-duckdb')

  cd "${srcdir}/${pkgbase}/tools/pythonpkg"
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build

  install -D -m644 "${srcdir}/${pkgbase}/LICENSE" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}