summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5889570413b3a8b5d75a4e05a965f3eea8fff5de (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
# Maintainer:  dreieck (https://aur.archlinux.org/account/dreieck)
# Contributor: slact (https://aur.archlinux.org/account/slact)
# Contributor: Jan de Groot <jgc@archlinux.org>
# Contributor: Star Brilliant (https://aur.archlinux.org/account/m13253)

_pkgname=upower
pkgname="${_pkgname}-nocritical-nosystemd-git"
pkgver=1.90.4+6.r1704.20240424.544eba5
pkgrel=2
pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics (With a patch to disable low battery action). Built without systemd dependencies. Latest Git checkout."
arch=(
  'i686'
  'x86_64'
)
url="http://upower.freedesktop.org"
license=(
  'GPL2'
)
depends=(
  'gcc-libs'
  'glibc'
  'libgudev'
  'libimobiledevice'
  'libusb'
)
makedepends=(
  'docbook-xsl'
  'git'
  'gobject-introspection'
  'intltool' 
  'meson'
  'python'
)
optdepends=(
  'gobject-introspection-runtime: For /usr/lib/upower/integration-test.py.'
  'python>=3: For /usr/lib/upower/{integration-test.py,output_checker.py}.'
  'python-dbus: For /usr/lib/upower/integration-test.py.'
  'python-dbusmock: For /usr/lib/upower/integration-test.py.'
  'python-gobject: For  For /usr/lib/upower/integration-test.py.'
  'python-packaging: For /usr/lib/upower/integration-test.py.'
  'umockdev: For  For /usr/lib/upower/integration-test.py.'
)
# ## 2023-10-14: Checks disabled since it fails on my machine because battery temperature cannot be read out.
# checkdepends=(
#   'python-dbus'
#   'python-dbusmock'
#   'python-gobject'
#   'python-packaging'
#   'umockdev'
# )
provides=(
  "${_pkgname}=${pkgver}"
  "${_pkgname}-nocritical=${pkgver}"
  "${_pkgname}-nosystemd=${pkgver}"
  "${_pkgname}-git=${pkgver}"
)
conflicts=(
  "${_pkgname}"
)
backup=(
  'etc/UPower/UPower.conf'
)
source=(
  "${_pkgname}::git+https://gitlab.freedesktop.org/upower/upower.git"
  "0001-Add-a-critical-action-Ignore.patch"
)
sha256sums=(
  "SKIP"                                                              # Upstream source
  "04b87837be843ebd07a1d39ae95f77e883208fef0145fa3086690fdb61b81c10"  # 0001-Add-a-critical-action-Ignore.patch
)
options+=('emptydirs')

prepare() {
  cd "${srcdir}/${_pkgname}"

  for _patch in "${srcdir}/0001-Add-a-critical-action-Ignore.patch"; do
    msg2 "Applying patch '$(basename "${_patch}")'"
    patch -N -p1 --follow-symlinks -i "${_patch}"
  done

  git log > "${srcdir}/git.log"
}

pkgver() {
  cd "${srcdir}/${_pkgname}"

  _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
  _rev="$(git rev-list --count HEAD)"
  _date="$(git log -1 --date=format:"%Y%m%d" --format="%ad")"
  _hash="$(git rev-parse --short HEAD)"

  if [ -z "${_ver}" ]; then
    error "Could not determine version."
    return 1
  else
    printf '%s' "${_ver}.r${_rev}.${_date}.${_hash}"
  fi
}

build() {
  cd "${srcdir}"

  arch-meson \
    -D man=true \
    -D gtk-doc=false \
    -D introspection=enabled \
    -D systemdsystemunitdir=no \
    -D idevice=enabled \
    upower build

  meson compile -C build
}

# ## 2023-10-14: Checks disabled since it fails on my machine because battery temperature cannot be read out.
# check() {
#   cd "${srcdir}"
# 
#   meson test -C build --print-errorlogs
# }

package() {
  depends+=(libg{lib,object,io}-2.0.so)
  provides+=(libupower-glib.so)

  cd "${srcdir}"

  meson install -C build --destdir "${pkgdir}"

  cd "${srcdir}/${_pkgname}"
  for _docfile in "${srcdir}/git.log" AUTHORS code-of-conduct.md COMMITMENT HACKING NEWS README RELEASE; do
    install -Dvm644 "${_docfile}" "${pkgdir}/usr/share/doc/${_pkgname}/$(basename "${_docfile}")"
  done
  for _licensefile in COPYING; do
    install -Dvm644 "${_licensefile}" "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_licensefile}")"
    ln -svr "${pkgdir}/usr/share/licenses/${pkgname}/$(basename "${_licensefile}")" "${pkgdir}/usr/share/doc/${_pkgname}/$(basename "${_licensefile}")"
  done
}