diff --git a/srcpkgs/systemd-boot-efistub b/srcpkgs/systemd-boot-efistub new file mode 120000 index 00000000000..171756f5fb6 --- /dev/null +++ b/srcpkgs/systemd-boot-efistub @@ -0,0 +1 @@ +systemd-boot \ No newline at end of file diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf new file mode 100644 index 00000000000..23c744dd2a6 --- /dev/null +++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.conf @@ -0,0 +1,11 @@ +## uncomment this line to disable the systemd-boot hook +#SYSTEMD_BOOT_DISABLE=1 + +## Default $BOOT is /boot +#BOOT="/boot" + +## Default ESP is $BOOT +#ESP="$BOOT" + +## If unset, cmdline will be generated using UUID from fstab +#CMDLINE="" diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install new file mode 100644 index 00000000000..ddfdef523a7 --- /dev/null +++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-install @@ -0,0 +1,98 @@ +#!/bin/sh +# +# Kernel hook for systemd-boot. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +. "$ROOTDIR/etc/default/systemd-boot" + +if [ "$SYSTEMD_BOOT_DISABLE" ]; then + exit 0 +fi + +if ! bootctl is-installed >/dev/null; then + echo "systemd-boot is not installed to the ESP" + echo "run 'bootctl install' to install it" + exit 0 +fi + +BOOT="${BOOT:-/boot}" +ESP="${ESP:-"$BOOT"}" + +BOOT="$ROOTDIR/$BOOT" +ESP="$ROOTDIR/$ESP" + +[ -d "$ESP" ] || exit 0 + +ARCH="$(xbps-uhelper arch)" + +# EFI_ARCH is the identifier from the UEFI specification +case "$ARCH" in + x86_64*) EFI_ARCH="x64";; + i686*) EFI_ARCH="ia32";; + aarch64*) EFI_ARCH="aa64";; +esac + +entries="$ESP/loader/entries" +name="void-$ARCH-$VERSION" +entry="$entries/$name.conf" + +LINUX="vmlinuz-${VERSION}" + +if [ ! -f "$ESP/$LINUX" ]; then + LINUX="vmlinux-${VERSION}" + if [ ! -f "$ESP/$LINUX" ]; then + echo "Failed to find kernel at $ESP/vmlinuz-${VERSION} or $ESP/vmlinux-${VERSION}, aborting" + exit 1 + fi +fi + +INITRD="initramfs-${VERSION}.img" + +if [ ! -f "$ESP/$INITRD" ]; then + echo "Failed to find initramfs at $ESP/$INITRD, aborting" + exit 1 +fi + +# check if user provided options in /etc/default/systemd-boot +if [ -z "$CMDLINE" ]; then + # get UUID from fstab + CMDLINE="$( awk ' /^[[:space:]]*[^[:space:]#]+/ { + DEVICE=$1 + MOUNTPOINT=$2 + FSTYPE=$3 + if (MOUNTPOINT == "/") + { + print "rootfstype="FSTYPE, "root="DEVICE + exit + } + }' "$ROOTDIR/etc/fstab" + )" + if [ -z "$CMDLINE" ]; then + echo "Failed to determine root device, aborting" + exit 1 + fi + CMDLINE="${CMDLINE} quiet rw" +fi + +mkdir -p "$entries" + +cat <<-EOF > "$entry" + title Void Linux $ARCH $VERSION + sort-key void + version $VERSION + options $CMDLINE + linux $LINUX + initrd $INITRD +EOF + +if [ "$EFI_ARCH" ]; then + cat <<-EOF >> "$entry" + architecture $EFI_ARCH + EOF +fi + +echo "Created systemd-boot entry $entry with options '$CMDLINE'" diff --git a/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove new file mode 100644 index 00000000000..89825b55740 --- /dev/null +++ b/srcpkgs/systemd-boot/files/kernel.d/systemd-boot.post-remove @@ -0,0 +1,32 @@ +#!/bin/sh +# +# Kernel hook for systemd-boot. +# +# Arguments passed to this script: $1 pkgname, $2 version. +# +PKGNAME="$1" +VERSION="$2" + +. "$ROOTDIR/etc/default/systemd-boot" + +if [ "$SYSTEMD_BOOT_DISABLE" ]; then + exit 0 +fi + +BOOT="${BOOT:-/boot}" +ESP="${ESP:-"$BOOT"}" + +BOOT="$ROOTDIR/$BOOT" +ESP="$ROOTDIR/$ESP" + +ARCH="$(xbps-uhelper arch)" + +entries="$ESP/loader/entries" +name="void-$ARCH-$VERSION" +entry="$entries/$name.conf" + +[ -d "$ESP" ] || exit 0 + +rm -f "$entry" + +echo "Removed systemd-boot entry $entry" diff --git a/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch new file mode 100644 index 00000000000..80f415eb7fe --- /dev/null +++ b/srcpkgs/systemd-boot/files/patches/musl/musl-misc.patch @@ -0,0 +1,903 @@ +From 96b8c3dd79f334424f5e1fe5b03e45468d0f1e2d Mon Sep 17 00:00:00 2001 +From: jane400 +Date: Sat, 4 May 2024 02:58:07 +0200 +Subject: [PATCH] musl fixes + +This includes multiple tiny patches, so adding co-authored for these. +Co-Authored-By: Chen Qi +Co-Authored-By: Caleb Connolly +--- + src/basic/arphrd-util.c | 3 ++- + src/basic/arphrd-util.h | 1 + + src/basic/fd-util.h | 1 + + src/basic/fileio.h | 1 + + src/basic/generate-arphrd-list.sh | 2 +- + src/basic/glob-util.c | 14 -------------- + src/basic/glob-util.h | 1 + + src/basic/linux/if.h | 6 ++++++ + src/basic/linux/in6.h | 1 + + src/basic/missing_type.h | 16 ++++++++++++++++ + src/basic/pidref.h | 1 + + src/basic/sort-util.h | 1 + + src/basic/string-util.h | 1 + + src/libsystemd-network/arp-util.c | 2 +- + src/libsystemd-network/sd-dhcp6-client.c | 2 +- + src/libsystemd/sd-journal/catalog.c | 1 + + src/network/netdev/bareudp.c | 2 +- + src/network/netdev/batadv.c | 2 +- + src/network/netdev/bond.c | 2 +- + src/network/netdev/bridge.c | 1 - + src/network/netdev/dummy.c | 2 +- + src/network/netdev/geneve.c | 1 - + src/network/netdev/ifb.c | 2 +- + src/network/netdev/ipoib.c | 2 +- + src/network/netdev/ipvlan.c | 2 +- + src/network/netdev/macsec.c | 2 +- + src/network/netdev/macvlan.c | 2 +- + src/network/netdev/netdev.c | 2 +- + src/network/netdev/netdevsim.c | 2 +- + src/network/netdev/nlmon.c | 2 +- + src/network/netdev/tunnel.c | 2 +- + src/network/netdev/tuntap.c | 2 +- + src/network/netdev/vcan.c | 2 +- + src/network/netdev/veth.c | 3 ++- + src/network/netdev/vlan.c | 1 - + src/network/netdev/vrf.c | 1 - + src/network/netdev/vxcan.c | 2 +- + src/network/netdev/vxlan.c | 2 +- + src/network/netdev/wireguard.c | 3 ++- + src/network/netdev/xfrm.c | 2 +- + src/network/networkd-dhcp-common.c | 2 +- + src/network/networkd-dhcp-server.c | 2 +- + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-ipv6ll.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-ndisc.c | 2 +- + src/network/networkd-setlink.c | 2 +- + src/network/networkd-sysctl.c | 2 +- + src/shared/edit-util.c | 8 ++++---- + src/shared/edit-util.h | 2 +- + src/shared/linux/ethtool.h | 2 +- + src/shared/netif-util.c | 2 +- + src/systemctl/systemctl-edit.c | 2 +- + src/test/test-arphrd-util.c | 1 - + src/test/test-glob-util.c | 9 ++------- + src/test/test-parse-argument.c | 1 + + src/test/test-recurse-dir.c | 1 + + src/tmpfiles/tmpfiles.c | 8 ++------ + src/udev/udev-builtin-net_id.c | 2 +- + 59 files changed, 81 insertions(+), 73 deletions(-) + +diff --git a/src/basic/arphrd-util.c b/src/basic/arphrd-util.c +index 3ea2c9d09a9..421c368d45c 100644 +--- a/src/basic/arphrd-util.c ++++ b/src/basic/arphrd-util.c +@@ -2,7 +2,8 @@ + + #include + #include +-#include ++ ++#include + #include + #include + +diff --git a/src/basic/arphrd-util.h b/src/basic/arphrd-util.h +index 33f5694abd0..f4091276b15 100644 +--- a/src/basic/arphrd-util.h ++++ b/src/basic/arphrd-util.h +@@ -3,6 +3,7 @@ + + #include + #include ++#include + + const char *arphrd_to_name(int id); + int arphrd_from_name(const char *name); +diff --git a/src/basic/fd-util.h b/src/basic/fd-util.h +index af17481dd86..fa20bfa30f9 100644 +--- a/src/basic/fd-util.h ++++ b/src/basic/fd-util.h +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + #include "macro.h" + #include "missing_fcntl.h" +diff --git a/src/basic/fileio.h b/src/basic/fileio.h +index 03c3f3ff283..7d2ea991552 100644 +--- a/src/basic/fileio.h ++++ b/src/basic/fileio.h +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + + #include "macro.h" + #include "time-util.h" +diff --git a/src/basic/generate-arphrd-list.sh b/src/basic/generate-arphrd-list.sh +index ca1ba7cad4d..2e8fb64ba30 100755 +--- a/src/basic/generate-arphrd-list.sh ++++ b/src/basic/generate-arphrd-list.sh +@@ -3,6 +3,6 @@ + set -eu + set -o pipefail + +-${1:?} -dM -include linux/if_arp.h -include "${2:?}" - gl_closedir) +- pglob->gl_closedir = closedir_wrapper; +- if (!pglob->gl_readdir) +- pglob->gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot; +- if (!pglob->gl_opendir) +- pglob->gl_opendir = (void *(*)(const char *)) opendir; +- if (!pglob->gl_lstat) +- pglob->gl_lstat = lstat; +- if (!pglob->gl_stat) +- pglob->gl_stat = stat; +- + errno = 0; + k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob); + if (k == GLOB_NOMATCH) +diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h +index 7ca26cc27f7..c1d476ff2be 100644 +--- a/src/basic/glob-util.h ++++ b/src/basic/glob-util.h +@@ -6,6 +6,7 @@ + + #include "macro.h" + #include "string-util.h" ++#include "missing_type.h" + + /* Note: this function modifies pglob to set various functions. */ + int safe_glob(const char *path, int flags, glob_t *pglob); +diff --git a/src/basic/linux/if.h b/src/basic/linux/if.h +index e79f5c8cebd..567c747ec3e 100644 +--- a/src/basic/linux/if.h ++++ b/src/basic/linux/if.h +@@ -132,8 +132,14 @@ enum net_device_flags { + #define IFF_ECHO IFF_ECHO + #endif /* __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO */ + ++#if !(__UAPI_DEF_IF_NET_DEVICE_FLAGS && __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO && defined(IFF_VOLATILE)) ++#ifdef IFF_VOLATILE ++#undef IFF_VOLATILE ++#endif ++ + #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ + IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) ++#endif + + #define IF_GET_IFACE 0x0001 /* for querying only */ + #define IF_GET_PROTO 0x0002 +diff --git a/src/basic/linux/in6.h b/src/basic/linux/in6.h +index ff8d21f9e95..91afa8918c5 100644 +--- a/src/basic/linux/in6.h ++++ b/src/basic/linux/in6.h +@@ -22,6 +22,7 @@ + #ifndef _UAPI_LINUX_IN6_H + #define _UAPI_LINUX_IN6_H + ++#include + #include + #include + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index 1d17705c356..2463fd3bcbb 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -10,3 +10,19 @@ + #if !HAVE_CHAR16_T + # define char16_t uint16_t + #endif ++ ++#ifndef __GLIBC__ ++typedef int (*comparison_fn_t)(const void *, const void *); ++#endif ++ ++#ifndef FTW_CONTINUE ++#define FTW_CONTINUE 0 ++#endif ++ ++#ifndef GLOB_BRACE ++#define GLOB_BRACE 0 ++#endif ++ ++#ifndef GLOB_ALTDIRFUNC ++#define GLOB_ALTDIRFUNC 0 ++#endif +diff --git a/src/basic/pidref.h b/src/basic/pidref.h +index 9920ebb9b3b..e0df1ffb270 100644 +--- a/src/basic/pidref.h ++++ b/src/basic/pidref.h +@@ -2,6 +2,7 @@ + #pragma once + + #include "macro.h" ++#include "signal.h" + + /* An embeddable structure carrying a reference to a process. Supposed to be used when tracking processes continuously. */ + typedef struct PidRef { +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index 9c818bd7470..ef10c8be2cf 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -4,6 +4,7 @@ + #include + + #include "macro.h" ++#include "missing_type.h" + + /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the + * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that +diff --git a/src/basic/string-util.h b/src/basic/string-util.h +index ff5efbcf557..b329da8d177 100644 +--- a/src/basic/string-util.h ++++ b/src/basic/string-util.h +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + #include "alloc-util.h" + #include "macro.h" +diff --git a/src/libsystemd-network/arp-util.c b/src/libsystemd-network/arp-util.c +index ad61614f12f..4a53f944ac9 100644 +--- a/src/libsystemd-network/arp-util.c ++++ b/src/libsystemd-network/arp-util.c +@@ -5,7 +5,7 @@ + + #include + #include +-#include ++#include + + #include "arp-util.h" + #include "ether-addr-util.h" +diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c +index 3e992d7cadc..afc88936cd5 100644 +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,7 @@ + + #include + #include +-#include ++ + #include + + #include "sd-dhcp6-client.h" +diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c +index a0b673f65fc..29dd2fee164 100644 +--- a/src/libsystemd/sd-journal/catalog.c ++++ b/src/libsystemd/sd-journal/catalog.c +@@ -29,6 +29,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing_type.h" + + const char * const catalog_file_dirs[] = { + "/usr/local/lib/systemd/catalog/", +diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c +index 1df886573ba..80763cd009c 100644 +--- a/src/network/netdev/bareudp.c ++++ b/src/network/netdev/bareudp.c +@@ -2,7 +2,7 @@ + * Copyright © 2020 VMware, Inc. */ + + #include +-#include ++ + + #include "bareudp.h" + #include "netlink-util.h" +diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c +index 26da0231d45..52cc6943993 100644 +--- a/src/network/netdev/batadv.c ++++ b/src/network/netdev/batadv.c +@@ -3,7 +3,7 @@ + #include + #include + #include +-#include ++ + + #include "batadv.h" + #include "fileio.h" +diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c +index 52a7f126b6d..f7ffc7910e0 100644 +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + + #include "alloc-util.h" + #include "bond.h" +diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c +index d426c0c5019..36c504b1b11 100644 +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -2,7 +2,6 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include +-#include + #include + #include + +diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c +index 00df1d27873..136a097eed8 100644 +--- a/src/network/netdev/dummy.c ++++ b/src/network/netdev/dummy.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + + #include "dummy.h" + +diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c +index 22c2b00e1b7..e6a24c0fa09 100644 +--- a/src/network/netdev/geneve.c ++++ b/src/network/netdev/geneve.c +@@ -2,7 +2,6 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include +-#include + #include + + #include "alloc-util.h" +diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c +index d7ff44cb9ea..cf1f689e709 100644 +--- a/src/network/netdev/ifb.c ++++ b/src/network/netdev/ifb.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright © 2019 VMware, Inc. */ + +-#include ++ + + #include "ifb.h" + +diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c +index d5fe299b7b4..877bc011105 100644 +--- a/src/network/netdev/ipoib.c ++++ b/src/network/netdev/ipoib.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + #include + + #include "ipoib.h" +diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c +index 51ae64341db..d95fce77705 100644 +--- a/src/network/netdev/ipvlan.c ++++ b/src/network/netdev/ipvlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include ++ + + #include "conf-parser.h" + #include "ipvlan.h" +diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c +index 4b9f19cc95c..dbce56221fd 100644 +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + #include + #include + #include +diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c +index 21933d3970a..ed690ccb395 100644 +--- a/src/network/netdev/macvlan.c ++++ b/src/network/netdev/macvlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include ++ + + #include "conf-parser.h" + #include "macvlan.h" +diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c +index 2b411425ba1..11826705fc0 100644 +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include ++ + #include + + #include "alloc-util.h" +diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c +index 15d5c132f96..92600c9a75d 100644 +--- a/src/network/netdev/netdevsim.c ++++ b/src/network/netdev/netdevsim.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + + #include "netdevsim.h" + +diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c +index ff372092e61..3726180eac1 100644 +--- a/src/network/netdev/nlmon.c ++++ b/src/network/netdev/nlmon.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + + #include "nlmon.h" + +diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c +index db84e7cf6ee..f518e7cec85 100644 +--- a/src/network/netdev/tunnel.c ++++ b/src/network/netdev/tunnel.c +@@ -2,7 +2,7 @@ + + #include + #include +-#include ++ + #include + #include + #include +diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c +index f5be31ed943..c2e6a47f446 100644 +--- a/src/network/netdev/tuntap.c ++++ b/src/network/netdev/tuntap.c +@@ -5,7 +5,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c +index 380547ee1e8..7124f9f2c0c 100644 +--- a/src/network/netdev/vcan.c ++++ b/src/network/netdev/vcan.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + + #include "vcan.h" + +diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c +index 78555286d1a..3379309d4a7 100644 +--- a/src/network/netdev/veth.c ++++ b/src/network/netdev/veth.c +@@ -3,7 +3,8 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include ++#include ++ + #include + #include + +diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c +index 60e49a5b8a9..8c0189e8036 100644 +--- a/src/network/netdev/vlan.c ++++ b/src/network/netdev/vlan.c +@@ -3,7 +3,6 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include + #include + + #include "parse-util.h" +diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c +index 24079a7203c..88d649fbc39 100644 +--- a/src/network/netdev/vrf.c ++++ b/src/network/netdev/vrf.c +@@ -2,7 +2,6 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include +-#include + #include + + #include "vrf.h" +diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c +index c0343f45b62..f1a96bef296 100644 +--- a/src/network/netdev/vxcan.c ++++ b/src/network/netdev/vxcan.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + + #include "vxcan.h" + +diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c +index 37f65967a6b..ee1d9e15ac0 100644 +--- a/src/network/netdev/vxlan.c ++++ b/src/network/netdev/vxlan.c +@@ -3,7 +3,7 @@ + /* Make sure the net/if.h header is included before any linux/ one */ + #include + #include +-#include ++ + + #include "conf-parser.h" + #include "alloc-util.h" +diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c +index fed1be8d110..c12c6e34903 100644 +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -5,7 +5,8 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include +-#include ++#include ++ + #include + #include + #include +diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c +index 905bfc0bdf0..05743977f9a 100644 +--- a/src/network/netdev/xfrm.c ++++ b/src/network/netdev/xfrm.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include ++ + + #include "missing_network.h" + #include "xfrm.h" +diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c +index 9f0268d934e..4d871c4ea16 100644 +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++#include + + #include "bus-error.h" + #include "bus-locator.h" +diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c +index c35102af74a..b60cc53b5b9 100644 +--- a/src/network/networkd-dhcp-server.c ++++ b/src/network/networkd-dhcp-server.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + #include + + #include "sd-dhcp-server.h" +diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c +index 4dd6044b189..5c1d5887521 100644 +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -3,7 +3,7 @@ + #include + #include + #include +-#include ++ + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c +index 32229a3fc70..5e080fe8ce3 100644 +--- a/src/network/networkd-ipv6ll.c ++++ b/src/network/networkd-ipv6ll.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + + #include "in-addr-util.h" + #include "networkd-address.h" +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index 6b0f09926a0..844f83850fc 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -4,7 +4,7 @@ + #include + #include + #include +-#include ++ + #include + #include + #include +diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c +index 7cafe1f6a3e..e38e176dd60 100644 +--- a/src/network/networkd-ndisc.c ++++ b/src/network/networkd-ndisc.c +@@ -6,7 +6,7 @@ + #include + #include + #include +-#include ++ + + #include "sd-ndisc.h" + +diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c +index 058bc00ba10..7f82ca6781a 100644 +--- a/src/network/networkd-setlink.c ++++ b/src/network/networkd-setlink.c +@@ -2,7 +2,7 @@ + + #include + #include +-#include ++ + #include + + #include "missing_network.h" +diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c +index 68c23e0eb79..56f71d71881 100644 +--- a/src/network/networkd-sysctl.c ++++ b/src/network/networkd-sysctl.c +@@ -2,7 +2,7 @@ + + #include + #include +-#include ++ + + #include "af-list.h" + #include "missing_network.h" +diff --git a/src/shared/edit-util.c b/src/shared/edit-util.c +index cfb2828f4e3..3015139016e 100644 +--- a/src/shared/edit-util.c ++++ b/src/shared/edit-util.c +@@ -212,7 +212,7 @@ static int create_edit_temp_file(EditFile *e, const char *contents, size_t conte + if (fchmod(fileno(f), 0644) < 0) + return log_error_errno(errno, "Failed to change mode of temporary file '%s': %m", temp); + +- if (e->context->stdin) { ++ if (e->context->_stdin) { + if (fwrite(contents, 1, contents_size, f) != contents_size) + return log_error_errno(SYNTHETIC_ERRNO(EIO), + "Failed to copy input to temporary file '%s'.", temp); +@@ -326,7 +326,7 @@ static int strip_edit_temp_file(EditFile *e) { + if (!tmp) + return log_oom(); + +- if (e->context->marker_start && !e->context->stdin) { ++ if (e->context->marker_start && !e->context->_stdin) { + /* Trim out the lines between the two markers */ + char *contents_start, *contents_end; + +@@ -374,7 +374,7 @@ int do_edit_files_and_install(EditFileContext *context) { + if (context->n_files == 0) + return log_debug_errno(SYNTHETIC_ERRNO(ENOENT), "Got no files to edit."); + +- if (context->stdin) { ++ if (context->_stdin) { + r = read_full_stream(stdin, &data, &data_size); + if (r < 0) + return log_error_errno(r, "Failed to read stdin: %m"); +@@ -386,7 +386,7 @@ int do_edit_files_and_install(EditFileContext *context) { + return r; + } + +- if (!context->stdin) { ++ if (!context->_stdin) { + r = run_editor(context); + if (r < 0) + return r; +diff --git a/src/shared/edit-util.h b/src/shared/edit-util.h +index 9d9c890f2a9..5289782d719 100644 +--- a/src/shared/edit-util.h ++++ b/src/shared/edit-util.h +@@ -15,7 +15,7 @@ typedef struct EditFileContext { + const char *marker_end; + bool remove_parent; + bool overwrite_with_origin; /* Always overwrite target with original file. */ +- bool stdin; /* Read contents from stdin instead of launching an editor. */ ++ bool _stdin; /* Read contents from stdin instead of launching an editor. */ + } EditFileContext; + + void edit_file_context_done(EditFileContext *context); +diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h +index 3d1da515c08..633494efbd6 100644 +--- a/src/shared/linux/ethtool.h ++++ b/src/shared/linux/ethtool.h +@@ -16,7 +16,7 @@ + + #include + #include +-#include ++#include + + #include /* for INT_MAX */ + +diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c +index 8adc2c89c81..919491cea46 100644 +--- a/src/shared/netif-util.c ++++ b/src/shared/netif-util.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include +-#include ++ + + #include "arphrd-util.h" + #include "device-util.h" +diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c +index 15398f83646..ae08d65b0f1 100644 +--- a/src/systemctl/systemctl-edit.c ++++ b/src/systemctl/systemctl-edit.c +@@ -316,7 +316,7 @@ int verb_edit(int argc, char *argv[], void *userdata) { + .marker_end = DROPIN_MARKER_END, + .remove_parent = !arg_full, + .overwrite_with_origin = true, +- .stdin = arg_stdin, ++ ._stdin = arg_stdin, + }; + _cleanup_strv_free_ char **names = NULL; + sd_bus *bus; +diff --git a/src/test/test-arphrd-util.c b/src/test/test-arphrd-util.c +index 15b79977504..afa876506a6 100644 +--- a/src/test/test-arphrd-util.c ++++ b/src/test/test-arphrd-util.c +@@ -2,7 +2,6 @@ + + /* Make sure the net/if.h header is included before any linux/ one */ + #include +-#include + + #include "arphrd-util.h" + #include "string-util.h" +diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c +index 49d71f15c71..44becc6ead3 100644 +--- a/src/test/test-glob-util.c ++++ b/src/test/test-glob-util.c +@@ -12,6 +12,7 @@ + #include "rm-rf.h" + #include "tests.h" + #include "tmpfile-util.h" ++#include "missing_type.h" + + TEST(glob_first) { + char *first, name[] = "/tmp/test-glob_first.XXXXXX"; +@@ -60,13 +61,7 @@ TEST(glob_no_dot) { + char template[] = "/tmp/test-glob-util.XXXXXXX"; + const char *fn; + +- _cleanup_globfree_ glob_t g = { +- .gl_closedir = closedir_wrapper, +- .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot, +- .gl_opendir = (void *(*)(const char *)) opendir, +- .gl_lstat = lstat, +- .gl_stat = stat, +- }; ++ _cleanup_globfree_ glob_t g = {}; + + int r; + +diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c +index c07b2d9afe7..5b4562740e8 100644 +--- a/src/test/test-parse-argument.c ++++ b/src/test/test-parse-argument.c +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include ++#include + + #include "parse-argument.h" + #include "stdio-util.h" +diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c +index 8684d064ec3..70fc2b53763 100644 +--- a/src/test/test-recurse-dir.c ++++ b/src/test/test-recurse-dir.c +@@ -8,6 +8,7 @@ + #include "recurse-dir.h" + #include "strv.h" + #include "tests.h" ++#include "missing_type.h" + + static char **list_nftw = NULL; + +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 807925f199d..a932873f236 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -2569,9 +2569,7 @@ finish: + } + + static int glob_item(Context *c, Item *i, action_t action) { +- _cleanup_globfree_ glob_t g = { +- .gl_opendir = (void *(*)(const char *)) opendir_nomod, +- }; ++ _cleanup_globfree_ glob_t g = {}; + int r; + + assert(c); +@@ -2597,9 +2595,7 @@ static int glob_item_recursively( + Item *i, + fdaction_t action) { + +- _cleanup_globfree_ glob_t g = { +- .gl_opendir = (void *(*)(const char *)) opendir_nomod, +- }; ++ _cleanup_globfree_ glob_t g = {}; + int r; + + assert(c); +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 384a1f31cbc..d8b3db40b7d 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -19,7 +19,7 @@ + #include + #include + #include +-#include ++ + #include + #include + +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-gshadow.patch b/srcpkgs/systemd-boot/patches/musl-gshadow.patch new file mode 100644 index 00000000000..a0351093828 --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-gshadow.patch @@ -0,0 +1,158 @@ +From 9bc52f47d34e5686d5608ad2217df99e82f6b438 Mon Sep 17 00:00:00 2001 +From: jane400 +Date: Sun, 2 Jun 2024 10:07:09 +0200 +Subject: [PATCH] musl: missing gshadow + +--- + src/basic/gshadow.h | 5 +++++ + src/shared/user-record-nss.c | 20 ++++++++++++++++++++ + src/shared/userdb.c | 7 ++++++- + 3 files changed, 31 insertions(+), 1 deletion(-) + create mode 100644 src/basic/gshadow.h + +diff --git a/src/basic/gshadow.h b/src/basic/gshadow.h +new file mode 100644 +index 00000000000..a6a56f38ce7 +--- /dev/null ++++ b/src/basic/gshadow.h +@@ -0,0 +1,5 @@ ++#pragma once ++ ++#define ENABLE_GSHADOW 0 ++ ++struct sgrp {}; +diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c +index ffb57214662..2596c658b39 100644 +--- a/src/shared/user-record-nss.c ++++ b/src/shared/user-record-nss.c +@@ -286,8 +286,10 @@ int nss_group_to_group_record( + if (isempty(grp->gr_name)) + return -EINVAL; + ++#if ENABLE_GSHADOW + if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name)) + return -EINVAL; ++#endif + + g = group_record_new(); + if (!g) +@@ -303,6 +305,7 @@ int nss_group_to_group_record( + + g->gid = grp->gr_gid; + ++#if ENABLE_GSHADOW + if (sgrp) { + if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { + g->hashed_password = strv_new(sgrp->sg_passwd); +@@ -318,6 +321,7 @@ int nss_group_to_group_record( + if (r < 0) + return r; + } ++#endif + + r = json_build(&g->json, JSON_BUILD_OBJECT( + JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), +@@ -341,9 +345,12 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re + int r; + + assert(grp); ++#if ENABLE_GSHADOW + assert(ret_sgrp); ++#endif + assert(ret_buffer); + ++#if ENABLE_GSHADOW + for (;;) { + _cleanup_free_ char *buf = NULL; + struct sgrp sgrp, *result; +@@ -372,6 +379,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re + buflen *= 2; + buf = mfree(buf); + } ++#else ++ return -ESRCH; ++#endif + } + + int nss_group_record_by_name( +@@ -391,6 +401,7 @@ int nss_group_record_by_name( + if (r < 0) + return r; + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -402,6 +413,9 @@ int nss_group_record_by_name( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +@@ -418,13 +432,16 @@ int nss_group_record_by_gid( + _cleanup_free_ char *sbuf = NULL; + _cleanup_free_ struct group *result = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + r = getgrgid_malloc(gid, &result); + if (r < 0) + return r; + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -436,6 +453,9 @@ int nss_group_record_by_gid( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +diff --git a/src/shared/userdb.c b/src/shared/userdb.c +index 75dece34429..4f4e21a6c4b 100644 +--- a/src/shared/userdb.c ++++ b/src/shared/userdb.c +@@ -1038,13 +1038,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { + if (gr) { + _cleanup_free_ char *buffer = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp; ++#endif + + if (streq_ptr(gr->gr_name, "root")) + iterator->synthesize_root = false; + if (gr->gr_gid == GID_NOBODY) + iterator->synthesize_nobody = false; + ++#if ENABLE_GSHADOW + if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { + r = nss_sgrp_for_group(gr, &sgrp, &buffer); + if (r < 0) { +@@ -1055,8 +1058,10 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { + r = -EUCLEAN; + incomplete = true; + } ++#endif ++ ++ r = nss_group_to_group_record(gr, NULL, ret); + +- r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); + if (r < 0) + return r; + +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_info.patch b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch new file mode 100644 index 00000000000..516fcd60baf --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-malloc_info.patch @@ -0,0 +1,57 @@ +From 2694840a90fe719422ca8d0ca52eedee9e3ceb09 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 2 Aug 2023 12:20:40 -0700 +Subject: [PATCH] shared: Do not use malloc_info on musl + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj +--- + src/shared/bus-util.c | 5 +++-- + src/shared/common-signal.c | 4 ++-- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index 30f9602b1ed..5308f168db2 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -755,15 +755,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat + _cleanup_close_ int fd = -EBADF; + size_t dump_size; + FILE *f; +- int r; ++ int r = 0; + + assert(message); + + f = memstream_init(&m); + if (!f) + return -ENOMEM; +- ++#ifdef __GLIBC__ + r = RET_NERRNO(malloc_info(/* options= */ 0, f)); ++#endif + if (r < 0) + return r; + +diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c +index 8e70e365dd6..9e782caec9b 100644 +--- a/src/shared/common-signal.c ++++ b/src/shared/common-signal.c +@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo + log_oom(); + break; + } +- ++#ifdef __GLIBC__ + if (malloc_info(0, f) < 0) { + log_error_errno(errno, "Failed to invoke malloc_info(): %m"); + break; + } +- ++#endif + (void) memstream_dump(LOG_INFO, &m); + break; + } +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch new file mode 100644 index 00000000000..52de4fd3f63 --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-malloc_trim.patch @@ -0,0 +1,39 @@ +From 2f31dab873a4b980cb1bd09a001257afb75385b9 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 2 Aug 2023 12:06:27 -0700 +Subject: [PATCH] sd-event: Make malloc_trim() conditional on glibc + +musl does not have this API + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj +--- + src/libsystemd/sd-event/sd-event.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c +index a1305ef0149..b8a73da2a3b 100644 +--- a/src/libsystemd/sd-event/sd-event.c ++++ b/src/libsystemd/sd-event/sd-event.c +@@ -1877,7 +1877,7 @@ _public_ int sd_event_add_exit( + } + + _public_ int sd_event_trim_memory(void) { +- int r; ++ int r = 0; + + /* A default implementation of a memory pressure callback. Simply releases our own allocation caches + * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a +@@ -1891,7 +1891,9 @@ _public_ int sd_event_trim_memory(void) { + + usec_t before_timestamp = now(CLOCK_MONOTONIC); + hashmap_trim_pools(); ++#ifdef __GLIBC__ + r = malloc_trim(0); ++#endif + usec_t after_timestamp = now(CLOCK_MONOTONIC); + + if (r > 0) +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-prctl.patch b/srcpkgs/systemd-boot/patches/musl-prctl.patch new file mode 100644 index 00000000000..7da334d0273 --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-prctl.patch @@ -0,0 +1,32 @@ +From 32b3e60a0920d1f4fa2f3300747d69ad167ba372 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Mon, 25 Feb 2019 15:44:54 +0800 +Subject: [PATCH] avoid redefinition of prctl_mm_map structure + +Fix the following compile failure: +error: redefinition of 'struct prctl_mm_map' + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi +--- + src/basic/missing_prctl.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h +index 2c9f9f6c50f..65a984b564e 100644 +--- a/src/basic/missing_prctl.h ++++ b/src/basic/missing_prctl.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once + ++#ifdef __GLIBC__ + #include ++#endif + + #include "macro.h" + +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-printf.patch b/srcpkgs/systemd-boot/patches/musl-printf.patch new file mode 100644 index 00000000000..6b37a4743db --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-printf.patch @@ -0,0 +1,434 @@ +From ef5cd9b237c743b24470cce7975a69282b1e0289 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Sat, 22 May 2021 20:26:24 +0200 +Subject: [PATCH] add fallback parse_printf_format implementation + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Emil Renner Berthing +Signed-off-by: Khem Raj +Signed-off-by: Chen Qi +[rebased for systemd 243] +Signed-off-by: Scott Murray +--- + meson.build | 1 + + src/basic/meson.build | 5 + + src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++ + src/basic/stdio-util.h | 2 +- + src/libsystemd/sd-journal/journal-send.c | 2 +- + 6 files changed, 338 insertions(+), 2 deletions(-) + create mode 100644 src/basic/parse-printf-format.c + create mode 100644 src/basic/parse-printf-format.h + +diff --git a/meson.build b/meson.build +index ea4e12aa1c6..c384e236698 100644 +--- a/meson.build ++++ b/meson.build +@@ -753,6 +753,7 @@ foreach header : ['crypt.h', + 'linux/memfd.h', + 'linux/time_types.h', + 'linux/vm_sockets.h', ++ 'printf.h', + 'sys/auxv.h', + 'sys/sdt.h', + 'threads.h', +diff --git a/src/basic/meson.build b/src/basic/meson.build +index 9a214575a56..b49b6ade568 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -189,6 +189,11 @@ endforeach + + basic_sources += generated_gperf_headers + ++if conf.get('HAVE_PRINTF_H') != 1 ++ basic_sources += [files('parse-printf-format.c')] ++endif ++ ++ + ############################################################ + + arch_list = [ +diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c +new file mode 100644 +index 00000000000..49437e54454 +--- /dev/null ++++ b/src/basic/parse-printf-format.c +@@ -0,0 +1,273 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2014 Emil Renner Berthing ++ ++ With parts from the musl C library ++ Copyright 2005-2014 Rich Felker, et al. ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#include ++#include ++ ++#include "parse-printf-format.h" ++ ++static const char *consume_nonarg(const char *fmt) ++{ ++ do { ++ if (*fmt == '\0') ++ return fmt; ++ } while (*fmt++ != '%'); ++ return fmt; ++} ++ ++static const char *consume_num(const char *fmt) ++{ ++ for (;*fmt >= '0' && *fmt <= '9'; fmt++) ++ /* do nothing */; ++ return fmt; ++} ++ ++static const char *consume_argn(const char *fmt, size_t *arg) ++{ ++ const char *p = fmt; ++ size_t val = 0; ++ ++ if (*p < '1' || *p > '9') ++ return fmt; ++ do { ++ val = 10*val + (*p++ - '0'); ++ } while (*p >= '0' && *p <= '9'); ++ ++ if (*p != '$') ++ return fmt; ++ *arg = val; ++ return p+1; ++} ++ ++static const char *consume_flags(const char *fmt) ++{ ++ while (1) { ++ switch (*fmt) { ++ case '#': ++ case '0': ++ case '-': ++ case ' ': ++ case '+': ++ case '\'': ++ case 'I': ++ fmt++; ++ continue; ++ } ++ return fmt; ++ } ++} ++ ++enum state { ++ BARE, ++ LPRE, ++ LLPRE, ++ HPRE, ++ HHPRE, ++ BIGLPRE, ++ ZTPRE, ++ JPRE, ++ STOP ++}; ++ ++enum type { ++ NONE, ++ PTR, ++ INT, ++ UINT, ++ ULLONG, ++ LONG, ++ ULONG, ++ SHORT, ++ USHORT, ++ CHAR, ++ UCHAR, ++ LLONG, ++ SIZET, ++ IMAX, ++ UMAX, ++ PDIFF, ++ UIPTR, ++ DBL, ++ LDBL, ++ MAXTYPE ++}; ++ ++static const short pa_types[MAXTYPE] = { ++ [NONE] = PA_INT, ++ [PTR] = PA_POINTER, ++ [INT] = PA_INT, ++ [UINT] = PA_INT, ++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG, ++ [LONG] = PA_INT | PA_FLAG_LONG, ++ [ULONG] = PA_INT | PA_FLAG_LONG, ++ [SHORT] = PA_INT | PA_FLAG_SHORT, ++ [USHORT] = PA_INT | PA_FLAG_SHORT, ++ [CHAR] = PA_CHAR, ++ [UCHAR] = PA_CHAR, ++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG, ++ [SIZET] = PA_INT | PA_FLAG_LONG, ++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG, ++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG, ++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG, ++ [UIPTR] = PA_INT | PA_FLAG_LONG, ++ [DBL] = PA_DOUBLE, ++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE ++}; ++ ++#define S(x) [(x)-'A'] ++#define E(x) (STOP + (x)) ++ ++static const unsigned char states[]['z'-'A'+1] = { ++ { /* 0: bare types */ ++ S('d') = E(INT), S('i') = E(INT), ++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT), ++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), ++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), ++ S('c') = E(CHAR),S('C') = E(INT), ++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR), ++ S('m') = E(NONE), ++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE, ++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE ++ }, { /* 1: l-prefixed */ ++ S('d') = E(LONG), S('i') = E(LONG), ++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG), ++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL), ++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL), ++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR), ++ S('l') = LLPRE ++ }, { /* 2: ll-prefixed */ ++ S('d') = E(LLONG), S('i') = E(LLONG), ++ S('o') = E(ULLONG),S('u') = E(ULLONG), ++ S('x') = E(ULLONG),S('X') = E(ULLONG), ++ S('n') = E(PTR) ++ }, { /* 3: h-prefixed */ ++ S('d') = E(SHORT), S('i') = E(SHORT), ++ S('o') = E(USHORT),S('u') = E(USHORT), ++ S('x') = E(USHORT),S('X') = E(USHORT), ++ S('n') = E(PTR), ++ S('h') = HHPRE ++ }, { /* 4: hh-prefixed */ ++ S('d') = E(CHAR), S('i') = E(CHAR), ++ S('o') = E(UCHAR),S('u') = E(UCHAR), ++ S('x') = E(UCHAR),S('X') = E(UCHAR), ++ S('n') = E(PTR) ++ }, { /* 5: L-prefixed */ ++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL), ++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL), ++ S('n') = E(PTR) ++ }, { /* 6: z- or t-prefixed (assumed to be same size) */ ++ S('d') = E(PDIFF),S('i') = E(PDIFF), ++ S('o') = E(SIZET),S('u') = E(SIZET), ++ S('x') = E(SIZET),S('X') = E(SIZET), ++ S('n') = E(PTR) ++ }, { /* 7: j-prefixed */ ++ S('d') = E(IMAX), S('i') = E(IMAX), ++ S('o') = E(UMAX), S('u') = E(UMAX), ++ S('x') = E(UMAX), S('X') = E(UMAX), ++ S('n') = E(PTR) ++ } ++}; ++ ++size_t parse_printf_format(const char *fmt, size_t n, int *types) ++{ ++ size_t i = 0; ++ size_t last = 0; ++ ++ memset(types, 0, n); ++ ++ while (1) { ++ size_t arg; ++ unsigned int state; ++ ++ fmt = consume_nonarg(fmt); ++ if (*fmt == '\0') ++ break; ++ if (*fmt == '%') { ++ fmt++; ++ continue; ++ } ++ arg = 0; ++ fmt = consume_argn(fmt, &arg); ++ /* flags */ ++ fmt = consume_flags(fmt); ++ /* width */ ++ if (*fmt == '*') { ++ size_t warg = 0; ++ fmt = consume_argn(fmt+1, &warg); ++ if (warg == 0) ++ warg = ++i; ++ if (warg > last) ++ last = warg; ++ if (warg <= n && types[warg-1] == NONE) ++ types[warg-1] = INT; ++ } else ++ fmt = consume_num(fmt); ++ /* precision */ ++ if (*fmt == '.') { ++ fmt++; ++ if (*fmt == '*') { ++ size_t parg = 0; ++ fmt = consume_argn(fmt+1, &parg); ++ if (parg == 0) ++ parg = ++i; ++ if (parg > last) ++ last = parg; ++ if (parg <= n && types[parg-1] == NONE) ++ types[parg-1] = INT; ++ } else { ++ if (*fmt == '-') ++ fmt++; ++ fmt = consume_num(fmt); ++ } ++ } ++ /* length modifier and conversion specifier */ ++ state = BARE; ++ do { ++ unsigned char c = *fmt++; ++ ++ if (c < 'A' || c > 'z') ++ continue; ++ state = states[state]S(c); ++ if (state == 0) ++ continue; ++ } while (state < STOP); ++ ++ if (state == E(NONE)) ++ continue; ++ ++ if (arg == 0) ++ arg = ++i; ++ if (arg > last) ++ last = arg; ++ if (arg <= n) ++ types[arg-1] = state - STOP; ++ } ++ ++ if (last > n) ++ last = n; ++ for (i = 0; i < last; i++) ++ types[i] = pa_types[types[i]]; ++ ++ return last; ++} +diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h +new file mode 100644 +index 00000000000..47be7522d7f +--- /dev/null ++++ b/src/basic/parse-printf-format.h +@@ -0,0 +1,57 @@ ++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ ++ ++/*** ++ This file is part of systemd. ++ ++ Copyright 2014 Emil Renner Berthing ++ ++ With parts from the GNU C Library ++ Copyright 1991-2014 Free Software Foundation, Inc. ++ ++ systemd is free software; you can redistribute it and/or modify it ++ under the terms of the GNU Lesser General Public License as published by ++ the Free Software Foundation; either version 2.1 of the License, or ++ (at your option) any later version. ++ ++ systemd is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public License ++ along with systemd; If not, see . ++***/ ++ ++#pragma once ++ ++#include "config.h" ++ ++#if HAVE_PRINTF_H ++#include ++#else ++ ++#include ++ ++enum { /* C type: */ ++ PA_INT, /* int */ ++ PA_CHAR, /* int, cast to char */ ++ PA_WCHAR, /* wide char */ ++ PA_STRING, /* const char *, a '\0'-terminated string */ ++ PA_WSTRING, /* const wchar_t *, wide character string */ ++ PA_POINTER, /* void * */ ++ PA_FLOAT, /* float */ ++ PA_DOUBLE, /* double */ ++ PA_LAST ++}; ++ ++/* Flag bits that can be set in a type returned by `parse_printf_format'. */ ++#define PA_FLAG_MASK 0xff00 ++#define PA_FLAG_LONG_LONG (1 << 8) ++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG ++#define PA_FLAG_LONG (1 << 9) ++#define PA_FLAG_SHORT (1 << 10) ++#define PA_FLAG_PTR (1 << 11) ++ ++size_t parse_printf_format(const char *fmt, size_t n, int *types); ++ ++#endif /* HAVE_PRINTF_H */ +diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h +index 0a2239d0225..43a765dacd5 100644 +--- a/src/basic/stdio-util.h ++++ b/src/basic/stdio-util.h +@@ -1,12 +1,12 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + #pragma once + +-#include + #include + #include + #include + + #include "macro.h" ++#include "parse-printf-format.h" + + _printf_(3, 4) + static inline char* snprintf_ok(char *buf, size_t len, const char *format, ...) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index 7d02b57d7b4..75e8e08add5 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -2,7 +2,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -28,6 +27,7 @@ + #include "stdio-util.h" + #include "string-util.h" + #include "tmpfile-util.h" ++#include "parse-printf-format.h" + + #define SNDBUF_SIZE (8*1024*1024) + +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-rlim.patch b/srcpkgs/systemd-boot/patches/musl-rlim.patch new file mode 100644 index 00000000000..ca3da713e7d --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-rlim.patch @@ -0,0 +1,106 @@ +From 02281a6fdd04011144ce0f51bb78abc92fdd550a Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Mon, 25 Feb 2019 15:12:41 +0800 +Subject: [PATCH] Use uintmax_t for handling rlim_t + +PRIu{32,64} is not right format to represent rlim_t type +therefore use %ju and typecast the rlim_t variables to +uintmax_t. + +Fixes portablility errors like + +execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] +| fprintf(f, "%s%s: " RLIM_FMT "\n", +| ^~~~~~~~ +| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +| ~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] + +Signed-off-by: Khem Raj +[Rebased for v241] +Signed-off-by: Chen Qi +--- + src/basic/format-util.h | 8 +------- + src/basic/rlimit-util.c | 12 ++++++------ + src/core/execute.c | 4 ++-- + 3 files changed, 9 insertions(+), 15 deletions(-) + +diff --git a/src/basic/format-util.h b/src/basic/format-util.h +index ba7cff6a8b5..2736abb07b6 100644 +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -42,13 +42,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + # error Unknown timex member size + #endif + +-#if SIZEOF_RLIM_T == 8 +-# define RLIM_FMT "%" PRIu64 +-#elif SIZEOF_RLIM_T == 4 +-# define RLIM_FMT "%" PRIu32 +-#else +-# error Unknown rlim_t size +-#endif ++#define RLIM_FMT "%ju" + + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 +diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c +index a9f7b87f289..059c67731d3 100644 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -47,7 +47,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { + fixed.rlim_max == highest.rlim_max) + return 0; + +- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max); ++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } +@@ -310,13 +310,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { + if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) + r = free_and_strdup(&s, "infinity"); + else if (rl->rlim_cur >= RLIM_INFINITY) +- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); + else if (rl->rlim_max >= RLIM_INFINITY) +- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); + else if (rl->rlim_cur == rl->rlim_max) +- r = asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); + else +- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + if (r < 0) + return -ENOMEM; + +@@ -425,7 +425,7 @@ int rlimit_nofile_safe(void) { + rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open()); + rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max); + if (setrlimit(RLIMIT_NOFILE, &rl) < 0) +- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); ++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); + + return 1; + } +diff --git a/src/core/execute.c b/src/core/execute.c +index 513e95e09d7..0e269617f82 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -1067,9 +1067,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { + for (unsigned i = 0; i < RLIM_NLIMITS; i++) + if (c->rlimit[i]) { + fprintf(f, "%sLimit%s: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); + fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); + } + + if (c->ioprio_set) { +-- +GitLab + diff --git a/srcpkgs/systemd-boot/patches/musl-strerror_r.patch b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch new file mode 100644 index 00000000000..9070170ccd5 --- /dev/null +++ b/srcpkgs/systemd-boot/patches/musl-strerror_r.patch @@ -0,0 +1,76 @@ +From 924a552644576b304767abeb00b4e6d9ec13af77 Mon Sep 17 00:00:00 2001 +From: Chen Qi +Date: Tue, 10 Jul 2018 15:40:17 +0800 +Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi + strerror_r + +XSI-compliant strerror_r and GNU-specifi strerror_r are different. + + int strerror_r(int errnum, char *buf, size_t buflen); + /* XSI-compliant */ + + char *strerror_r(int errnum, char *buf, size_t buflen); + /* GNU-specific */ + +We need to distinguish between them. Otherwise, we'll get an int value +assigned to (char *) variable, resulting in segment fault. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi +--- + src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++- + src/libsystemd/sd-journal/journal-send.c | 5 +++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c +index f415797700e..a5c6e9a3bdd 100644 +--- a/src/libsystemd/sd-bus/bus-error.c ++++ b/src/libsystemd/sd-bus/bus-error.c +@@ -410,7 +410,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { + return; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(error, m, k); ++ x = m; ++#else + x = strerror_r(error, m, k); ++#endif + if (errno == ERANGE || strlen(x) >= k - 1) { + free(m); + k *= 2; +@@ -595,8 +600,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static + + if (e && e->message) + return e->message; +- ++#ifndef __GLIBC__ ++ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ return buf; ++#else + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif + } + + static bool map_ok(const sd_bus_error_map *map) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index 75e8e08add5..41e5c7c2b89 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + +-- +GitLab + diff --git a/srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch b/srcpkgs/systemd-boot/patches/musl-wchar_t.patch similarity index 100% rename from srcpkgs/systemd-boot-efistub/patches/musl-wchar_t.patch rename to srcpkgs/systemd-boot/patches/musl-wchar_t.patch diff --git a/srcpkgs/systemd-boot-efistub/template b/srcpkgs/systemd-boot/template similarity index 60% rename from srcpkgs/systemd-boot-efistub/template rename to srcpkgs/systemd-boot/template index 824ca02fd15..402ae2a7026 100644 --- a/srcpkgs/systemd-boot-efistub/template +++ b/srcpkgs/systemd-boot/template @@ -1,8 +1,9 @@ -# Template file for 'systemd-boot-efistub' -pkgname=systemd-boot-efistub -version=256 +# Template file for 'systemd-boot' +pkgname=systemd-boot +version=256.6 revision=1 build_style=meson +conf_files="/etc/default/systemd-boot" configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled -Dsbat-distro=void -Dsbat-distro-summary=Void -Dsbat-distro-pkgname=${pkgname} -Dsbat-distro-version="${version}_${revision}" @@ -28,16 +29,20 @@ configure_args="-Defi=true -Dman=enabled -Dbootloader=enabled # most of these aren't needed for what we're building but it's easier than patching hostmakedepends="pkg-config gperf python3-Jinja2 python3-pyelftools libxslt docbook-xsl" makedepends="libcap-devel libmount-devel" -short_desc="UEFI stub loader from systemd-boot" -maintainer="classabbyamp " +depends="systemd-boot-efistub>=${version}_${revision} ukify>=${version}_${revision}" +short_desc="Simple UEFI boot manager from systemd" +maintainer="Daniel Martinez " license="LGPL-2.1-or-later" homepage="https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/" -distfiles="https://github.com/systemd/systemd-stable/archive/refs/tags/v${version}.tar.gz" -checksum=ca40487e044c9d6b7ad214d453b1cab696e5ccbd5244eca78460972cb0589a17 -make_check=no # missing printf.h +distfiles="https://github.com/systemd/systemd/archive/refs/tags/v${version}.tar.gz" +checksum=c085f162dec001407dd32f00abbf20b7e6ed7043dcfaf8ed954787d86707f409 +make_check=no # tests a bunch of stuff we aren't using if [ "${XBPS_TARGET_LIBC}" = glibc ]; then makedepends+=" libxcrypt-devel" +else + # see src/basic/linux/if_ether.h + export CFLAGS="-D__UAPI_DEF_ETHHDR=0 -Wno-error=incompatible-pointer-types" fi case "${XBPS_TARGET_MACHINE}" in @@ -49,10 +54,22 @@ case "${XBPS_TARGET_MACHINE}" in *) broken="unknown efi architecture" ;; esac -_bins=(ukify) -_mans=(man/ukify.1 man/systemd-stub.7) -_efis=("src/boot/efi/linux${_efi_arch}.efi.stub") -make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]}" +_bins=(ukify bootctl) +_mans=(man/ukify.1 man/systemd-stub.7 + man/sd-boot.7 man/systemd-boot.7 man/bootctl.1) +_efis=("src/boot/efi/linux${_efi_arch}.efi.stub" + "src/boot/efi/systemd-boot${_efi_arch}.efi") +_libexecs=(systemd-bless-boot) +make_build_target="${_bins[*]} ${_mans[*]} ${_efis[*]} ${_libexecs[*]}" + +post_patch() { + if [ "${XBPS_TARGET_LIBC}" = musl ]; then + for x in ${FILESDIR}/patches/musl/*.patch; do + msg_normal "Applying patch $x\n" + patch -sNp1 -i ${x} + done + fi +} do_install() { for b in "${_bins[@]}"; do @@ -66,6 +83,17 @@ do_install() { for e in "${_efis[@]}"; do vinstall "build/$e" 644 usr/lib/systemd/boot/efi done + + for l in "${_libexecs[@]}"; do + vinstall "build/$l" 644 usr/lib/systemd + done + + vinstall ${FILESDIR}/kernel.d/systemd-boot.post-install 744 \ + etc/kernel.d/post-install 50-systemd-boot + vinstall ${FILESDIR}/kernel.d/systemd-boot.post-remove 744 \ + etc/kernel.d/post-remove 50-systemd-boot + vinstall ${FILESDIR}/kernel.d/systemd-boot.conf 644 \ + etc/default systemd-boot } ukify_package() { @@ -76,3 +104,13 @@ ukify_package() { vmove usr/share/man/man1/ukify.1 } } + +systemd-boot-efistub_package() { + short_desc="UEFI stub loader from systemd-boot" + pkg_install() { + vmove "usr/lib/systemd/boot/efi/linux*.efi.stub" + vmove "usr/share/man/man7/linux*.efi.*" + vmove usr/share/man/man7/sd-stub.7 + vmove usr/share/man/man7/systemd-stub.7 + } +} diff --git a/srcpkgs/ukify b/srcpkgs/ukify index 9258199038e..171756f5fb6 120000 --- a/srcpkgs/ukify +++ b/srcpkgs/ukify @@ -1 +1 @@ -systemd-boot-efistub \ No newline at end of file +systemd-boot \ No newline at end of file