# HG changeset patch # User David Demelier # Date 1554720811 -7200 # Node ID 9987c7d6e9cf7cb9b4b57f9c3c216782bf0a8028 # Parent a89c2ee9ff94727df2f56b07870e0b28cf9d97ca system/accountsservice: initial import, closes #1581 diff -r a89c2ee9ff94 -r 9987c7d6e9cf system/accountsservice/accountsservice.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/accountsservice/accountsservice.sh Mon Apr 08 12:53:31 2019 +0200 @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Copyright (c) 2019 David Demelier +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# + +PKGNAME=accountsservice +PKGVERSION=0.6.54 +PKGREVISION=1 +PKGLICENSE="GPLv3" +PKGSUMMARY="D-Bus API for querying users" +PKGDOWNLOAD="https://www.freedesktop.org/software/$PKGNAME/$PKGNAME-$PKGVERSION.tar.xz" +PKGDEPENDS="dev/meson:build dev/gobject-introspection security/polkit" + +: ${CC:=clang} +: ${CFLAGS:=-O2} +: ${LDFLAGS:=} + +build() +{ + rm -rf $PKGNAME-$PKGVERSION + tar xvaf $PKGNAME-$PKGVERSION.tar.xz + pushd $PKGNAME-$PKGVERSION + + # credits to void-linux. + patch -p0 < ../musl-fgetspent_r.patch + patch -p0 < ../musl-wtmp.patch + CC="$CC" \ + CFLAGS="$CFLAGS" \ + LDFLAGS="$LDFLAGS" \ + meson \ + --prefix /usr \ + --buildtype release \ + --default-library shared \ + -D admin_group=wheel \ + -D systemd=false \ + -D elogind=false \ + -D systemdsystemunitdir=no \ + . build + CC="$CC" ninja -C build + DESTDIR=$DESTDIR ninja -C build install + + popd + rm -rf $PKGNAME-$PKGVERSION +} + diff -r a89c2ee9ff94 -r 9987c7d6e9cf system/accountsservice/musl-fgetspent_r.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/accountsservice/musl-fgetspent_r.patch Mon Apr 08 12:53:31 2019 +0200 @@ -0,0 +1,34 @@ +diff --git a/src/daemon.c b/src/daemon.c +index 312394a..e7b3c58 100644 +--- src/daemon.c ++++ src/daemon.c +@@ -140,6 +140,28 @@ error_get_type (void) + #define MAX_LOCAL_USERS 50 + #endif + ++#ifndef __GLIBC__ ++ /* Musl libc does not support fgetspent_r(), write own ++ * wrapper ++ */ ++static int fgetspent_r(FILE *fp, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp) { ++ struct spwd *shadow_entry = fgetspent(fp); ++ if(!shadow_entry) ++ return -1; ++ size_t namplen = strlen(shadow_entry->sp_namp); ++ size_t pwdplen = strlen(shadow_entry->sp_pwdp); ++ ++ if(namplen + pwdplen + 2 > buflen) ++ return -1; ++ ++ *spbufp = memcpy(spbuf, shadow_entry, sizeof(struct spwd)); ++ spbuf->sp_namp = strncpy(buf, shadow_entry->sp_namp, namplen + 1); ++ spbuf->sp_pwdp = strncpy(buf + namplen + 1, shadow_entry->sp_pwdp, pwdplen + 1); ++ ++ return 0; ++} ++#endif ++ + static struct passwd * + entry_generator_fgetpwent (Daemon *daemon, + GHashTable *users, + diff -r a89c2ee9ff94 -r 9987c7d6e9cf system/accountsservice/musl-wtmp.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/system/accountsservice/musl-wtmp.patch Mon Apr 08 12:53:31 2019 +0200 @@ -0,0 +1,15 @@ +Reason: fix build on musl +Tidy up and send upstream soon... +--- meson.build ++++ meson.build +@@ -82,8 +82,7 @@ if cc.has_header_symbol('utmpx.h', 'WTMPX_FILENAME', prefix: '#define _GNU_SOURC + elif cc.has_header_symbol('paths.h', '_PATH_WTMPX') + config_h.set('PATH_WTMP', '_PATH_WTMPX') + else +- assert(run_command('test', '-e', '/var/log/utx.log').returncode() == 0, 'Do not know which filename to watch for wtmp changes') +- config_h.set_quoted('PATH_WTMP', '/var/log/utx.log') ++ config_h.set_quoted('PATH_WTMP', '/var/log/wtmp') + endif + + # compiler flags +