summaryrefslogtreecommitdiff
path: root/pcr/elogind/PKGBUILD
blob: 174e18b61024a6e01bfd0657e351fec30c484406 (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
# Maintainer (artix): artoo <artoo@cromnix.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
# Maintainer: David P. <megver83@parabola.nu>
# Contributor: Luke Shumaker <lukeshu@parabola.nu>

# Note: have libelogind-manpages as a separate package, so that
# systemd-libsystemd (which also includes the same manpages) and
# libelogind don't conflict.

pkgbase=elogind
pkgname=('elogind' 'libelogind' 'libelogind-manpages')
pkgver=238.1.0
_commit='8bb4695ef79404b6731b20dee58115c313444754'
pkgrel=2.1
pkgdesc="The systemd project's logind, extracted to a standalone package"
arch=('i686' 'x86_64' 'armv7h')
url="https://github.com/elogind/elogind"
license=('GPL2' 'LGPL2.1') # Mostly LGPL2.1, only the single `src/uaccess-command/uaccess-command.c` file is GPL2
makedepends=('acl' 'docbook-xsl' 'gperf' 'pam'
             'libcap' 'polkit' 'dbus' 'udev' 'meson' 'git')
validpgpkeys=('0C4DF110D49D911C593050BF5FC1DF9CEC74BA48') # Sven Eden <seden@havi.de>
source=(# fragment is latest tag for source verification, final merge in prepare()
        "git+https://github.com/elogind/elogind#tag=v${pkgver%.*}?signed"
        'elogind-struct-statx-is-defined.patch')
sha256sums=('SKIP'
            '3d6a1b1590bee1e673db1384f570596a8604e2c68adf0a9c1dc81ed67c3943bb')

prepare() {
  cd "$pkgbase"

  # merge the latest stable commit (fast-foward only to make sure
  # the verified tag is in)
  git merge --ff-only "${_commit}"

  patch -Np1 -i ../elogind-struct-statx-is-defined.patch
}

pkgver() {
  local version count

  cd "$pkgbase"

  version="$(git describe --abbrev=0 --tags)"
  count="$(git rev-list --count ${version}..)"
  printf '%s.%s' "${version#v}" "${count}"
}

build() {
  local meson_options=(
    -Drootlibdir=/usr/lib
    -Drootlibexecdir=/usr/lib/elogind
    -Ddbuspolicydir=/usr/share/dbus-1/system.d
    -Ddefault-hierarchy=hybrid
    -Dcgroup-controller=openrc
  )

  arch-meson "$pkgbase" build "${meson_options[@]}"

  ninja -C build

  # Go ahead and split the package now.  It's easier this way, because
  # we can use mv instead of awkward, error-prone rm/cp pairs.
  rm -rf "$srcdir/dest"

  # Put things in the main systemd package by default
  DESTDIR="$srcdir/dest/elogind" ninja -C build install

  install -d "$srcdir/dest/libelogind"/usr/lib
  mv -T "$srcdir/dest"/{elogind,libelogind}/usr/lib/pkgconfig
  mv -T "$srcdir/dest"/{elogind,libelogind}/usr/include
  mv -t "$srcdir/dest/libelogind"/usr/lib -- "$srcdir/dest/elogind"/usr/lib/libelogind*

  install -d "$srcdir/dest"/libelogind-manpages/usr/share/man
  mv -T "$srcdir/dest"/{elogind,libelogind-manpages}/usr/share/man/man3
}

package_elogind() {
  depends=('acl' 'pam' 'dbus' 'udev' 'libelogind')
  conflicts=('systemd-tools') # because both provide org.freedesktop.login1, say 'systemd-tools' instead of 'systemd' to avoid hitting systemd-dummy
  optdepends=('elogind-openrc: elogind initscript'
              'polkit-elogind: polkit support')
  backup=('etc/elogind/logind.conf')

  cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"
}

package_libelogind(){
  pkgdesc="elogind client libraries"
  provides=('libelogind.so')
  optdepends=('libelogind-manpages')

  cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"
}

package_libelogind-manpages() {
  pkgdesc='Manual pages for libelogind'
  depends=('libelogind')
  conflicts=('systemd-libsystemd') # because both provide the same manpages

  cp -rT -d --no-preserve=ownership,timestamp "$srcdir/dest/$pkgname" "$pkgdir"
}