summaryrefslogtreecommitdiff
path: root/opt/dbus/MAKEPKG
blob: 7eb3816d4313fc11be358c936afd8669ea1827ee (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
#!/bin/mkpkg
# description: D-Bus message bus system
# url: https://freedesktop.org/wiki/Software/dbus

name=dbus
version=1.16.2
release=2
depends=(expat)
makedeps=(meson libxslt docbook-xsl)
groups=(messagebus:user:messagebus:/nonexistent:755:81:81)
services=(dbus)
source=(https://dbus.freedesktop.org/releases/$name/$name-$version.tar.xz
  fix-daemon-location.patch)

patch() {
  cd $name-$version
  patch -p1 -i "$SRC"/fix-daemon-location.patch
}

sha256sums=(
    "0ba2a1a4b16afe7bceb2c07e9ce99a8c2c3508e5dec290dbb643384bd6beb7e2"
    "32862e56777619a479ebefc45589cb76207c836de24a8bca14aecb4552e42528"
)

build() {
  meson setup $name-$version build \
    --prefix=/usr \
    --libdir=lib \
    --localstatedir=/var \
    --sysconfdir=/etc \
    --libexecdir=lib/dbus \
    --buildtype=plain \
    -D dbus_daemondir=/usr/bin \
    -D dbus_user=messagebus \
    -D runtime_dir=/run \
    -D system_pid_file=/run/dbus/pid \
    -D system_socket=/run/dbus/system_bus_socket \
    -D x11_autolaunch=disabled \
    -D systemd=disabled \
    -D selinux=disabled \
    -D xml_docs=enabled \
    -D doxygen_docs=disabled \
    -D ducktype_docs=disabled \
    -D qt_help=disabled 


  meson compile -C build
  DESTDIR=$PKG meson install -C build

  # Symlink arch-specific header into the standard include path
  # so consumers find dbus-arch-deps.h without needing the lib include path
  ln -sf /usr/lib/dbus-1.0/include/dbus/dbus-arch-deps.h \
    "$PKG"/usr/include/dbus-1.0/dbus/dbus-arch-deps.h

  # machine-id lives on tmpfs, regenerated each boot by the run script
  ln -s /run/machine-id "$PKG"/etc/machine-id

  rm -f "$PKG"/usr/lib/dbus/dbus-daemon-launch-helper
  rm -rf $PKG/usr/share/doc
  rm -rf $PKG/usr/share/xml
  rm -rf $PKG/run
}

post_build() {
    # runit service
    install -d $PKG/etc/sv/dbus/log

    printf '%s\n' \
        '#!/bin/sh' \
        'exec 2>&1' \
        'install -d -m 755 -o messagebus -g messagebus /run/dbus' \
        'dbus-uuidgen --ensure=/run/machine-id' \
        'exec dbus-daemon --system --nofork --nopidfile' \
        > $PKG/etc/sv/dbus/run

    printf '%s\n' \
        '#!/bin/sh' \
        'rm -f /run/dbus/system_bus_socket' \
        > $PKG/etc/sv/dbus/finish

    printf '%s\n' \
        '#!/bin/sh' \
        'mkdir -p /var/log/dbus' \
        'exec svlogd -tt /var/log/dbus' \
        > $PKG/etc/sv/dbus/log/run

    chmod 755 $PKG/etc/sv/dbus/run
    chmod 755 $PKG/etc/sv/dbus/finish
    chmod 755 $PKG/etc/sv/dbus/log/run

    # session bus: started on first login, reused afterwards
    install -d "$PKG"/etc/profile.d

    printf '%s\n' \
        '# /etc/profile.d/20-dbus.sh - start/attach per-user D-Bus session bus' \
        'if [ -n "$XDG_RUNTIME_DIR" ]; then' \
        '    _bus="$XDG_RUNTIME_DIR/bus"' \
        '    if [ ! -S "$_bus" ] && mkdir "$XDG_RUNTIME_DIR/.dbus-lock" 2>/dev/null; then' \
        '        /usr/bin/dbus-daemon --session --address="unix:path=$_bus" \' \
        '            --fork --nopidfile --syslog-only' \
        '        rmdir "$XDG_RUNTIME_DIR/.dbus-lock"' \
        '    fi' \
        '    if [ -S "$_bus" ]; then' \
        '        export DBUS_SESSION_BUS_ADDRESS="unix:path=$_bus"' \
        '    fi' \
        '    unset _bus' \
        'fi' \
        > "$PKG"/etc/profile.d/20-dbus.sh

    chmod 644 "$PKG"/etc/profile.d/20-dbus.sh
}

signify() {
    untrusted comment: public key
    RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}

# vim: filetype=sh