summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4c9de6debe92e87911c73d3b6485e9e64be862ad (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
# Maintainer:
# Contributor: Mark Wagie <mark dot wagie at proton dot me>
# Contributor: MatMoul <matmoul at the google email domain which is .com>

_pkgname="octopi"
pkgname="$_pkgname"
pkgver=0.17.0
pkgrel=1
pkgdesc="A powerful Pacman frontend using Qt libs"
url="https://github.com/aarnt/octopi"
license=('GPL-2.0-or-later')
arch=('x86_64')

depends=(
  'qt6-multimedia'
  'qtermwidget'
)
makedepends=(
  'cmake'
  'git'
  'ninja'
  'qt6-5compat'
  'qt6-tools'
  'vala'
)
optdepends=(
  'inxi: for SysInfo log'
  'lsb-release: for SysInfo log'
  'mhwd: for SysInfo log'
  'pacaur: for AUR support'
  'pacmanlogviewer: to view pacman log files'
  'paru: for AUR support'
  'pikaur: for AUR support'
  'systemd: for SysInfo log'
  'trizen: for AUR support'
  'yay: for AUR support'
)

_source_octopi() {
  _pkgsrc_octopi="$_pkgname-$pkgver"
  local _pkgext="tar.gz"
  source+=("$_pkgsrc_octopi.$_pkgext"::"https://github.com/aarnt/octopi/archive/refs/tags/v$pkgver.$_pkgext")
  sha256sums+=('3ae93389c0ee8ffcdd2bf0f2b28f25bcfbb73493036f210c24f5ee836c90fa5c')

  _prepare_octopi() (
    # fix qt-sudo path
    sed 's&usr/local&usr&g' -i "$_pkgsrc_octopi/src/constants.h"
  )

  _build_octopi() (
    local _cmake_options=(
      -B build_octopi
      -S "$_pkgsrc_octopi"
      -G Ninja
      -DCMAKE_BUILD_TYPE=None
      -DCMAKE_INSTALL_PREFIX='/usr'
      -Dalpm_octopi_utils_DIR="'$srcdir/fakeinstall/usr/lib/cmake/alpm_octopi_utils/'"
      -Wno-dev
    )

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

_source_alpm_utils() {
  conflicts+=('alpm_octopi_utils')

  _pkgsrc_alpm_utils="alpm_octopi_utils"
  source+=("$_pkgsrc_alpm_utils"::"git+https://github.com/aarnt/alpm_octopi_utils.git")
  sha256sums+=('SKIP')

  _build_alpm_utils() (
    local _cmake_options=(
      -B build_alpm
      -S "$_pkgsrc_alpm_utils"
      -G Ninja
      -DCMAKE_BUILD_TYPE=None
      -DCMAKE_INSTALL_PREFIX='/usr'
      -Wno-dev
    )

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

    DESTDIR="fakeinstall" cmake --install build_alpm
  )
}

_source_octopi
_source_alpm_utils

prepare() {
  _run_if_exists _prepare_octopi
  _run_if_exists _prepare_alpm_utils
}

build() {
  _run_if_exists _build_alpm_utils
  _run_if_exists _build_octopi
}

package() {
  depends+=(
    'pacman'
    'pacman-contrib'
    'qt-sudo' # AUR
  )

  DESTDIR="$pkgdir" cmake --install build_octopi

  # library
  install -Dm644 "fakeinstall/usr/lib/libalpm_octopi_utils.so" -t "$pkgdir/usr/lib/"

  # not needed for standard licenses
  rm -rf "$pkgdir/usr/share/licenses/"
}

_run_if_exists() {
  if declare -F "$1" > /dev/null; then
    eval "$1"
  fi
}