summaryrefslogtreecommitdiff
path: root/libre/bibletime/PKGBUILD
blob: a58cfda205e82612dd781ac4195aea2b9955808a (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
85
86
87
88
89
90
91
92
93
# Maintainer (arch): Felix Yan <felixonmars@archlinux.org>
# Maintainer (arch): Alexander F Rødseth <xyproto@archlinux.org>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: SanskritFritz (gmail)
# Contributor: Tobias T. <OldShatterhand at gmx-topmail dot de>


# parabola changes and rationale:
# - replace blacklisted 'qt5-webengine' back-end with 'qt5-webkit'
# - pin to strongly-coupled dependency versions
# - FIXME: freeze at this version? - bibletime v>=3 does not support webkit?


pkgname=bibletime
pkgver=2.11.2
pkgrel=1
pkgrel+=.parabola2
pkgdesc='Bible study tool'
pkgdesc+=', (webkit build)'
arch=('x86_64')
arch+=('i686' 'armv7h')
url='http://www.bibletime.info/'
license=('GPL2')
depends=('sword' 'clucene' 'qt5-webengine' 'qt5-svg')
depends=( ${depends[*]/qt5-webengine/qt5-webkit} )
depends_i686=(icu69)
makedepends=('cmake' 'qt5-tools')
source=("$pkgname-$pkgver.tar.gz::https://github.com/bibletime/bibletime/archive/v$pkgver.tar.gz")
source+=('webkit.patch')
sha512sums=('951c72dea1e281c0403284b36d680452ffb9dec180097faec49bc8536ad9a9e3cb543060b9972beae415e94467dbff6edcc253a0fda217cbb17a94fce40ff553')
sha512sums+=('6d64be9904729b9bdf7a0464af8ba9e230b400ee461aca6dc8c7060c8bdb870ad61494ae3cd6a2f32a7ef45605b88671350c83e6cf9406f334242c63139cdc0c')


_version_constraint() # (dep_pkgname [precision])
{
  local dep_pkgname=$1
  local req_precision=$2
  local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} | tail -n 1)
  local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
  local def_precision=$(( n_dots + 1 ))
  local is_reqprecision_valid=$( [[ "${req_precision}" =~ ^[1-${def_precision}]$ ]] && echo 1 || echo 0 )
  local precision=$( (( is_reqprecision_valid )) && echo ${req_precision} || echo ${def_precision} )
  local pkgver_rx='[^-\.\ ]+'
  local subver_rx='\.'${pkgver_rx}
  local pkgrel_rx='[^-\ ]+'
  local capture_rx=${pkgver_rx}
  for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;

  if   [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx})$ ]]
  then local version=${BASH_REMATCH[1]}
       local pkgrel=${BASH_REMATCH[3]%%.*}
       local subver_inc=$(( ${version##*.} + 1 )) # right-trims from any non-numeric
       local pkgrel_inc=$(( pkgrel + 1 ))
       local version_min=$(   (( ! is_reqprecision_valid )) && echo ${full_version%-*}-${pkgrel} || \
                                                               echo ${version}                      )
       local version_max=$( ( (( ! is_reqprecision_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
                            ( [[ "${version}" =~ \.      ]] && echo ${version%.*}.${subver_inc}      ) || \
                                                               echo ${subver_inc}                         )
       local constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"

       echo "applied version constraint: '${constraint_string}'" >&2
  else echo "ERROR: _version_constraint() error parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'" >&2
       exit 1
  fi

  echo -n "${constraint_string}"
}


prepare() {
  mkdir -p build

  cd bibletime-$pkgver

  echo "applying 'webkit.patch'"
  patch -p1 -i "${srcdir}"/webkit.patch
}

build() {
  cd build

  cmake ../bibletime-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_BUILD_TYPE=Release
  make
}

package() {
  make -C build DESTDIR="$pkgdir" install

  # pin to strongly-coupled dependency versions
  depends=( ${depends[*]/sword/$(_version_constraint sword 3)} )
}