summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b13d6932dd788bcac1a15976da48d99a7b34c9a0 (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
# Maintainer: Pekka Ristola <pekkarr [at] protonmail [dot] com>

_cranname=RSQLite
_cranver=2.2.15
pkgname=r-${_cranname,,}
pkgver=${_cranver//[:-]/.}
pkgrel=1
pkgdesc="SQLite Interface for R"
arch=(i686 x86_64)
url="https://cran.r-project.org/package=${_cranname}"
license=(LGPL)
depends=(
    r-bit64
    r-blob
    r-dbi
    r-memoise
    r-pkgconfig
    r-rcpp
    sqlite
)
makedepends=(boost r-plogr)
checkdepends=(r-dbitest r-testthat)
optdepends=(
    r-callr
    r-dbitest
    r-gert
    r-gh
    r-knitr
    r-rmarkdown
    r-hms
    r-rvest
    r-testthat
    r-xml2
)
source=("https://cran.r-project.org/src/contrib/${_cranname}_${_cranver}.tar.gz")
sha256sums=('4980724e68ca8de800db4ae85767b15c063a34caa95f307f1cd7ba8262fad7b3')

prepare() {
  cd "${_cranname}"

  # Skip source code formatting check
  sed -i '/"source code formatting"/a skip("Do not check code formatting")' \
      tests/testthat/test-astyle.R

  # build against system sqlite and use system boost headers
  sed -i -e 's|PKG_LIBS = vendor/sqlite3/sqlite3.o|PKG_LIBS = -lsqlite3|' \
      -e 's| -Ivendor -Ivendor/extensions -Ivendor/sqlite3||' \
      src/Makevars
  sed -i 's|"vendor/sqlite3/sqlite3.h"|<sqlite3.h>|' src/{import-file.c,sqlite3-cpp.h}

  # Skip test that breaks with system sqlite
  sed -i '/"can read more than standard limit (#314)"/a skip("Does not work with system sqlite")' \
      tests/testthat/test-blob.R
}

build() {
  mkdir -p build
  R CMD INSTALL "${_cranname}" -l "${srcdir}/build"
}

check() {
  cd "${_cranname}/tests"
  R_LIBS="${srcdir}/build" NOT_CRAN=true Rscript --vanilla testthat.R
}

package() {
  install -dm0755 "${pkgdir}/usr/lib/R/library"

  cp -a --no-preserve=ownership "build/${_cranname}" "${pkgdir}/usr/lib/R/library"
}