summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b8198b8fa04d25e75f99e11e2596df89b7c00d6a (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# Maintainer:
# Contributor: Michael Riegert <michael at eowyn net>
# Contributor: Danilo Kuehn <dk at nogo-software dot de>

_pkgname="nextcloud-client"
pkgname="$_pkgname-git"
pkgver=3.10.1.r224.gbfb016c28
pkgrel=1
pkgdesc="Nextloud client for linux"
#url="https://nextcloud.com/"
url="https://github.com/nextcloud/desktop"
license=('GPL2')
arch=('i686' 'x86_64')

depends=(
  inkscape
  karchive5
  libcloudproviders
  openssl
  qt5-graphicaleffects
  qt5-quickcontrols2
  qt5-svg
  qt5-webengine
  qt5-webkit
  qt5-websockets
  qtkeychain-qt5
  sqlite
  xdg-utils
)
makedepends=(
  cmocka
  doxygen
  extra-cmake-modules
  git
  python-sphinx
  qt5-tools
)
optdepends=(
  'kio5: integration with Dolphin'
  'nemo-python: integration with Nemo'
  'python-caja: integration with Caja'
  'python-nautilus: integration with Nautilus'
)
provides=('mirall' 'mirall-git' 'owncloud-client' 'nextcloud-client')
conflicts=('mirall-git' 'owncloud-client' 'owncloud-client-ngs' 'nextcloud-client' 'owncloud-client-git')
backup=('etc/Nextcloud/sync-exclude.lst')

_pkgsrc="$_pkgname"
source=(
  "$_pkgsrc"::"git+https://github.com/nextcloud/desktop.git"
  'dschmidt.libcrashreporter-qt'::'git+https://github.com/dschmidt/libcrashreporter-qt.git'
)
sha256sums=(
  'SKIP'
  'SKIP'
)

pkgver() {
  cd "$_pkgsrc"

  local _file='VERSION.cmake'

  local _ver_major=$(
    grep -E 'MIRALL_VERSION_MAJOR\s+([0-9]+)' "$_file" \
      | sed -E 's@^.*MIRALL_VERSION_MAJOR\s+([0-9]+).*$@\1@'
  )
  local _ver_minor=$(
    grep -E 'MIRALL_VERSION_MINOR\s+([0-9]+)' "$_file" \
      | sed -E 's@^.*MIRALL_VERSION_MINOR\s+([0-9]+).*$@\1@'
  )
  local _version=$(
    git tag -l "v${_ver_major:?}.${_ver_minor:?}.[0-9]" | sort -h | tail -1
  )
  local _revision=$(
    git rev-list --count ${_version:?}..HEAD
  )
  local _hash=$(
    git rev-parse --short HEAD
  )

  printf '%s.r%s.g%s' \
    "${_version#v}" \
    "${_revision:?}" \
    "${_hash:?}"
}

_prepare_nextcloud_client() (
  cd "${srcdir:?}/$_pkgsrc"
  local -A _submodules=(
    ['dschmidt.libcrashreporter-qt']='src/3rdparty/libcrashreporter-qt'
  )
  _submodule_update
)

prepare() {
  _submodule_update() {
    local key;
    for key in ${!_submodules[@]} ; do
      git submodule init "${_submodules[${key}]}"
      git submodule set-url "${_submodules[${key}]}" "${srcdir}/${key}"
      git -c protocol.file.allow=always submodule update "${_submodules[${key}]}"
    done
  }

  _prepare_nextcloud_client
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_INSTALL_PREFIX='/usr'
    -DCMAKE_INSTALL_LIBDIR='lib'
    -DWITH_DOC=FALSE
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="${pkgdir:?}" cmake --install build
}