summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 93e6f4915f4a44d0178609e27eb9c3167e23d8f5 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Maintainer:

## options
: ${_build_appstream:=true}
: ${_build_aur:=true}
: ${_build_flatpak:=true}
: ${_build_snap:=false}

: ${_pkgext=-git}

_pkgname="pamac"
pkgname="$_pkgname${_pkgext:-}"
pkgver=11.7.2.r0.g71ced27
pkgrel=1
pkgdesc="Pamac package manager"
url="https://github.com/manjaro/pamac"
license=('GPL-3.0-or-later')
arch=('x86_64')

_depends_libpamac=(
  'pacman'
  'polkit'
)
_depends_pamac=(
  'gtk4'
  'libadwaita'
  'libnotify'
)
_depends_tray_gtk=(
  'gtk3'
)

if [ "${_build_appstream::1}" = "t" ]; then
  _depends_libpamac+=(
    'appstream'
    'appstream-glib'
    'archlinux-appstream-data'
  )
fi
if [ "${_build_flatpak::1}" = "t" ]; then
  _depends_libpamac+=(
    'flatpak'
  )
fi
if [ "${_build_snap::1}" = "t" ]; then
  _depends_libpamac+=(
    'snapd'
    'snapd-glib'
  )
fi

_make_cli=(
  'asciidoc'
)
_make_libpamac=(
  'gobject-introspection'
  'meson'
  'vala'
)

makedepends=(
  'git'
  ${_depends_libpamac[@]}
  ${_depends_pamac[@]}
  ${_depends_tray_gtk[@]}
  ${_make_cli[@]}
  ${_make_libpamac[@]}
)
optdepends=(
  'polkit-gnome: needed for authentication in Cinnamon, Gnome'
  'lxsession: needed for authentication in Xfce, LXDE etc.'
)

_pkgsrc_pamac="$_pkgname"
_pkgsrc_libpamac="libpamac"
_pkgsrc_cli="pamac-cli"
source=(
  "$_pkgsrc_pamac"::"git+$url.git"
  "$_pkgsrc_libpamac"::"git+https://github.com/manjaro/libpamac.git"
  "$_pkgsrc_cli"::"git+https://github.com/manjaro/pamac-cli.git"
)
sha256sums=(
  'SKIP'
  'SKIP'
  'SKIP'
)

pkgver() {
  cd "$_pkgsrc_pamac"
  if [ -z "$_pkgext" ]; then
    git describe --tags
  else
    git describe --long --tags --abbrev=7 --exclude='*[a-zA-Z][a-zA-Z]*'
  fi | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

_prepare_pamac() (
  >&2 echo "Preparing for pamac..."
  cd "$_pkgsrc_pamac"
  local _tag=$(git tag | grep -Ev '(^[a-z]|[A-Za-z]{2})' | sort -rV | head -1)
  [ -z "$_pkgext" ] && git -c advice.detachedHead=false checkout -f "${_tag:?}"
  git describe --tags --long
)

_prepare_libpamac() (
  >&2 echo "Preparing for libpamac..."
  cd "$_pkgsrc_libpamac"
  local _tag=$(git tag | grep -Ev '(^[a-z]|[A-Za-z]{2})' | sort -rV | head -1)
  [ -z "$_pkgext" ] && git -c advice.detachedHead=false checkout -f "${_tag:?}"
  git describe --tags --long
)

_prepare_cli() (
  >&2 echo "Preparing for pamac-cli..."
  cd "$_pkgsrc_cli"
  local _tag=$(git tag | grep -Ev '(^[a-z]|[A-Za-z]{2})' | sort -rV | head -1)
  [ -z "$_pkgext" ] && git -c advice.detachedHead=false checkout -f "${_tag:?}"
  git describe --tags --long
)

prepare() {
  _prepare_libpamac
  _prepare_pamac
  _prepare_cli

  sed -E \
    -e '/version.*\)$/a '"add_project_arguments(['--vapidir', '$srcdir/fakeinstall/usr/share/vala/vapi'], language: 'vala')" \
    -e '/version.*\)$/a '"add_project_arguments(['--girdir', '$srcdir/fakeinstall/usr/share/gir-1.0'], language: 'vala')" \
    -i "$_pkgsrc_pamac/meson.build" "$_pkgsrc_cli/meson.build"
}

_build_libpamac() (
  local _meson_args=(
    -Denable-appstream=${_build_appstream:-true}
    -Denable-aur=${_build_aur:-true}
    -Denable-flatpak=${_build_flatpak:-true}
    -Denable-snap=${_build_snap:-true}
  )

  arch-meson "$_pkgsrc_libpamac" build_libpamac "${_meson_args[@]}"
  meson compile -C build_libpamac
  meson install -C build_libpamac --destdir "$srcdir/fakeinstall"

  sed -E -e 's&^prefix=.*$&prefix='"$srcdir/fakeinstall/usr&" \
    -i "fakeinstall/usr/lib/pkgconfig/pamac.pc"
)

_build_pamac() (
  local _meson_args=(
    -Denable-fake-gnome-software=false
  )

  arch-meson "$_pkgsrc_pamac" build_pamac "${_meson_args[@]}"
  meson compile -C build_pamac
)

_build_cli() (
  arch-meson "$_pkgsrc_cli" build_cli
  meson compile -C build_cli
)

build() (
  export PKG_CONFIG_PATH="$srcdir/fakeinstall/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
  _build_libpamac
  _build_pamac
  _build_cli
)

package() {
  pkgdesc+=" - library, gui, cli"
  depends=(
    ${_depends_libpamac[@]}
    ${_depends_pamac[@]}
    ${_depends_tray_gtk[@]}
  )

  local _pkgver_libpamac=$(git -C "$_pkgsrc_libpamac" describe --tags --abbrev=0)

  provides=(
    "libpamac=${_pkgver_libpamac:-${pkgver%.r*}}"
    "pamac=${pkgver%.r*}"
  )
  conflicts=(
    'libpamac'
    'pamac'
    'pamac-cli'
  )

  backup=('etc/pamac.conf')

  meson install -C build_libpamac --destdir "$pkgdir"
  meson install -C build_pamac --destdir "$pkgdir"
  meson install -C build_cli --destdir "$pkgdir"
}