summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d51659ff19148e53a93306c00c1dd24bd08d2196 (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
# 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=5.1.0alpha1.r306.gb462a2bf0
pkgrel=1
epoch=1
arch=(x86_64)
url='https://www.qbittorrent.org'
license=(GPL-2.0-or-later
         GPL-3.0-or-later)
depends=(gcc-libs
         glibc
         libtorrent-rasterbar
         openssl
         qt6-base
         zlib)
makedepends=(boost
             cmake
             git
             qt6-svg
             qt6-tools)
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
  cmake --build build

  cmake -B build-nox -S $pkgbase \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -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=${pkgver}")

  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=${pkgver}")

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