summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 937700bfbaa91878b5bf485fe9839f54185885fa (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: Yurii Kolesnykov <root@yurikoles.com>
# Based on community/qbittorrent by Antonio Rojas <arojas@archlinux.org>
#
# PRs are welcome here: https://github.com/yurikoles-aur/qbittorrent-git
#

pkgbase=qbittorrent-git
pkgname=(qbittorrent-git qbittorrent-nox-git)
pkgver=4.5.0beta1.r84.g3a2e73cc9
pkgrel=1
epoch=1
arch=(x86_64)
url='https://www.qbittorrent.org'
license=(custom GPL)
depends=(libtorrent-rasterbar qt6-base)
makedepends=(cmake boost qt6-tools qt6-svg)
makedepends+=(git)
optdepends=('python: needed for torrent search tab')
source=("$pkgbase::git+https://github.com/qbittorrent/qBittorrent.git")
sha256sums=('SKIP')

pkgver() {
  cd $pkgbase

  # replace latest tag with version from cmake
  local _major=`grep -m 1 QBT_VERSION_MAJOR src/base/version.h.in | cut -d' ' -f3`
  local _minor=`grep -m 1 QBT_VERSION_MINOR src/base/version.h.in | cut -d' ' -f3`
  local _bugfix=`grep -m 1 QBT_VERSION_BUGFIX src/base/version.h.in | cut -d' ' -f3`
  local _build=`grep -m 1 QBT_VERSION_BUILD src/base/version.h.in | cut -d' ' -f3`
  local _status=`grep -m 1 QBT_VERSION_STATUS src/base/version.h.in | cut -d' ' -f3 | sed 's/"//g'`
  local _cmake_ver=`printf "${_major}.${_minor}.${_bugfix}"`

  [[ "${_build}" -ne 0 ]] && _cmake_ver=`printf "${_cmake_ver}.${_build}"`
  [[ -n "${_status}" ]] && _cmake_ver=`printf "${_cmake_ver}${_status}"`

  # cutting off 'release-' prefix that presents in the git tag
  local _git_ver=`git describe --long --tags | sed 's/^release-//;s/\([^-]*-g\)/r\1/;s/-/./g'`
  local _git_tag=`git describe --tags --abbrev=0 | sed 's/^release-//;s/\([^-]*-g\)/r\1/;s/-/./g'`

  printf "${_git_ver/$_git_tag/$_cmake_ver}"
}

build() {
  cmake -B build -S $pkgbase \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT6=ON
  cmake --build build

  cmake -B build-nox -S $pkgbase \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DQT6=ON \
    -DGUI=OFF \
    -DSYSTEMD=ON
  cmake --build build-nox
}

package_qbittorrent-git() {
  pkgdesc='An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar'
  pkgdesc+=' (git version)'
  depends+=(qt6-svg hicolor-icon-theme)
  conflicts=('qbittorrent')
  provides=('qbittorrent')

  DESTDIR="$pkgdir" cmake --install build
  install -Dm644 $pkgbase/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}

package_qbittorrent-nox-git() {
  pkgdesc='An advanced BitTorrent client programmed in C++, based on Qt toolkit and libtorrent-rasterbar, w/o gui'
  pkgdesc+=' (git version)'
  conflicts=('qbittorrent-nox')
  provides=('qbittorrent-nox')

  DESTDIR="$pkgdir" cmake --install build-nox
  install -Dm644 $pkgbase/COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}