summaryrefslogtreecommitdiff
path: root/repo/system
diff options
context:
space:
mode:
Diffstat (limited to 'repo/system')
-rw-r--r--repo/system/acl/acl.xibuild (renamed from repo/system/acl.xibuild)0
-rw-r--r--repo/system/acpid/acpid.confd7
-rw-r--r--repo/system/acpid/acpid.initd28
-rw-r--r--repo/system/acpid/acpid.xibuild (renamed from repo/system/acpid.xibuild)0
-rw-r--r--repo/system/acpid/anything3
-rw-r--r--repo/system/acpid/handler.sh36
-rw-r--r--repo/system/acpid/lid-closed21
-rw-r--r--repo/system/acpid/power-supply-ac25
-rw-r--r--repo/system/argp-standalone/argp-standalone.xibuild (renamed from repo/system/argp-standalone.xibuild)0
-rw-r--r--repo/system/at-spi2-atk/at-spi2-atk.xibuild (renamed from repo/system/at-spi2-atk.xibuild)0
-rw-r--r--repo/system/at-spi2-core/at-spi2-core.xibuild (renamed from repo/system/at-spi2-core.xibuild)0
-rw-r--r--repo/system/atk/atk.xibuild (renamed from repo/system/atk.xibuild)0
-rw-r--r--repo/system/attr/attr.xibuild (renamed from repo/system/attr.xibuild)0
-rw-r--r--repo/system/binutils/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch55
-rw-r--r--repo/system/binutils/bfd-close-file-desriptor-if-there-is-no-archive-fd.patch234
-rw-r--r--repo/system/binutils/binutils-ld-fix-static-linking.patch46
-rw-r--r--repo/system/binutils/binutils.xibuild (renamed from repo/system/binutils.xibuild)0
-rw-r--r--repo/system/binutils/defang-no-split.patch38
-rw-r--r--repo/system/binutils/gold-mips.patch39
-rw-r--r--repo/system/binutils/ld-bfd-mips.patch19
-rw-r--r--repo/system/brotli/brotli.xibuild (renamed from repo/system/brotli.xibuild)0
-rw-r--r--repo/system/bzip2/bzip2.xibuild (renamed from repo/system/bzip2.xibuild)0
-rw-r--r--repo/system/c-ares/c-ares.xibuild (renamed from repo/system/c-ares.xibuild)0
-rw-r--r--repo/system/cacerts/cacerts.xibuild (renamed from repo/system/cacerts.xibuild)0
-rw-r--r--repo/system/cacerts/fix-sbase-coreutils.patch12
-rw-r--r--repo/system/cairo/cairo.xibuild (renamed from repo/system/cairo.xibuild)0
-rw-r--r--repo/system/cairo/fix-mask-usage-in-image-compositor.patch172
-rw-r--r--repo/system/cairo/musl-stacksize.patch23
-rw-r--r--repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch58
-rw-r--r--repo/system/dbus/dbus.confd7
-rw-r--r--repo/system/dbus/dbus.initd33
-rw-r--r--repo/system/dbus/dbus.trigger4
-rw-r--r--repo/system/dbus/dbus.xibuild (renamed from repo/system/dbus.xibuild)0
-rw-r--r--repo/system/dhcp/01-dhclient-script-fix-bare-ip.patch13
-rw-r--r--repo/system/dhcp/02-dhclient-script-remove-bashisms.patch28
-rw-r--r--repo/system/dhcp/03-fix-unwind-import.patch16
-rw-r--r--repo/system/dhcp/dhcp.xibuild (renamed from repo/system/dhcp.xibuild)0
-rw-r--r--repo/system/dhcp/dhcpd.confd28
-rw-r--r--repo/system/dhcp/dhcpd.initd115
-rw-r--r--repo/system/efibootmgr/efibootmgr.xibuild (renamed from repo/system/efibootmgr.xibuild)0
-rw-r--r--repo/system/efivar/efivar.xibuild (renamed from repo/system/efivar.xibuild)0
-rw-r--r--repo/system/efivar/patches/efivar-fix-format_guid.patch56
-rw-r--r--repo/system/efivar/patches/efivar-fix-packed.patch168
-rw-r--r--repo/system/efivar/patches/efivar-fix-ucs2.patch59
-rw-r--r--repo/system/efivar/patches/musl-bswap.patch33
-rw-r--r--repo/system/elfutils/elfutils.xibuild (renamed from repo/system/elfutils.xibuild)0
-rw-r--r--repo/system/elfutils/files/error.h27
-rw-r--r--repo/system/elfutils/patches/fix-aarch64_fregs.patch14
-rw-r--r--repo/system/elfutils/patches/fix-uninitialized.patch17
-rw-r--r--repo/system/elfutils/patches/musl-asm-ptrace-h.patch10
-rw-r--r--repo/system/elfutils/patches/musl-macros.patch87
-rw-r--r--repo/system/elfutils/patches/musl-strndupa.patch18
-rw-r--r--repo/system/elogind/elogind.initd23
-rw-r--r--repo/system/elogind/elogind.xibuild (renamed from repo/system/elogind.xibuild)0
-rw-r--r--repo/system/elogind/id-nobody.patch13
-rw-r--r--repo/system/elogind/mips.patch11
-rw-r--r--repo/system/elogind/ppc64-bad-tuple.patch25
-rw-r--r--repo/system/elogind/ppcle.patch25
-rw-r--r--repo/system/eudev/default-rules.patch9
-rw-r--r--repo/system/eudev/eudev.xibuild (renamed from repo/system/eudev.xibuild)0
-rw-r--r--repo/system/eudev/load-fbcon.patch10
-rw-r--r--repo/system/eudev/udev.initd22
-rw-r--r--repo/system/eudev/udev_retry.initd31
-rw-r--r--repo/system/execline/execline.xibuild (renamed from repo/system/execline.xibuild)0
-rw-r--r--repo/system/expat/expat.xibuild (renamed from repo/system/expat.xibuild)0
-rw-r--r--repo/system/findutils/findutils.xibuild (renamed from repo/system/findutils.xibuild)0
-rw-r--r--repo/system/freetype2/freetype2.xibuild (renamed from repo/system/freetype2.xibuild)0
-rw-r--r--repo/system/fribidi/fribidi.xibuild (renamed from repo/system/fribidi.xibuild)0
-rw-r--r--repo/system/gc/gc.xibuild (renamed from repo/system/gc.xibuild)0
-rw-r--r--repo/system/gdbm/gdbm.xibuild (renamed from repo/system/gdbm.xibuild)0
-rw-r--r--repo/system/gettext/gettext.xibuild (renamed from repo/system/gettext.xibuild)0
-rw-r--r--repo/system/glew/glew.patch34
-rw-r--r--repo/system/glew/glew.xibuild (renamed from repo/system/glew.xibuild)0
-rw-r--r--repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch47
-rw-r--r--repo/system/glib/deprecated-no-warn.patch23
-rw-r--r--repo/system/glib/glib.xibuild (renamed from repo/system/glib.xibuild)0
-rw-r--r--repo/system/glib/musl-libintl.patch22
-rw-r--r--repo/system/glm/fix-endian-test.patch30
-rw-r--r--repo/system/glm/glm.pc7
-rw-r--r--repo/system/glm/glm.xibuild (renamed from repo/system/glm.xibuild)0
-rw-r--r--repo/system/glu/glu.xibuild (renamed from repo/system/glu.xibuild)0
-rw-r--r--repo/system/gmp/gmp.xibuild (renamed from repo/system/gmp.xibuild)0
-rw-r--r--repo/system/gnutls/gnutls.xibuild (renamed from repo/system/gnutls.xibuild)0
-rw-r--r--repo/system/gobject-introspection/gobject-introspection.xibuild (renamed from repo/system/gobject-introspection.xibuild)0
-rw-r--r--repo/system/gobject-introspection/musl-time64.patch37
-rw-r--r--repo/system/gperf/gperf.xibuild (renamed from repo/system/gperf.xibuild)0
-rw-r--r--repo/system/grub/grub.xibuild (renamed from repo/system/grub.xibuild)0
-rw-r--r--repo/system/guile/guile.xibuild (renamed from repo/system/guile.xibuild)0
-rw-r--r--repo/system/gzip/gzip.xibuild (renamed from repo/system/gzip.xibuild)0
-rw-r--r--repo/system/hwids/hwids.xibuild (renamed from repo/system/hwids.xibuild)0
-rw-r--r--repo/system/iana-etc/iana-etc.xibuild (renamed from repo/system/iana-etc.xibuild)0
-rw-r--r--repo/system/icu/fix-ucptrietest-golden-diff.patch33
-rw-r--r--repo/system/icu/icu.xibuild (renamed from repo/system/icu.xibuild)0
-rw-r--r--repo/system/imlib2/imlib2.xibuild (renamed from repo/system/imlib2.xibuild)0
-rw-r--r--repo/system/intltool/intltool.xibuild (renamed from repo/system/intltool.xibuild)0
-rw-r--r--repo/system/jansson/jansson.xibuild (renamed from repo/system/jansson.xibuild)0
-rw-r--r--repo/system/js78/js78.xibuild (renamed from repo/system/js78.xibuild)0
-rw-r--r--repo/system/js78/patches/disable-jslint.patch17
-rw-r--r--repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch37
-rw-r--r--repo/system/js78/patches/fix-musl-build.patch16
-rw-r--r--repo/system/js78/patches/fix-python3.10-compilation.patch312
-rw-r--r--repo/system/js78/patches/fix-rust-target.patch15
-rw-r--r--repo/system/json-c/json-c.xibuild (renamed from repo/system/json-c.xibuild)0
-rw-r--r--repo/system/json-glib/json-glib.xibuild (renamed from repo/system/json-glib.xibuild)0
-rw-r--r--repo/system/jsoncpp/jsoncpp.xibuild (renamed from repo/system/jsoncpp.xibuild)0
-rw-r--r--repo/system/kbd/kbd.xibuild (renamed from repo/system/kbd.xibuild)0
-rw-r--r--repo/system/kmod/kmod.xibuild (renamed from repo/system/kmod.xibuild)0
-rw-r--r--repo/system/krb5/krb5.xibuild (renamed from repo/system/krb5.xibuild)0
-rw-r--r--repo/system/lcms2/lcms2.xibuild (renamed from repo/system/lcms2.xibuild)0
-rw-r--r--repo/system/ldns/ldns.xibuild (renamed from repo/system/ldns.xibuild)0
-rw-r--r--repo/system/libarchive/libarchive.xibuild (renamed from repo/system/libarchive.xibuild)0
-rw-r--r--repo/system/libcap-ng/libcap-ng.xibuild (renamed from repo/system/libcap-ng.xibuild)0
-rw-r--r--repo/system/libcap/libcap.xibuild (renamed from repo/system/libcap.xibuild)0
-rw-r--r--repo/system/libconfig/libconfig.xibuild (renamed from repo/system/libconfig.xibuild)0
-rw-r--r--repo/system/libdwarf/libdwarf.xibuild (renamed from repo/system/libdwarf.xibuild)0
-rw-r--r--repo/system/libedit/libedit.xibuild (renamed from repo/system/libedit.xibuild)0
-rw-r--r--repo/system/libelf/libelf.xibuild (renamed from repo/system/libelf.xibuild)0
-rw-r--r--repo/system/libev/libev-4.11-Add-pkgconfig-support.patch58
-rw-r--r--repo/system/libev/libev.xibuild (renamed from repo/system/libev.xibuild)0
-rw-r--r--repo/system/libevent/libevent.xibuild (renamed from repo/system/libevent.xibuild)0
-rw-r--r--repo/system/libexif/libexif.xibuild (renamed from repo/system/libexif.xibuild)0
-rw-r--r--repo/system/libffi/libffi.xibuild (renamed from repo/system/libffi.xibuild)0
-rw-r--r--repo/system/libfm-extra/libfm-extra.xibuild (renamed from repo/system/libfm-extra.xibuild)0
-rw-r--r--repo/system/libfm/libfm.xibuild (renamed from repo/system/libfm.xibuild)0
-rw-r--r--repo/system/libgcrypt/libgcrypt.xibuild (renamed from repo/system/libgcrypt.xibuild)0
-rw-r--r--repo/system/libgpg-error/libgpg-error.xibuild (renamed from repo/system/libgpg-error.xibuild)0
-rw-r--r--repo/system/libgudev/libgudev.xibuild (renamed from repo/system/libgudev.xibuild)0
-rw-r--r--repo/system/libidn/libidn.xibuild (renamed from repo/system/libidn.xibuild)0
-rw-r--r--repo/system/libldap/libldap.xibuild (renamed from repo/system/libldap.xibuild)0
-rw-r--r--repo/system/liblinear/liblinear.xibuild (renamed from repo/system/liblinear.xibuild)0
-rw-r--r--repo/system/libluv/libluv.xibuild (renamed from repo/system/libluv.xibuild)0
-rw-r--r--repo/system/libmbim/libmbim.xibuild (renamed from repo/system/libmbim.xibuild)0
-rw-r--r--repo/system/libmpack/libmpack.xibuild (renamed from repo/system/libmpack.xibuild)0
-rw-r--r--repo/system/libndp/libndp.xibuild (renamed from repo/system/libndp.xibuild)0
-rw-r--r--repo/system/libnghttp/libnghttp.xibuild (renamed from repo/system/libnghttp.xibuild)0
-rw-r--r--repo/system/libnl/libnl.xibuild (renamed from repo/system/libnl.xibuild)0
-rw-r--r--repo/system/libnsl/libnsl.xibuild (renamed from repo/system/libnsl.xibuild)0
-rw-r--r--repo/system/libp11-kit/libp11-kit.xibuild (renamed from repo/system/libp11-kit.xibuild)0
-rw-r--r--repo/system/libpcap/libpcap.xibuild (renamed from repo/system/libpcap.xibuild)0
-rw-r--r--repo/system/libpipeline/libpipeline.xibuild (renamed from repo/system/libpipeline.xibuild)0
-rw-r--r--repo/system/libpng/libpng-1.6.37-apng.patch1728
-rw-r--r--repo/system/libpng/libpng.xibuild (renamed from repo/system/libpng.xibuild)0
-rw-r--r--repo/system/libpsl/libpsl.xibuild (renamed from repo/system/libpsl.xibuild)0
-rw-r--r--repo/system/libptytty/libptytty.xibuild (renamed from repo/system/libptytty.xibuild)0
-rw-r--r--repo/system/libqmi/libqmi.xibuild (renamed from repo/system/libqmi.xibuild)0
-rw-r--r--repo/system/libqrtr/libqrtr.xibuild (renamed from repo/system/libqrtr.xibuild)0
-rw-r--r--repo/system/libretls/libretls.xibuild (renamed from repo/system/libretls.xibuild)0
-rw-r--r--repo/system/libretls/test_program.c11
-rw-r--r--repo/system/libsasl/libsasl.xibuild (renamed from repo/system/libsasl.xibuild)0
-rw-r--r--repo/system/libseccomp/libseccomp.xibuild (renamed from repo/system/libseccomp.xibuild)0
-rw-r--r--repo/system/libsigsegv/libsigsegv.xibuild (renamed from repo/system/libsigsegv.xibuild)0
-rw-r--r--repo/system/libssh2/libssh2.xibuild (renamed from repo/system/libssh2.xibuild)0
-rw-r--r--repo/system/libtasn1/libtasn1.xibuild (renamed from repo/system/libtasn1.xibuild)0
-rw-r--r--repo/system/libtermkey/libtermkey.xibuild (renamed from repo/system/libtermkey.xibuild)0
-rw-r--r--repo/system/libtirpc/libtirpc.xibuild (renamed from repo/system/libtirpc.xibuild)0
-rw-r--r--repo/system/libtool/libtool.xibuild (renamed from repo/system/libtool.xibuild)0
-rw-r--r--repo/system/libunistring/libunistring.xibuild (renamed from repo/system/libunistring.xibuild)0
-rw-r--r--repo/system/libusb/libusb.xibuild (renamed from repo/system/libusb.xibuild)0
-rw-r--r--repo/system/libuv/libuv.xibuild (renamed from repo/system/libuv.xibuild)0
-rw-r--r--repo/system/libvterm/libvterm.xibuild (renamed from repo/system/libvterm.xibuild)0
-rw-r--r--repo/system/libxcrypt/libxcrypt.xibuild (renamed from repo/system/libxcrypt.xibuild)0
-rw-r--r--repo/system/libxml2/libxml2.xibuild (renamed from repo/system/libxml2.xibuild)0
-rw-r--r--repo/system/libxslt/libxslt.xibuild (renamed from repo/system/libxslt.xibuild)0
-rw-r--r--repo/system/ljx/ljx.xibuild (renamed from repo/system/ljx.xibuild)0
-rw-r--r--repo/system/lua-lpeg/build-static-lib.patch29
-rw-r--r--repo/system/lua-lpeg/lua-lpeg.xibuild (renamed from repo/system/lua-lpeg.xibuild)0
-rw-r--r--repo/system/lua-lpeg/test-fix-setlocale.patch20
-rw-r--r--repo/system/lua-mpack/dont-install-busted.patch13
-rw-r--r--repo/system/lua-mpack/lua-mpack.xibuild (renamed from repo/system/lua-mpack.xibuild)0
-rw-r--r--repo/system/lua-mpack/skip-memleak-test.patch20
-rw-r--r--repo/system/lua/lua.xibuild (renamed from repo/system/lua.xibuild)0
-rw-r--r--repo/system/lua/lua5.4.pc24
-rw-r--r--repo/system/lua5-1/lua-5.1-make.patch71
-rw-r--r--repo/system/lua5-1/lua-5.1-module_paths.patch24
-rw-r--r--repo/system/lua5-1/lua-5.1-readline.patch10
-rw-r--r--repo/system/lua5-1/lua.pc32
-rw-r--r--repo/system/lua5-1/lua5-1.xibuild (renamed from repo/system/lua5-1.xibuild)0
-rw-r--r--repo/system/luajit/luajit.xibuild (renamed from repo/system/luajit.xibuild)0
-rw-r--r--repo/system/luajit/module-paths.patch25
-rw-r--r--repo/system/lz4/lz4.xibuild (renamed from repo/system/lz4.xibuild)0
-rw-r--r--repo/system/lzo/lzo.xibuild (renamed from repo/system/lzo.xibuild)0
-rw-r--r--repo/system/menu-cache/menu-cache-1.1.0-0001-Support-gcc10-compilation.patch108
-rw-r--r--repo/system/menu-cache/menu-cache.xibuild (renamed from repo/system/menu-cache.xibuild)0
-rw-r--r--repo/system/mobile-broadband-provider-info/mobile-broadband-provider-info.xibuild (renamed from repo/system/mobile-broadband-provider-info.xibuild)0
-rw-r--r--repo/system/modemmanager/modemmanager.initd11
-rw-r--r--repo/system/modemmanager/modemmanager.rules296
-rw-r--r--repo/system/modemmanager/modemmanager.xibuild (renamed from repo/system/modemmanager.xibuild)0
-rw-r--r--repo/system/mpfr/mpfr.xibuild (renamed from repo/system/mpfr.xibuild)0
-rw-r--r--repo/system/msgpack-c/msgpack-c.xibuild (renamed from repo/system/msgpack-c.xibuild)0
-rw-r--r--repo/system/mtdev/mtdev.xibuild (renamed from repo/system/mtdev.xibuild)0
-rw-r--r--repo/system/musl-fts/musl-fts.xibuild (renamed from repo/system/musl-fts.xibuild)0
-rw-r--r--repo/system/musl-legacy-compat/musl-legacy-compat.xibuild (renamed from repo/system/musl-legacy-compat.xibuild)0
-rw-r--r--repo/system/musl-obstack/musl-obstack.xibuild (renamed from repo/system/musl-obstack.xibuild)0
-rw-r--r--repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch24
-rw-r--r--repo/system/musl/change-scheduler-functions-Linux-compatib.patch52
-rw-r--r--repo/system/musl/fix-utmp-wtmp-paths.patch29
-rw-r--r--repo/system/musl/handle-aux-at_base.patch46
-rw-r--r--repo/system/musl/musl.xibuild (renamed from repo/system/musl.xibuild)0
-rw-r--r--repo/system/musl/qsort_r.patch213
-rw-r--r--repo/system/musl/syscall-cp-epoll.patch16
-rw-r--r--repo/system/ncurses/ncurses.xibuild (renamed from repo/system/ncurses.xibuild)0
-rw-r--r--repo/system/nettle/nettle.xibuild (renamed from repo/system/nettle.xibuild)0
-rw-r--r--repo/system/networkmanager/networkmanager-dispatcher.initd12
-rw-r--r--repo/system/networkmanager/networkmanager.conf2
-rw-r--r--repo/system/networkmanager/networkmanager.initd17
-rw-r--r--repo/system/networkmanager/networkmanager.rules9
-rw-r--r--repo/system/networkmanager/networkmanager.xibuild (renamed from repo/system/networkmanager.xibuild)0
-rw-r--r--repo/system/newt/newt.xibuild (renamed from repo/system/newt.xibuild)0
-rw-r--r--repo/system/nodejs/disable-running-gyp-on-shared-deps.patch20
-rw-r--r--repo/system/nodejs/fix-build-with-system-c-ares.patch535
-rw-r--r--repo/system/nodejs/nodejs.xibuild (renamed from repo/system/nodejs.xibuild)0
-rw-r--r--repo/system/nspr/nspr.xibuild (renamed from repo/system/nspr.xibuild)0
-rw-r--r--repo/system/nss/nss-config.in145
-rw-r--r--repo/system/nss/nss-softokn.pc.in11
-rw-r--r--repo/system/nss/nss-util.pc.in11
-rw-r--r--repo/system/nss/nss.pc.in11
-rw-r--r--repo/system/nss/nss.xibuild (renamed from repo/system/nss.xibuild)0
-rw-r--r--repo/system/nsss/nsss.xibuild (renamed from repo/system/nsss.xibuild)0
-rw-r--r--repo/system/openntpd/libtls-standalone.patch20
-rw-r--r--repo/system/openntpd/ntp-user.patch13
-rw-r--r--repo/system/openntpd/openntpd.confd3
-rw-r--r--repo/system/openntpd/openntpd.initd14
-rw-r--r--repo/system/openntpd/openntpd.xibuild (renamed from repo/system/openntpd.xibuild)0
-rw-r--r--repo/system/openrc/0001-call-sbin-mkmntdirs-in-localmount-OpenRC-service.patch25
-rw-r--r--repo/system/openrc/0002-fsck-don-t-add-C0-to-busybox-fsck.patch35
-rw-r--r--repo/system/openrc/0003-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch70
-rw-r--r--repo/system/openrc/0004-make-consolefont-service-compatible-with-busyboxs-se.patch70
-rw-r--r--repo/system/openrc/0005-Support-early-loading-of-keymap-if-kbd-is-installed.patch31
-rw-r--r--repo/system/openrc/0006-Add-support-for-starting-services-in-a-specified-VRF.patch101
-rw-r--r--repo/system/openrc/0007-Clean-up-staticroute-config-remove-irrelevant-parts-.patch47
-rw-r--r--repo/system/openrc/0008-bootmisc-switch-wipe_tmp-setting-to-no-by-default.patch44
-rw-r--r--repo/system/openrc/0009-fix-bootmisc-mv-error.patch27
-rw-r--r--repo/system/openrc/0010-noexec-devfs.patch14
-rw-r--r--repo/system/openrc/firstboot.initd34
-rw-r--r--repo/system/openrc/hostname.initd18
-rw-r--r--repo/system/openrc/hwdrivers.initd32
-rw-r--r--repo/system/openrc/machine-id.initd17
-rw-r--r--repo/system/openrc/modloop.confd6
-rwxr-xr-xrepo/system/openrc/modloop.initd153
-rw-r--r--repo/system/openrc/modules.initd80
-rw-r--r--repo/system/openrc/networking.initd88
-rw-r--r--repo/system/openrc/openrc.logrotate4
-rw-r--r--repo/system/openrc/openrc.post-install38
-rw-r--r--repo/system/openrc/openrc.post-upgrade35
-rw-r--r--repo/system/openrc/openrc.xibuild (renamed from repo/system/openrc.xibuild)0
-rw-r--r--repo/system/openrc/rc.conf313
-rw-r--r--repo/system/openrc/seedrng.patch640
-rw-r--r--repo/system/openrc/sysctl.initd87
-rw-r--r--repo/system/openrc/sysfsconf.initd66
-rw-r--r--repo/system/openrc/test-networking.sh65
-rw-r--r--repo/system/openssl/openssl.xibuild (renamed from repo/system/openssl.xibuild)0
-rw-r--r--repo/system/pahole/pahole.xibuild (renamed from repo/system/pahole.xibuild)0
-rw-r--r--repo/system/pam/other.pamd11
-rw-r--r--repo/system/pam/pam.xibuild (renamed from repo/system/pam.xibuild)0
-rw-r--r--repo/system/pam/system-account.pamd1
-rw-r--r--repo/system/pam/system-auth.pamd2
-rw-r--r--repo/system/pam/system-password.pamd3
-rw-r--r--repo/system/pam/system-session.pamd3
-rw-r--r--repo/system/pcre/pcre.xibuild (renamed from repo/system/pcre.xibuild)0
-rw-r--r--repo/system/pcre2/pcre2.xibuild (renamed from repo/system/pcre2.xibuild)0
-rw-r--r--repo/system/pcsc-lite/pcsc-lite.xibuild (renamed from repo/system/pcsc-lite.xibuild)0
-rw-r--r--repo/system/perl-xml-parser/perl-xml-parser.xibuild (renamed from repo/system/perl-xml-parser.xibuild)0
-rw-r--r--repo/system/perl/musl-locale.patch37
-rw-r--r--repo/system/perl/musl-skip-dst-test.patch13
-rw-r--r--repo/system/perl/musl-stack-size.patch16
-rw-r--r--repo/system/perl/perl.xibuild (renamed from repo/system/perl.xibuild)0
-rw-r--r--repo/system/perl/skip-test-due-to-busybox-ps.patch13
-rw-r--r--repo/system/perl/zlib-test.patch80
-rw-r--r--repo/system/polkit/files/polkit-19
-rw-r--r--repo/system/polkit/patches/CVE-2021-4034.patch79
-rw-r--r--repo/system/polkit/patches/make-innetgr-optional.patch239
-rw-r--r--repo/system/polkit/polkit.xibuild (renamed from repo/system/polkit.xibuild)0
-rw-r--r--repo/system/popt/popt.xibuild (renamed from repo/system/popt.xibuild)0
-rw-r--r--repo/system/psmisc/psmisc.xibuild (renamed from repo/system/psmisc.xibuild)0
-rw-r--r--repo/system/queue-standalone/queue-standalone.xibuild (renamed from repo/system/queue-standalone.xibuild)0
-rw-r--r--repo/system/re2/re2.xibuild (renamed from repo/system/re2.xibuild)0
-rw-r--r--repo/system/readline/readline.xibuild (renamed from repo/system/readline.xibuild)0
-rw-r--r--repo/system/rtmpdump/rtmpdump.xibuild (renamed from repo/system/rtmpdump.xibuild)0
-rw-r--r--repo/system/sbase/sbase.xibuild (renamed from repo/system/sbase.xibuild)0
-rw-r--r--repo/system/sed/sed.xibuild (renamed from repo/system/sed.xibuild)0
-rw-r--r--repo/system/sh/sh.xibuild (renamed from repo/system/sh.xibuild)0
-rw-r--r--repo/system/shadow/chage.pamd11
-rw-r--r--repo/system/shadow/chpasswd.pamd12
-rw-r--r--repo/system/shadow/login.pamd46
-rw-r--r--repo/system/shadow/newusers.pamd12
-rw-r--r--repo/system/shadow/passwd.pamd6
-rw-r--r--repo/system/shadow/shadow.xibuild (renamed from repo/system/shadow.xibuild)0
-rw-r--r--repo/system/shadow/su.pamd27
-rw-r--r--repo/system/shared-mime-info/shared-mime-info.xibuild (renamed from repo/system/shared-mime-info.xibuild)0
-rw-r--r--repo/system/skalibs/skalibs.xibuild (renamed from repo/system/skalibs.xibuild)0
-rw-r--r--repo/system/slang/slang.xibuild (renamed from repo/system/slang.xibuild)0
-rw-r--r--repo/system/snappy/cmakelists.patch76
-rw-r--r--repo/system/snappy/fix-inline.patch13
-rw-r--r--repo/system/snappy/rtti.patch56
-rw-r--r--repo/system/snappy/snappy.xibuild (renamed from repo/system/snappy.xibuild)0
-rw-r--r--repo/system/sqlite3/sqlite3.xibuild (renamed from repo/system/sqlite3.xibuild)0
-rw-r--r--repo/system/startup-notification/startup-notification.xibuild (renamed from repo/system/startup-notification.xibuild)0
-rw-r--r--repo/system/sysklogd/sysklogd.initd3
-rw-r--r--repo/system/sysklogd/sysklogd.xibuild (renamed from repo/system/sysklogd.xibuild)0
-rw-r--r--repo/system/syslinux/0018-prevent-pow-optimization.patch36
-rw-r--r--repo/system/syslinux/fix-sysmacros.patch12
-rw-r--r--repo/system/syslinux/gcc-10.patch109
-rw-r--r--repo/system/syslinux/syslinux.post-upgrade61
-rw-r--r--repo/system/syslinux/syslinux.trigger3
-rw-r--r--repo/system/syslinux/syslinux.xibuild (renamed from repo/system/syslinux.xibuild)0
-rw-r--r--repo/system/syslinux/update-extlinux284
-rw-r--r--repo/system/syslinux/update-extlinux.conf74
-rw-r--r--repo/system/tar/tar.xibuild (renamed from repo/system/tar.xibuild)0
-rw-r--r--repo/system/tcl/tcl.xibuild (renamed from repo/system/tcl.xibuild)0
-rw-r--r--repo/system/tomlc99/tomlc99.xibuild (renamed from repo/system/tomlc99.xibuild)0
-rw-r--r--repo/system/tree-sitter/tree-sitter.xibuild (renamed from repo/system/tree-sitter.xibuild)0
-rw-r--r--repo/system/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch27
-rw-r--r--repo/system/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch28
-rw-r--r--repo/system/tzdata/tzdata.xibuild (renamed from repo/system/tzdata.xibuild)0
-rw-r--r--repo/system/ubase/ubase.xibuild (renamed from repo/system/ubase.xibuild)0
-rw-r--r--repo/system/udev-rules/udev-rules.xibuild (renamed from repo/system/udev-rules.xibuild)0
-rw-r--r--repo/system/unibilium/unibilium.xibuild (renamed from repo/system/unibilium.xibuild)0
-rw-r--r--repo/system/utmps/btmpd.initd24
-rw-r--r--repo/system/utmps/btmpd.logrotate6
-rw-r--r--repo/system/utmps/utmp-init.initd21
-rw-r--r--repo/system/utmps/utmp-prepare.initd25
-rw-r--r--repo/system/utmps/utmpd.initd23
-rw-r--r--repo/system/utmps/utmps.xibuild (renamed from repo/system/utmps.xibuild)0
-rw-r--r--repo/system/utmps/wtmpd.initd24
-rw-r--r--repo/system/utmps/wtmpd.logrotate6
-rw-r--r--repo/system/xxhash/xxhash.xibuild (renamed from repo/system/xxhash.xibuild)0
-rw-r--r--repo/system/xz/xz.xibuild (renamed from repo/system/xz.xibuild)0
-rw-r--r--repo/system/zip/zip.xibuild (renamed from repo/system/zip.xibuild)0
-rw-r--r--repo/system/zlib/zlib.xibuild (renamed from repo/system/zlib.xibuild)0
-rw-r--r--repo/system/zstd/zstd.xibuild (renamed from repo/system/zstd.xibuild)0
330 files changed, 9702 insertions, 0 deletions
diff --git a/repo/system/acl.xibuild b/repo/system/acl/acl.xibuild
index eca7ca5..eca7ca5 100644
--- a/repo/system/acl.xibuild
+++ b/repo/system/acl/acl.xibuild
diff --git a/repo/system/acpid/acpid.confd b/repo/system/acpid/acpid.confd
new file mode 100644
index 0000000..2b3d304
--- /dev/null
+++ b/repo/system/acpid/acpid.confd
@@ -0,0 +1,7 @@
+# Configuration file for /etc/init.d/acpid (from acpid package)
+
+# Additional arguments to pass to acpid.
+command_args="--logevents"
+
+# Uncomment to use process supervisor.
+#supervisor="supervise-daemon"
diff --git a/repo/system/acpid/acpid.initd b/repo/system/acpid/acpid.initd
new file mode 100644
index 0000000..c2d60f9
--- /dev/null
+++ b/repo/system/acpid/acpid.initd
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+
+description="The ACPI Daemon"
+
+extra_started_commands="reload"
+description_reload="Reload configuration"
+
+command="/sbin/acpid"
+command_args="--foreground ${command_args:-}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+depend() {
+ need dev localmount
+ after hwdrivers modules
+ provide acpid
+ keyword -vserver -lxc
+}
+
+reload() {
+ ebegin "Reloading $RC_SVCNAME configuration"
+ if [ "$supervisor" ]; then
+ $supervisor "$RC_SVCNAME" --signal HUP
+ else
+ start-stop-daemon --pidfile "$pidfile" --signal HUP
+ fi
+ eend $?
+}
diff --git a/repo/system/acpid.xibuild b/repo/system/acpid/acpid.xibuild
index f960ac0..f960ac0 100644
--- a/repo/system/acpid.xibuild
+++ b/repo/system/acpid/acpid.xibuild
diff --git a/repo/system/acpid/anything b/repo/system/acpid/anything
new file mode 100644
index 0000000..d182898
--- /dev/null
+++ b/repo/system/acpid/anything
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=.*
+action=/etc/acpi/handler.sh %e
diff --git a/repo/system/acpid/handler.sh b/repo/system/acpid/handler.sh
new file mode 100644
index 0000000..412ac02
--- /dev/null
+++ b/repo/system/acpid/handler.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+# vim: set ts=4:
+#
+# This is the default ACPI handler script that is configured in
+# /etc/acpi/events/anything to be called for every ACPI event.
+# You can edit it and add your own actions; treat it as a configuration file.
+#
+PATH="/usr/share/acpid:$PATH"
+alias log='logger -t acpid'
+
+# <dev-class>:<dev-name>:<notif-value>:<sup-value>
+case "$1:$2:$3:$4" in
+
+button/power:PWRF:*)
+ log 'Power button pressed'
+ # Shutdown the system unless it has a lid (notebook).
+ [ -e /proc/acpi/button/lid/LID ] || poweroff
+;;
+button/sleep:SLPB:*)
+ log 'Sleep button pressed'
+ # Suspend to RAM.
+ zzz
+;;
+button/lid:*:close:*)
+ log 'Lid closed'
+ # Suspend to RAM if AC adapter is not connected.
+ power-supply-ac || zzz
+;;
+ac_adapter:*:*:*0)
+ log 'AC adapter unplugged'
+ # Suspend to RAM if notebook's lid is closed.
+ lid-closed && zzz
+;;
+esac
+
+exit 0
diff --git a/repo/system/acpid/lid-closed b/repo/system/acpid/lid-closed
new file mode 100644
index 0000000..57ffb71
--- /dev/null
+++ b/repo/system/acpid/lid-closed
@@ -0,0 +1,21 @@
+#!/bin/sh
+# This script exits with status 0 if the latop's lid is closed, 1 if opened,
+# 10 if /proc/acpi/button/lid/LID/state does not exist or is not readable.
+set -u
+
+STATE_FILE='/proc/acpi/button/lid/LID/state'
+
+verbose=false
+[ "${1:-}" = '-v' ] && verbose=true
+
+if ! [ -r "$STATE_FILE" ]; then
+ $verbose && echo "$STATE_FILE does not exist or is not readable!" >&2
+ exit 10
+fi
+
+read -r _ state < "$STATE_FILE" || exit 10
+
+[ "$state" = 'closed' ]; rc=$?
+
+$verbose && echo $rc
+exit $rc
diff --git a/repo/system/acpid/power-supply-ac b/repo/system/acpid/power-supply-ac
new file mode 100644
index 0000000..337aae2
--- /dev/null
+++ b/repo/system/acpid/power-supply-ac
@@ -0,0 +1,25 @@
+#!/bin/sh
+# This script exits with status 0 when the computer is on AC power (or no AC
+# power supply found), 1 otherwise (i.e. running on battery).
+set -u
+
+verbose=false
+[ "${1:-}" = '-v' ] && verbose=true
+
+# If we do not have any power supplies, assume we are on AC.
+rc=0
+
+# Iterate through power supplies sysfs knows about.
+for ps in /sys/class/power_supply/*; do
+ [ -r $ps/online ] || continue
+ # We know we have an AC adaptor, our default return changes to failed.
+ rc=1
+
+ if [ "$(cat $ps/online)" -eq 1 ]; then
+ rc=0
+ break
+ fi
+done
+
+$verbose && echo $rc
+exit $rc
diff --git a/repo/system/argp-standalone.xibuild b/repo/system/argp-standalone/argp-standalone.xibuild
index 4c2a722..4c2a722 100644
--- a/repo/system/argp-standalone.xibuild
+++ b/repo/system/argp-standalone/argp-standalone.xibuild
diff --git a/repo/system/at-spi2-atk.xibuild b/repo/system/at-spi2-atk/at-spi2-atk.xibuild
index 9cdecd9..9cdecd9 100644
--- a/repo/system/at-spi2-atk.xibuild
+++ b/repo/system/at-spi2-atk/at-spi2-atk.xibuild
diff --git a/repo/system/at-spi2-core.xibuild b/repo/system/at-spi2-core/at-spi2-core.xibuild
index 58e56a2..58e56a2 100644
--- a/repo/system/at-spi2-core.xibuild
+++ b/repo/system/at-spi2-core/at-spi2-core.xibuild
diff --git a/repo/system/atk.xibuild b/repo/system/atk/atk.xibuild
index 4fd470a..4fd470a 100644
--- a/repo/system/atk.xibuild
+++ b/repo/system/atk/atk.xibuild
diff --git a/repo/system/attr.xibuild b/repo/system/attr/attr.xibuild
index bbd9a27..bbd9a27 100644
--- a/repo/system/attr.xibuild
+++ b/repo/system/attr/attr.xibuild
diff --git a/repo/system/binutils/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch b/repo/system/binutils/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
new file mode 100644
index 0000000..6e1fa77
--- /dev/null
+++ b/repo/system/binutils/0001-Revert-PR25882-.gnu.attributes-are-not-checked-for-s.patch
@@ -0,0 +1,55 @@
+From bbf05b742fde518fb97c789b043fe0d3aaf549f0 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Tue, 21 Sep 2021 14:53:13 +0000
+Subject: [PATCH] Revert "PR25882, .gnu.attributes are not checked for shared
+ libraries"
+
+This revert is needed to avoid wrongly tagging objects with the incompatible
+IBM long double ABI, which is not supported by musl and will result in
+linking errors if used.
+
+This reverts commit a8acd6eeb6dc2cc5460ece90f90ebe36b56b20ba.
+---
+ bfd/elf32-tic6x.c | 3 ---
+ ld/ldlang.c | 10 ++++------
+ 2 files changed, 4 insertions(+), 9 deletions(-)
+
+diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
+index 5754f3cb860..3ad1d612749 100644
+--- a/bfd/elf32-tic6x.c
++++ b/bfd/elf32-tic6x.c
+@@ -3735,9 +3735,6 @@ elf32_tic6x_merge_attributes (bfd *ibfd, struct bfd_link_info *info)
+
+ case Tag_ABI_PIC:
+ case Tag_ABI_PID:
+- /* Don't transfer these tags from dynamic objects. */
+- if ((ibfd->flags & DYNAMIC) != 0)
+- continue;
+ if (out_attr[i].i > in_attr[i].i)
+ out_attr[i].i = in_attr[i].i;
+ break;
+diff --git a/ld/ldlang.c b/ld/ldlang.c
+index 37b64c89ee1..f13beaef9d9 100644
+--- a/ld/ldlang.c
++++ b/ld/ldlang.c
+@@ -7071,13 +7071,11 @@ lang_check (void)
+ bfd_printable_name (input_bfd), input_bfd,
+ bfd_printable_name (link_info.output_bfd));
+ }
+-
+- /* If the input bfd has no contents, it shouldn't set the
+- private data of the output bfd. */
+- else if (!file->flags.just_syms
+- && ((input_bfd->flags & DYNAMIC) != 0
+- || bfd_count_sections (input_bfd) != 0))
++ else if (bfd_count_sections (input_bfd))
+ {
++ /* If the input bfd has no contents, it shouldn't set the
++ private data of the output bfd. */
++
+ bfd_error_handler_type pfn = NULL;
+
+ /* If we aren't supposed to warn about mismatched input
+--
+2.33.0
+
diff --git a/repo/system/binutils/bfd-close-file-desriptor-if-there-is-no-archive-fd.patch b/repo/system/binutils/bfd-close-file-desriptor-if-there-is-no-archive-fd.patch
new file mode 100644
index 0000000..357d0f9
--- /dev/null
+++ b/repo/system/binutils/bfd-close-file-desriptor-if-there-is-no-archive-fd.patch
@@ -0,0 +1,234 @@
+Upstream: yes
+URL: https://sourceware.org/bugzilla/show_bug.cgi?id=28138
+From 1c611b40e6bfc8029bff7696814330b5bc0ee5c0 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 26 Jul 2021 05:59:55 -0700
+Subject: [PATCH] bfd: Close the file descriptor if there is no archive fd
+
+Close the file descriptor if there is no archive plugin file descriptor
+to avoid running out of file descriptors on thin archives with many
+archive members.
+
+bfd/
+
+ PR ld/28138
+ * plugin.c (bfd_plugin_close_file_descriptor): Close the file
+ descriptor there is no archive plugin file descriptor.
+
+ld/
+
+ PR ld/28138
+ * testsuite/ld-plugin/lto.exp: Run tmpdir/pr28138 only for
+ native build.
+
+ PR ld/28138
+ * testsuite/ld-plugin/lto.exp: Run ld/28138 tests.
+ * testsuite/ld-plugin/pr28138.c: New file.
+ * testsuite/ld-plugin/pr28138-1.c: Likewise.
+ * testsuite/ld-plugin/pr28138-2.c: Likewise.
+ * testsuite/ld-plugin/pr28138-3.c: Likewise.
+ * testsuite/ld-plugin/pr28138-4.c: Likewise.
+ * testsuite/ld-plugin/pr28138-5.c: Likewise.
+ * testsuite/ld-plugin/pr28138-6.c: Likewise.
+ * testsuite/ld-plugin/pr28138-7.c: Likewise.
+
+(cherry picked from commit 5a98fb7513b559e20dfebdbaa2a471afda3b4742)
+(cherry picked from commit 7dc37e1e1209c80e0bab784df6b6bac335e836f2)
+---
+ bfd/plugin.c | 8 +++++++
+ ld/testsuite/ld-plugin/lto.exp | 34 ++++++++++++++++++++++++++++++
+ ld/testsuite/ld-plugin/pr28138-1.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-2.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-3.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-4.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-5.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-6.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138-7.c | 6 ++++++
+ ld/testsuite/ld-plugin/pr28138.c | 20 ++++++++++++++++++
+ 10 files changed, 104 insertions(+)
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-1.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-2.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-3.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-4.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-5.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-6.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138-7.c
+ create mode 100644 ld/testsuite/ld-plugin/pr28138.c
+
+diff --git a/bfd/plugin.c b/bfd/plugin.c
+index 6cfa2b66470..3bab8febe88 100644
+--- a/bfd/plugin.c
++++ b/bfd/plugin.c
+@@ -291,6 +291,14 @@ bfd_plugin_close_file_descriptor (bfd *abfd, int fd)
+ && !bfd_is_thin_archive (abfd->my_archive))
+ abfd = abfd->my_archive;
+
++ /* Close the file descriptor if there is no archive plugin file
++ descriptor. */
++ if (abfd->archive_plugin_fd == -1)
++ {
++ close (fd);
++ return;
++ }
++
+ abfd->archive_plugin_fd_open_count--;
+ /* Dup the archive plugin file descriptor for later use, which
+ will be closed by _bfd_archive_close_and_cleanup. */
+diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
+index def69e43ab3..999d911ce6a 100644
+--- a/ld/testsuite/ld-plugin/lto.exp
++++ b/ld/testsuite/ld-plugin/lto.exp
+@@ -687,6 +687,40 @@ if { [is_elf_format] && [check_lto_shared_available] } {
+ }
+ }
+
++run_cc_link_tests [list \
++ [list \
++ "Build pr28138.a" \
++ "-T" "" \
++ {pr28138-1.c pr28138-2.c pr28138-3.c pr28138-4.c pr28138-5.c \
++ pr28138-6.c pr28138-7.c} {} "pr28138.a" \
++ ] \
++ [list \
++ "Build pr28138.o" \
++ "" "" \
++ {pr28138.c} {} \
++ ] \
++]
++
++set exec_output [run_host_cmd "sh" \
++ "-c \"ulimit -n 20; \
++ $CC -Btmpdir/ld -o tmpdir/pr28138 \
++ tmpdir/pr28138.o tmpdir/pr28138.a\""]
++set exec_output [prune_warnings $exec_output]
++if [string match "" $exec_output] then {
++ if { [isnative] } {
++ set exec_output [run_host_cmd "tmpdir/pr28138" ""]
++ if [string match "PASS" $exec_output] then {
++ pass "PR ld/28138"
++ } else {
++ fail "PR ld/28138"
++ }
++ } else {
++ pass "PR ld/28138"
++ }
++} else {
++ fail "PR ld/28138"
++}
++
+ set testname "Build liblto-11.a"
+ remote_file host delete "tmpdir/liblto-11.a"
+ set catch_output [run_host_cmd "$ar" "rc $plug_opt tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"]
+diff --git a/ld/testsuite/ld-plugin/pr28138-1.c b/ld/testsuite/ld-plugin/pr28138-1.c
+new file mode 100644
+index 00000000000..51d119e1642
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-1.c
+@@ -0,0 +1,6 @@
++extern int a0(void);
++int
++a1(void)
++{
++ return 1 + a0();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-2.c b/ld/testsuite/ld-plugin/pr28138-2.c
+new file mode 100644
+index 00000000000..1120cd797e9
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-2.c
+@@ -0,0 +1,6 @@
++extern int a1(void);
++int
++a2(void)
++{
++ return 1 + a1();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-3.c b/ld/testsuite/ld-plugin/pr28138-3.c
+new file mode 100644
+index 00000000000..ec464947ee6
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-3.c
+@@ -0,0 +1,6 @@
++extern int a2(void);
++int
++a3(void)
++{
++ return 1 + a2();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-4.c b/ld/testsuite/ld-plugin/pr28138-4.c
+new file mode 100644
+index 00000000000..475701b2c5c
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-4.c
+@@ -0,0 +1,6 @@
++extern int a3(void);
++int
++a4(void)
++{
++ return 1 + a3();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-5.c b/ld/testsuite/ld-plugin/pr28138-5.c
+new file mode 100644
+index 00000000000..e24f86c363e
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-5.c
+@@ -0,0 +1,6 @@
++extern int a4(void);
++int
++a5(void)
++{
++ return 1 + a4();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-6.c b/ld/testsuite/ld-plugin/pr28138-6.c
+new file mode 100644
+index 00000000000..b5b938bdb21
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-6.c
+@@ -0,0 +1,6 @@
++extern int a5(void);
++int
++a6(void)
++{
++ return 1 + a5();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138-7.c b/ld/testsuite/ld-plugin/pr28138-7.c
+new file mode 100644
+index 00000000000..4ef75bf0f0c
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138-7.c
+@@ -0,0 +1,6 @@
++extern int a6(void);
++int
++a7(void)
++{
++ return 1 + a6();
++}
+diff --git a/ld/testsuite/ld-plugin/pr28138.c b/ld/testsuite/ld-plugin/pr28138.c
+new file mode 100644
+index 00000000000..68252c9f382
+--- /dev/null
++++ b/ld/testsuite/ld-plugin/pr28138.c
+@@ -0,0 +1,20 @@
++#include <stdio.h>
++
++extern int a7(void);
++
++int
++a0(void)
++{
++ return 0;
++}
++
++int
++main()
++{
++ if (a7() == 7)
++ {
++ printf ("PASS\n");
++ return 0;
++ }
++ return 1;
++}
+--
+2.27.0
+
diff --git a/repo/system/binutils/binutils-ld-fix-static-linking.patch b/repo/system/binutils/binutils-ld-fix-static-linking.patch
new file mode 100644
index 0000000..bc5d762
--- /dev/null
+++ b/repo/system/binutils/binutils-ld-fix-static-linking.patch
@@ -0,0 +1,46 @@
+This fixes static linking for our hardened toolchain
+diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc
+index e8126cb..9532bfb 100644
+--- a/ld/scripttempl/elf.sc
++++ b/ld/scripttempl/elf.sc
+@@ -235,8 +235,8 @@ test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
+ if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
+ SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
+- CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
+- DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
++ CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .ctors"
++ DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin*.o *crtend*.o $OTHER_EXCLUDE_FILES) .dtors"
+ else
+ SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
+@@ -270,15 +270,14 @@ CTOR=".ctors ${CONSTRUCTING-0} :
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+- KEEP (*crtbegin.o(.ctors))
+- KEEP (*crtbegin?.o(.ctors))
++ KEEP (*crtbegin*.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
++ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ ${CONSTRUCTING+${CTOR_END}}
+@@ -286,9 +285,8 @@ CTOR=".ctors ${CONSTRUCTING-0} :
+ DTOR=".dtors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${DTOR_START}}
+- KEEP (*crtbegin.o(.dtors))
+- KEEP (*crtbegin?.o(.dtors))
+- KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
++ KEEP (*crtbegin*.o(.dtors))
++ KEEP (*(EXCLUDE_FILE (*crtend*.o $OTHER_EXCLUDE_FILES) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ ${CONSTRUCTING+${DTOR_END}}
diff --git a/repo/system/binutils.xibuild b/repo/system/binutils/binutils.xibuild
index f7172ea..f7172ea 100644
--- a/repo/system/binutils.xibuild
+++ b/repo/system/binutils/binutils.xibuild
diff --git a/repo/system/binutils/defang-no-split.patch b/repo/system/binutils/defang-no-split.patch
new file mode 100644
index 0000000..cea68ed
--- /dev/null
+++ b/repo/system/binutils/defang-no-split.patch
@@ -0,0 +1,38 @@
+From 2dad02b6d46eef438cbd14d8511487b056628a38 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <siarheit@google.com>
+Date: Mon, 26 Jul 2021 22:51:18 +0100
+Subject: [PATCH 1/1] texi2pod.pl: add no-op --no-split option support
+ [PR28144]
+
+Change 2faf902da ("generate single html manual page by default")
+added use of --no-split option to makeinfo. binutils reuses
+makeinfo options for texi2pod.pl wrapper. Unsupported option
+led to silent manpage truncation.
+
+The change adds no-op option support.
+
+etc/
+ PR 28144
+ * texi2pod.pl: Handle no-op --no-split option.
+
+(cherry picked from commit 96a7037cd8573cf065aa6b12baca68696f96d9ca)
+---
+ etc/texi2pod.pl | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/etc/texi2pod.pl b/etc/texi2pod.pl
+index 11f70d156be..dcf2b437640 100644
+--- a/etc/texi2pod.pl
++++ b/etc/texi2pod.pl
+@@ -59,6 +59,8 @@ while ($_ = shift) {
+ $flag = shift;
+ }
+ push (@ipath, $flag);
++ } elsif (/^--no-split$/) {
++ # ignore option for makeinfo compatibility
+ } elsif (/^-/) {
+ usage();
+ } else {
+--
+2.27.0
+
diff --git a/repo/system/binutils/gold-mips.patch b/repo/system/binutils/gold-mips.patch
new file mode 100644
index 0000000..291a2aa
--- /dev/null
+++ b/repo/system/binutils/gold-mips.patch
@@ -0,0 +1,39 @@
+# DP: Fix gold on mips64 targets.
+
+gold/
+
+2016-08-09 Aurelien Jarno <aurelien@aurel32.net>
+
+ * configure.tgt: Add mips64el*-*-*|mips64le*-*-* and mips64*-*-*.
+
+
+--- a/gold/configure.tgt
++++ b/gold/configure.tgt
+@@ -153,6 +153,13 @@ aarch64*-*)
+ targ_big_endian=false
+ targ_extra_big_endian=true
+ ;;
++mips*64*el*-*-*|mips*64*le*-*-*)
++ targ_obj=mips
++ targ_machine=EM_MIPS_RS3_LE
++ targ_size=64
++ targ_big_endian=false
++ targ_extra_big_endian=true
++ ;;
+ mips*el*-*-*|mips*le*-*-*)
+ targ_obj=mips
+ targ_machine=EM_MIPS_RS3_LE
+@@ -160,6 +167,13 @@ mips*el*-*-*|mips*le*-*-*)
+ targ_big_endian=false
+ targ_extra_big_endian=true
+ ;;
++mips*64*-*-*)
++ targ_obj=mips
++ targ_machine=EM_MIPS
++ targ_size=64
++ targ_big_endian=true
++ targ_extra_big_endian=false
++ ;;
+ mips*-*-*)
+ targ_obj=mips
+ targ_machine=EM_MIPS
diff --git a/repo/system/binutils/ld-bfd-mips.patch b/repo/system/binutils/ld-bfd-mips.patch
new file mode 100644
index 0000000..2991c88
--- /dev/null
+++ b/repo/system/binutils/ld-bfd-mips.patch
@@ -0,0 +1,19 @@
+--- ./ld/configure.tgt.orig
++++ ./ld/configure.tgt
+@@ -541,12 +541,12 @@
+ ;;
+ mips*-*-windiss) targ_emul=elf32mipswindiss
+ ;;
+-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32
+- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip"
++mips64*el-*-linux-*) targ_emul=elf64ltsmip
++ targ_extra_emuls="elf32ltsmipn32 elf32btsmipn32 elf32ltsmip elf32btsmip elf64btsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
+-mips64*-*-linux-*) targ_emul=elf32btsmipn32
+- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip"
++mips64*-*-linux-*) targ_emul=elf64btsmip
++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
+ mips*el-*-linux-*) targ_emul=elf32ltsmip
diff --git a/repo/system/brotli.xibuild b/repo/system/brotli/brotli.xibuild
index dbdd973..dbdd973 100644
--- a/repo/system/brotli.xibuild
+++ b/repo/system/brotli/brotli.xibuild
diff --git a/repo/system/bzip2.xibuild b/repo/system/bzip2/bzip2.xibuild
index d0d42f6..d0d42f6 100644
--- a/repo/system/bzip2.xibuild
+++ b/repo/system/bzip2/bzip2.xibuild
diff --git a/repo/system/c-ares.xibuild b/repo/system/c-ares/c-ares.xibuild
index 6cf3e3f..6cf3e3f 100644
--- a/repo/system/c-ares.xibuild
+++ b/repo/system/c-ares/c-ares.xibuild
diff --git a/repo/system/cacerts.xibuild b/repo/system/cacerts/cacerts.xibuild
index 9fef8e1..9fef8e1 100644
--- a/repo/system/cacerts.xibuild
+++ b/repo/system/cacerts/cacerts.xibuild
diff --git a/repo/system/cacerts/fix-sbase-coreutils.patch b/repo/system/cacerts/fix-sbase-coreutils.patch
new file mode 100644
index 0000000..8e34376
--- /dev/null
+++ b/repo/system/cacerts/fix-sbase-coreutils.patch
@@ -0,0 +1,12 @@
+diff -Nuar a/make-ca b/make-ca
+--- a/make-ca 2020-03-08 04:55:46.000000000 +0000
++++ b/make-ca 2022-03-09 21:41:03.786961743 +0000
+@@ -809,7 +809,7 @@
+
+ # Install certdata.txt
+ if test "${REBUILD}" == "0"; then
+- install -vdm755 "${DESTDIR}${SSLDIR}"
++ install -dm755 "${DESTDIR}${SSLDIR}"
+ install -m644 "${WORKDIR}/certdata.txt" "${DESTDIR}${SSLDIR}/certdata.txt"
+ fi
+
diff --git a/repo/system/cairo.xibuild b/repo/system/cairo/cairo.xibuild
index 4bc7041..4bc7041 100644
--- a/repo/system/cairo.xibuild
+++ b/repo/system/cairo/cairo.xibuild
diff --git a/repo/system/cairo/fix-mask-usage-in-image-compositor.patch b/repo/system/cairo/fix-mask-usage-in-image-compositor.patch
new file mode 100644
index 0000000..8d5717f
--- /dev/null
+++ b/repo/system/cairo/fix-mask-usage-in-image-compositor.patch
@@ -0,0 +1,172 @@
+From 03a820b173ed1fdef6ff14b4468f5dbc02ff59be Mon Sep 17 00:00:00 2001
+From: Heiko Lewin <heiko.lewin@worldiety.de>
+Date: Tue, 15 Dec 2020 16:48:19 +0100
+Subject: [PATCH 1/3] Fix mask usage in image-compositor
+
+---
+ src/cairo-image-compositor.c | 8 ++--
+ test/Makefile.sources | 1 +
+ test/bug-image-compositor.c | 39 ++++++++++++++++++++
+ test/reference/bug-image-compositor.ref.png | Bin 0 -> 185 bytes
+ 4 files changed, 44 insertions(+), 4 deletions(-)
+ create mode 100644 test/bug-image-compositor.c
+ create mode 100644 test/reference/bug-image-compositor.ref.png
+
+diff --git a/src/cairo-image-compositor.c b/src/cairo-image-compositor.c
+index 79ad69f68..4f8aaed99 100644
+--- a/src/cairo-image-compositor.c
++++ b/src/cairo-image-compositor.c
+@@ -2610,14 +2610,14 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
+ unsigned num_spans)
+ {
+ cairo_image_span_renderer_t *r = abstract_renderer;
+- uint8_t *m;
++ uint8_t *m, *base = (uint8_t*)pixman_image_get_data(r->mask);
+ int x0;
+
+ if (num_spans == 0)
+ return CAIRO_STATUS_SUCCESS;
+
+ x0 = spans[0].x;
+- m = r->_buf;
++ m = base;
+ do {
+ int len = spans[1].x - spans[0].x;
+ if (len >= r->u.composite.run_length && spans[0].coverage == 0xff) {
+@@ -2655,7 +2655,7 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
+ spans[0].x, y,
+ spans[1].x - spans[0].x, h);
+
+- m = r->_buf;
++ m = base;
+ x0 = spans[1].x;
+ } else if (spans[0].coverage == 0x0) {
+ if (spans[0].x != x0) {
+@@ -2684,7 +2684,7 @@ _inplace_src_spans (void *abstract_renderer, int y, int h,
+ #endif
+ }
+
+- m = r->_buf;
++ m = base;
+ x0 = spans[1].x;
+ } else {
+ *m++ = spans[0].coverage;
+diff --git a/test/bug-image-compositor.c b/test/bug-image-compositor.c
+new file mode 100644
+index 000000000..fc4fd370b
+--- /dev/null
++++ b/test/bug-image-compositor.c
+@@ -0,0 +1,39 @@
++#include "cairo-test.h"
++
++static cairo_test_status_t
++draw (cairo_t *cr, int width, int height)
++{
++ cairo_set_source_rgb (cr, 0., 0., 0.);
++ cairo_paint (cr);
++
++ cairo_set_source_rgb (cr, 1., 1., 1.);
++ cairo_set_line_width (cr, 1.);
++
++ cairo_pattern_t *p = cairo_pattern_create_linear (0, 0, width, height);
++ cairo_pattern_add_color_stop_rgb (p, 0, 0.99, 1, 1);
++ cairo_pattern_add_color_stop_rgb (p, 1, 1, 1, 1);
++ cairo_set_source (cr, p);
++
++ cairo_move_to (cr, 0.5, -1);
++ for (int i = 0; i < width; i+=3) {
++ cairo_rel_line_to (cr, 2, 2);
++ cairo_rel_line_to (cr, 1, -2);
++ }
++
++ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
++ cairo_stroke (cr);
++
++ cairo_pattern_destroy(p);
++
++ return CAIRO_TEST_SUCCESS;
++}
++
++
++CAIRO_TEST (bug_image_compositor,
++ "Crash in image-compositor",
++ "stroke, stress", /* keywords */
++ NULL, /* requirements */
++ 10000, 1,
++ NULL, draw)
++
++
+
+From 8bc14a6bba3bc8a64ff0749c74d9b96305bf6429 Mon Sep 17 00:00:00 2001
+From: Heiko Lewin <heiko.lewin@worldiety.de>
+Date: Tue, 15 Dec 2020 17:14:18 +0100
+Subject: [PATCH 2/3] Minor cleanups
+
+---
+ test/bug-image-compositor.c | 33 ++++++++++++++++++++++++++++++---
+ 1 file changed, 30 insertions(+), 3 deletions(-)
+
+diff --git a/test/bug-image-compositor.c b/test/bug-image-compositor.c
+index fc4fd370b..304ea089c 100644
+--- a/test/bug-image-compositor.c
++++ b/test/bug-image-compositor.c
+@@ -1,5 +1,34 @@
++/*
++ * Copyright © 2020 Uli Schlachter, Heiko Lewin
++ *
++ * Permission is hereby granted, free of charge, to any person
++ * obtaining a copy of this software and associated documentation
++ * files (the "Software"), to deal in the Software without
++ * restriction, including without limitation the rights to use, copy,
++ * modify, merge, publish, distribute, sublicense, and/or sell copies
++ * of the Software, and to permit persons to whom the Software is
++ * furnished to do so, subject to the following conditions:
++ *
++ * The above copyright notice and this permission notice shall be
++ * included in all copies or substantial portions of the Software.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
++ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
++ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
++ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++ * SOFTWARE.
++ *
++ * Author: Uli Schlachter <psychon@znc.in>
++ * Author: Heiko Lewin <hlewin@gmx.de>
++ */
+ #include "cairo-test.h"
+
++
++/* This test reproduces an overflow of a mask-buffer in cairo-image-compositor.c */
++
+ static cairo_test_status_t
+ draw (cairo_t *cr, int width, int height)
+ {
+@@ -13,6 +42,7 @@ draw (cairo_t *cr, int width, int height)
+ cairo_pattern_add_color_stop_rgb (p, 0, 0.99, 1, 1);
+ cairo_pattern_add_color_stop_rgb (p, 1, 1, 1, 1);
+ cairo_set_source (cr, p);
++ cairo_pattern_destroy(p);
+
+ cairo_move_to (cr, 0.5, -1);
+ for (int i = 0; i < width; i+=3) {
+@@ -23,8 +53,6 @@ draw (cairo_t *cr, int width, int height)
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_stroke (cr);
+
+- cairo_pattern_destroy(p);
+-
+ return CAIRO_TEST_SUCCESS;
+ }
+
+@@ -36,4 +64,3 @@ CAIRO_TEST (bug_image_compositor,
+ 10000, 1,
+ NULL, draw)
+
+-
+--
+GitLab
+
diff --git a/repo/system/cairo/musl-stacksize.patch b/repo/system/cairo/musl-stacksize.patch
new file mode 100644
index 0000000..d10469e
--- /dev/null
+++ b/repo/system/cairo/musl-stacksize.patch
@@ -0,0 +1,23 @@
+Reduce the footprint of stack frame usage by turning
+some large(r) structures as `static __thread` instead.
+
+--- a/src/cairo-rectangular-scan-converter.c 2015-10-27 22:04:21.000000000 +0100
++++ b/src/cairo-rectangular-scan-converter.c 2016-05-07 04:25:26.640851782 +0200
+@@ -489,7 +489,7 @@
+ cairo_span_renderer_t *renderer,
+ rectangle_t **rectangles)
+ {
+- sweep_line_t sweep_line;
++ static __thread sweep_line_t sweep_line;
+ rectangle_t *start, *stop;
+ cairo_status_t status;
+
+@@ -656,7 +656,7 @@
+ cairo_span_renderer_t *renderer)
+ {
+ cairo_rectangular_scan_converter_t *self = converter;
+- rectangle_t *rectangles_stack[CAIRO_STACK_ARRAY_LENGTH (rectangle_t *)];
++ static __thread rectangle_t *rectangles_stack[CAIRO_STACK_ARRAY_LENGTH (rectangle_t *)];
+ rectangle_t **rectangles;
+ struct _cairo_rectangular_scan_converter_chunk *chunk;
+ cairo_status_t status;
diff --git a/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch b/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
new file mode 100644
index 0000000..d5cfe2f
--- /dev/null
+++ b/repo/system/cairo/pdf-font-subset-Generate-valid-font-names.patch
@@ -0,0 +1,58 @@
+From a3b69a0215fdface0fd5730872a4b3242d979dca Mon Sep 17 00:00:00 2001
+From: Uli Schlachter <psychon@znc.in>
+Date: Tue, 9 Feb 2021 16:54:35 +0100
+Subject: [PATCH] pdf font subset: Generate valid font names
+
+A hash value is encoded in base 26 with upper case letters for font
+names.
+
+Commit ed984146 replaced "numerator = abs (hash);" with "numerator =
+hash;" in this code, because hash has type uint32_t and the compiler
+warned about taking the absolute value of an unsigned value. However,
+abs() is actually defined to take an int argument. Thus, there was some
+implicit cast.
+
+Since numerator has type long, i.e. is signed, it is now actually
+possible to get an overflow in the implicit cast and then have a
+negative number. The following code is not prepared for this and
+produces non-letters when encoding the hash.
+
+This commit fixes that problem by not using ldiv() and instead using /
+and % to directly compute the needed values. This gets rid of the need
+to convert to type long. Since now everything works with uint32_t, there
+is no more chance for negative numbers messing things up.
+
+Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/449
+Signed-off-by: Uli Schlachter <psychon@znc.in>
+---
+ src/cairo-pdf-surface.c | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
+index 6da460878..52c49b6d2 100644
+--- a/src/cairo-pdf-surface.c
++++ b/src/cairo-pdf-surface.c
+@@ -5310,18 +5310,14 @@ _create_font_subset_tag (cairo_scaled_font_subset_t *font_subset,
+ {
+ uint32_t hash;
+ int i;
+- long numerator;
+- ldiv_t d;
+
+ hash = _hash_data ((unsigned char *) font_name, strlen(font_name), 0);
+ hash = _hash_data ((unsigned char *) (font_subset->glyphs),
+ font_subset->num_glyphs * sizeof(unsigned long), hash);
+
+- numerator = hash;
+ for (i = 0; i < 6; i++) {
+- d = ldiv (numerator, 26);
+- numerator = d.quot;
+- tag[i] = 'A' + d.rem;
++ tag[i] = 'A' + (hash % 26);
++ hash /= 26;
+ }
+ tag[i] = 0;
+ }
+--
+GitLab
+
diff --git a/repo/system/dbus/dbus.confd b/repo/system/dbus/dbus.confd
new file mode 100644
index 0000000..0454047
--- /dev/null
+++ b/repo/system/dbus/dbus.confd
@@ -0,0 +1,7 @@
+# Configuration for /etc/init.d/dbus
+
+# Additional arguments to pass to dbus-daemon.
+#command_args=
+
+# Uncomment to use process supervisor.
+#supervisor=supervise-daemon
diff --git a/repo/system/dbus/dbus.initd b/repo/system/dbus/dbus.initd
new file mode 100644
index 0000000..f3f44da
--- /dev/null
+++ b/repo/system/dbus/dbus.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+name="System Message Bus"
+description="D-Bus System Message Bus"
+
+extra_started_commands="reload"
+
+command="/usr/bin/dbus-daemon"
+command_args="--system --nofork --nopidfile --syslog-only ${command_args:-}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+depend() {
+ need localmount
+ after bootmisc
+}
+
+start_pre() {
+ checkpath -d -m755 -o root:messagebus /run/dbus || return 1
+
+ /usr/bin/dbus-uuidgen --ensure=/etc/machine-id
+}
+
+stop_post() {
+ [ ! -S /run/dbus/system_bus_socket ] || rm -f /run/dbus/system_bus_socket
+}
+
+reload() {
+ ebegin "Reloading $name configuration"
+ /usr/bin/dbus-send --print-reply --system --type=method_call \
+ --dest=org.freedesktop.DBus \
+ / org.freedesktop.DBus.ReloadConfig > /dev/null
+ eend $?
+}
diff --git a/repo/system/dbus/dbus.trigger b/repo/system/dbus/dbus.trigger
new file mode 100644
index 0000000..a537bd8
--- /dev/null
+++ b/repo/system/dbus/dbus.trigger
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+dbus-send --system --type=method_call --dest=org.freedesktop.DBus / \
+ org.freedesktop.DBUS.ReloadConfig >/dev/null 2>&1 || :
diff --git a/repo/system/dbus.xibuild b/repo/system/dbus/dbus.xibuild
index 3bbfc31..3bbfc31 100644
--- a/repo/system/dbus.xibuild
+++ b/repo/system/dbus/dbus.xibuild
diff --git a/repo/system/dhcp/01-dhclient-script-fix-bare-ip.patch b/repo/system/dhcp/01-dhclient-script-fix-bare-ip.patch
new file mode 100644
index 0000000..7b3165d
--- /dev/null
+++ b/repo/system/dhcp/01-dhclient-script-fix-bare-ip.patch
@@ -0,0 +1,13 @@
+diff --git a/client/scripts/linux b/client/scripts/linux
+index 0c42969..3cd2a75 100755
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -394,7 +394,7 @@ case "$reason" in
+ make_resolv_conf
+ else
+ # flush all IPs from interface
+- ip -4 addr flush dev ${interface}
++ ${ip} -4 addr flush dev ${interface}
+ exit_with_hooks 2
+ fi
+
diff --git a/repo/system/dhcp/02-dhclient-script-remove-bashisms.patch b/repo/system/dhcp/02-dhclient-script-remove-bashisms.patch
new file mode 100644
index 0000000..afa1048
--- /dev/null
+++ b/repo/system/dhcp/02-dhclient-script-remove-bashisms.patch
@@ -0,0 +1,28 @@
+diff --git a/client/scripts/linux b/client/scripts/linux
+index 0c42969..2e7274b 100755
+--- a/client/scripts/linux
++++ b/client/scripts/linux
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # dhclient-script for Linux. Dan Halbert, March, 1997.
+ # Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
+ # No guarantees about this. I'm a novice at the details of Linux
+@@ -428,7 +428,7 @@ case "$reason" in
+ # Check if any IPv6 address on this interface is marked as
+ # tentative.
+ ${ip} addr show ${interface} | grep inet6 | grep tentative \
+- &> /dev/null
++ > /dev/null 2>&1
+ if [ $? -eq 0 ]; then
+ # Wait for duplicate address detection to complete or for
+ # the timeout specified as --dad-wait-time.
+@@ -437,7 +437,7 @@ case "$reason" in
+ # We're going to poll for the tentative flag every second.
+ sleep 1
+ ${ip} addr show ${interface} | grep inet6 | grep tentative \
+- &> /dev/null
++ > /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ break;
+ fi
diff --git a/repo/system/dhcp/03-fix-unwind-import.patch b/repo/system/dhcp/03-fix-unwind-import.patch
new file mode 100644
index 0000000..8b87fdb
--- /dev/null
+++ b/repo/system/dhcp/03-fix-unwind-import.patch
@@ -0,0 +1,16 @@
+bind assumes _Unwind_GetIP is a function which is not necessarily
+true. In some implementations of libunwind it's a macro.
+This fixes the build on Alpine on armhf and armv7.
+
+--- a/bind/bind-9.11.36/lib/isc/backtrace.c
++++ b/bind/bind-9.11.36/lib/isc/backtrace.c
+@@ -81,8 +81,7 @@ isc_backtrace_gettrace(void **addrs, int
+ return (ISC_R_SUCCESS);
+ }
+ #elif defined(BACKTRACE_GCC)
+-extern int _Unwind_Backtrace(void* fn, void* a);
+-extern void* _Unwind_GetIP(void* ctx);
++#include <unwind.h>
+
+ typedef struct {
+ void **result;
diff --git a/repo/system/dhcp.xibuild b/repo/system/dhcp/dhcp.xibuild
index 241dee1..241dee1 100644
--- a/repo/system/dhcp.xibuild
+++ b/repo/system/dhcp/dhcp.xibuild
diff --git a/repo/system/dhcp/dhcpd.confd b/repo/system/dhcp/dhcpd.confd
new file mode 100644
index 0000000..5cd2eec
--- /dev/null
+++ b/repo/system/dhcp/dhcpd.confd
@@ -0,0 +1,28 @@
+# /etc/conf.d/dhcpd: config file for /etc/init.d/dhcpd
+
+# If you require more than one instance of dhcpd you can create symbolic
+# links to dhcpd service like so
+# cd /etc/init.d
+# ln -s dhcpd dhcpd.foo
+# cd ../conf.d
+# cp dhcpd dhcpd.foo
+# Now you can edit dhcpd.foo and specify a different configuration file.
+# You'll also need to specify a pidfile in that dhcpd.conf file.
+# See the pid-file-name option in the dhcpd.conf man page for details.
+
+# If you wish to run dhcpd in a chroot, uncomment the following line
+# DHCPD_CHROOT="/var/lib/dhcp/chroot"
+
+# All file paths below are relative to the chroot.
+# You can specify a different chroot directory but MAKE SURE it's empty.
+
+# Specify a configuration file - the default is /etc/dhcp/dhcpd.conf
+# DHCPD_CONF="/etc/dhcp/dhcpd.conf"
+
+# Configure which interface or interfaces to for dhcpd to listen on.
+# List all interfaces space separated. If this is not specified then
+# we listen on all interfaces.
+# DHCPD_IFACE=""
+
+# Insert any other dhcpd options - see the man page for a full list.
+# DHCPD_OPTS=""
diff --git a/repo/system/dhcp/dhcpd.initd b/repo/system/dhcp/dhcpd.initd
new file mode 100644
index 0000000..f69ae71
--- /dev/null
+++ b/repo/system/dhcp/dhcpd.initd
@@ -0,0 +1,115 @@
+#!/sbin/openrc-run
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcp/files/dhcpd.init5,v 1.1 2011/12/04 22:45:07 vapier Exp $
+
+extra_commands="configtest"
+
+: ${DHCPD_CONF:=/etc/dhcp/${SVCNAME}.conf}
+
+depend() {
+ need net
+ after firewall
+ use logger dns
+}
+
+get_var() {
+ local var="$(sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' "${chroot}${DHCPD_CONF}")"
+ echo ${var:-$2}
+}
+
+checkconfig() {
+ set -- ${DHCPD_OPTS} ${chroot:+-chroot} ${chroot} -t
+
+ dhcpd "$@" 1>/dev/null 2>&1
+ local ret=$?
+ if [ ${ret} -ne 0 ] ; then
+ eerror "${SVCNAME} has detected a syntax error in your configuration files:"
+ dhcpd "$@"
+ fi
+
+ return ${ret}
+}
+
+configtest() {
+ local chroot=${DHCPD_CHROOT%/}
+
+ ebegin "Checking ${SVCNAME} configuration"
+ checkconfig
+ eend $?
+}
+
+start() {
+ local chroot=${DHCPD_CHROOT%/}
+
+ # Work out our cffile if it's in our DHCPD_OPTS
+ case " ${DHCPD_OPTS} " in
+ *" -cf "*)
+ DHCPD_CONF=" ${DHCPD_OPTS} "
+ DHCPD_CONF="${DHCPD_CONF##* -cf }"
+ DHCPD_CONF="${DHCPD_CONF%% *}"
+ ;;
+ *) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
+ ;;
+ esac
+
+ if [ -n "${chroot}" ] ; then
+ # the config test want's these to exist
+ mkdir -p \
+ "${chroot}"/run/dhcp \
+ "${chroot}"/var/lib/dhcp \
+ "${chroot}"/etc/dhcp
+ fi
+
+ # see comment in get_var() above
+ if [ ! -f "${chroot}${DHCPD_CONF}" ] ; then
+ eerror "${chroot}${DHCPD_CONF} does not exist"
+ return 1
+ fi
+
+ checkconfig || return 1
+
+ checkpath -d -o dhcp:dhcp "${chroot}"/run/dhcp "${chroot}"/var/lib/dhcp
+
+ local leasefile="$(get_var lease-file-name /var/lib/dhcp/${SVCNAME}.leases)"
+ checkpath -f -o dhcp:dhcp "${chroot}${leasefile}"
+
+ # Setup LD_PRELOAD so name resolution works in our chroot.
+ if [ -n "${chroot}" ] ; then
+ checkpath -d -o root:root -m 755 "${chroot}"/dev "${chroot}"/etc "${chroot}"/proc
+ cp -pP /etc/localtime /etc/resolv.conf "${chroot}"/etc/
+ export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"
+ if ! mountinfo -q "${chroot}/proc" ; then
+ mount --bind /proc "${chroot}/proc"
+ fi
+ fi
+
+ local pidfile="$(get_var pid-file-name /run/dhcp/${SVCNAME}.pid)"
+
+ ebegin "Starting ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --start --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/${pidfile}" \
+ -- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
+ -user dhcp -group dhcp \
+ ${chroot:+-chroot} ${chroot} ${DHCPD_IFACE}
+ eend $? \
+ && save_options chroot "${chroot}" \
+ && save_options pidfile "${pidfile}"
+}
+
+stop() {
+ local chroot="$(get_options chroot)"
+
+ ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
+ start-stop-daemon --stop --exec /usr/sbin/dhcpd \
+ --pidfile "${chroot}/$(get_options pidfile)"
+ res=$?
+
+ if [ ${res} -eq 0 ] && [ -n "${chroot}" ] ; then
+ if mountinfo -q "${chroot}/proc" ; then
+ umount "${chroot}/proc"
+ fi
+ fi
+
+ eend $res
+}
diff --git a/repo/system/efibootmgr.xibuild b/repo/system/efibootmgr/efibootmgr.xibuild
index ae58a48..ae58a48 100644
--- a/repo/system/efibootmgr.xibuild
+++ b/repo/system/efibootmgr/efibootmgr.xibuild
diff --git a/repo/system/efivar.xibuild b/repo/system/efivar/efivar.xibuild
index 2b5b666..2b5b666 100644
--- a/repo/system/efivar.xibuild
+++ b/repo/system/efivar/efivar.xibuild
diff --git a/repo/system/efivar/patches/efivar-fix-format_guid.patch b/repo/system/efivar/patches/efivar-fix-format_guid.patch
new file mode 100644
index 0000000..f40942f
--- /dev/null
+++ b/repo/system/efivar/patches/efivar-fix-format_guid.patch
@@ -0,0 +1,56 @@
+From b98ba8921010d03f46704a476c69861515deb1ca Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Mon, 7 Jan 2019 10:30:59 -0500
+Subject: [PATCH] dp.h: make format_guid() handle misaligned guid pointers
+ safely.
+
+GCC 9 adds -Werror=address-of-packed-member, which causes us to see the
+build error reported at
+ https://bugzilla.opensuse.org/show_bug.cgi?id=1120862 .
+
+That bug report shows us the following:
+
+In file included from dp.c:26:
+dp.h: In function 'format_vendor_helper':
+dp.h:120:37: error: taking address of packed member of 'struct <anonymous>' may result in an unaligned pointer value [-Werror=address-of-packed-member]
+ 120 | format_guid(buf, size, off, label, &dp->hw_vendor.vendor_guid);
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~
+dp.h:74:25: note: in definition of macro 'format_guid'
+ 74 | _rc = efi_guid_to_str(guid, &_guidstr); \
+ | ^~~~
+cc1: all warnings being treated as errors
+
+This patch makes format_guid() use a local variable as a bounce buffer
+in the case that the guid we're passed is aligned as chaotic neutral.
+
+Note that this only fixes this instance and there may be others that bz
+didn't show because it exited too soon, and I don't have a gcc 9 build
+in front of me right now.
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ src/dp.h | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/src/dp.h b/src/dp.h
+index aa4e390..20cb608 100644
+--- a/src/dp.h
++++ b/src/dp.h
+@@ -70,8 +70,15 @@
+ #define format_guid(buf, size, off, dp_type, guid) ({ \
+ int _rc; \
+ char *_guidstr = NULL; \
+- \
+- _rc = efi_guid_to_str(guid, &_guidstr); \
++ efi_guid_t _guid; \
++ const efi_guid_t * const _guid_p = \
++ likely(__alignof__(guid) == sizeof(guid)) \
++ ? guid \
++ : &_guid; \
++ \
++ if (unlikely(__alignof__(guid) == sizeof(guid))) \
++ memmove(&_guid, guid, sizeof(_guid)); \
++ _rc = efi_guid_to_str(_guid_p, &_guidstr); \
+ if (_rc < 0) { \
+ efi_error("could not build %s GUID DP string", \
+ dp_type); \
diff --git a/repo/system/efivar/patches/efivar-fix-packed.patch b/repo/system/efivar/patches/efivar-fix-packed.patch
new file mode 100644
index 0000000..bbb6a99
--- /dev/null
+++ b/repo/system/efivar/patches/efivar-fix-packed.patch
@@ -0,0 +1,168 @@
+From c3c553db85ff10890209d0fe48fb4856ad68e4e0 Mon Sep 17 00:00:00 2001
+From: Peter Jones <pjones@redhat.com>
+Date: Thu, 21 Feb 2019 15:20:12 -0500
+Subject: [PATCH] Fix all the places -Werror=address-of-packed-member catches.
+
+This gets rid of all the places GCC 9's -Werror=address-of-packed-member
+flags as problematic.
+
+Fixes github issue #123
+
+Signed-off-by: Peter Jones <pjones@redhat.com>
+---
+ src/dp-message.c | 6 ++++--
+ src/dp.h | 12 ++++--------
+ src/guid.c | 2 +-
+ src/include/efivar/efivar.h | 2 +-
+ src/ucs2.h | 27 +++++++++++++++++++--------
+ 5 files changed, 29 insertions(+), 20 deletions(-)
+
+diff --git a/src/dp-message.c b/src/dp-message.c
+index 3724e5f..9f96466 100644
+--- a/src/dp-message.c
++++ b/src/dp-message.c
+@@ -620,11 +620,13 @@ _format_message_dn(char *buf, size_t size, const_efidp dp)
+ ) / sizeof(efi_ip_addr_t);
+ format(buf, size, off, "Dns", "Dns(");
+ for (int i=0; i < end; i++) {
+- const efi_ip_addr_t *addr = &dp->dns.addrs[i];
++ efi_ip_addr_t addr;
++
++ memcpy(&addr, &dp->dns.addrs[i], sizeof(addr));
+ if (i != 0)
+ format(buf, size, off, "Dns", ",");
+ format_ip_addr(buf, size, off, "Dns",
+- dp->dns.is_ipv6, addr);
++ dp->dns.is_ipv6, &addr);
+ }
+ format(buf, size, off, "Dns", ")");
+ break;
+diff --git a/src/dp.h b/src/dp.h
+index 20cb608..1f921d5 100644
+--- a/src/dp.h
++++ b/src/dp.h
+@@ -71,13 +71,9 @@
+ int _rc; \
+ char *_guidstr = NULL; \
+ efi_guid_t _guid; \
+- const efi_guid_t * const _guid_p = \
+- likely(__alignof__(guid) == sizeof(guid)) \
+- ? guid \
+- : &_guid; \
+- \
+- if (unlikely(__alignof__(guid) == sizeof(guid))) \
+- memmove(&_guid, guid, sizeof(_guid)); \
++ const efi_guid_t * const _guid_p = &_guid; \
++ \
++ memmove(&_guid, guid, sizeof(_guid)); \
+ _rc = efi_guid_to_str(_guid_p, &_guidstr); \
+ if (_rc < 0) { \
+ efi_error("could not build %s GUID DP string", \
+@@ -86,7 +82,7 @@
+ _guidstr = onstack(_guidstr, \
+ strlen(_guidstr)+1); \
+ _rc = format(buf, size, off, dp_type, "%s", \
+- _guidstr); \
++ _guidstr); \
+ } \
+ _rc; \
+ })
+diff --git a/src/guid.c b/src/guid.c
+index 306c9ff..3156b3b 100644
+--- a/src/guid.c
++++ b/src/guid.c
+@@ -31,7 +31,7 @@
+ extern const efi_guid_t efi_guid_zero;
+
+ int NONNULL(1, 2) PUBLIC
+-efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
++efi_guid_cmp(const void * const a, const void * const b)
+ {
+ return memcmp(a, b, sizeof (efi_guid_t));
+ }
+diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
+index 316891c..ad6449d 100644
+--- a/src/include/efivar/efivar.h
++++ b/src/include/efivar/efivar.h
+@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
+
+ extern int efi_guid_is_zero(const efi_guid_t *guid);
+ extern int efi_guid_is_empty(const efi_guid_t *guid);
+-extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
++extern int efi_guid_cmp(const void * const a, const void * const b);
+
+ /* import / export functions */
+ typedef struct efi_variable efi_variable_t;
+diff --git a/src/ucs2.h b/src/ucs2.h
+index dbb5900..edd8367 100644
+--- a/src/ucs2.h
++++ b/src/ucs2.h
+@@ -23,16 +23,21 @@
+ (((val) & ((mask) << (shift))) >> (shift))
+
+ static inline size_t UNUSED
+-ucs2len(const uint16_t * const s, ssize_t limit)
++ucs2len(const void *vs, ssize_t limit)
+ {
+ ssize_t i;
+- for (i = 0; i < (limit >= 0 ? limit : i+1) && s[i] != (uint16_t)0; i++)
++ const uint16_t *s = vs;
++ const uint8_t *s8 = vs;
++
++ for (i = 0;
++ i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
++ i++, s8 += 2, s++)
+ ;
+ return i;
+ }
+
+ static inline size_t UNUSED
+-ucs2size(const uint16_t * const s, ssize_t limit)
++ucs2size(const void *s, ssize_t limit)
+ {
+ size_t rc = ucs2len(s, limit);
+ rc *= sizeof (uint16_t);
+@@ -69,10 +74,11 @@ utf8size(uint8_t *s, ssize_t limit)
+ }
+
+ static inline unsigned char * UNUSED
+-ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
++ucs2_to_utf8(const void * const voidchars, ssize_t limit)
+ {
+ ssize_t i, j;
+ unsigned char *ret;
++ const uint16_t * const chars = voidchars;
+
+ if (limit < 0)
+ limit = ucs2len(chars, -1);
+@@ -124,10 +130,12 @@ ucs2_to_utf8(const uint16_t * const chars, ssize_t limit)
+ }
+
+ static inline ssize_t UNUSED NONNULL(4)
+-utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
++utf8_to_ucs2(void *ucs2void, ssize_t size, int terminate, uint8_t *utf8)
+ {
+ ssize_t req;
+ ssize_t i, j;
++ uint16_t *ucs2 = ucs2void;
++ uint16_t val16;
+
+ if (!ucs2 && size > 0) {
+ errno = EINVAL;
+@@ -162,10 +170,13 @@ utf8_to_ucs2(uint16_t *ucs2, ssize_t size, int terminate, uint8_t *utf8)
+ val = utf8[i] & 0x7f;
+ i += 1;
+ }
+- ucs2[j] = val;
++ val16 = val;
++ ucs2[j] = val16;
++ }
++ if (terminate) {
++ val16 = 0;
++ ucs2[j++] = val16;
+ }
+- if (terminate)
+- ucs2[j++] = (uint16_t)0;
+ return j;
+ };
+
diff --git a/repo/system/efivar/patches/efivar-fix-ucs2.patch b/repo/system/efivar/patches/efivar-fix-ucs2.patch
new file mode 100644
index 0000000..594da61
--- /dev/null
+++ b/repo/system/efivar/patches/efivar-fix-ucs2.patch
@@ -0,0 +1,59 @@
+From fdb803402fb32fa6d020bac57a40c7efe4aabb7d Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javierm@redhat.com>
+Date: Tue, 5 Mar 2019 17:23:24 +0100
+Subject: [PATCH] ucs2.h: remove unused variable
+
+The const uint16_t pointer is not used since now the two bytes of the
+UCS-2 chars are checked to know if is the termination of the string.
+
+Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
+---
+ src/ucs2.h | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/ucs2.h b/src/ucs2.h
+index edd8367..e0390c3 100644
+--- a/src/ucs2.h
++++ b/src/ucs2.h
+@@ -26,12 +26,11 @@ static inline size_t UNUSED
+ ucs2len(const void *vs, ssize_t limit)
+ {
+ ssize_t i;
+- const uint16_t *s = vs;
+ const uint8_t *s8 = vs;
+
+ for (i = 0;
+ i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
+- i++, s8 += 2, s++)
++ i++, s8 += 2)
+ ;
+ return i;
+ }
+From 4e04afc2df9bbc26e5ab524b53a6f4f1e61d7c9e Mon Sep 17 00:00:00 2001
+From: Javier Martinez Canillas <javierm@redhat.com>
+Date: Tue, 5 Mar 2019 17:23:32 +0100
+Subject: [PATCH] ucs2.h: fix logic that checks for UCS-2 string termination
+
+Currently the loop to count the lenght of the UCS-2 string ends if either
+of the two bytes are 0, but 0 is a valid value for UCS-2 character codes.
+
+So only break the loop when 0 is the value for both UCS-2 char bytes.
+
+Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
+---
+ src/ucs2.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ucs2.h b/src/ucs2.h
+index e0390c3..fd8b056 100644
+--- a/src/ucs2.h
++++ b/src/ucs2.h
+@@ -29,7 +29,7 @@ ucs2len(const void *vs, ssize_t limit)
+ const uint8_t *s8 = vs;
+
+ for (i = 0;
+- i < (limit >= 0 ? limit : i+1) && s8[0] != 0 && s8[1] != 0;
++ i < (limit >= 0 ? limit : i+1) && !(s8[0] == 0 && s8[1] == 0);
+ i++, s8 += 2)
+ ;
+ return i;
diff --git a/repo/system/efivar/patches/musl-bswap.patch b/repo/system/efivar/patches/musl-bswap.patch
new file mode 100644
index 0000000..8b86d9a
--- /dev/null
+++ b/repo/system/efivar/patches/musl-bswap.patch
@@ -0,0 +1,33 @@
+From c9b54ee2cd504542cac4ed95fa7842bd14b39f9c Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Fri, 18 Aug 2017 20:36:03 -0500
+Subject: [PATCH] makeguids: Ensure compatibility with other libcs
+
+The musl libc does not provide __bswap_constant_XX.
+If <endian.h> does not provide these macros, use our own.
+
+This fixes issue #84.
+---
+ src/makeguids.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/makeguids.c b/src/makeguids.c
+index ec75a86..6b0d80e 100644
+--- a/src/makeguids.c
++++ b/src/makeguids.c
+@@ -152,6 +152,15 @@ main(int argc, char *argv[])
+ fprintf(symout, "#include <efivar/efivar.h>\n");
+ fprintf(symout, "#include <endian.h>\n");
+ fprintf(symout, """\n\
++#ifndef __bswap_constant_16\n\
++#define __bswap_constant_16(x)\\\n\
++ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))\n\
++#endif\n\
++#ifndef __bswap_constant_32\n\
++#define __bswap_constant_32(x)\\\n\
++ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \\\n\
++ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))\n\
++#endif\n\
+ #if BYTE_ORDER == BIG_ENDIAN\n\
+ #define cpu_to_be32(n) (n)\n\
+ #define cpu_to_be16(n) (n)\n\
diff --git a/repo/system/elfutils.xibuild b/repo/system/elfutils/elfutils.xibuild
index a68827f..a68827f 100644
--- a/repo/system/elfutils.xibuild
+++ b/repo/system/elfutils/elfutils.xibuild
diff --git a/repo/system/elfutils/files/error.h b/repo/system/elfutils/files/error.h
new file mode 100644
index 0000000..ef06827
--- /dev/null
+++ b/repo/system/elfutils/files/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
diff --git a/repo/system/elfutils/patches/fix-aarch64_fregs.patch b/repo/system/elfutils/patches/fix-aarch64_fregs.patch
new file mode 100644
index 0000000..4007416
--- /dev/null
+++ b/repo/system/elfutils/patches/fix-aarch64_fregs.patch
@@ -0,0 +1,14 @@
+It looks like fregs.vregs[] is an array of double?
+Casting to Dwarf_Word instead of & 0xFFFFFFF should do.
+
+--- a/backends/aarch64_initreg.c 2015-11-27 14:36:29.000000000 +0100
++++ b/backends/aarch64_initreg.c 2016-08-09 03:47:25.428560159 +0200
+@@ -82,7 +82,7 @@
+
+ Dwarf_Word dwarf_fregs[32];
+ for (int r = 0; r < 32; r++)
+- dwarf_fregs[r] = fregs.vregs[r] & 0xFFFFFFFF;
++ dwarf_fregs[r] = (Dwarf_Word)fregs.vregs[r];
+
+ if (! setfunc (64, 32, dwarf_fregs, arg))
+ return false;
diff --git a/repo/system/elfutils/patches/fix-uninitialized.patch b/repo/system/elfutils/patches/fix-uninitialized.patch
new file mode 100644
index 0000000..31ecd9e
--- /dev/null
+++ b/repo/system/elfutils/patches/fix-uninitialized.patch
@@ -0,0 +1,17 @@
+
+--- a/libcpu/i386_disasm.c 2015-08-21 14:22:37.000000000 +0200
++++ b/libcpu/i386_disasm.c 2015-11-20 06:30:59.250629957 +0100
+@@ -1,4 +1,4 @@
+-/* Disassembler for x86.
++/* Disassembler for x86.
+ Copyright (C) 2007, 2008, 2009, 2011 Red Hat, Inc.
+ This file is part of elfutils.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2007.
+@@ -710,6 +710,7 @@
+
+ case 'm':
+ /* Mnemonic. */
++ str = mnebuf;
+
+ if (unlikely (instrtab[cnt].mnemonic == MNE_INVALID))
+ {
diff --git a/repo/system/elfutils/patches/musl-asm-ptrace-h.patch b/repo/system/elfutils/patches/musl-asm-ptrace-h.patch
new file mode 100644
index 0000000..fc14686
--- /dev/null
+++ b/repo/system/elfutils/patches/musl-asm-ptrace-h.patch
@@ -0,0 +1,10 @@
+--- a/backends/ppc_initreg.c 2019-11-26 23:48:42.000000000 +0100
++++ b/backends/ppc_initreg.c 2019-12-08 16:57:58.334872602 +0100
+@@ -32,6 +32,7 @@
+
+ #include <stdlib.h>
+ #if defined(__powerpc__) && defined(__linux__)
++# include <asm/ptrace.h>
+ # include <sys/ptrace.h>
+ # include <sys/user.h>
+ #endif
diff --git a/repo/system/elfutils/patches/musl-macros.patch b/repo/system/elfutils/patches/musl-macros.patch
new file mode 100644
index 0000000..0d7ec41
--- /dev/null
+++ b/repo/system/elfutils/patches/musl-macros.patch
@@ -0,0 +1,87 @@
+--- a/src/arlib.h 2015-08-21 14:22:37.000000000 +0200
++++ b/src/arlib.h 2015-11-20 08:02:55.153199611 +0100
+@@ -29,6 +29,16 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+
++#if !defined(ACCESSPERMS)
++# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
++#endif
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++#if !defined(DEFFILEMODE)
++# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
++#endif
++
+
+ /* State of -D/-U flags. */
+ extern bool arlib_deterministic_output;
+--- a/src/elfcompress.c.orig 2016-04-02 12:51:26.903848894 +0200
++++ b/src/elfcompress.c 2016-04-02 12:55:15.076996338 +0200
+@@ -35,6 +35,14 @@
+ #include <gelf.h>
+ #include "system.h"
+
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH 0
++#endif
++
++#if !defined(ALLPERMS)
++# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO) /* 07777 */
++#endif
++
+ /* Name and version of program. */
+ static void print_version (FILE *stream, struct argp_state *state);
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+diff --git a/lib/libeu.h b/lib/libeu.h
+index 69fe3d7..e5c99b8 100644
+--- a/lib/libeu.h
++++ b/lib/libeu.h
+@@ -31,6 +31,27 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#include <unistd.h>
++#include <alloca.h>
++#include <string.h>
++
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
+
+ extern void *xmalloc (size_t) __attribute__ ((__malloc__));
+ extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
+diff --git a/src/strip.c b/src/strip.c
+index 48792a7..d2f0c60 100644
+--- a/src/strip.c
++++ b/src/strip.c
+@@ -46,6 +46,14 @@
+ #include <system.h>
+ #include <printversion.h>
+
++#if !defined(FNM_EXTMATCH)
++# define FNM_EXTMATCH 0
++#endif
++
++#if !defined(ACCESSPERMS)
++#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
++#endif
++
+ typedef uint8_t GElf_Byte;
+
+ /* Name and version of program. */
diff --git a/repo/system/elfutils/patches/musl-strndupa.patch b/repo/system/elfutils/patches/musl-strndupa.patch
new file mode 100644
index 0000000..a520688
--- /dev/null
+++ b/repo/system/elfutils/patches/musl-strndupa.patch
@@ -0,0 +1,18 @@
+--- a/src/unstrip.c.orig 2017-04-27 14:26:26.000000000 +0000
++++ b/src/unstrip.c 2017-05-05 15:51:33.515154220 +0000
+@@ -56,6 +56,15 @@
+ # define _(str) gettext (str)
+ #endif
+
++#ifndef strndupa
++#define strndupa(s, n) \
++ (__extension__ ({const char *__in = (s); \
++ size_t __len = strnlen (__in, (n)) + 1; \
++ char *__out = (char *) alloca (__len); \
++ __out[__len-1] = '\0'; \
++ (char *) memcpy (__out, __in, __len-1);}))
++#endif
++
+ /* Name and version of program. */
+ ARGP_PROGRAM_VERSION_HOOK_DEF = print_version;
+
diff --git a/repo/system/elogind/elogind.initd b/repo/system/elogind/elogind.initd
new file mode 100644
index 0000000..0c22ca9
--- /dev/null
+++ b/repo/system/elogind/elogind.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+supervisor=supervise-daemon
+
+name="System login manager"
+description="System service that manages user logins"
+description_reload="Reload configuration without exiting"
+
+command=/usr/libexec/elogind/elogind
+
+depend() {
+ need dbus
+
+ # Make sure we start before any other display manager
+ before display-manager
+}
+
+extra_started_commands="reload"
+
+reload() {
+ ebegin "Reloading configuration"
+ $supervisor $RC_SVCNAME --signal HUP
+ eend $?
+}
diff --git a/repo/system/elogind.xibuild b/repo/system/elogind/elogind.xibuild
index c5f1774..c5f1774 100644
--- a/repo/system/elogind.xibuild
+++ b/repo/system/elogind/elogind.xibuild
diff --git a/repo/system/elogind/id-nobody.patch b/repo/system/elogind/id-nobody.patch
new file mode 100644
index 0000000..5e9e5cd
--- /dev/null
+++ b/repo/system/elogind/id-nobody.patch
@@ -0,0 +1,13 @@
+--- a/src/basic/user-util.h
++++ b/src/basic/user-util.h
+@@ -70,8 +70,8 @@ int take_etc_passwd_lock(const char *root);
+ #define UID_INVALID ((uid_t) -1)
+ #define GID_INVALID ((gid_t) -1)
+
+-#define UID_NOBODY ((uid_t) 65534U)
+-#define GID_NOBODY ((gid_t) 65534U)
++#define UID_NOBODY ((uid_t) 99U)
++#define GID_NOBODY ((gid_t) 99U)
+
+ #define ETC_PASSWD_LOCK_PATH "/etc/.pwd.lock"
+
diff --git a/repo/system/elogind/mips.patch b/repo/system/elogind/mips.patch
new file mode 100644
index 0000000..ca1c097
--- /dev/null
+++ b/repo/system/elogind/mips.patch
@@ -0,0 +1,11 @@
+--- a/src/basic/missing_syscall.h 2021-01-15 08:12:02.000000000 +0100
++++ b/src/basic/missing_syscall.h 2021-02-24 07:20:32.026355819 +0100
+@@ -11,7 +11,7 @@
+ #include <sys/wait.h>
+ #include <unistd.h>
+
+-#ifdef ARCH_MIPS
++#if defined(_MIPSEL) || defined(_MIPSEB)
+ #include <asm/sgidefs.h>
+ #endif
+
diff --git a/repo/system/elogind/ppc64-bad-tuple.patch b/repo/system/elogind/ppc64-bad-tuple.patch
new file mode 100644
index 0000000..f6237ff
--- /dev/null
+++ b/repo/system/elogind/ppc64-bad-tuple.patch
@@ -0,0 +1,25 @@
+From 0ce8ef86e8bfc872b40bc090fea9873fa1f51836 Mon Sep 17 00:00:00 2001
+From: q66 <daniel@octaforge.org>
+Date: Thu, 21 Jan 2021 22:22:28 +0100
+Subject: [PATCH] fix ppc64 arch tuple
+
+---
+ src/basic/architecture.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git src/basic/architecture.h src/basic/architecture.h
+index 620b522..3ea6e52 100644
+--- a/src/basic/architecture.h
++++ b/src/basic/architecture.h
+@@ -77,7 +77,7 @@ int uname_architecture(void);
+ #elif defined(__powerpc64__)
+ # if __BYTE_ORDER == __BIG_ENDIAN
+ # define native_architecture() ARCHITECTURE_PPC64
+-# define LIB_ARCH_TUPLE "ppc64-linux-gnu"
++# define LIB_ARCH_TUPLE "powerpc64-linux-gnu"
+ # define SECONDARY_ARCHITECTURE ARCHITECTURE_PPC
+ # else
+ # define native_architecture() ARCHITECTURE_PPC64_LE
+--
+2.30.0
+
diff --git a/repo/system/elogind/ppcle.patch b/repo/system/elogind/ppcle.patch
new file mode 100644
index 0000000..b986b0f
--- /dev/null
+++ b/repo/system/elogind/ppcle.patch
@@ -0,0 +1,25 @@
+From 836f3efb84a703b3594906572a54616d25cecf5e Mon Sep 17 00:00:00 2001
+From: q66 <daniel@octaforge.org>
+Date: Thu, 21 Jan 2021 21:59:12 +0100
+Subject: [PATCH] add ppcle arch tuple
+
+---
+ src/basic/architecture.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git src/basic/architecture.h src/basic/architecture.h
+index 620b522..afdff7a 100644
+--- a/src/basic/architecture.h
++++ b/src/basic/architecture.h
+@@ -94,7 +94,7 @@ int uname_architecture(void);
+ # endif
+ # else
+ # define native_architecture() ARCHITECTURE_PPC_LE
+-# error "Missing LIB_ARCH_TUPLE for PPCLE"
++# define LIB_ARCH_TUPLE "powerpcle-linux-gnu"
+ # endif
+ #elif defined(__ia64__)
+ # define native_architecture() ARCHITECTURE_IA64
+--
+2.30.0
+
diff --git a/repo/system/eudev/default-rules.patch b/repo/system/eudev/default-rules.patch
new file mode 100644
index 0000000..0786a98
--- /dev/null
+++ b/repo/system/eudev/default-rules.patch
@@ -0,0 +1,9 @@
+--- a/rules/50-udev-default.rules
++++ b/rules/50-udev-default.rules
+@@ -73,5 +73,6 @@ KERNEL=="rfkill", MODE="0664"
+ KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
+
+ KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
++KERNEL=="kvm", GROUP="kvm", MODE="0660"
+
+ LABEL="default_end"
diff --git a/repo/system/eudev.xibuild b/repo/system/eudev/eudev.xibuild
index 983d112..983d112 100644
--- a/repo/system/eudev.xibuild
+++ b/repo/system/eudev/eudev.xibuild
diff --git a/repo/system/eudev/load-fbcon.patch b/repo/system/eudev/load-fbcon.patch
new file mode 100644
index 0000000..e5e404a
--- /dev/null
+++ b/repo/system/eudev/load-fbcon.patch
@@ -0,0 +1,10 @@
+--- eudev-3.2.1/rules/80-drivers.rules.orig 2017-01-24 11:00:53.174192908 +0200
++++ eudev-3.2.1/rules/80-drivers.rules 2017-01-24 11:04:01.886714118 +0200
+@@ -8,6 +8,7 @@
+ SUBSYSTEM=="memstick", RUN{builtin}+="kmod load ms_block mspro_block"
+ SUBSYSTEM=="i2o", RUN{builtin}+="kmod load i2o_block"
+ SUBSYSTEM=="module", KERNEL=="parport_pc", RUN{builtin}+="kmod load ppdev"
++SUBSYSTEM=="graphics", RUN{builtin}+="kmod load fbcon"
+ KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN{builtin}+="kmod load sm_ftl"
+
+ LABEL="drivers_end"
diff --git a/repo/system/eudev/udev.initd b/repo/system/eudev/udev.initd
new file mode 100644
index 0000000..5ce2354
--- /dev/null
+++ b/repo/system/eudev/udev.initd
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+
+start () {
+ # Start the udev daemon to continually watch for, and act on,
+ # uevents
+ /sbin/udevd --daemon
+
+ # Now traverse /sys in order to "coldplug" devices that have
+ # already been discovered
+ /sbin/udevadm trigger --action=add --type=subsystems
+ /sbin/udevadm trigger --action=add --type=devices
+ /sbin/udevadm trigger --action=change --type=devices
+
+ # Now wait for udevd to process the uevents we triggered
+ if ! is_true "$OMIT_UDEV_SETTLE"; then
+ /sbin/udevadm settle
+ fi
+
+ # If any LVM based partitions are on the system, ensure they
+ # are activated so they can be used.
+ if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
+}
diff --git a/repo/system/eudev/udev_retry.initd b/repo/system/eudev/udev_retry.initd
new file mode 100644
index 0000000..cfe077c
--- /dev/null
+++ b/repo/system/eudev/udev_retry.initd
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+start () {
+ echo "Retrying failed uevents, if any..."
+
+ # As of udev-186, the --run option is no longer valid
+ #rundir=$(/sbin/udevadm info --run)
+ rundir=/run/udev
+ # From Debian: "copy the rules generated before / was mounted
+ # read-write":
+
+ for file in ${rundir}/tmp-rules--*; do
+ dest=${file##*tmp-rules--}
+ [ "$dest" = '*' ] && break
+ cat $file >> /etc/udev/rules.d/$dest
+ rm -f $file
+ done
+
+ # Re-trigger the uevents that may have failed,
+ # in hope they will succeed now
+ /bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \
+ while read line ; do
+ for subsystem in $line ; do
+ /sbin/udevadm trigger --subsystem-match=$subsystem --action=add
+ done
+ done
+
+ # Now wait for udevd to process the uevents we triggered
+ if ! is_true "$OMIT_UDEV_RETRY_SETTLE"; then
+ /sbin/udevadm settle
+ fi
+}
diff --git a/repo/system/execline.xibuild b/repo/system/execline/execline.xibuild
index 61d3e57..61d3e57 100644
--- a/repo/system/execline.xibuild
+++ b/repo/system/execline/execline.xibuild
diff --git a/repo/system/expat.xibuild b/repo/system/expat/expat.xibuild
index d921e1b..d921e1b 100644
--- a/repo/system/expat.xibuild
+++ b/repo/system/expat/expat.xibuild
diff --git a/repo/system/findutils.xibuild b/repo/system/findutils/findutils.xibuild
index 1dbc9d3..1dbc9d3 100644
--- a/repo/system/findutils.xibuild
+++ b/repo/system/findutils/findutils.xibuild
diff --git a/repo/system/freetype2.xibuild b/repo/system/freetype2/freetype2.xibuild
index b4a2571..b4a2571 100644
--- a/repo/system/freetype2.xibuild
+++ b/repo/system/freetype2/freetype2.xibuild
diff --git a/repo/system/fribidi.xibuild b/repo/system/fribidi/fribidi.xibuild
index ec3ea83..ec3ea83 100644
--- a/repo/system/fribidi.xibuild
+++ b/repo/system/fribidi/fribidi.xibuild
diff --git a/repo/system/gc.xibuild b/repo/system/gc/gc.xibuild
index bde408f..bde408f 100644
--- a/repo/system/gc.xibuild
+++ b/repo/system/gc/gc.xibuild
diff --git a/repo/system/gdbm.xibuild b/repo/system/gdbm/gdbm.xibuild
index 3906bbb..3906bbb 100644
--- a/repo/system/gdbm.xibuild
+++ b/repo/system/gdbm/gdbm.xibuild
diff --git a/repo/system/gettext.xibuild b/repo/system/gettext/gettext.xibuild
index 11b6754..11b6754 100644
--- a/repo/system/gettext.xibuild
+++ b/repo/system/gettext/gettext.xibuild
diff --git a/repo/system/glew/glew.patch b/repo/system/glew/glew.patch
new file mode 100644
index 0000000..61c4447
--- /dev/null
+++ b/repo/system/glew/glew.patch
@@ -0,0 +1,34 @@
+Fixes pkg-config file to have correct system libdir.
+
+diff -aur glew-2.2.0/Makefile glew-2.2.0-alpine/Makefile
+--- glew-2.2.0/Makefile 2020-03-15 11:53:59.000000000 +0000
++++ glew-2.2.0-alpine/Makefile 2022-01-28 02:42:23.773580331 +0000
+@@ -144,7 +144,7 @@
+ glew.pc: glew.pc.in
+ sed \
+ -e "s|@prefix@|$(GLEW_PREFIX)|g" \
+- -e "s|@libdir@|$(LIBDIR)|g" \
++ -e "s|@libdir@|/usr/lib|g" \
+ -e "s|@exec_prefix@|$(BINDIR)|g" \
+ -e "s|@includedir@|$(INCDIR)|g" \
+ -e "s|@version@|$(GLEW_VERSION)|g" \
+
+diff -aur glew-2.2.0/config/Makefile.linux glew-2.2.0-alpine/config/Makefile.linux
+--- glew-2.2.0/config/Makefile.linux 2020-03-15 11:53:59.000000000 +0000
++++ glew-2.2.0-alpine/config/Makefile.linux 2022-01-28 02:43:26.813582486 +0000
+@@ -12,13 +12,8 @@
+ ifeq (e2k,${M_ARCH})
+ ARCH64 = true
+ endif
+-ifeq (${ARCH64},true)
+- LDFLAGS.EXTRA = -L/usr/X11R6/lib64 -L/usr/lib64
+- LIBDIR = $(GLEW_DEST)/lib64
+-else
+- LDFLAGS.EXTRA = -L/usr/X11R6/lib -L/usr/lib
+- LIBDIR = $(GLEW_DEST)/lib
+-endif
++LDFLAGS.EXTRA = -L/usr/X11R6/lib -L/usr/lib
++LIBDIR = $(GLEW_DEST)/lib
+ LDFLAGS.GL = -lGL -lX11
+ LDFLAGS.STATIC = -Wl,-Bstatic
+ LDFLAGS.DYNAMIC = -Wl,-Bdynamic
diff --git a/repo/system/glew.xibuild b/repo/system/glew/glew.xibuild
index 7ad27fe..7ad27fe 100644
--- a/repo/system/glew.xibuild
+++ b/repo/system/glew/glew.xibuild
diff --git a/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch b/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch
new file mode 100644
index 0000000..50a9a8c
--- /dev/null
+++ b/repo/system/glib/0001-gquark-fix-initialization-with-c-constructors.patch
@@ -0,0 +1,47 @@
+From e4216dee57f5156e192b2910f13eb855a104cb18 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 6 Jul 2016 12:38:40 +0200
+Subject: [PATCH] gquark: fix initialization with c++ constructors
+
+C++ constructors may want create new quarks, but we can not guarantee
+that the glib library ctor is executed first. Therefore we make sure
+that quarks are always initialized from g_quark_from_string and
+g_quark_from_static_string
+
+This fixes crashes in glibmm with musl which likely happens on AIX too.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=768215
+https://bugzilla.gnome.org/show_bug.cgi?id=756139#c14
+---
+ glib/gquark.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/glib/gquark.c b/glib/gquark.c
+index 9e51a92..17ecd7f 100644
+--- a/glib/gquark.c
++++ b/glib/gquark.c
+@@ -57,6 +57,11 @@ static gint quark_block_offset = 0;
+ void
+ g_quark_init (void)
+ {
++ /* we may be initialized from c++ constructor or the glib ctor, but we
++ cannot guarantee in what order. So we check if we have been initialized */
++ if (quark_ht != NULL)
++ return;
++
+ g_assert (quark_seq_id == 0);
+ quark_ht = g_hash_table_new (g_str_hash, g_str_equal);
+ quarks = g_new (gchar*, QUARK_BLOCK_SIZE);
+@@ -179,6 +184,9 @@ quark_from_string (const gchar *string,
+ {
+ GQuark quark = 0;
+
++ if (G_UNLIKELY (quark_ht == NULL))
++ g_quark_init();
++
+ quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string));
+
+ if (!quark)
+--
+2.9.0
+
diff --git a/repo/system/glib/deprecated-no-warn.patch b/repo/system/glib/deprecated-no-warn.patch
new file mode 100644
index 0000000..e247eca
--- /dev/null
+++ b/repo/system/glib/deprecated-no-warn.patch
@@ -0,0 +1,23 @@
+diff -Naur a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c
+--- a/gio/glib-compile-schemas.c 2018-09-21 15:23:52.000000000 +0100
++++ b/gio/glib-compile-schemas.c 2019-02-10 14:37:30.034879344 +0000
+@@ -1233,19 +1233,6 @@
+ return;
+ }
+
+- if (path && (g_str_has_prefix (path, "/apps/") ||
+- g_str_has_prefix (path, "/desktop/") ||
+- g_str_has_prefix (path, "/system/")))
+- {
+- gchar *message = NULL;
+- message = g_strdup_printf (_("Warning: Schema “%s” has path “%s”. "
+- "Paths starting with "
+- "“/apps/”, “/desktop/” or “/system/” are deprecated."),
+- id, path);
+- g_printerr ("%s\n", message);
+- g_free (message);
+- }
+-
+ state->schema_state = schema_state_new (path, gettext_domain,
+ extends, extends_name, list_of);
+
diff --git a/repo/system/glib.xibuild b/repo/system/glib/glib.xibuild
index 870e600..870e600 100644
--- a/repo/system/glib.xibuild
+++ b/repo/system/glib/glib.xibuild
diff --git a/repo/system/glib/musl-libintl.patch b/repo/system/glib/musl-libintl.patch
new file mode 100644
index 0000000..a673800
--- /dev/null
+++ b/repo/system/glib/musl-libintl.patch
@@ -0,0 +1,22 @@
+diff --git a/meson.build b/meson.build
+index 319f183..3a5fdfc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2047,9 +2047,6 @@ endif
+ # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
+ # implementations. This could be extended if issues are found in some platforms.
+ libintl_deps = []
+-if cc.has_function('ngettext')
+- have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
+-else
+ # First just find the bare library.
+ libintl = cc.find_library('intl', required : false)
+ # The bare library probably won't link without help if it's static.
+@@ -2081,7 +2078,6 @@ else
+ have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', args : osx_ldflags,
+ dependencies : libintl_deps)
+ endif
+-endif
+
+ glib_conf.set('HAVE_BIND_TEXTDOMAIN_CODESET', have_bind_textdomain_codeset)
+
diff --git a/repo/system/glm/fix-endian-test.patch b/repo/system/glm/fix-endian-test.patch
new file mode 100644
index 0000000..ba2cce4
--- /dev/null
+++ b/repo/system/glm/fix-endian-test.patch
@@ -0,0 +1,30 @@
+diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp
+index 5830999..86167c5 100644
+--- a/test/gtc/gtc_packing.cpp
++++ b/test/gtc/gtc_packing.cpp
+@@ -5,6 +5,8 @@
+ #include <cstdio>
+ #include <vector>
+
++#include <endian.h>
++
+ void print_bits(float const& s)
+ {
+ union
+@@ -154,6 +156,7 @@ int test_U3x10_1x2()
+ Error += glm::all(glm::equal(v0, v1)) ? 0 : 1;
+ }
+
++#if BYTE_ORDER == LITTLE_ENDIAN
+ glm::u8vec4 const v0(0xff, 0x77, 0x0, 0x33);
+ glm::uint32 const p0 = *reinterpret_cast<glm::uint32 const*>(&v0[0]);
+ glm::uint32 const r0 = 0x330077ff;
+@@ -165,7 +168,7 @@ int test_U3x10_1x2()
+ glm::uint32 const r1 = 0xc001dcff;
+
+ Error += p1 == r1 ? 0 : 1;
+-
++#endif
+ return Error;
+ }
+
diff --git a/repo/system/glm/glm.pc b/repo/system/glm/glm.pc
new file mode 100644
index 0000000..e3bb5ac
--- /dev/null
+++ b/repo/system/glm/glm.pc
@@ -0,0 +1,7 @@
+prefix=/usr
+includedir=${prefix}/include
+
+Name: GLM
+Description: OpenGL Mathematics
+Version: 0.9.9
+Cflags: -I${includedir}
diff --git a/repo/system/glm.xibuild b/repo/system/glm/glm.xibuild
index cd918c3..cd918c3 100644
--- a/repo/system/glm.xibuild
+++ b/repo/system/glm/glm.xibuild
diff --git a/repo/system/glu.xibuild b/repo/system/glu/glu.xibuild
index 54249a7..54249a7 100644
--- a/repo/system/glu.xibuild
+++ b/repo/system/glu/glu.xibuild
diff --git a/repo/system/gmp.xibuild b/repo/system/gmp/gmp.xibuild
index 0bfd3f4..0bfd3f4 100644
--- a/repo/system/gmp.xibuild
+++ b/repo/system/gmp/gmp.xibuild
diff --git a/repo/system/gnutls.xibuild b/repo/system/gnutls/gnutls.xibuild
index 20160e4..20160e4 100644
--- a/repo/system/gnutls.xibuild
+++ b/repo/system/gnutls/gnutls.xibuild
diff --git a/repo/system/gobject-introspection.xibuild b/repo/system/gobject-introspection/gobject-introspection.xibuild
index 5d5a117..5d5a117 100644
--- a/repo/system/gobject-introspection.xibuild
+++ b/repo/system/gobject-introspection/gobject-introspection.xibuild
diff --git a/repo/system/gobject-introspection/musl-time64.patch b/repo/system/gobject-introspection/musl-time64.patch
new file mode 100644
index 0000000..9990efd
--- /dev/null
+++ b/repo/system/gobject-introspection/musl-time64.patch
@@ -0,0 +1,37 @@
+--- a/giscanner/ast.py 2022-03-18 11:54:42.318927500 +0000
++++ b/giscanner/ast.py 2022-03-18 11:54:42.318927500 +0000
+@@ -346,7 +346,7 @@
+ type_names['ssize_t'] = type_names['gssize']
+ type_names['uintptr_t'] = type_names['guintptr']
+ type_names['intptr_t'] = type_names['gintptr']
+-type_names['time_t'] = TYPE_LONG
++type_names['time_t'] = TYPE_INT64
+ type_names['off_t'] = type_names['gsize']
+ type_names['pid_t'] = TYPE_INT
+ type_names['uid_t'] = TYPE_UINT
+--- a/tests/scanner/Regress-1.0-expected.gir 2022-03-18 11:54:42.318927500 +0000
++++ b/tests/scanner/Regress-1.0-expected.gir 2022-03-18 11:54:42.318927500 +0000
+@@ -2023,7 +2023,7 @@
+ <type name="FooObject" c:type="RegressFooObject*"/>
+ </instance-parameter>
+ <parameter name="time" transfer-ownership="none">
+- <type name="glong" c:type="time_t"/>
++ <type name="gint64" c:type="time_t"/>
+ </parameter>
+ </parameters>
+ </method>
+@@ -8569,7 +8569,7 @@
+ <function name="test_timet" c:identifier="regress_test_timet">
+ <source-position filename="regress.h" line="94"/>
+ <return-value transfer-ownership="none">
+- <type name="glong" c:type="time_t"/>
++ <type name="gint64" c:type="time_t"/>
+ </return-value>
+ <parameters>
+ <parameter name="in" transfer-ownership="none">
+@@ -8576,4 +8576,4 @@
+- <type name="glong" c:type="time_t"/>
++ <type name="gint64" c:type="time_t"/>
+ </parameter>
+ </parameters>
+ </function>
diff --git a/repo/system/gperf.xibuild b/repo/system/gperf/gperf.xibuild
index eebb471..eebb471 100644
--- a/repo/system/gperf.xibuild
+++ b/repo/system/gperf/gperf.xibuild
diff --git a/repo/system/grub.xibuild b/repo/system/grub/grub.xibuild
index 343c07e..343c07e 100644
--- a/repo/system/grub.xibuild
+++ b/repo/system/grub/grub.xibuild
diff --git a/repo/system/guile.xibuild b/repo/system/guile/guile.xibuild
index 5873f37..5873f37 100644
--- a/repo/system/guile.xibuild
+++ b/repo/system/guile/guile.xibuild
diff --git a/repo/system/gzip.xibuild b/repo/system/gzip/gzip.xibuild
index 8e3c78a..8e3c78a 100644
--- a/repo/system/gzip.xibuild
+++ b/repo/system/gzip/gzip.xibuild
diff --git a/repo/system/hwids.xibuild b/repo/system/hwids/hwids.xibuild
index 1cd6827..1cd6827 100644
--- a/repo/system/hwids.xibuild
+++ b/repo/system/hwids/hwids.xibuild
diff --git a/repo/system/iana-etc.xibuild b/repo/system/iana-etc/iana-etc.xibuild
index 812ed14..812ed14 100644
--- a/repo/system/iana-etc.xibuild
+++ b/repo/system/iana-etc/iana-etc.xibuild
diff --git a/repo/system/icu/fix-ucptrietest-golden-diff.patch b/repo/system/icu/fix-ucptrietest-golden-diff.patch
new file mode 100644
index 0000000..1b8082e
--- /dev/null
+++ b/repo/system/icu/fix-ucptrietest-golden-diff.patch
@@ -0,0 +1,33 @@
+Patch-Source: https://github.com/unicode-org/icu/pull/1925
+Subject: [PATCH] ICU-21793 Fix ucptrietest golden diff
+
+diff --git a/icu4c/source/tools/toolutil/toolutil.cpp b/icu4c/source/tools/toolutil/toolutil.cpp
+index 1fc68aa69c8..a9dc37377a8 100644
+--- a/tools/toolutil/toolutil.cpp
++++ b/tools/toolutil/toolutil.cpp
+@@ -228,18 +228,19 @@ uprv_compareGoldenFiles(
+ std::ifstream ifs(goldenFilePath, std::ifstream::in);
+ int32_t pos = 0;
+ char c;
+- while ((c = ifs.get()) != std::char_traits<char>::eof() && pos < bufferLen) {
++ while (ifs.get(c) && pos < bufferLen) {
+ if (c != buffer[pos]) {
+ // Files differ at this position
+- return pos;
++ break;
+ }
+ pos++;
+ }
+- if (pos < bufferLen || c != std::char_traits<char>::eof()) {
+- // Files are different lengths
+- return pos;
++ if (pos == bufferLen && ifs.eof()) {
++ // Files are same lengths
++ pos = -1;
+ }
+- return -1;
++ ifs.close();
++ return pos;
+ }
+
+ /*U_CAPI UDate U_EXPORT2
diff --git a/repo/system/icu.xibuild b/repo/system/icu/icu.xibuild
index 0d8d798..0d8d798 100644
--- a/repo/system/icu.xibuild
+++ b/repo/system/icu/icu.xibuild
diff --git a/repo/system/imlib2.xibuild b/repo/system/imlib2/imlib2.xibuild
index 9ed5b15..9ed5b15 100644
--- a/repo/system/imlib2.xibuild
+++ b/repo/system/imlib2/imlib2.xibuild
diff --git a/repo/system/intltool.xibuild b/repo/system/intltool/intltool.xibuild
index aee502e..aee502e 100644
--- a/repo/system/intltool.xibuild
+++ b/repo/system/intltool/intltool.xibuild
diff --git a/repo/system/jansson.xibuild b/repo/system/jansson/jansson.xibuild
index 9f82843..9f82843 100644
--- a/repo/system/jansson.xibuild
+++ b/repo/system/jansson/jansson.xibuild
diff --git a/repo/system/js78.xibuild b/repo/system/js78/js78.xibuild
index 199740a..199740a 100644
--- a/repo/system/js78.xibuild
+++ b/repo/system/js78/js78.xibuild
diff --git a/repo/system/js78/patches/disable-jslint.patch b/repo/system/js78/patches/disable-jslint.patch
new file mode 100644
index 0000000..04a8b3e
--- /dev/null
+++ b/repo/system/js78/patches/disable-jslint.patch
@@ -0,0 +1,17 @@
+--- a/js/src/build/moz.build
++++ b/js/src/build/moz.build
+@@ -80,14 +80,3 @@
+ NO_EXPAND_LIBS = True
+
+ DIST_INSTALL = True
+-
+-# Run SpiderMonkey style checker after linking the static library. This avoids
+-# running the script for no-op builds.
+-GeneratedFile(
+- 'spidermonkey_checks', script='/config/run_spidermonkey_checks.py',
+- inputs=[
+- '!%sjs_static.%s' % (CONFIG['LIB_PREFIX'], CONFIG['LIB_SUFFIX']),
+- '/config/check_spidermonkey_style.py',
+- '/config/check_macroassembler_style.py',
+- '/config/check_js_opcode.py'
+- ])
diff --git a/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch b/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
new file mode 100644
index 0000000..1af68d9
--- /dev/null
+++ b/repo/system/js78/patches/fd6847c9416f9eebde636e21d794d25d1be8791d.patch
@@ -0,0 +1,37 @@
+See https://bugzilla.mozilla.org/show_bug.cgi?id=1539739
+
+From fd6847c9416f9eebde636e21d794d25d1be8791d Mon Sep 17 00:00:00 2001
+From: Mike Hommey <mh@glandium.org>
+Date: Sat, 1 Jun 2019 09:06:01 +0900
+Subject: [PATCH] Bug 1526653 - Include struct definitions for user_vfp and
+ user_vfp_exc.
+
+---
+ js/src/wasm/WasmSignalHandlers.cpp | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/js/src/wasm/WasmSignalHandlers.cpp b/js/src/wasm/WasmSignalHandlers.cpp
+index 636537f8478..383c380f04c 100644
+--- a/js/src/wasm/WasmSignalHandlers.cpp
++++ b/js/src/wasm/WasmSignalHandlers.cpp
+@@ -248,7 +248,16 @@ using mozilla::DebugOnly;
+ #endif
+
+ #ifdef WASM_EMULATE_ARM_UNALIGNED_FP_ACCESS
+-# include <sys/user.h>
++struct user_vfp {
++ unsigned long long fpregs[32];
++ unsigned long fpscr;
++};
++
++struct user_vfp_exc {
++ unsigned long fpexc;
++ unsigned long fpinst;
++ unsigned long fpinst2;
++};
+ #endif
+
+ #if defined(ANDROID)
+--
+2.20.1
+
diff --git a/repo/system/js78/patches/fix-musl-build.patch b/repo/system/js78/patches/fix-musl-build.patch
new file mode 100644
index 0000000..af39467
--- /dev/null
+++ b/repo/system/js78/patches/fix-musl-build.patch
@@ -0,0 +1,16 @@
+Upstream: No
+Reason: mozjs60 miscompiles on musl if built with HAVE_THREAD_TLS_KEYWORD:
+https://github.com/void-linux/void-packages/issues/2598
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -1272,6 +1272,9 @@
+ *-android*|*-linuxandroid*)
+ :
+ ;;
++ *-musl*)
++ :
++ ;;
+ *)
+ AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
+ ;;
diff --git a/repo/system/js78/patches/fix-python3.10-compilation.patch b/repo/system/js78/patches/fix-python3.10-compilation.patch
new file mode 100644
index 0000000..4473d9b
--- /dev/null
+++ b/repo/system/js78/patches/fix-python3.10-compilation.patch
@@ -0,0 +1,312 @@
+#https://src.fedoraproject.org/rpms/mozjs78/blob/rawhide/f/Fixup-compatibility-of-mozbuild-with-Python-3.10.patch
+
+m a88d0c8e27b48344942187c2611bb121bde9332d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= <fzatlouk@redhat.com>
+Date: Tue, 13 Jul 2021 11:46:20 +0200
+Subject: [PATCH] Fixup compatibility of mozbuild with Python 3.10
+
+---
+ python/mach/mach/config.py | 4 ++--
+ python/mach/mach/main.py | 4 ++--
+ python/mach/mach/decorators.py | 2 +-
+ python/mozbuild/mozbuild/backend/configenvironment.py | 3 ++-
+ python/mozbuild/mozbuild/makeutil.py | 2 +-
+ python/mozbuild/mozbuild/util.py | 2 +-
+ testing/marionette/client/marionette_driver/wait.py | 2 +-
+ testing/mozbase/manifestparser/manifestparser/filters.py | 3 ++-
+ testing/mozbase/versioninfo.py | 2 +-
+ testing/web-platform/tests/tools/manifest/vcs.py | 2 +-
+ .../web-platform/tests/tools/third_party/h2/h2/settings.py | 2 +-
+ .../tests/tools/third_party/html5lib/html5lib/_trie/_base.py | 2 +-
+ .../tools/third_party/html5lib/html5lib/treebuilders/dom.py | 2 +-
+ .../tests/tools/third_party/hyper/hyper/common/headers.py | 2 +-
+ .../tests/tools/third_party/hyper/hyper/h2/settings.py | 2 +-
+ .../tests/tools/third_party/hyper/hyper/http11/connection.py | 4 ++--
+ .../third_party/hyper/hyper/packages/hyperframe/flags.py | 2 +-
+ .../tests/tools/third_party/hyperframe/hyperframe/flags.py | 2 +-
+ testing/web-platform/tests/tools/wptserve/wptserve/config.py | 3 ++-
+ testing/web-platform/tests/webdriver/tests/support/sync.py | 2 +-
+ 19 files changed, 24 insertions(+), 21 deletions(-)
+
+diff --git a/python/mach/mach/config.py b/python/mach/mach/config.py
+index 7210eca82..edb4d2e93 100644
+--- a/python/mach/mach/config.py
++++ b/python/mach/mach/config.py
+@@ -144,7 +144,7 @@ def reraise_attribute_error(func):
+ return _
+
+
+-class ConfigSettings(collections.Mapping):
++class ConfigSettings(collections.abc.Mapping):
+ """Interface for configuration settings.
+
+ This is the main interface to the configuration.
+@@ -190,7 +190,7 @@ class ConfigSettings(collections.Mapping):
+ will result in exceptions being raised.
+ """
+
+- class ConfigSection(collections.MutableMapping, object):
++ class ConfigSection(collections.abc.MutableMapping, object):
+ """Represents an individual config section."""
+ def __init__(self, config, name, settings):
+ object.__setattr__(self, '_config', config)
+diff --git a/python/mach/mach/decorators.py b/python/mach/mach/decorators.py
+index 27f7f34a6..5f63271a3 100644
+--- a/python/mach/mach/decorators.py
++++ b/python/mach/mach/decorators.py
+@@ -140,7 +140,7 @@ def CommandProvider(cls):
+ 'Conditions argument must take a list ' + \
+ 'of functions. Found %s instead.'
+
+- if not isinstance(command.conditions, collections.Iterable):
++ if not isinstance(command.conditions, collections.abc.Iterable):
+ msg = msg % (command.name, type(command.conditions))
+ raise MachError(msg)
+
+--- a/python/mach/mach/main.py
++++ b/python/mach/mach/main.py
+@@ -16,7 +16,7 @@
+ import sys
+ import traceback
+ import uuid
+-from collections import Iterable
++from collections.abc import Iterable
+
+ from six import string_types
+
+diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
+index 20d1a9fa6..8747958bd 100644
+--- a/python/mozbuild/mozbuild/backend/configenvironment.py
++++ b/python/mozbuild/mozbuild/backend/configenvironment.py
+@@ -9,7 +9,8 @@ import six
+ import sys
+ import json
+
+-from collections import Iterable, OrderedDict
++from collections import OrderedDict
++from collections.abc import Iterable
+ from types import ModuleType
+
+ import mozpack.path as mozpath
+diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
+index 4da1a3b26..4ce56848c 100644
+--- a/python/mozbuild/mozbuild/makeutil.py
++++ b/python/mozbuild/mozbuild/makeutil.py
+@@ -7,7 +7,7 @@ from __future__ import absolute_import, print_function, unicode_literals
+ import os
+ import re
+ import six
+-from collections import Iterable
++from collections.abc import Iterable
+
+
+ class Makefile(object):
+diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
+index 044cf645c..98ed3ef52 100644
+--- a/python/mozbuild/mozbuild/util.py
++++ b/python/mozbuild/mozbuild/util.py
+@@ -782,7 +782,7 @@ class HierarchicalStringList(object):
+ self._strings = StrictOrderingOnAppendList()
+ self._children = {}
+
+- class StringListAdaptor(collections.Sequence):
++ class StringListAdaptor(collections.abc.Sequence):
+ def __init__(self, hsl):
+ self._hsl = hsl
+
+diff --git a/testing/marionette/client/marionette_driver/wait.py b/testing/marionette/client/marionette_driver/wait.py
+index eeaa1e23d..c147f463f 100644
+--- a/testing/marionette/client/marionette_driver/wait.py
++++ b/testing/marionette/client/marionette_driver/wait.py
+@@ -82,7 +82,7 @@ class Wait(object):
+
+ exceptions = []
+ if ignored_exceptions is not None:
+- if isinstance(ignored_exceptions, collections.Iterable):
++ if isinstance(ignored_exceptions, collections.abc.Iterable):
+ exceptions.extend(iter(ignored_exceptions))
+ else:
+ exceptions.append(ignored_exceptions)
+diff --git a/testing/mozbase/manifestparser/manifestparser/filters.py b/testing/mozbase/manifestparser/manifestparser/filters.py
+index 287ee033b..b1d608003 100644
+--- a/testing/mozbase/manifestparser/manifestparser/filters.py
++++ b/testing/mozbase/manifestparser/manifestparser/filters.py
+@@ -12,7 +12,8 @@ from __future__ import absolute_import
+
+ import itertools
+ import os
+-from collections import defaultdict, MutableSequence
++from collections import defaultdict
++from collections.abc import MutableSequence
+
+ import six
+ from six import string_types
+diff --git a/testing/mozbase/versioninfo.py b/testing/mozbase/versioninfo.py
+index 91d1a0473..8c1680069 100755
+--- a/testing/mozbase/versioninfo.py
++++ b/testing/mozbase/versioninfo.py
+@@ -11,7 +11,7 @@ from commit messages.
+
+ from __future__ import absolute_import, print_function
+
+-from collections import Iterable
++from collections.abc import Iterable
+ from distutils.version import StrictVersion
+ import argparse
+ import os
+diff --git a/testing/web-platform/tests/tools/manifest/vcs.py b/testing/web-platform/tests/tools/manifest/vcs.py
+index 7c0feeb81..05ee19c7c 100644
+--- a/testing/web-platform/tests/tools/manifest/vcs.py
++++ b/testing/web-platform/tests/tools/manifest/vcs.py
+@@ -3,7 +3,7 @@ import json
+ import os
+ import stat
+ from collections import deque
+-from collections import MutableMapping
++from collections.abc import MutableMapping
+
+ from six import with_metaclass, PY2
+
+diff --git a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
+index 3da720329..e097630e9 100644
+--- a/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
++++ b/testing/web-platform/tests/tools/third_party/h2/h2/settings.py
+@@ -88,7 +88,7 @@ class ChangedSetting:
+ )
+
+
+-class Settings(collections.MutableMapping):
++class Settings(collections.abc.MutableMapping):
+ """
+ An object that encapsulates HTTP/2 settings state.
+
+diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
+index a1158bbbf..a9295a2ba 100644
+--- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
++++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/_trie/_base.py
+@@ -1,6 +1,6 @@
+ from __future__ import absolute_import, division, unicode_literals
+
+-from collections import Mapping
++from collections.abc import Mapping
+
+
+ class Trie(Mapping):
+diff --git a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
+index dcfac220b..818a33433 100644
+--- a/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
++++ b/testing/web-platform/tests/tools/third_party/html5lib/html5lib/treebuilders/dom.py
+@@ -1,7 +1,7 @@
+ from __future__ import absolute_import, division, unicode_literals
+
+
+-from collections import MutableMapping
++from collections.abc import MutableMapping
+ from xml.dom import minidom, Node
+ import weakref
+
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
+index 655a591ac..6454f550a 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/common/headers.py
+@@ -10,7 +10,7 @@ import collections
+ from hyper.common.util import to_bytestring, to_bytestring_tuple
+
+
+-class HTTPHeaderMap(collections.MutableMapping):
++class HTTPHeaderMap(collections.abc.MutableMapping):
+ """
+ A structure that contains HTTP headers.
+
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
+index fedc5e3c4..040afea92 100755
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/h2/settings.py
+@@ -151,7 +151,7 @@ class ChangedSetting:
+ )
+
+
+-class Settings(collections.MutableMapping):
++class Settings(collections.abc.MutableMapping):
+ """
+ An object that encapsulates HTTP/2 settings state.
+
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
+index 61361c358..a214311d2 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/http11/connection.py
+@@ -10,7 +10,7 @@ import os
+ import socket
+ import base64
+
+-from collections import Iterable, Mapping
++from collections.abc import Iterable, Mapping
+
+ import collections
+ from hyperframe.frame import SettingsFrame
+@@ -295,7 +295,7 @@ class HTTP11Connection(object):
+ return
+
+ # Iterables that set a specific content length.
+- elif isinstance(body, collections.Iterable):
++ elif isinstance(body, collections.abc.Iterable):
+ for item in body:
+ try:
+ self._sock.send(item)
+diff --git a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
+index e8f630056..8f2ea689b 100644
+--- a/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
++++ b/testing/web-platform/tests/tools/third_party/hyper/hyper/packages/hyperframe/flags.py
+@@ -11,7 +11,7 @@ import collections
+ Flag = collections.namedtuple("Flag", ["name", "bit"])
+
+
+-class Flags(collections.MutableSet):
++class Flags(collections.abc.MutableSet):
+ """
+ A simple MutableSet implementation that will only accept known flags as elements.
+
+diff --git a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
+index 05b35017e..14c352e10 100644
+--- a/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
++++ b/testing/web-platform/tests/tools/third_party/hyperframe/hyperframe/flags.py
+@@ -11,7 +11,7 @@ import collections
+ Flag = collections.namedtuple("Flag", ["name", "bit"])
+
+
+-class Flags(collections.MutableSet):
++class Flags(collections.abc.MutableSet):
+ """
+ A simple MutableSet implementation that will only accept known flags as
+ elements.
+diff --git a/testing/web-platform/tests/tools/wptserve/wptserve/config.py b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
+index 7766565fe..3c1c36d6f 100644
+--- a/testing/web-platform/tests/tools/wptserve/wptserve/config.py
++++ b/testing/web-platform/tests/tools/wptserve/wptserve/config.py
+@@ -2,7 +2,8 @@ import copy
+ import logging
+ import os
+
+-from collections import defaultdict, Mapping
++from collections import defaultdict
++from collections.abc import Mapping
+ from six import integer_types, iteritems, itervalues, string_types
+
+ from . import sslutils
+diff --git a/testing/web-platform/tests/webdriver/tests/support/sync.py b/testing/web-platform/tests/webdriver/tests/support/sync.py
+index 3fc77131c..8e8f6b819 100644
+--- a/testing/web-platform/tests/webdriver/tests/support/sync.py
++++ b/testing/web-platform/tests/webdriver/tests/support/sync.py
+@@ -81,7 +81,7 @@ class Poll(object):
+
+ exceptions = []
+ if ignored_exceptions is not None:
+- if isinstance(ignored_exceptions, collections.Iterable):
++ if isinstance(ignored_exceptions, collections.abc.Iterable):
+ exceptions.extend(iter(ignored_exceptions))
+ else:
+ exceptions.append(ignored_exceptions)
+--
+2.31.1
+
+
diff --git a/repo/system/js78/patches/fix-rust-target.patch b/repo/system/js78/patches/fix-rust-target.patch
new file mode 100644
index 0000000..f1a98df
--- /dev/null
+++ b/repo/system/js78/patches/fix-rust-target.patch
@@ -0,0 +1,15 @@
+Allow us to just set RUST_TARGEt ourselves instead of hacking around in mozilla's
+weird custom build system...
+
+diff -upr firefox-68.9.0.orig/build/moz.configure/rust.configure firefox-68.9.0/build/moz.configure/rust.configure
+--- firefox-68.9.0.orig/build/moz.configure/rust.configure 2020-06-02 22:54:39.982616128 +0200
++++ firefox-68.9.0/build/moz.configure/rust.configure 2020-06-02 23:08:37.656332899 +0200
+@@ -345,7 +345,7 @@ def rust_triple_alias(host_or_target):
+
+ return None
+
+- rustc_target = find_candidate(candidates)
++ rustc_target = os.environ['RUST_TARGET']
+
+ if rustc_target is None:
+ die("Don't know how to translate {} for rustc".format(
diff --git a/repo/system/json-c.xibuild b/repo/system/json-c/json-c.xibuild
index 339e62b..339e62b 100644
--- a/repo/system/json-c.xibuild
+++ b/repo/system/json-c/json-c.xibuild
diff --git a/repo/system/json-glib.xibuild b/repo/system/json-glib/json-glib.xibuild
index ce9f0b5..ce9f0b5 100644
--- a/repo/system/json-glib.xibuild
+++ b/repo/system/json-glib/json-glib.xibuild
diff --git a/repo/system/jsoncpp.xibuild b/repo/system/jsoncpp/jsoncpp.xibuild
index 01d3bb6..01d3bb6 100644
--- a/repo/system/jsoncpp.xibuild
+++ b/repo/system/jsoncpp/jsoncpp.xibuild
diff --git a/repo/system/kbd.xibuild b/repo/system/kbd/kbd.xibuild
index 9c48903..9c48903 100644
--- a/repo/system/kbd.xibuild
+++ b/repo/system/kbd/kbd.xibuild
diff --git a/repo/system/kmod.xibuild b/repo/system/kmod/kmod.xibuild
index 673036a..673036a 100644
--- a/repo/system/kmod.xibuild
+++ b/repo/system/kmod/kmod.xibuild
diff --git a/repo/system/krb5.xibuild b/repo/system/krb5/krb5.xibuild
index 4ed4ef7..4ed4ef7 100644
--- a/repo/system/krb5.xibuild
+++ b/repo/system/krb5/krb5.xibuild
diff --git a/repo/system/lcms2.xibuild b/repo/system/lcms2/lcms2.xibuild
index 3f9cdd3..3f9cdd3 100644
--- a/repo/system/lcms2.xibuild
+++ b/repo/system/lcms2/lcms2.xibuild
diff --git a/repo/system/ldns.xibuild b/repo/system/ldns/ldns.xibuild
index a835ee6..a835ee6 100644
--- a/repo/system/ldns.xibuild
+++ b/repo/system/ldns/ldns.xibuild
diff --git a/repo/system/libarchive.xibuild b/repo/system/libarchive/libarchive.xibuild
index c03c225..c03c225 100644
--- a/repo/system/libarchive.xibuild
+++ b/repo/system/libarchive/libarchive.xibuild
diff --git a/repo/system/libcap-ng.xibuild b/repo/system/libcap-ng/libcap-ng.xibuild
index a67ebbf..a67ebbf 100644
--- a/repo/system/libcap-ng.xibuild
+++ b/repo/system/libcap-ng/libcap-ng.xibuild
diff --git a/repo/system/libcap.xibuild b/repo/system/libcap/libcap.xibuild
index dab917e..dab917e 100644
--- a/repo/system/libcap.xibuild
+++ b/repo/system/libcap/libcap.xibuild
diff --git a/repo/system/libconfig.xibuild b/repo/system/libconfig/libconfig.xibuild
index b81a2bd..b81a2bd 100644
--- a/repo/system/libconfig.xibuild
+++ b/repo/system/libconfig/libconfig.xibuild
diff --git a/repo/system/libdwarf.xibuild b/repo/system/libdwarf/libdwarf.xibuild
index 66aec4f..66aec4f 100644
--- a/repo/system/libdwarf.xibuild
+++ b/repo/system/libdwarf/libdwarf.xibuild
diff --git a/repo/system/libedit.xibuild b/repo/system/libedit/libedit.xibuild
index b594d83..b594d83 100644
--- a/repo/system/libedit.xibuild
+++ b/repo/system/libedit/libedit.xibuild
diff --git a/repo/system/libelf.xibuild b/repo/system/libelf/libelf.xibuild
index 5ec93b0..5ec93b0 100644
--- a/repo/system/libelf.xibuild
+++ b/repo/system/libelf/libelf.xibuild
diff --git a/repo/system/libev/libev-4.11-Add-pkgconfig-support.patch b/repo/system/libev/libev-4.11-Add-pkgconfig-support.patch
new file mode 100644
index 0000000..8c478ca
--- /dev/null
+++ b/repo/system/libev/libev-4.11-Add-pkgconfig-support.patch
@@ -0,0 +1,58 @@
+From 01d2c386b58afa49567ccc079c963f76dc2e60f3 Mon Sep 17 00:00:00 2001
+From: Mathieu Bridon <bochecha@fedoraproject.org>
+Date: Fri, 8 Feb 2013 15:40:51 +0800
+Subject: [PATCH] Add pkgconfig support
+
+---
+ Makefile.am | 4 ++++
+ configure.ac | 2 +-
+ libev.pc.in | 11 +++++++++++
+ 3 files changed, 16 insertions(+), 1 deletion(-)
+ create mode 100644 libev.pc.in
+
+diff --git a/Makefile.am b/Makefile.am
+index 059305b..9e556c0 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -11,6 +11,10 @@ man_MANS = ev.3
+
+ include_HEADERS = ev.h ev++.h event.h
+
++pkgconfigdir = $(libdir)/pkgconfig
++
++pkgconfig_DATA = libev.pc
++
+ lib_LTLIBRARIES = libev.la
+
+ libev_la_SOURCES = ev.c event.c
+diff --git a/configure.ac b/configure.ac
+index 31d0a25..1af149a 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,5 +21,5 @@ AC_PROG_LIBTOOL
+
+ m4_include([libev.m4])
+
+-AC_CONFIG_FILES([Makefile])
++AC_CONFIG_FILES([Makefile libev.pc])
+ AC_OUTPUT
+diff --git a/libev.pc.in b/libev.pc.in
+new file mode 100644
+index 0000000..3b6c636
+--- /dev/null
++++ b/libev.pc.in
+@@ -0,0 +1,11 @@
++prefix=@prefix@
++exec_prefix=@prefix@
++libdir=@libdir@
++includedir=@includedir@
++
++Name: libev
++Description: High-performance event loop/event model
++Version: @VERSION@
++Libs: -L${libdir} -lev
++Libs.private:
++Cflags: -I${includedir}
+--
+1.8.1
+
diff --git a/repo/system/libev.xibuild b/repo/system/libev/libev.xibuild
index 6f43e9b..6f43e9b 100644
--- a/repo/system/libev.xibuild
+++ b/repo/system/libev/libev.xibuild
diff --git a/repo/system/libevent.xibuild b/repo/system/libevent/libevent.xibuild
index 84e2dd4..84e2dd4 100644
--- a/repo/system/libevent.xibuild
+++ b/repo/system/libevent/libevent.xibuild
diff --git a/repo/system/libexif.xibuild b/repo/system/libexif/libexif.xibuild
index 129c73a..129c73a 100644
--- a/repo/system/libexif.xibuild
+++ b/repo/system/libexif/libexif.xibuild
diff --git a/repo/system/libffi.xibuild b/repo/system/libffi/libffi.xibuild
index d802142..d802142 100644
--- a/repo/system/libffi.xibuild
+++ b/repo/system/libffi/libffi.xibuild
diff --git a/repo/system/libfm-extra.xibuild b/repo/system/libfm-extra/libfm-extra.xibuild
index 7cb00fa..7cb00fa 100644
--- a/repo/system/libfm-extra.xibuild
+++ b/repo/system/libfm-extra/libfm-extra.xibuild
diff --git a/repo/system/libfm.xibuild b/repo/system/libfm/libfm.xibuild
index 21661e5..21661e5 100644
--- a/repo/system/libfm.xibuild
+++ b/repo/system/libfm/libfm.xibuild
diff --git a/repo/system/libgcrypt.xibuild b/repo/system/libgcrypt/libgcrypt.xibuild
index 4c90552..4c90552 100644
--- a/repo/system/libgcrypt.xibuild
+++ b/repo/system/libgcrypt/libgcrypt.xibuild
diff --git a/repo/system/libgpg-error.xibuild b/repo/system/libgpg-error/libgpg-error.xibuild
index 7498665..7498665 100644
--- a/repo/system/libgpg-error.xibuild
+++ b/repo/system/libgpg-error/libgpg-error.xibuild
diff --git a/repo/system/libgudev.xibuild b/repo/system/libgudev/libgudev.xibuild
index a365c76..a365c76 100644
--- a/repo/system/libgudev.xibuild
+++ b/repo/system/libgudev/libgudev.xibuild
diff --git a/repo/system/libidn.xibuild b/repo/system/libidn/libidn.xibuild
index f592955..f592955 100644
--- a/repo/system/libidn.xibuild
+++ b/repo/system/libidn/libidn.xibuild
diff --git a/repo/system/libldap.xibuild b/repo/system/libldap/libldap.xibuild
index 5faf692..5faf692 100644
--- a/repo/system/libldap.xibuild
+++ b/repo/system/libldap/libldap.xibuild
diff --git a/repo/system/liblinear.xibuild b/repo/system/liblinear/liblinear.xibuild
index 7a20846..7a20846 100644
--- a/repo/system/liblinear.xibuild
+++ b/repo/system/liblinear/liblinear.xibuild
diff --git a/repo/system/libluv.xibuild b/repo/system/libluv/libluv.xibuild
index fabd348..fabd348 100644
--- a/repo/system/libluv.xibuild
+++ b/repo/system/libluv/libluv.xibuild
diff --git a/repo/system/libmbim.xibuild b/repo/system/libmbim/libmbim.xibuild
index 8fe1d88..8fe1d88 100644
--- a/repo/system/libmbim.xibuild
+++ b/repo/system/libmbim/libmbim.xibuild
diff --git a/repo/system/libmpack.xibuild b/repo/system/libmpack/libmpack.xibuild
index 3685876..3685876 100644
--- a/repo/system/libmpack.xibuild
+++ b/repo/system/libmpack/libmpack.xibuild
diff --git a/repo/system/libndp.xibuild b/repo/system/libndp/libndp.xibuild
index 8e061ef..8e061ef 100644
--- a/repo/system/libndp.xibuild
+++ b/repo/system/libndp/libndp.xibuild
diff --git a/repo/system/libnghttp.xibuild b/repo/system/libnghttp/libnghttp.xibuild
index 6f006dc..6f006dc 100644
--- a/repo/system/libnghttp.xibuild
+++ b/repo/system/libnghttp/libnghttp.xibuild
diff --git a/repo/system/libnl.xibuild b/repo/system/libnl/libnl.xibuild
index 7ea18ba..7ea18ba 100644
--- a/repo/system/libnl.xibuild
+++ b/repo/system/libnl/libnl.xibuild
diff --git a/repo/system/libnsl.xibuild b/repo/system/libnsl/libnsl.xibuild
index 051272b..051272b 100644
--- a/repo/system/libnsl.xibuild
+++ b/repo/system/libnsl/libnsl.xibuild
diff --git a/repo/system/libp11-kit.xibuild b/repo/system/libp11-kit/libp11-kit.xibuild
index 11d33be..11d33be 100644
--- a/repo/system/libp11-kit.xibuild
+++ b/repo/system/libp11-kit/libp11-kit.xibuild
diff --git a/repo/system/libpcap.xibuild b/repo/system/libpcap/libpcap.xibuild
index 27e56c5..27e56c5 100644
--- a/repo/system/libpcap.xibuild
+++ b/repo/system/libpcap/libpcap.xibuild
diff --git a/repo/system/libpipeline.xibuild b/repo/system/libpipeline/libpipeline.xibuild
index e7cac33..e7cac33 100644
--- a/repo/system/libpipeline.xibuild
+++ b/repo/system/libpipeline/libpipeline.xibuild
diff --git a/repo/system/libpng/libpng-1.6.37-apng.patch b/repo/system/libpng/libpng-1.6.37-apng.patch
new file mode 100644
index 0000000..8aaa50b
--- /dev/null
+++ b/repo/system/libpng/libpng-1.6.37-apng.patch
@@ -0,0 +1,1728 @@
+diff -Naru libpng-1.6.37.org/png.h libpng-1.6.37/png.h
+--- libpng-1.6.37.org/png.h 2019-04-19 07:21:37.398024800 +0900
++++ libpng-1.6.37/png.h 2019-04-19 07:22:37.871245630 +0900
+@@ -330,6 +330,10 @@
+ # include "pnglibconf.h"
+ #endif
+
++#define PNG_APNG_SUPPORTED
++#define PNG_READ_APNG_SUPPORTED
++#define PNG_WRITE_APNG_SUPPORTED
++
+ #ifndef PNG_VERSION_INFO_ONLY
+ /* Machine specific configuration. */
+ # include "pngconf.h"
+@@ -425,6 +429,17 @@
+ * See pngconf.h for base types that vary by machine/system
+ */
+
++#ifdef PNG_APNG_SUPPORTED
++/* dispose_op flags from inside fcTL */
++#define PNG_DISPOSE_OP_NONE 0x00U
++#define PNG_DISPOSE_OP_BACKGROUND 0x01U
++#define PNG_DISPOSE_OP_PREVIOUS 0x02U
++
++/* blend_op flags from inside fcTL */
++#define PNG_BLEND_OP_SOURCE 0x00U
++#define PNG_BLEND_OP_OVER 0x01U
++#endif /* PNG_APNG_SUPPORTED */
++
+ /* This triggers a compiler error in png.c, if png.c and png.h
+ * do not agree upon the version number.
+ */
+@@ -746,6 +761,10 @@
+ #define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
+ #define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
+ #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
++#ifdef PNG_APNG_SUPPORTED
++#define PNG_INFO_acTL 0x20000U
++#define PNG_INFO_fcTL 0x40000U
++#endif
+
+ /* This is used for the transformation routines, as some of them
+ * change these values for the row. It also should enable using
+@@ -783,6 +802,10 @@
+ #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+ typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
+ typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
++#ifdef PNG_APNG_SUPPORTED
++typedef PNG_CALLBACK(void, *png_progressive_frame_ptr, (png_structp,
++ png_uint_32));
++#endif
+
+ /* The following callback receives png_uint_32 row_number, int pass for the
+ * png_bytep data of the row. When transforming an interlaced image the
+@@ -3226,6 +3249,74 @@
+ /*******************************************************************************
+ * END OF HARDWARE AND SOFTWARE OPTIONS
+ ******************************************************************************/
++#ifdef PNG_APNG_SUPPORTED
++PNG_EXPORT(250, png_uint_32, png_get_acTL, (png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 *num_frames, png_uint_32 *num_plays));
++
++PNG_EXPORT(251, png_uint_32, png_set_acTL, (png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 num_frames, png_uint_32 num_plays));
++
++PNG_EXPORT(252, png_uint_32, png_get_num_frames, (png_structp png_ptr,
++ png_infop info_ptr));
++
++PNG_EXPORT(253, png_uint_32, png_get_num_plays, (png_structp png_ptr,
++ png_infop info_ptr));
++
++PNG_EXPORT(254, png_uint_32, png_get_next_frame_fcTL,
++ (png_structp png_ptr, png_infop info_ptr, png_uint_32 *width,
++ png_uint_32 *height, png_uint_32 *x_offset, png_uint_32 *y_offset,
++ png_uint_16 *delay_num, png_uint_16 *delay_den, png_byte *dispose_op,
++ png_byte *blend_op));
++
++PNG_EXPORT(255, png_uint_32, png_set_next_frame_fcTL,
++ (png_structp png_ptr, png_infop info_ptr, png_uint_32 width,
++ png_uint_32 height, png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op));
++
++PNG_EXPORT(256, png_uint_32, png_get_next_frame_width,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(257, png_uint_32, png_get_next_frame_height,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(258, png_uint_32, png_get_next_frame_x_offset,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(259, png_uint_32, png_get_next_frame_y_offset,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(260, png_uint_16, png_get_next_frame_delay_num,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(261, png_uint_16, png_get_next_frame_delay_den,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(262, png_byte, png_get_next_frame_dispose_op,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(263, png_byte, png_get_next_frame_blend_op,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(264, png_byte, png_get_first_frame_is_hidden,
++ (png_structp png_ptr, png_infop info_ptr));
++PNG_EXPORT(265, png_uint_32, png_set_first_frame_is_hidden,
++ (png_structp png_ptr, png_infop info_ptr, png_byte is_hidden));
++
++#ifdef PNG_READ_APNG_SUPPORTED
++PNG_EXPORT(266, void, png_read_frame_head, (png_structp png_ptr,
++ png_infop info_ptr));
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++PNG_EXPORT(267, void, png_set_progressive_frame_fn, (png_structp png_ptr,
++ png_progressive_frame_ptr frame_info_fn,
++ png_progressive_frame_ptr frame_end_fn));
++#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PNG_READ_APNG_SUPPORTED */
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++PNG_EXPORT(268, void, png_write_frame_head, (png_structp png_ptr,
++ png_infop info_ptr, png_bytepp row_pointers,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op));
++
++PNG_EXPORT(269, void, png_write_frame_tail, (png_structp png_ptr,
++ png_infop info_ptr));
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++#endif /* PNG_APNG_SUPPORTED */
+
+ /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
+ * defs, and in scripts/symbols.def.
+@@ -3235,7 +3326,11 @@
+ * one to use is one more than this.)
+ */
+ #ifdef PNG_EXPORT_LAST_ORDINAL
++#ifdef PNG_APNG_SUPPORTED
++ PNG_EXPORT_LAST_ORDINAL(269);
++#else
+ PNG_EXPORT_LAST_ORDINAL(249);
++#endif /* PNG_APNG_SUPPORTED */
+ #endif
+
+ #ifdef __cplusplus
+diff -Naru libpng-1.6.37.org/pngget.c libpng-1.6.37/pngget.c
+--- libpng-1.6.37.org/pngget.c 2019-04-19 07:21:37.399024787 +0900
++++ libpng-1.6.37/pngget.c 2019-04-19 07:22:37.850245901 +0900
+@@ -1246,4 +1246,166 @@
+ # endif
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++png_uint_32 PNGAPI
++png_get_acTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 *num_frames, png_uint_32 *num_plays)
++{
++ png_debug1(1, "in %s retrieval function", "acTL");
++
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_acTL) &&
++ num_frames != NULL && num_plays != NULL)
++ {
++ *num_frames = info_ptr->num_frames;
++ *num_plays = info_ptr->num_plays;
++ return (1);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_num_frames()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->num_frames);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_num_plays()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->num_plays);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 *width, png_uint_32 *height,
++ png_uint_32 *x_offset, png_uint_32 *y_offset,
++ png_uint_16 *delay_num, png_uint_16 *delay_den,
++ png_byte *dispose_op, png_byte *blend_op)
++{
++ png_debug1(1, "in %s retrieval function", "fcTL");
++
++ if (png_ptr != NULL && info_ptr != NULL &&
++ (info_ptr->valid & PNG_INFO_fcTL) &&
++ width != NULL && height != NULL &&
++ x_offset != NULL && y_offset != NULL &&
++ delay_num != NULL && delay_den != NULL &&
++ dispose_op != NULL && blend_op != NULL)
++ {
++ *width = info_ptr->next_frame_width;
++ *height = info_ptr->next_frame_height;
++ *x_offset = info_ptr->next_frame_x_offset;
++ *y_offset = info_ptr->next_frame_y_offset;
++ *delay_num = info_ptr->next_frame_delay_num;
++ *delay_den = info_ptr->next_frame_delay_den;
++ *dispose_op = info_ptr->next_frame_dispose_op;
++ *blend_op = info_ptr->next_frame_blend_op;
++ return (1);
++ }
++
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_width()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_width);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_height()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_height);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_x_offset()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_x_offset);
++ return (0);
++}
++
++png_uint_32 PNGAPI
++png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_y_offset()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_y_offset);
++ return (0);
++}
++
++png_uint_16 PNGAPI
++png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_delay_num()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_delay_num);
++ return (0);
++}
++
++png_uint_16 PNGAPI
++png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_delay_den()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_delay_den);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_dispose_op()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_dispose_op);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_get_next_frame_blend_op()");
++
++ if (png_ptr != NULL && info_ptr != NULL)
++ return (info_ptr->next_frame_blend_op);
++ return (0);
++}
++
++png_byte PNGAPI
++png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_first_frame_is_hidden()");
++
++ if (png_ptr != NULL)
++ return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
++
++ PNG_UNUSED(info_ptr)
++
++ return 0;
++}
++#endif /* PNG_APNG_SUPPORTED */
+ #endif /* READ || WRITE */
+diff -Naru libpng-1.6.37.org/pnginfo.h libpng-1.6.37/pnginfo.h
+--- libpng-1.6.37.org/pnginfo.h 2019-04-19 07:21:37.399024787 +0900
++++ libpng-1.6.37/pnginfo.h 2019-04-19 07:22:37.850245901 +0900
+@@ -263,5 +263,18 @@
+ png_bytepp row_pointers; /* the image bits */
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++ png_uint_32 num_frames; /* including default image */
++ png_uint_32 num_plays;
++ png_uint_32 next_frame_width;
++ png_uint_32 next_frame_height;
++ png_uint_32 next_frame_x_offset;
++ png_uint_32 next_frame_y_offset;
++ png_uint_16 next_frame_delay_num;
++ png_uint_16 next_frame_delay_den;
++ png_byte next_frame_dispose_op;
++ png_byte next_frame_blend_op;
++#endif
++
+ };
+ #endif /* PNGINFO_H */
+diff -Naru libpng-1.6.37.org/pngpread.c libpng-1.6.37/pngpread.c
+--- libpng-1.6.37.org/pngpread.c 2019-04-19 07:21:37.399024787 +0900
++++ libpng-1.6.37/pngpread.c 2019-04-19 07:22:37.850245901 +0900
+@@ -195,6 +195,106 @@
+
+ chunk_name = png_ptr->chunk_name;
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->num_frames_read > 0 &&
++ png_ptr->num_frames_read < info_ptr->num_frames)
++ {
++ if (chunk_name == png_IDAT)
++ {
++ /* Discard trailing IDATs for the first frame */
++ if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
++ png_error(png_ptr, "out of place IDAT");
++
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++ else if (chunk_name == png_fdAT)
++ {
++ if (png_ptr->buffer_size < 4)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_ensure_sequence_number(png_ptr, 4);
++
++ if (!(png_ptr->mode & PNG_HAVE_fcTL))
++ {
++ /* Discard trailing fdATs for frames other than the first */
++ if (png_ptr->num_frames_read < 2)
++ png_error(png_ptr, "out of place fdAT");
++
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++
++ else
++ {
++ /* frame data follows */
++ png_ptr->idat_size = png_ptr->push_length - 4;
++ png_ptr->mode |= PNG_HAVE_IDAT;
++ png_ptr->process_mode = PNG_READ_IDAT_MODE;
++
++ return;
++ }
++ }
++
++ else if (chunk_name == png_fcTL)
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_read_reset(png_ptr);
++ png_ptr->mode &= ~PNG_HAVE_fcTL;
++
++ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
++
++ if (!(png_ptr->mode & PNG_HAVE_fcTL))
++ png_error(png_ptr, "missing required fcTL chunk");
++
++ png_read_reinit(png_ptr, info_ptr);
++ png_progressive_read_reset(png_ptr);
++
++ if (png_ptr->frame_info_fn != NULL)
++ (*(png_ptr->frame_info_fn))(png_ptr, png_ptr->num_frames_read);
++
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++
++ return;
++ }
++
++ else
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++
++ return;
++ }
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ if (chunk_name == png_IDAT)
+ {
+ if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
+@@ -261,6 +361,9 @@
+
+ else if (chunk_name == png_IDAT)
+ {
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_have_info(png_ptr, info_ptr);
++#endif
+ png_ptr->idat_size = png_ptr->push_length;
+ png_ptr->process_mode = PNG_READ_IDAT_MODE;
+ png_push_have_info(png_ptr, info_ptr);
+@@ -406,6 +509,30 @@
+ png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
+ }
+ #endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ else if (chunk_name == png_acTL)
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_handle_acTL(png_ptr, info_ptr, png_ptr->push_length);
++ }
++
++ else if (chunk_name == png_fcTL)
++ {
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++
++ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
++ }
++
++#endif /* PNG_READ_APNG_SUPPORTED */
+
+ else
+ {
+@@ -539,7 +666,11 @@
+ png_byte chunk_tag[4];
+
+ /* TODO: this code can be commoned up with the same code in push_read */
++#ifdef PNG_READ_APNG_SUPPORTED
++ PNG_PUSH_SAVE_BUFFER_IF_LT(12)
++#else
+ PNG_PUSH_SAVE_BUFFER_IF_LT(8)
++#endif
+ png_push_fill_buffer(png_ptr, chunk_length, 4);
+ png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
+ png_reset_crc(png_ptr);
+@@ -547,17 +678,64 @@
+ png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
+ png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
++ {
++ if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
++ {
++ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
++ if (png_ptr->frame_end_fn != NULL)
++ (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
++ png_ptr->num_frames_read++;
++ return;
++ }
++ else
++ {
++ if (png_ptr->chunk_name == png_IEND)
++ png_error(png_ptr, "Not enough image data");
++ if (png_ptr->push_length + 4 > png_ptr->buffer_size)
++ {
++ png_push_save_buffer(png_ptr);
++ return;
++ }
++ png_warning(png_ptr, "Skipping (ignoring) a chunk between "
++ "APNG chunks");
++ png_crc_finish(png_ptr, png_ptr->push_length);
++ png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
++ return;
++ }
++ }
++ else
++#endif
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->chunk_name != png_IDAT && png_ptr->num_frames_read == 0)
++#else
+ if (png_ptr->chunk_name != png_IDAT)
++#endif
+ {
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+
+ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
+ png_error(png_ptr, "Not enough compressed data");
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->frame_end_fn != NULL)
++ (*(png_ptr->frame_end_fn))(png_ptr, png_ptr->num_frames_read);
++ png_ptr->num_frames_read++;
++#endif
++
+ return;
+ }
+
+ png_ptr->idat_size = png_ptr->push_length;
++
++#ifdef PNG_READ_APNG_SUPPORTED
++ if (png_ptr->num_frames_read > 0)
++ {
++ png_ensure_sequence_number(png_ptr, 4);
++ png_ptr->idat_size -= 4;
++ }
++#endif
+ }
+
+ if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
+@@ -631,6 +809,15 @@
+ if (!(buffer_length > 0) || buffer == NULL)
+ png_error(png_ptr, "No IDAT data (internal error)");
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ /* If the app is not APNG-aware, decode only the first frame */
++ if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
++ {
++ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++ return;
++ }
++#endif
++
+ /* This routine must process all the data it has been given
+ * before returning, calling the row callback as required to
+ * handle the uncompressed results.
+@@ -1085,6 +1272,18 @@
+ png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
+ }
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void PNGAPI
++png_set_progressive_frame_fn(png_structp png_ptr,
++ png_progressive_frame_ptr frame_info_fn,
++ png_progressive_frame_ptr frame_end_fn)
++{
++ png_ptr->frame_info_fn = frame_info_fn;
++ png_ptr->frame_end_fn = frame_end_fn;
++ png_ptr->apng_flags |= PNG_APNG_APP;
++}
++#endif
++
+ png_voidp PNGAPI
+ png_get_progressive_ptr(png_const_structrp png_ptr)
+ {
+diff -Naru libpng-1.6.37.org/pngpriv.h libpng-1.6.37/pngpriv.h
+--- libpng-1.6.37.org/pngpriv.h 2019-04-19 07:21:37.399024787 +0900
++++ libpng-1.6.37/pngpriv.h 2019-04-19 07:22:37.850245901 +0900
+@@ -637,6 +637,10 @@
+ #define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U /* Have another chunk after IDAT */
+ /* 0x4000U (unused) */
+ #define PNG_IS_READ_STRUCT 0x8000U /* Else is a write struct */
++#ifdef PNG_APNG_SUPPORTED
++#define PNG_HAVE_acTL 0x10000U
++#define PNG_HAVE_fcTL 0x20000U
++#endif
+
+ /* Flags for the transformations the PNG library does on the image data */
+ #define PNG_BGR 0x0001U
+@@ -873,6 +877,16 @@
+ #define png_tRNS PNG_U32(116, 82, 78, 83)
+ #define png_zTXt PNG_U32(122, 84, 88, 116)
+
++#ifdef PNG_APNG_SUPPORTED
++#define png_acTL PNG_U32( 97, 99, 84, 76)
++#define png_fcTL PNG_U32(102, 99, 84, 76)
++#define png_fdAT PNG_U32(102, 100, 65, 84)
++
++/* For png_struct.apng_flags: */
++#define PNG_FIRST_FRAME_HIDDEN 0x0001U
++#define PNG_APNG_APP 0x0002U
++#endif
++
+ /* The following will work on (signed char*) strings, whereas the get_uint_32
+ * macro will fail on top-bit-set values because of the sign extension.
+ */
+@@ -1644,6 +1658,47 @@
+ */
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op), PNG_EMPTY);
++
++#ifdef PNG_READ_APNG_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_handle_acTL,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_fcTL,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_handle_fdAT,(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_have_info,(png_structp png_ptr, png_infop info_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_ensure_sequence_number,(png_structp png_ptr,
++ png_uint_32 length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_reset,(png_structp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
++ png_infop info_ptr),PNG_EMPTY);
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),PNG_EMPTY);
++#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PNG_READ_APNG_SUPPORTED */
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_fcTL,(png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
++ png_const_bytep data, png_size_t length),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
++ png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++#endif /* PNG_APNG_SUPPORTED */
++
+ /* Added at libpng version 1.4.0 */
+ #ifdef PNG_COLORSPACE_SUPPORTED
+ /* These internal functions are for maintaining the colorspace structure within
+diff -Naru libpng-1.6.37.org/pngread.c libpng-1.6.37/pngread.c
+--- libpng-1.6.37.org/pngread.c 2019-04-19 07:21:37.400024774 +0900
++++ libpng-1.6.37/pngread.c 2019-04-19 07:22:37.851245887 +0900
+@@ -161,6 +161,9 @@
+
+ else if (chunk_name == png_IDAT)
+ {
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_have_info(png_ptr, info_ptr);
++#endif
+ png_ptr->idat_size = length;
+ break;
+ }
+@@ -255,6 +258,17 @@
+ png_handle_iTXt(png_ptr, info_ptr, length);
+ #endif
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ else if (chunk_name == png_acTL)
++ png_handle_acTL(png_ptr, info_ptr, length);
++
++ else if (chunk_name == png_fcTL)
++ png_handle_fcTL(png_ptr, info_ptr, length);
++
++ else if (chunk_name == png_fdAT)
++ png_handle_fdAT(png_ptr, info_ptr, length);
++#endif
++
+ else
+ png_handle_unknown(png_ptr, info_ptr, length,
+ PNG_HANDLE_CHUNK_AS_DEFAULT);
+@@ -262,6 +276,72 @@
+ }
+ #endif /* SEQUENTIAL_READ */
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void PNGAPI
++png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
++{
++ png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
++
++ png_debug(0, "Reading frame head");
++
++ if (!(png_ptr->mode & PNG_HAVE_acTL))
++ png_error(png_ptr, "attempt to png_read_frame_head() but "
++ "no acTL present");
++
++ /* do nothing for the main IDAT */
++ if (png_ptr->num_frames_read == 0)
++ return;
++
++ png_read_reset(png_ptr);
++ png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
++ png_ptr->mode &= ~PNG_HAVE_fcTL;
++
++ have_chunk_after_DAT = 0;
++ for (;;)
++ {
++ png_uint_32 length = png_read_chunk_header(png_ptr);
++
++ if (png_ptr->chunk_name == png_IDAT)
++ {
++ /* discard trailing IDATs for the first frame */
++ if (have_chunk_after_DAT || png_ptr->num_frames_read > 1)
++ png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
++ png_crc_finish(png_ptr, length);
++ }
++
++ else if (png_ptr->chunk_name == png_fcTL)
++ {
++ png_handle_fcTL(png_ptr, info_ptr, length);
++ have_chunk_after_DAT = 1;
++ }
++
++ else if (png_ptr->chunk_name == png_fdAT)
++ {
++ png_ensure_sequence_number(png_ptr, length);
++
++ /* discard trailing fdATs for frames other than the first */
++ if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1)
++ png_crc_finish(png_ptr, length - 4);
++ else if(png_ptr->mode & PNG_HAVE_fcTL)
++ {
++ png_ptr->idat_size = length - 4;
++ png_ptr->mode |= PNG_HAVE_IDAT;
++
++ break;
++ }
++ else
++ png_error(png_ptr, "png_read_frame_head(): out of place fdAT");
++ }
++ else
++ {
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ png_crc_finish(png_ptr, length);
++ }
++ }
++}
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ /* Optional call to update the users info_ptr structure */
+ void PNGAPI
+ png_read_update_info(png_structrp png_ptr, png_inforp info_ptr)
+diff -Naru libpng-1.6.37.org/pngrutil.c libpng-1.6.37/pngrutil.c
+--- libpng-1.6.37.org/pngrutil.c 2019-04-19 07:21:37.401024761 +0900
++++ libpng-1.6.37/pngrutil.c 2019-04-19 07:22:37.853245862 +0900
+@@ -865,6 +865,11 @@
+ filter_type = buf[11];
+ interlace_type = buf[12];
+
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_ptr->first_frame_width = width;
++ png_ptr->first_frame_height = height;
++#endif
++
+ /* Set internal variables */
+ png_ptr->width = width;
+ png_ptr->height = height;
+@@ -2857,6 +2862,179 @@
+ }
+ #endif
+
++#ifdef PNG_READ_APNG_SUPPORTED
++void /* PRIVATE */
++png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_byte data[8];
++ png_uint_32 num_frames;
++ png_uint_32 num_plays;
++ png_uint_32 didSet;
++
++ png_debug(1, "in png_handle_acTL");
++
++ if (!(png_ptr->mode & PNG_HAVE_IHDR))
++ {
++ png_error(png_ptr, "Missing IHDR before acTL");
++ }
++ else if (png_ptr->mode & PNG_HAVE_IDAT)
++ {
++ png_warning(png_ptr, "Invalid acTL after IDAT skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++ else if (png_ptr->mode & PNG_HAVE_acTL)
++ {
++ png_warning(png_ptr, "Duplicate acTL skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++ else if (length != 8)
++ {
++ png_warning(png_ptr, "acTL with invalid length skipped");
++ png_crc_finish(png_ptr, length);
++ return;
++ }
++
++ png_crc_read(png_ptr, data, 8);
++ png_crc_finish(png_ptr, 0);
++
++ num_frames = png_get_uint_31(png_ptr, data);
++ num_plays = png_get_uint_31(png_ptr, data + 4);
++
++ /* the set function will do error checking on num_frames */
++ didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays);
++ if(didSet)
++ png_ptr->mode |= PNG_HAVE_acTL;
++}
++
++void /* PRIVATE */
++png_handle_fcTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_byte data[22];
++ png_uint_32 width;
++ png_uint_32 height;
++ png_uint_32 x_offset;
++ png_uint_32 y_offset;
++ png_uint_16 delay_num;
++ png_uint_16 delay_den;
++ png_byte dispose_op;
++ png_byte blend_op;
++
++ png_debug(1, "in png_handle_fcTL");
++
++ png_ensure_sequence_number(png_ptr, length);
++
++ if (!(png_ptr->mode & PNG_HAVE_IHDR))
++ {
++ png_error(png_ptr, "Missing IHDR before fcTL");
++ }
++ else if (png_ptr->mode & PNG_HAVE_IDAT)
++ {
++ /* for any frames other then the first this message may be misleading,
++ * but correct. PNG_HAVE_IDAT is unset before the frame head is read
++ * i can't think of a better message */
++ png_warning(png_ptr, "Invalid fcTL after IDAT skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++ else if (png_ptr->mode & PNG_HAVE_fcTL)
++ {
++ png_warning(png_ptr, "Duplicate fcTL within one frame skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++ else if (length != 26)
++ {
++ png_warning(png_ptr, "fcTL with invalid length skipped");
++ png_crc_finish(png_ptr, length-4);
++ return;
++ }
++
++ png_crc_read(png_ptr, data, 22);
++ png_crc_finish(png_ptr, 0);
++
++ width = png_get_uint_31(png_ptr, data);
++ height = png_get_uint_31(png_ptr, data + 4);
++ x_offset = png_get_uint_31(png_ptr, data + 8);
++ y_offset = png_get_uint_31(png_ptr, data + 12);
++ delay_num = png_get_uint_16(data + 16);
++ delay_den = png_get_uint_16(data + 18);
++ dispose_op = data[20];
++ blend_op = data[21];
++
++ if (png_ptr->num_frames_read == 0 && (x_offset != 0 || y_offset != 0))
++ {
++ png_warning(png_ptr, "fcTL for the first frame must have zero offset");
++ return;
++ }
++
++ if (info_ptr != NULL)
++ {
++ if (png_ptr->num_frames_read == 0 &&
++ (width != info_ptr->width || height != info_ptr->height))
++ {
++ png_warning(png_ptr, "size in first frame's fcTL must match "
++ "the size in IHDR");
++ return;
++ }
++
++ /* The set function will do more error checking */
++ png_set_next_frame_fcTL(png_ptr, info_ptr, width, height,
++ x_offset, y_offset, delay_num, delay_den,
++ dispose_op, blend_op);
++
++ png_read_reinit(png_ptr, info_ptr);
++
++ png_ptr->mode |= PNG_HAVE_fcTL;
++ }
++}
++
++void /* PRIVATE */
++png_have_info(png_structp png_ptr, png_infop info_ptr)
++{
++ if((info_ptr->valid & PNG_INFO_acTL) && !(info_ptr->valid & PNG_INFO_fcTL))
++ {
++ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
++ info_ptr->num_frames++;
++ }
++}
++
++void /* PRIVATE */
++png_handle_fdAT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
++{
++ png_ensure_sequence_number(png_ptr, length);
++
++ /* This function is only called from png_read_end(), png_read_info(),
++ * and png_push_read_chunk() which means that:
++ * - the user doesn't want to read this frame
++ * - or this is an out-of-place fdAT
++ * in either case it is safe to ignore the chunk with a warning */
++ png_warning(png_ptr, "ignoring fdAT chunk");
++ png_crc_finish(png_ptr, length - 4);
++ PNG_UNUSED(info_ptr)
++}
++
++void /* PRIVATE */
++png_ensure_sequence_number(png_structp png_ptr, png_uint_32 length)
++{
++ png_byte data[4];
++ png_uint_32 sequence_number;
++
++ if (length < 4)
++ png_error(png_ptr, "invalid fcTL or fdAT chunk found");
++
++ png_crc_read(png_ptr, data, 4);
++ sequence_number = png_get_uint_31(png_ptr, data);
++
++ if (sequence_number != png_ptr->next_seq_num)
++ png_error(png_ptr, "fcTL or fdAT chunk with out-of-order sequence "
++ "number found");
++
++ png_ptr->next_seq_num++;
++}
++#endif /* PNG_READ_APNG_SUPPORTED */
++
+ #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+ /* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
+ static int
+@@ -4165,7 +4343,38 @@
+ {
+ uInt avail_in;
+ png_bytep buffer;
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_uint_32 bytes_to_skip = 0;
++
++ while (png_ptr->idat_size == 0 || bytes_to_skip != 0)
++ {
++ png_crc_finish(png_ptr, bytes_to_skip);
++ bytes_to_skip = 0;
+
++ png_ptr->idat_size = png_read_chunk_header(png_ptr);
++ if (png_ptr->num_frames_read == 0)
++ {
++ if (png_ptr->chunk_name != png_IDAT)
++ png_error(png_ptr, "Not enough image data");
++ }
++ else
++ {
++ if (png_ptr->chunk_name == png_IEND)
++ png_error(png_ptr, "Not enough image data");
++ if (png_ptr->chunk_name != png_fdAT)
++ {
++ png_warning(png_ptr, "Skipped (ignored) a chunk "
++ "between APNG chunks");
++ bytes_to_skip = png_ptr->idat_size;
++ continue;
++ }
++
++ png_ensure_sequence_number(png_ptr, png_ptr->idat_size);
++
++ png_ptr->idat_size -= 4;
++ }
++ }
++#else
+ while (png_ptr->idat_size == 0)
+ {
+ png_crc_finish(png_ptr, 0);
+@@ -4177,7 +4386,7 @@
+ if (png_ptr->chunk_name != png_IDAT)
+ png_error(png_ptr, "Not enough image data");
+ }
+-
++#endif /* PNG_READ_APNG_SUPPORTED */
+ avail_in = png_ptr->IDAT_read_size;
+
+ if (avail_in > png_ptr->idat_size)
+@@ -4240,6 +4449,9 @@
+
+ png_ptr->mode |= PNG_AFTER_IDAT;
+ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_ptr->num_frames_read++;
++#endif
+
+ if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
+ png_chunk_benign_error(png_ptr, "Extra compressed data");
+@@ -4678,4 +4890,80 @@
+
+ png_ptr->flags |= PNG_FLAG_ROW_INIT;
+ }
++
++#ifdef PNG_READ_APNG_SUPPORTED
++/* This function is to be called after the main IDAT set has been read and
++ * before a new IDAT is read. It resets some parts of png_ptr
++ * to make them usable by the read functions again */
++void /* PRIVATE */
++png_read_reset(png_structp png_ptr)
++{
++ png_ptr->mode &= ~PNG_HAVE_IDAT;
++ png_ptr->mode &= ~PNG_AFTER_IDAT;
++ png_ptr->row_number = 0;
++ png_ptr->pass = 0;
++}
++
++void /* PRIVATE */
++png_read_reinit(png_structp png_ptr, png_infop info_ptr)
++{
++ png_ptr->width = info_ptr->next_frame_width;
++ png_ptr->height = info_ptr->next_frame_height;
++ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
++ png_ptr->info_rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,
++ png_ptr->width);
++ if (png_ptr->prev_row)
++ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
++}
++
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++/* same as png_read_reset() but for the progressive reader */
++void /* PRIVATE */
++png_progressive_read_reset(png_structp png_ptr)
++{
++#ifdef PNG_READ_INTERLACING_SUPPORTED
++ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
++
++ /* Start of interlace block */
++ const int png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
++
++ /* Offset to next interlace block */
++ const int png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
++
++ /* Start of interlace block in the y direction */
++ const int png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
++
++ /* Offset to next interlace block in the y direction */
++ const int png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
++
++ if (png_ptr->interlaced)
++ {
++ if (!(png_ptr->transformations & PNG_INTERLACE))
++ png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
++ png_pass_ystart[0]) / png_pass_yinc[0];
++ else
++ png_ptr->num_rows = png_ptr->height;
++
++ png_ptr->iwidth = (png_ptr->width +
++ png_pass_inc[png_ptr->pass] - 1 -
++ png_pass_start[png_ptr->pass]) /
++ png_pass_inc[png_ptr->pass];
++ }
++ else
++#endif /* PNG_READ_INTERLACING_SUPPORTED */
++ {
++ png_ptr->num_rows = png_ptr->height;
++ png_ptr->iwidth = png_ptr->width;
++ }
++ png_ptr->flags &= ~PNG_FLAG_ZSTREAM_ENDED;
++ if (inflateReset(&(png_ptr->zstream)) != Z_OK)
++ png_error(png_ptr, "inflateReset failed");
++ png_ptr->zstream.avail_in = 0;
++ png_ptr->zstream.next_in = 0;
++ png_ptr->zstream.next_out = png_ptr->row_buf;
++ png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
++ png_ptr->iwidth) + 1;
++}
++#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
++#endif /* PNG_READ_APNG_SUPPORTED */
+ #endif /* READ */
+diff -Naru libpng-1.6.37.org/pngset.c libpng-1.6.37/pngset.c
+--- libpng-1.6.37.org/pngset.c 2019-04-19 07:21:37.401024761 +0900
++++ libpng-1.6.37/pngset.c 2019-04-19 07:22:37.858245798 +0900
+@@ -288,6 +288,11 @@
+ info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
+
+ info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
++
++#ifdef PNG_APNG_SUPPORTED
++ /* for non-animated png. this may be overwritten from an acTL chunk later */
++ info_ptr->num_frames = 1;
++#endif
+ }
+
+ #ifdef PNG_oFFs_SUPPORTED
+@@ -1158,6 +1163,147 @@
+ }
+ #endif /* sPLT */
+
++#ifdef PNG_APNG_SUPPORTED
++png_uint_32 PNGAPI
++png_set_acTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays)
++{
++ png_debug1(1, "in %s storage function", "acTL");
++
++ if (png_ptr == NULL || info_ptr == NULL)
++ {
++ png_warning(png_ptr,
++ "Call to png_set_acTL() with NULL png_ptr "
++ "or info_ptr ignored");
++ return (0);
++ }
++ if (num_frames == 0)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_frames zero");
++ return (0);
++ }
++ if (num_frames > PNG_UINT_31_MAX)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_frames > 2^31-1");
++ return (0);
++ }
++ if (num_plays > PNG_UINT_31_MAX)
++ {
++ png_warning(png_ptr,
++ "Ignoring attempt to set acTL with num_plays "
++ "> 2^31-1");
++ return (0);
++ }
++
++ info_ptr->num_frames = num_frames;
++ info_ptr->num_plays = num_plays;
++
++ info_ptr->valid |= PNG_INFO_acTL;
++
++ return (1);
++}
++
++/* delay_num and delay_den can hold any 16-bit values including zero */
++png_uint_32 PNGAPI
++png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op)
++{
++ png_debug1(1, "in %s storage function", "fcTL");
++
++ if (png_ptr == NULL || info_ptr == NULL)
++ {
++ png_warning(png_ptr,
++ "Call to png_set_fcTL() with NULL png_ptr or info_ptr "
++ "ignored");
++ return (0);
++ }
++
++ png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++
++ if (blend_op == PNG_BLEND_OP_OVER)
++ {
++ if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) &&
++ !(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
++ {
++ png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
++ "and wasteful for opaque images, ignored");
++ blend_op = PNG_BLEND_OP_SOURCE;
++ }
++ }
++
++ info_ptr->next_frame_width = width;
++ info_ptr->next_frame_height = height;
++ info_ptr->next_frame_x_offset = x_offset;
++ info_ptr->next_frame_y_offset = y_offset;
++ info_ptr->next_frame_delay_num = delay_num;
++ info_ptr->next_frame_delay_den = delay_den;
++ info_ptr->next_frame_dispose_op = dispose_op;
++ info_ptr->next_frame_blend_op = blend_op;
++
++ info_ptr->valid |= PNG_INFO_fcTL;
++
++ return (1);
++}
++
++void /* PRIVATE */
++png_ensure_fcTL_is_valid(png_structp png_ptr,
++ png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den,
++ png_byte dispose_op, png_byte blend_op)
++{
++ if (width == 0 || width > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid width in fcTL (> 2^31-1)");
++ if (height == 0 || height > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid height in fcTL (> 2^31-1)");
++ if (x_offset > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid x_offset in fcTL (> 2^31-1)");
++ if (y_offset > PNG_UINT_31_MAX)
++ png_error(png_ptr, "invalid y_offset in fcTL (> 2^31-1)");
++ if (width + x_offset > png_ptr->first_frame_width ||
++ height + y_offset > png_ptr->first_frame_height)
++ png_error(png_ptr, "dimensions of a frame are greater than"
++ "the ones in IHDR");
++
++ if (dispose_op != PNG_DISPOSE_OP_NONE &&
++ dispose_op != PNG_DISPOSE_OP_BACKGROUND &&
++ dispose_op != PNG_DISPOSE_OP_PREVIOUS)
++ png_error(png_ptr, "invalid dispose_op in fcTL");
++
++ if (blend_op != PNG_BLEND_OP_SOURCE &&
++ blend_op != PNG_BLEND_OP_OVER)
++ png_error(png_ptr, "invalid blend_op in fcTL");
++
++ PNG_UNUSED(delay_num)
++ PNG_UNUSED(delay_den)
++}
++
++png_uint_32 PNGAPI
++png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
++ png_byte is_hidden)
++{
++ png_debug(1, "in png_first_frame_is_hidden()");
++
++ if (png_ptr == NULL)
++ return 0;
++
++ if (is_hidden)
++ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
++ else
++ png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
++
++ PNG_UNUSED(info_ptr)
++
++ return 1;
++}
++#endif /* PNG_APNG_SUPPORTED */
++
+ #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+ static png_byte
+ check_location(png_const_structrp png_ptr, int location)
+diff -Naru libpng-1.6.37.org/pngstruct.h libpng-1.6.37/pngstruct.h
+--- libpng-1.6.37.org/pngstruct.h 2019-04-19 07:21:37.401024761 +0900
++++ libpng-1.6.37/pngstruct.h 2019-04-19 07:22:37.854245849 +0900
+@@ -409,6 +409,27 @@
+ png_byte filter_type;
+ #endif
+
++#ifdef PNG_APNG_SUPPORTED
++ png_uint_32 apng_flags;
++ png_uint_32 next_seq_num; /* next fcTL/fdAT chunk sequence number */
++ png_uint_32 first_frame_width;
++ png_uint_32 first_frame_height;
++
++#ifdef PNG_READ_APNG_SUPPORTED
++ png_uint_32 num_frames_read; /* incremented after all image data of */
++ /* a frame is read */
++#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
++ png_progressive_frame_ptr frame_info_fn; /* frame info read callback */
++ png_progressive_frame_ptr frame_end_fn; /* frame data read callback */
++#endif
++#endif
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_uint_32 num_frames_to_write;
++ png_uint_32 num_frames_written;
++#endif
++#endif /* PNG_APNG_SUPPORTED */
++
+ /* New members added in libpng-1.2.0 */
+
+ /* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
+diff -Naru libpng-1.6.37.org/pngtest.c libpng-1.6.37/pngtest.c
+--- libpng-1.6.37.org/pngtest.c 2019-04-19 07:21:37.401024761 +0900
++++ libpng-1.6.37/pngtest.c 2019-04-19 07:22:37.854245849 +0900
+@@ -875,6 +875,10 @@
+ volatile int num_passes;
+ int pass;
+ int bit_depth, color_type;
++#ifdef PNG_APNG_SUPPORTED
++ png_uint_32 num_frames;
++ png_uint_32 num_plays;
++#endif
+
+ row_buf = NULL;
+ error_parameters.file_name = inname;
+@@ -1383,6 +1387,22 @@
+ }
+ }
+ #endif
++
++#ifdef PNG_APNG_SUPPORTED
++ if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_acTL))
++ {
++ if (png_get_acTL(read_ptr, read_info_ptr, &num_frames, &num_plays))
++ {
++ png_byte is_hidden;
++ pngtest_debug2("Handling acTL chunks (frames %ld, plays %ld)",
++ num_frames, num_plays);
++ png_set_acTL(write_ptr, write_info_ptr, num_frames, num_plays);
++ is_hidden = png_get_first_frame_is_hidden(read_ptr, read_info_ptr);
++ png_set_first_frame_is_hidden(write_ptr, write_info_ptr, is_hidden);
++ }
++ }
++#endif
++
+ #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
+ {
+ png_unknown_chunkp unknowns;
+@@ -1463,6 +1483,110 @@
+ t_misc += (t_stop - t_start);
+ t_start = t_stop;
+ #endif
++#ifdef PNG_APNG_SUPPORTED
++ if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_acTL))
++ {
++ png_uint_32 frame;
++ for (frame = 0; frame < num_frames; frame++)
++ {
++ png_uint_32 frame_width;
++ png_uint_32 frame_height;
++ png_uint_32 x_offset;
++ png_uint_32 y_offset;
++ png_uint_16 delay_num;
++ png_uint_16 delay_den;
++ png_byte dispose_op;
++ png_byte blend_op;
++ png_read_frame_head(read_ptr, read_info_ptr);
++ if (png_get_valid(read_ptr, read_info_ptr, PNG_INFO_fcTL))
++ {
++ png_get_next_frame_fcTL(read_ptr, read_info_ptr,
++ &frame_width, &frame_height,
++ &x_offset, &y_offset,
++ &delay_num, &delay_den,
++ &dispose_op, &blend_op);
++ }
++ else
++ {
++ frame_width = width;
++ frame_height = height;
++ x_offset = 0;
++ y_offset = 0;
++ delay_num = 1;
++ delay_den = 1;
++ dispose_op = PNG_DISPOSE_OP_NONE;
++ blend_op = PNG_BLEND_OP_SOURCE;
++ }
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_write_frame_head(write_ptr, write_info_ptr, (png_bytepp)&row_buf,
++ frame_width, frame_height,
++ x_offset, y_offset,
++ delay_num, delay_den,
++ dispose_op, blend_op);
++#endif
++ for (pass = 0; pass < num_passes; pass++)
++ {
++# ifdef calc_pass_height
++ png_uint_32 pass_height;
++
++ if (num_passes == 7) /* interlaced */
++ {
++ if (PNG_PASS_COLS(frame_width, pass) > 0)
++ pass_height = PNG_PASS_ROWS(frame_height, pass);
++
++ else
++ pass_height = 0;
++ }
++
++ else /* not interlaced */
++ pass_height = frame_height;
++# else
++# define pass_height frame_height
++# endif
++
++ pngtest_debug1("Writing row data for pass %d", pass);
++ for (y = 0; y < pass_height; y++)
++ {
++#ifndef SINGLE_ROWBUF_ALLOC
++ pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
++
++ row_buf = (png_bytep)png_malloc(read_ptr,
++ png_get_rowbytes(read_ptr, read_info_ptr));
++
++ pngtest_debug2("\t0x%08lx (%lu bytes)", (unsigned long)row_buf,
++ (unsigned long)png_get_rowbytes(read_ptr, read_info_ptr));
++
++#endif /* !SINGLE_ROWBUF_ALLOC */
++ png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
++
++#ifdef PNG_WRITE_SUPPORTED
++#ifdef PNGTEST_TIMING
++ t_stop = (float)clock();
++ t_decode += (t_stop - t_start);
++ t_start = t_stop;
++#endif
++ png_write_rows(write_ptr, (png_bytepp)&row_buf, 1);
++#ifdef PNGTEST_TIMING
++ t_stop = (float)clock();
++ t_encode += (t_stop - t_start);
++ t_start = t_stop;
++#endif
++#endif /* PNG_WRITE_SUPPORTED */
++
++#ifndef SINGLE_ROWBUF_ALLOC
++ pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
++ png_free(read_ptr, row_buf);
++ row_buf = NULL;
++#endif /* !SINGLE_ROWBUF_ALLOC */
++ }
++ }
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_write_frame_tail(write_ptr, write_info_ptr);
++#endif
++ }
++ }
++ else
++#endif
+ for (pass = 0; pass < num_passes; pass++)
+ {
+ # ifdef calc_pass_height
+diff -Naru libpng-1.6.37.org/pngwrite.c libpng-1.6.37/pngwrite.c
+--- libpng-1.6.37.org/pngwrite.c 2019-04-19 07:21:37.402024748 +0900
++++ libpng-1.6.37/pngwrite.c 2019-04-19 07:22:37.855245836 +0900
+@@ -128,6 +128,10 @@
+ * the application continues writing the PNG. So check the 'invalid'
+ * flag here too.
+ */
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ if (info_ptr->valid & PNG_INFO_acTL)
++ png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
++#endif
+ #ifdef PNG_GAMMA_SUPPORTED
+ # ifdef PNG_WRITE_gAMA_SUPPORTED
+ if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
+@@ -370,6 +374,11 @@
+ png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
+ #endif
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ if (png_ptr->num_frames_written != png_ptr->num_frames_to_write)
++ png_error(png_ptr, "Not enough frames written");
++#endif
++
+ /* See if user wants us to write information chunks */
+ if (info_ptr != NULL)
+ {
+@@ -1461,6 +1470,43 @@
+ }
+ #endif
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void PNGAPI
++png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
++ png_bytepp row_pointers, png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op)
++{
++ png_debug(1, "in png_write_frame_head");
++
++ /* there is a chance this has been set after png_write_info was called,
++ * so it would be set but not written. is there a way to be sure? */
++ if (!(info_ptr->valid & PNG_INFO_acTL))
++ png_error(png_ptr, "png_write_frame_head(): acTL not set");
++
++ png_write_reset(png_ptr);
++
++ png_write_reinit(png_ptr, info_ptr, width, height);
++
++ if ( !(png_ptr->num_frames_written == 0 &&
++ (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) )
++ png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++
++ PNG_UNUSED(row_pointers)
++}
++
++void PNGAPI
++png_write_frame_tail(png_structp png_ptr, png_infop info_ptr)
++{
++ png_debug(1, "in png_write_frame_tail");
++
++ png_ptr->num_frames_written++;
++
++ PNG_UNUSED(info_ptr)
++}
++#endif /* PNG_WRITE_APNG_SUPPORTED */
+
+ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
+ /* Initialize the write structure - general purpose utility. */
+diff -Naru libpng-1.6.37.org/pngwutil.c libpng-1.6.37/pngwutil.c
+--- libpng-1.6.37.org/pngwutil.c 2019-04-19 07:21:37.402024748 +0900
++++ libpng-1.6.37/pngwutil.c 2019-04-19 07:22:37.867245682 +0900
+@@ -821,6 +821,11 @@
+ /* Write the chunk */
+ png_write_complete_chunk(png_ptr, png_IHDR, buf, 13);
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ png_ptr->first_frame_width = width;
++ png_ptr->first_frame_height = height;
++#endif
++
+ if ((png_ptr->do_filter) == PNG_NO_FILTERS)
+ {
+ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
+@@ -1002,8 +1007,17 @@
+ optimize_cmf(data, png_image_size(png_ptr));
+ #endif
+
+- if (size > 0)
+- png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++ if (size > 0)
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ {
++ if (png_ptr->num_frames_written == 0)
++#endif
++ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ else
++ png_write_fdAT(png_ptr, data, size);
++ }
++#endif /* PNG_WRITE_APNG_SUPPORTED */
+ png_ptr->mode |= PNG_HAVE_IDAT;
+
+ png_ptr->zstream.next_out = data;
+@@ -1050,7 +1064,17 @@
+ #endif
+
+ if (size > 0)
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ {
++ if (png_ptr->num_frames_written == 0)
++#endif
+ png_write_complete_chunk(png_ptr, png_IDAT, data, size);
++#ifdef PNG_WRITE_APNG_SUPPORTED
++ else
++ png_write_fdAT(png_ptr, data, size);
++ }
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++
+ png_ptr->zstream.avail_out = 0;
+ png_ptr->zstream.next_out = NULL;
+ png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
+@@ -1885,6 +1909,82 @@
+ }
+ #endif
+
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void /* PRIVATE */
++png_write_acTL(png_structp png_ptr,
++ png_uint_32 num_frames, png_uint_32 num_plays)
++{
++ png_byte buf[8];
++
++ png_debug(1, "in png_write_acTL");
++
++ png_ptr->num_frames_to_write = num_frames;
++
++ if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN)
++ num_frames--;
++
++ png_save_uint_32(buf, num_frames);
++ png_save_uint_32(buf + 4, num_plays);
++
++ png_write_complete_chunk(png_ptr, png_acTL, buf, (png_size_t)8);
++}
++
++void /* PRIVATE */
++png_write_fcTL(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
++ png_uint_32 x_offset, png_uint_32 y_offset,
++ png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
++ png_byte blend_op)
++{
++ png_byte buf[26];
++
++ png_debug(1, "in png_write_fcTL");
++
++ if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0))
++ png_error(png_ptr, "x and/or y offset for the first frame aren't 0");
++ if (png_ptr->num_frames_written == 0 &&
++ (width != png_ptr->first_frame_width ||
++ height != png_ptr->first_frame_height))
++ png_error(png_ptr, "width and/or height in the first frame's fcTL "
++ "don't match the ones in IHDR");
++
++ /* more error checking */
++ png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
++ delay_num, delay_den, dispose_op, blend_op);
++
++ png_save_uint_32(buf, png_ptr->next_seq_num);
++ png_save_uint_32(buf + 4, width);
++ png_save_uint_32(buf + 8, height);
++ png_save_uint_32(buf + 12, x_offset);
++ png_save_uint_32(buf + 16, y_offset);
++ png_save_uint_16(buf + 20, delay_num);
++ png_save_uint_16(buf + 22, delay_den);
++ buf[24] = dispose_op;
++ buf[25] = blend_op;
++
++ png_write_complete_chunk(png_ptr, png_fcTL, buf, (png_size_t)26);
++
++ png_ptr->next_seq_num++;
++}
++
++void /* PRIVATE */
++png_write_fdAT(png_structp png_ptr,
++ png_const_bytep data, png_size_t length)
++{
++ png_byte buf[4];
++
++ png_write_chunk_header(png_ptr, png_fdAT, (png_uint_32)(4 + length));
++
++ png_save_uint_32(buf, png_ptr->next_seq_num);
++ png_write_chunk_data(png_ptr, buf, 4);
++
++ png_write_chunk_data(png_ptr, data, length);
++
++ png_write_chunk_end(png_ptr);
++
++ png_ptr->next_seq_num++;
++}
++#endif /* PNG_WRITE_APNG_SUPPORTED */
++
+ /* Initializes the row writing capability of libpng */
+ void /* PRIVATE */
+ png_write_start_row(png_structrp png_ptr)
+@@ -2778,4 +2878,39 @@
+ }
+ #endif /* WRITE_FLUSH */
+ }
++
++#ifdef PNG_WRITE_APNG_SUPPORTED
++void /* PRIVATE */
++png_write_reset(png_structp png_ptr)
++{
++ png_ptr->row_number = 0;
++ png_ptr->pass = 0;
++ png_ptr->mode &= ~PNG_HAVE_IDAT;
++}
++
++void /* PRIVATE */
++png_write_reinit(png_structp png_ptr, png_infop info_ptr,
++ png_uint_32 width, png_uint_32 height)
++{
++ if (png_ptr->num_frames_written == 0 &&
++ (width != png_ptr->first_frame_width ||
++ height != png_ptr->first_frame_height))
++ png_error(png_ptr, "width and/or height in the first frame's fcTL "
++ "don't match the ones in IHDR");
++ if (width > png_ptr->first_frame_width ||
++ height > png_ptr->first_frame_height)
++ png_error(png_ptr, "width and/or height for a frame greater than"
++ "the ones in IHDR");
++
++ png_set_IHDR(png_ptr, info_ptr, width, height,
++ info_ptr->bit_depth, info_ptr->color_type,
++ info_ptr->interlace_type, info_ptr->compression_type,
++ info_ptr->filter_type);
++
++ png_ptr->width = width;
++ png_ptr->height = height;
++ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
++ png_ptr->usr_width = png_ptr->width;
++}
++#endif /* PNG_WRITE_APNG_SUPPORTED */
+ #endif /* WRITE */
+diff -Naru libpng-1.6.37.org/scripts/symbols.def libpng-1.6.37/scripts/symbols.def
+--- libpng-1.6.37.org/scripts/symbols.def 2019-04-19 07:21:37.405024710 +0900
++++ libpng-1.6.37/scripts/symbols.def 2019-04-19 07:22:37.856245823 +0900
+@@ -253,3 +253,23 @@
+ png_set_eXIf @247
+ png_get_eXIf_1 @248
+ png_set_eXIf_1 @249
++ png_get_acTL @250
++ png_set_acTL @251
++ png_get_num_frames @252
++ png_get_num_plays @253
++ png_get_next_frame_fcTL @254
++ png_set_next_frame_fcTL @255
++ png_get_next_frame_width @256
++ png_get_next_frame_height @257
++ png_get_next_frame_x_offset @258
++ png_get_next_frame_y_offset @259
++ png_get_next_frame_delay_num @260
++ png_get_next_frame_delay_den @261
++ png_get_next_frame_dispose_op @262
++ png_get_next_frame_blend_op @263
++ png_get_first_frame_is_hidden @264
++ png_set_first_frame_is_hidden @265
++ png_read_frame_head @266
++ png_set_progressive_frame_fn @267
++ png_write_frame_head @268
++ png_write_frame_tail @269
diff --git a/repo/system/libpng.xibuild b/repo/system/libpng/libpng.xibuild
index e40077d..e40077d 100644
--- a/repo/system/libpng.xibuild
+++ b/repo/system/libpng/libpng.xibuild
diff --git a/repo/system/libpsl.xibuild b/repo/system/libpsl/libpsl.xibuild
index 1ac7a34..1ac7a34 100644
--- a/repo/system/libpsl.xibuild
+++ b/repo/system/libpsl/libpsl.xibuild
diff --git a/repo/system/libptytty.xibuild b/repo/system/libptytty/libptytty.xibuild
index bc36364..bc36364 100644
--- a/repo/system/libptytty.xibuild
+++ b/repo/system/libptytty/libptytty.xibuild
diff --git a/repo/system/libqmi.xibuild b/repo/system/libqmi/libqmi.xibuild
index 7439f1f..7439f1f 100644
--- a/repo/system/libqmi.xibuild
+++ b/repo/system/libqmi/libqmi.xibuild
diff --git a/repo/system/libqrtr.xibuild b/repo/system/libqrtr/libqrtr.xibuild
index 7c4de5a..7c4de5a 100644
--- a/repo/system/libqrtr.xibuild
+++ b/repo/system/libqrtr/libqrtr.xibuild
diff --git a/repo/system/libretls.xibuild b/repo/system/libretls/libretls.xibuild
index 97b31af..97b31af 100644
--- a/repo/system/libretls.xibuild
+++ b/repo/system/libretls/libretls.xibuild
diff --git a/repo/system/libretls/test_program.c b/repo/system/libretls/test_program.c
new file mode 100644
index 0000000..f8d7332
--- /dev/null
+++ b/repo/system/libretls/test_program.c
@@ -0,0 +1,11 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <tls.h>
+
+int
+main(int argc, const char *argv[])
+{
+ assert(tls_init() == 0);
+
+ return EXIT_SUCCESS;
+}
diff --git a/repo/system/libsasl.xibuild b/repo/system/libsasl/libsasl.xibuild
index 5c55e31..5c55e31 100644
--- a/repo/system/libsasl.xibuild
+++ b/repo/system/libsasl/libsasl.xibuild
diff --git a/repo/system/libseccomp.xibuild b/repo/system/libseccomp/libseccomp.xibuild
index 5e05d58..5e05d58 100644
--- a/repo/system/libseccomp.xibuild
+++ b/repo/system/libseccomp/libseccomp.xibuild
diff --git a/repo/system/libsigsegv.xibuild b/repo/system/libsigsegv/libsigsegv.xibuild
index 15fd491..15fd491 100644
--- a/repo/system/libsigsegv.xibuild
+++ b/repo/system/libsigsegv/libsigsegv.xibuild
diff --git a/repo/system/libssh2.xibuild b/repo/system/libssh2/libssh2.xibuild
index ebf8cdf..ebf8cdf 100644
--- a/repo/system/libssh2.xibuild
+++ b/repo/system/libssh2/libssh2.xibuild
diff --git a/repo/system/libtasn1.xibuild b/repo/system/libtasn1/libtasn1.xibuild
index a2394ed..a2394ed 100644
--- a/repo/system/libtasn1.xibuild
+++ b/repo/system/libtasn1/libtasn1.xibuild
diff --git a/repo/system/libtermkey.xibuild b/repo/system/libtermkey/libtermkey.xibuild
index b73a16e..b73a16e 100644
--- a/repo/system/libtermkey.xibuild
+++ b/repo/system/libtermkey/libtermkey.xibuild
diff --git a/repo/system/libtirpc.xibuild b/repo/system/libtirpc/libtirpc.xibuild
index ec4f3b9..ec4f3b9 100644
--- a/repo/system/libtirpc.xibuild
+++ b/repo/system/libtirpc/libtirpc.xibuild
diff --git a/repo/system/libtool.xibuild b/repo/system/libtool/libtool.xibuild
index c97257c..c97257c 100644
--- a/repo/system/libtool.xibuild
+++ b/repo/system/libtool/libtool.xibuild
diff --git a/repo/system/libunistring.xibuild b/repo/system/libunistring/libunistring.xibuild
index 286b0c8..286b0c8 100644
--- a/repo/system/libunistring.xibuild
+++ b/repo/system/libunistring/libunistring.xibuild
diff --git a/repo/system/libusb.xibuild b/repo/system/libusb/libusb.xibuild
index 324b100..324b100 100644
--- a/repo/system/libusb.xibuild
+++ b/repo/system/libusb/libusb.xibuild
diff --git a/repo/system/libuv.xibuild b/repo/system/libuv/libuv.xibuild
index 976b2b9..976b2b9 100644
--- a/repo/system/libuv.xibuild
+++ b/repo/system/libuv/libuv.xibuild
diff --git a/repo/system/libvterm.xibuild b/repo/system/libvterm/libvterm.xibuild
index d212ccc..d212ccc 100644
--- a/repo/system/libvterm.xibuild
+++ b/repo/system/libvterm/libvterm.xibuild
diff --git a/repo/system/libxcrypt.xibuild b/repo/system/libxcrypt/libxcrypt.xibuild
index ec931e1..ec931e1 100644
--- a/repo/system/libxcrypt.xibuild
+++ b/repo/system/libxcrypt/libxcrypt.xibuild
diff --git a/repo/system/libxml2.xibuild b/repo/system/libxml2/libxml2.xibuild
index 9e2fd8a..9e2fd8a 100644
--- a/repo/system/libxml2.xibuild
+++ b/repo/system/libxml2/libxml2.xibuild
diff --git a/repo/system/libxslt.xibuild b/repo/system/libxslt/libxslt.xibuild
index 805925f..805925f 100644
--- a/repo/system/libxslt.xibuild
+++ b/repo/system/libxslt/libxslt.xibuild
diff --git a/repo/system/ljx.xibuild b/repo/system/ljx/ljx.xibuild
index c28cd7b..c28cd7b 100644
--- a/repo/system/ljx.xibuild
+++ b/repo/system/ljx/ljx.xibuild
diff --git a/repo/system/lua-lpeg/build-static-lib.patch b/repo/system/lua-lpeg/build-static-lib.patch
new file mode 100644
index 0000000..d8a8f8c
--- /dev/null
+++ b/repo/system/lua-lpeg/build-static-lib.patch
@@ -0,0 +1,29 @@
+--- a/makefile
++++ b/makefile
+@@ -24,12 +24,15 @@
+
+ CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
+ CC = gcc
++AR = ar
++RANLIB = ranlib
+
+ FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
+
+ # For Linux
+ linux:
+ $(MAKE) lpeg.so "DLLFLAGS = -shared -fPIC"
++ $(MAKE) lpeg.a
+
+ # For Mac OS
+ macosx:
+@@ -37,6 +40,10 @@
+
+ lpeg.so: $(FILES)
+ env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
++
++lpeg.a: $(FILES)
++ env $(AR) rc lpeg.a $(FILES)
++ env $(RANLIB) lpeg.a
+
+ $(FILES): makefile
+
diff --git a/repo/system/lua-lpeg.xibuild b/repo/system/lua-lpeg/lua-lpeg.xibuild
index f2b3b4d..f2b3b4d 100644
--- a/repo/system/lua-lpeg.xibuild
+++ b/repo/system/lua-lpeg/lua-lpeg.xibuild
diff --git a/repo/system/lua-lpeg/test-fix-setlocale.patch b/repo/system/lua-lpeg/test-fix-setlocale.patch
new file mode 100644
index 0000000..028c18c
--- /dev/null
+++ b/repo/system/lua-lpeg/test-fix-setlocale.patch
@@ -0,0 +1,20 @@
+os.setlocale just calls setlocale() from libc and musl's implementation
+behaves a bit differently in comparison with BSD libc or glibc.
+
+When particular locales for all categories are the same, e.g. "C",
+`setlocale(LC_ALL, "")` returns just "C" on BSD libc (tested on macOS)
+and glibc, but musl returns "C;C;C;C;C;C". When some locale is different,
+e.g. LC_CTYPE, then on macOS you get "C/en_US.UTF-8/C/C/C/C", on glibc
+"LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;...", on musl "en_US.UTF-8;C;C;C;C;C".
+
+--- a/test.lua
++++ b/test.lua
+@@ -1428,7 +1428,7 @@
+
+
+ -- testing pre-defined names
+-assert(os.setlocale("C") == "C")
++assert(os.setlocale("C"):sub(1, 1) == "C")
+
+ function eqlpeggsub (p1, p2)
+ local s1 = cs2str(re.compile(p1))
diff --git a/repo/system/lua-mpack/dont-install-busted.patch b/repo/system/lua-mpack/dont-install-busted.patch
new file mode 100644
index 0000000..2acb260
--- /dev/null
+++ b/repo/system/lua-mpack/dont-install-busted.patch
@@ -0,0 +1,13 @@
+Fix Makefile to not try to download and install LuaRocks and busted; use
+system-provided busted.
+--- a/Makefile
++++ b/Makefile
+@@ -61,7 +61,7 @@
+ depsclean:
+ rm -rf $(DEPS_DIR)
+
+-test: $(BUSTED) $(MPACK)
++test: $(MPACK)
+ $(BUSTED) -o gtest test.lua
+
+ valgrind: $(BUSTED) $(MPACK)
diff --git a/repo/system/lua-mpack.xibuild b/repo/system/lua-mpack/lua-mpack.xibuild
index 85c5195..85c5195 100644
--- a/repo/system/lua-mpack.xibuild
+++ b/repo/system/lua-mpack/lua-mpack.xibuild
diff --git a/repo/system/lua-mpack/skip-memleak-test.patch b/repo/system/lua-mpack/skip-memleak-test.patch
new file mode 100644
index 0000000..f89b522
--- /dev/null
+++ b/repo/system/lua-mpack/skip-memleak-test.patch
@@ -0,0 +1,20 @@
+This test requires binary to be built in debug mode.
+--- a/test.lua
++++ b/test.lua
+@@ -276,16 +276,6 @@
+ end)
+ end)
+
+- it('should not leak memory', function()
+- -- get the path to the lua interpreter, taken from
+- -- http://stackoverflow.com/a/18304231
+- local i_min = 0
+- while arg[ i_min ] do i_min = i_min - 1 end
+- i_min = i_min + 1
+- local res = io.popen(arg[i_min]..' leak_test.lua'):read('*a')
+- assert.are_same('ok\n', res)
+- end)
+-
+ describe('is_bin option', function()
+ it('controls if strings are serialized to BIN or STR', function()
+ local isbin = false
diff --git a/repo/system/lua.xibuild b/repo/system/lua/lua.xibuild
index fdcf8ab..fdcf8ab 100644
--- a/repo/system/lua.xibuild
+++ b/repo/system/lua/lua.xibuild
diff --git a/repo/system/lua/lua5.4.pc b/repo/system/lua/lua5.4.pc
new file mode 100644
index 0000000..06c8abc
--- /dev/null
+++ b/repo/system/lua/lua5.4.pc
@@ -0,0 +1,24 @@
+# lua.pc -- pkg-config data for Lua
+
+# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
+prefix=/usr
+INSTALL_BIN=${prefix}/bin
+INSTALL_INC=${prefix}/include
+INSTALL_LIB=${prefix}/lib
+INSTALL_MAN=${prefix}/man/man1
+INSTALL_LMOD=${prefix}/share/lua/@MAJOR_VER@
+INSTALL_CMOD=${prefix}/lib/lua/@MAJOR_VER@
+
+# canonical vars
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib/lua@MAJOR_VER@
+includedir=${prefix}/include/lua@MAJOR_VER@
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: @MINOR_VER@
+Requires:
+Libs: -L${libdir} -llua -lm
+Cflags: -I${includedir}
+
+# (end of lua@MAJOR_VER@.pc)
diff --git a/repo/system/lua5-1/lua-5.1-make.patch b/repo/system/lua5-1/lua-5.1-make.patch
new file mode 100644
index 0000000..2db6367
--- /dev/null
+++ b/repo/system/lua5-1/lua-5.1-make.patch
@@ -0,0 +1,71 @@
+--- ./Makefile.orig
++++ ./Makefile
+@@ -126,3 +126,18 @@
+ .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+
+ # (end of Makefile)
++
++# Use libtool for binary installs, etc.
++
++export V
++export LIBTOOL = ../libtool --quiet --tag=CC
++# See libtool manual about how to set this
++
++alpine_clean:
++ cd src; $(MAKE) $@
++
++alpine_install:
++ mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua luac $(INSTALL_BIN)
++ cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
++ cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua.la $(INSTALL_LIB)
+--- ./src/Makefile.orig
++++ ./src/Makefile
+@@ -51,10 +51,10 @@
+ $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+ $(RANLIB) $@
+
+-$(LUA_T): $(LUA_O) $(LUA_A)
++origin$(LUA_T): $(LUA_O) $(LUA_A)
+ $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+
+-$(LUAC_T): $(LUAC_O) $(LUA_A)
++origin$(LUAC_T): $(LUAC_O) $(LUA_A)
+ $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+
+ clean:
+@@ -178,5 +178,34 @@
+ lzio.h
+ print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
+ ltm.h lzio.h lmem.h lopcodes.h lundump.h
++
++
++export LIBTOOL = ../libtool --quiet --tag=CC
++export LIB_VERSION = 0:0:0
++
++# The following rules use libtool for compiling and linking in order to
++# provide shared library support.
++
++LIB_NAME = liblua.la
++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
++
++%.lo %.o: %.c
++ $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
++
++$(LIB_NAME): $(LIB_OBJS)
++ $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
++ -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
++
++$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ $(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
++
++$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
++ $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) $(LIB_NAME)
++
++alpine_clean:
++ $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua luac
++
++alpine_all: $(LIB_NAME) $(LUA_T) $(LUAC_T)
++
+
+ # (end of Makefile)
diff --git a/repo/system/lua5-1/lua-5.1-module_paths.patch b/repo/system/lua5-1/lua-5.1-module_paths.patch
new file mode 100644
index 0000000..e67d09f
--- /dev/null
+++ b/repo/system/lua5-1/lua-5.1-module_paths.patch
@@ -0,0 +1,24 @@
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -95,13 +94,19 @@
+
+ #else
+ #define LUA_ROOT "/usr/local/"
++#define LUA_ROOT2 "/usr/"
+ #define LUA_LDIR LUA_ROOT "share/lua/5.1/"
++#define LUA_LDIR2 LUA_ROOT2 "share/lua/5.1/"
++#define LUA_LDIR3 LUA_ROOT2 "share/lua/common/"
+ #define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
++#define LUA_CDIR2 LUA_ROOT2 "lib/lua/5.1/"
+ #define LUA_PATH_DEFAULT \
+ "./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
+- LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
++ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \
++ LUA_LDIR2"?.lua;" LUA_LDIR2"?/init.lua;" \
++ LUA_LDIR3"?.lua;" LUA_LDIR3"?/init.lua"
+ #define LUA_CPATH_DEFAULT \
+- "./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
++ "./?.so;" LUA_CDIR"?.so;" LUA_CDIR2"?.so;" LUA_CDIR"loadall.so"
+ #endif
+
+
diff --git a/repo/system/lua5-1/lua-5.1-readline.patch b/repo/system/lua5-1/lua-5.1-readline.patch
new file mode 100644
index 0000000..f144861
--- /dev/null
+++ b/repo/system/lua5-1/lua-5.1-readline.patch
@@ -0,0 +1,10 @@
+--- lua-5.1.1.orig/src/luaconf.h 2006-04-10 20:27:23.000000000 +0200
++++ lua-5.1.1/src/luaconf.h 2006-11-15 14:53:07.000000000 +0100
+@@ -36,7 +36,6 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+ #if defined(LUA_USE_MACOSX)
diff --git a/repo/system/lua5-1/lua.pc b/repo/system/lua5-1/lua.pc
new file mode 100644
index 0000000..1e78955
--- /dev/null
+++ b/repo/system/lua5-1/lua.pc
@@ -0,0 +1,32 @@
+# lua.pc -- pkg-config data for Lua
+
+# vars from install Makefile
+
+# grep '^V=' ../Makefile
+V= 5.1
+# grep '^R=' ../Makefile
+R= 5.1.5
+
+# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
+prefix= /usr
+INSTALL_BIN= ${prefix}/bin
+INSTALL_INC= ${prefix}/include
+INSTALL_LIB= ${prefix}/lib
+INSTALL_MAN= ${prefix}/man/man1
+INSTALL_LMOD= ${prefix}/share/lua/${V}
+INSTALL_CMOD= ${prefix}/lib/lua/${V}
+
+# canonical vars
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: Lua
+Description: An Extensible Extension Language
+Version: ${R}
+Requires:
+Libs: -L${libdir} -llua -lm
+Cflags: -I${includedir}
+
+# (end of lua.pc)
+
diff --git a/repo/system/lua5-1.xibuild b/repo/system/lua5-1/lua5-1.xibuild
index 5fc5f80..5fc5f80 100644
--- a/repo/system/lua5-1.xibuild
+++ b/repo/system/lua5-1/lua5-1.xibuild
diff --git a/repo/system/luajit.xibuild b/repo/system/luajit/luajit.xibuild
index 09f6015..09f6015 100644
--- a/repo/system/luajit.xibuild
+++ b/repo/system/luajit/luajit.xibuild
diff --git a/repo/system/luajit/module-paths.patch b/repo/system/luajit/module-paths.patch
new file mode 100644
index 0000000..46e8d12
--- /dev/null
+++ b/repo/system/luajit/module-paths.patch
@@ -0,0 +1,25 @@
+Add /usr/share/lua/common to LUA_PATH. We use this directory for Lua modules
+that are compatible with Lua 5.1 and newer.
+
+--- a/src/luaconf.h
++++ b/src/luaconf.h
+@@ -42,8 +42,10 @@
+ #ifdef LUA_ROOT
+ #define LUA_JROOT LUA_ROOT
+ #define LUA_RLDIR LUA_ROOT "/share" LUA_LUADIR
++#define LUA_RLDIR2 LUA_ROOT "/share/lua/common/"
+ #define LUA_RCDIR LUA_ROOT "/" LUA_MULTILIB LUA_LUADIR
+ #define LUA_RLPATH ";" LUA_RLDIR "?.lua;" LUA_RLDIR "?/init.lua"
++#define LUA_RLPATH2 ";" LUA_RLDIR2 "?.lua;" LUA_RLDIR2 "?/init.lua"
+ #define LUA_RCPATH ";" LUA_RCDIR "?.so"
+ #else
+ #define LUA_JROOT LUA_LROOT
+@@ -58,7 +60,7 @@
+ #define LUA_LCPATH1 ";" LUA_LCDIR "?.so"
+ #define LUA_LCPATH2 ";" LUA_LCDIR "loadall.so"
+
+-#define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH
++#define LUA_PATH_DEFAULT "./?.lua" LUA_JPATH LUA_LLPATH LUA_RLPATH LUA_RLPATH2
+ #define LUA_CPATH_DEFAULT "./?.so" LUA_LCPATH1 LUA_RCPATH LUA_LCPATH2
+ #endif
+
diff --git a/repo/system/lz4.xibuild b/repo/system/lz4/lz4.xibuild
index e0bfd68..e0bfd68 100644
--- a/repo/system/lz4.xibuild
+++ b/repo/system/lz4/lz4.xibuild
diff --git a/repo/system/lzo.xibuild b/repo/system/lzo/lzo.xibuild
index 4c24afc..4c24afc 100644
--- a/repo/system/lzo.xibuild
+++ b/repo/system/lzo/lzo.xibuild
diff --git a/repo/system/menu-cache/menu-cache-1.1.0-0001-Support-gcc10-compilation.patch b/repo/system/menu-cache/menu-cache-1.1.0-0001-Support-gcc10-compilation.patch
new file mode 100644
index 0000000..29f8e53
--- /dev/null
+++ b/repo/system/menu-cache/menu-cache-1.1.0-0001-Support-gcc10-compilation.patch
@@ -0,0 +1,108 @@
+From 1ce739649b4d66339a03fc0ec9ee7a2f7c141780 Mon Sep 17 00:00:00 2001
+From: Mamoru TASAKA <mtasaka@fedoraproject.org>
+Date: Fri, 24 Jan 2020 13:33:00 +0900
+Subject: [PATCH] Support gcc10 compilation
+
+gcc10 now defaults to -fno-common, and with gcc10 menu-cache compilation fails like
+
+/bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:167: multiple definition of `DirDirs'; main.o:menu-cache-gen/menu-tags.h:167: first defined here
+/bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:164: multiple definition of `AppDirs'; main.o:menu-cache-gen/menu-tags.h:164: first defined here
+/bin/ld: menu-merge.o:menu-cache-gen/menu-tags.h:52: multiple definition of `menuTag_Layout'; main.o:menu-cache-gen/menu-tags.h:52: first defined here
+....
+
+This patch fixes compilation with gcc10: properly declaring variables in header with "extern", and also removing some unneeded variables in header files.
+---
+ menu-cache-gen/menu-tags.h | 55 ++++++++++++--------------------------
+ 1 file changed, 17 insertions(+), 38 deletions(-)
+
+diff --git a/menu-cache-gen/menu-tags.h b/menu-cache-gen/menu-tags.h
+index f3fd7d3..f71c0bc 100644
+--- a/menu-cache-gen/menu-tags.h
++++ b/menu-cache-gen/menu-tags.h
+@@ -22,38 +22,17 @@
+ #include <libfm/fm-extra.h>
+ #include <menu-cache.h>
+
+-FmXmlFileTag menuTag_Menu;
+-FmXmlFileTag menuTag_AppDir;
+-FmXmlFileTag menuTag_DefaultAppDirs;
+-FmXmlFileTag menuTag_DirectoryDir;
+-FmXmlFileTag menuTag_DefaultDirectoryDirs;
+-FmXmlFileTag menuTag_Include;
+-FmXmlFileTag menuTag_Exclude;
+-FmXmlFileTag menuTag_Filename;
+-FmXmlFileTag menuTag_Or;
+-FmXmlFileTag menuTag_And;
+-FmXmlFileTag menuTag_Not;
+-FmXmlFileTag menuTag_Category;
+-FmXmlFileTag menuTag_MergeFile;
+-FmXmlFileTag menuTag_MergeDir;
+-FmXmlFileTag menuTag_DefaultMergeDirs;
+-FmXmlFileTag menuTag_Directory;
+-FmXmlFileTag menuTag_Name;
+-FmXmlFileTag menuTag_Deleted;
+-FmXmlFileTag menuTag_NotDeleted;
+-FmXmlFileTag menuTag_OnlyUnallocated;
+-FmXmlFileTag menuTag_NotOnlyUnallocated;
+-FmXmlFileTag menuTag_All;
+-FmXmlFileTag menuTag_LegacyDir;
+-FmXmlFileTag menuTag_KDELegacyDirs;
+-FmXmlFileTag menuTag_Move;
+-FmXmlFileTag menuTag_Old;
+-FmXmlFileTag menuTag_New;
+-FmXmlFileTag menuTag_Layout;
+-FmXmlFileTag menuTag_DefaultLayout;
+-FmXmlFileTag menuTag_Menuname;
+-FmXmlFileTag menuTag_Separator;
+-FmXmlFileTag menuTag_Merge;
++extern FmXmlFileTag menuTag_AppDir;
++extern FmXmlFileTag menuTag_DirectoryDir;
++extern FmXmlFileTag menuTag_Include;
++extern FmXmlFileTag menuTag_Exclude;
++extern FmXmlFileTag menuTag_Filename;
++extern FmXmlFileTag menuTag_Or;
++extern FmXmlFileTag menuTag_And;
++extern FmXmlFileTag menuTag_Not;
++extern FmXmlFileTag menuTag_Category;
++extern FmXmlFileTag menuTag_All;
++extern FmXmlFileTag menuTag_LegacyDir;
+
+ typedef enum {
+ MERGE_NONE, /* starting value */
+@@ -152,19 +131,19 @@ typedef struct {
+ } MenuRule;
+
+ /* requested language(s) */
+-char **languages;
++extern char **languages;
+
+ /* list of menu files to monitor */
+-GSList *MenuFiles;
++extern GSList *MenuFiles;
+
+ /* list of menu dirs to monitor */
+-GSList *MenuDirs;
++extern GSList *MenuDirs;
+
+ /* list of available app dirs */
+-GSList *AppDirs;
++extern GSList *AppDirs;
+
+ /* list of available dir dirs */
+-GSList *DirDirs;
++extern GSList *DirDirs;
+
+ /* parse and merge menu files */
+ MenuMenu *get_merged_menu(const char *file, FmXmlFile **xmlfile, GError **error);
+@@ -177,7 +156,7 @@ gboolean save_menu_cache(MenuMenu *layout, const char *menuname, const char *fil
+ void _free_layout_items(GList *data);
+
+ /* verbosity level */
+-gint verbose;
++extern gint verbose;
+
+ #define DBG if (verbose) g_debug
+ #define VDBG if (verbose > 1) g_debug
+--
+2.24.1
+
diff --git a/repo/system/menu-cache.xibuild b/repo/system/menu-cache/menu-cache.xibuild
index 6183364..6183364 100644
--- a/repo/system/menu-cache.xibuild
+++ b/repo/system/menu-cache/menu-cache.xibuild
diff --git a/repo/system/mobile-broadband-provider-info.xibuild b/repo/system/mobile-broadband-provider-info/mobile-broadband-provider-info.xibuild
index 618feb3..618feb3 100644
--- a/repo/system/mobile-broadband-provider-info.xibuild
+++ b/repo/system/mobile-broadband-provider-info/mobile-broadband-provider-info.xibuild
diff --git a/repo/system/modemmanager/modemmanager.initd b/repo/system/modemmanager/modemmanager.initd
new file mode 100644
index 0000000..29310b3
--- /dev/null
+++ b/repo/system/modemmanager/modemmanager.initd
@@ -0,0 +1,11 @@
+#!/sbin/openrc-run
+
+supervisor=supervise-daemon
+command=/usr/sbin/ModemManager
+command_args="${modemmanager_opts}"
+
+description="ModemManager Daemon"
+
+depend() {
+ need dbus
+}
diff --git a/repo/system/modemmanager/modemmanager.rules b/repo/system/modemmanager/modemmanager.rules
new file mode 100644
index 0000000..1eb7b19
--- /dev/null
+++ b/repo/system/modemmanager/modemmanager.rules
@@ -0,0 +1,296 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+<title>modemmanager.rules « modemmanager « community - aports - Alpine packages build scripts
+</title>
+<meta name='generator' content='cgit v1.2.3'/>
+<meta name='robots' content='index, nofollow'/>
+<link rel='stylesheet' type='text/css' href='/cgit.css'/>
+<link rel='shortcut icon' href='//alpinelinux.org/alpine-logo.ico'/>
+<link rel='alternate' title='Atom feed' href='http://git.alpinelinux.org/aports/atom/community/modemmanager/modemmanager.rules?h=master' type='application/atom+xml'/>
+<link rel='vcs-git' href='https://git.alpinelinux.org/aports' title='aports Git repository'/>
+</head>
+<body>
+<div id='cgit'><table id='header'>
+<tr>
+<td class='logo' rowspan='2'><a href='/'><img src='//wiki.alpinelinux.org/images/alogo.png' alt='cgit logo'/></a></td>
+<td class='main'><a href='/'>index</a> : <a title='aports' href='/aports/'>aports</a></td><td class='form'><form method='get'>
+<select name='h' onchange='this.form.submit();'>
+<option value='1.10-stable'>1.10-stable</option>
+<option value='1.9'>1.9</option>
+<option value='2.0-stable'>2.0-stable</option>
+<option value='2.1-stable'>2.1-stable</option>
+<option value='2.2-stable'>2.2-stable</option>
+<option value='2.3-stable'>2.3-stable</option>
+<option value='2.4-stable'>2.4-stable</option>
+<option value='2.5-stable'>2.5-stable</option>
+<option value='2.6-stable'>2.6-stable</option>
+<option value='2.7-stable'>2.7-stable</option>
+<option value='3.0-stable'>3.0-stable</option>
+<option value='3.1-stable'>3.1-stable</option>
+<option value='3.10-stable'>3.10-stable</option>
+<option value='3.11-stable'>3.11-stable</option>
+<option value='3.12-stable'>3.12-stable</option>
+<option value='3.13-stable'>3.13-stable</option>
+<option value='3.14-stable'>3.14-stable</option>
+<option value='3.15-stable'>3.15-stable</option>
+<option value='3.2-stable'>3.2-stable</option>
+<option value='3.3-stable'>3.3-stable</option>
+<option value='3.4-stable'>3.4-stable</option>
+<option value='3.5-stable'>3.5-stable</option>
+<option value='3.6-stable'>3.6-stable</option>
+<option value='3.7-stable'>3.7-stable</option>
+<option value='3.8-stable'>3.8-stable</option>
+<option value='3.9-stable'>3.9-stable</option>
+<option value='cherry-pick-980a8718'>cherry-pick-980a8718</option>
+<option value='fs-upgrade-1.10.7'>fs-upgrade-1.10.7</option>
+<option value='libcgroup'>libcgroup</option>
+<option value='master' selected='selected'>master</option>
+<option value='nuspell'>nuspell</option>
+<option value='patches/3526'>patches/3526</option>
+<option value='patches/3527'>patches/3527</option>
+<option value='patches/3530'>patches/3530</option>
+<option value='patches/3531'>patches/3531</option>
+<option value='patches/3534'>patches/3534</option>
+<option value='patches/3535'>patches/3535</option>
+<option value='patches/3538'>patches/3538</option>
+<option value='patches/3539'>patches/3539</option>
+<option value='patches/3540'>patches/3540</option>
+<option value='patches/3551'>patches/3551</option>
+<option value='patches/3556'>patches/3556</option>
+<option value='patches/3558'>patches/3558</option>
+<option value='patches/3559'>patches/3559</option>
+<option value='patches/3562'>patches/3562</option>
+<option value='patches/3563'>patches/3563</option>
+<option value='patches/3564'>patches/3564</option>
+<option value='patches/3565'>patches/3565</option>
+<option value='patches/3567'>patches/3567</option>
+<option value='patches/3568'>patches/3568</option>
+<option value='patches/3569'>patches/3569</option>
+<option value='patches/3574'>patches/3574</option>
+<option value='patches/3575'>patches/3575</option>
+<option value='patches/3576'>patches/3576</option>
+<option value='patches/3577'>patches/3577</option>
+<option value='patches/3582'>patches/3582</option>
+<option value='patches/3584'>patches/3584</option>
+<option value='patches/3590'>patches/3590</option>
+<option value='patches/3592'>patches/3592</option>
+<option value='patches/3594'>patches/3594</option>
+<option value='patches/3598'>patches/3598</option>
+<option value='patches/3599'>patches/3599</option>
+<option value='patches/3601'>patches/3601</option>
+<option value='patches/3603'>patches/3603</option>
+<option value='patches/3604'>patches/3604</option>
+<option value='patches/3606'>patches/3606</option>
+<option value='patches/3607'>patches/3607</option>
+<option value='patches/3608'>patches/3608</option>
+<option value='patches/3610'>patches/3610</option>
+<option value='patches/3612'>patches/3612</option>
+<option value='patches/3613'>patches/3613</option>
+<option value='patches/3615'>patches/3615</option>
+<option value='patches/3616'>patches/3616</option>
+<option value='patches/3618'>patches/3618</option>
+<option value='patches/3621'>patches/3621</option>
+<option value='patches/3622'>patches/3622</option>
+<option value='patches/3624'>patches/3624</option>
+<option value='patches/3627'>patches/3627</option>
+<option value='patches/3632'>patches/3632</option>
+<option value='patches/3633'>patches/3633</option>
+<option value='patches/3635'>patches/3635</option>
+<option value='patches/3636'>patches/3636</option>
+<option value='patches/3646'>patches/3646</option>
+<option value='patches/3654'>patches/3654</option>
+<option value='patches/3656'>patches/3656</option>
+<option value='patches/3662'>patches/3662</option>
+<option value='patches/3666'>patches/3666</option>
+<option value='patches/3670'>patches/3670</option>
+<option value='patches/3671'>patches/3671</option>
+<option value='patches/3675'>patches/3675</option>
+<option value='patches/3687'>patches/3687</option>
+<option value='patches/3690'>patches/3690</option>
+<option value='patches/3691'>patches/3691</option>
+<option value='patches/3692'>patches/3692</option>
+<option value='patches/3697'>patches/3697</option>
+<option value='patches/3706'>patches/3706</option>
+<option value='patches/3707'>patches/3707</option>
+<option value='patches/3715'>patches/3715</option>
+<option value='patches/3721'>patches/3721</option>
+<option value='patches/3722'>patches/3722</option>
+<option value='patches/3724'>patches/3724</option>
+<option value='patches/3731'>patches/3731</option>
+<option value='patches/3756'>patches/3756</option>
+<option value='patches/3764'>patches/3764</option>
+<option value='patches/3767'>patches/3767</option>
+<option value='patches/3770'>patches/3770</option>
+<option value='patches/3771'>patches/3771</option>
+<option value='patches/3774'>patches/3774</option>
+<option value='patches/3775'>patches/3775</option>
+<option value='patches/3777'>patches/3777</option>
+<option value='patches/3779'>patches/3779</option>
+<option value='patches/3787'>patches/3787</option>
+<option value='patches/3788'>patches/3788</option>
+<option value='patches/3789'>patches/3789</option>
+<option value='patches/3790'>patches/3790</option>
+<option value='patches/3793'>patches/3793</option>
+<option value='patches/3796'>patches/3796</option>
+<option value='patches/3797'>patches/3797</option>
+<option value='patches/3798'>patches/3798</option>
+<option value='patches/3799'>patches/3799</option>
+<option value='patches/3800'>patches/3800</option>
+<option value='patches/3802'>patches/3802</option>
+<option value='patches/3803'>patches/3803</option>
+<option value='patches/3804'>patches/3804</option>
+<option value='patches/3805'>patches/3805</option>
+<option value='patches/3808'>patches/3808</option>
+<option value='patches/3811'>patches/3811</option>
+<option value='patches/3813'>patches/3813</option>
+<option value='patches/3816'>patches/3816</option>
+<option value='patches/3818'>patches/3818</option>
+<option value='patches/3820'>patches/3820</option>
+<option value='patches/3821'>patches/3821</option>
+<option value='patches/3822'>patches/3822</option>
+<option value='patches/3823'>patches/3823</option>
+<option value='patches/3825'>patches/3825</option>
+<option value='patches/3827'>patches/3827</option>
+<option value='patches/3828'>patches/3828</option>
+<option value='patches/3829'>patches/3829</option>
+<option value='patches/3830'>patches/3830</option>
+<option value='patches/3831'>patches/3831</option>
+<option value='patches/3832'>patches/3832</option>
+<option value='patches/3833'>patches/3833</option>
+<option value='patches/3835'>patches/3835</option>
+<option value='patches/3836'>patches/3836</option>
+<option value='patches/3837'>patches/3837</option>
+<option value='patches/3838'>patches/3838</option>
+<option value='patches/3839'>patches/3839</option>
+<option value='patches/3843'>patches/3843</option>
+<option value='patches/3845'>patches/3845</option>
+<option value='patches/3846'>patches/3846</option>
+<option value='patches/3847'>patches/3847</option>
+<option value='patches/3850'>patches/3850</option>
+<option value='patches/3852'>patches/3852</option>
+<option value='patches/3853'>patches/3853</option>
+<option value='patches/3854'>patches/3854</option>
+<option value='patches/3855'>patches/3855</option>
+<option value='patches/3858'>patches/3858</option>
+<option value='patches/3861'>patches/3861</option>
+<option value='patches/3863'>patches/3863</option>
+<option value='patches/3864'>patches/3864</option>
+<option value='patches/3868'>patches/3868</option>
+<option value='patches/3869'>patches/3869</option>
+<option value='patches/3870'>patches/3870</option>
+<option value='patches/3871'>patches/3871</option>
+<option value='patches/3873'>patches/3873</option>
+<option value='patches/3878'>patches/3878</option>
+<option value='patches/3881'>patches/3881</option>
+<option value='patches/3882'>patches/3882</option>
+<option value='patches/3883'>patches/3883</option>
+<option value='patches/3885'>patches/3885</option>
+<option value='patches/3886'>patches/3886</option>
+<option value='patches/3887'>patches/3887</option>
+<option value='patches/3888'>patches/3888</option>
+<option value='patches/3890'>patches/3890</option>
+<option value='patches/3891'>patches/3891</option>
+<option value='patches/3892'>patches/3892</option>
+<option value='patches/3895'>patches/3895</option>
+<option value='patches/3896'>patches/3896</option>
+<option value='patches/3897'>patches/3897</option>
+<option value='patches/3908'>patches/3908</option>
+<option value='patches/3909'>patches/3909</option>
+<option value='patches/3912'>patches/3912</option>
+<option value='patches/3913'>patches/3913</option>
+<option value='patches/3914'>patches/3914</option>
+<option value='patches/3916'>patches/3916</option>
+<option value='patches/3918'>patches/3918</option>
+<option value='patches/3920'>patches/3920</option>
+<option value='patches/3923'>patches/3923</option>
+<option value='patches/3927'>patches/3927</option>
+<option value='patches/3933'>patches/3933</option>
+<option value='patches/3934'>patches/3934</option>
+<option value='patches/3937'>patches/3937</option>
+<option value='patches/3940'>patches/3940</option>
+<option value='patches/3941'>patches/3941</option>
+<option value='patches/3946'>patches/3946</option>
+<option value='patches/3947'>patches/3947</option>
+<option value='patches/3949'>patches/3949</option>
+<option value='patches/3950'>patches/3950</option>
+<option value='patches/3953'>patches/3953</option>
+<option value='patches/3954'>patches/3954</option>
+<option value='patches/3957'>patches/3957</option>
+<option value='patches/3958'>patches/3958</option>
+<option value='patches/3959'>patches/3959</option>
+<option value='patches/3963'>patches/3963</option>
+<option value='patches/3969'>patches/3969</option>
+<option value='patches/3970'>patches/3970</option>
+<option value='patches/3976'>patches/3976</option>
+<option value='patches/3977'>patches/3977</option>
+<option value='patches/3979'>patches/3979</option>
+<option value='patches/3980'>patches/3980</option>
+<option value='patches/3981'>patches/3981</option>
+<option value='patches/3987'>patches/3987</option>
+<option value='patches/3988'>patches/3988</option>
+<option value='patches/3989'>patches/3989</option>
+<option value='patches/3996'>patches/3996</option>
+<option value='wlroots'>wlroots</option>
+</select> <input type='submit' value='switch'/></form></td></tr>
+<tr><td class='sub'>Alpine packages build scripts
+</td><td class='sub right'>uwsgi</td></tr></table>
+<table class='tabs'><tr><td>
+<a href='/aports/about/'>about</a><a href='/aports/'>summary</a><a href='/aports/refs/'>refs</a><a href='/aports/log/community/modemmanager/modemmanager.rules'>log</a><a class='active' href='/aports/tree/community/modemmanager/modemmanager.rules'>tree</a><a href='/aports/commit/community/modemmanager/modemmanager.rules'>commit</a><a href='/aports/diff/community/modemmanager/modemmanager.rules'>diff</a><a href='/aports/stats/community/modemmanager/modemmanager.rules'>stats</a></td><td class='form'><form class='right' method='get' action='/aports/log/community/modemmanager/modemmanager.rules'>
+<select name='qt'>
+<option value='grep'>log msg</option>
+<option value='author'>author</option>
+<option value='committer'>committer</option>
+<option value='range'>range</option>
+</select>
+<input class='txt' type='search' size='10' name='q' value=''/>
+<input type='submit' value='search'/>
+</form>
+</td></tr></table>
+<div class='path'>path: <a href='/aports/tree/'>root</a>/<a href='/aports/tree/community'>community</a>/<a href='/aports/tree/community/modemmanager'>modemmanager</a>/<a href='/aports/tree/community/modemmanager/modemmanager.rules'>modemmanager.rules</a></div><div class='content'>blob: 4c56fb7f9ef117068e03d8e6c01d2f51dad066bd (<a href='/aports/plain/community/modemmanager/modemmanager.rules'>plain</a>) (<a href='/aports/blame/community/modemmanager/modemmanager.rules'>blame</a>)
+<table summary='blob content' class='blob'>
+<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
+<a id='n2' href='#n2'>2</a>
+<a id='n3' href='#n3'>3</a>
+<a id='n4' href='#n4'>4</a>
+<a id='n5' href='#n5'>5</a>
+<a id='n6' href='#n6'>6</a>
+<a id='n7' href='#n7'>7</a>
+<a id='n8' href='#n8'>8</a>
+<a id='n9' href='#n9'>9</a>
+<a id='n10' href='#n10'>10</a>
+<a id='n11' href='#n11'>11</a>
+<a id='n12' href='#n12'>12</a>
+<a id='n13' href='#n13'>13</a>
+<a id='n14' href='#n14'>14</a>
+<a id='n15' href='#n15'>15</a>
+<a id='n16' href='#n16'>16</a>
+<a id='n17' href='#n17'>17</a>
+<a id='n18' href='#n18'>18</a>
+<a id='n19' href='#n19'>19</a>
+</pre></td>
+<td class='lines'><pre><code>// Let users in plugdev group modify ModemManager
+polkit.addRule(function(action, subject) {
+ if ((action.id == &quot;org.freedesktop.ModemManager1.Device.Control&quot; ||
+ action.id == &quot;org.freedesktop.ModemManager1.Contacts&quot; ||
+ action.id == &quot;org.freedesktop.ModemManager1.Messaging&quot; ||
+ action.id == &quot;org.freedesktop.ModemManager1.Location&quot;) &amp;&amp;
+ subject.isInGroup(&quot;plugdev&quot;) &amp;&amp; subject.active) {
+ return &quot;yes&quot;;
+ }
+});
+
+// Let geoclue modify ModemManager for location gathering
+polkit.addRule(function(action, subject) {
+ if ((action.id == &quot;org.freedesktop.ModemManager1.Device.Control&quot; ||
+ action.id == &quot;org.freedesktop.ModemManager1.Location&quot;) &amp;&amp;
+ subject.isInGroup(&quot;geoclue&quot;)) {
+ return &quot;yes&quot;;
+ }
+});
+</code></pre></td></tr></table>
+</div> <!-- class=content -->
+<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit v1.2.3</a> (<a href='https://git-scm.com/'>git 2.25.1</a>) at 2022-03-31 19:59:28 +0000</div>
+</div> <!-- id=cgit -->
+</body>
+</html>
diff --git a/repo/system/modemmanager.xibuild b/repo/system/modemmanager/modemmanager.xibuild
index b2d5c5d..b2d5c5d 100644
--- a/repo/system/modemmanager.xibuild
+++ b/repo/system/modemmanager/modemmanager.xibuild
diff --git a/repo/system/mpfr.xibuild b/repo/system/mpfr/mpfr.xibuild
index a0fc726..a0fc726 100644
--- a/repo/system/mpfr.xibuild
+++ b/repo/system/mpfr/mpfr.xibuild
diff --git a/repo/system/msgpack-c.xibuild b/repo/system/msgpack-c/msgpack-c.xibuild
index e0f8b8f..e0f8b8f 100644
--- a/repo/system/msgpack-c.xibuild
+++ b/repo/system/msgpack-c/msgpack-c.xibuild
diff --git a/repo/system/mtdev.xibuild b/repo/system/mtdev/mtdev.xibuild
index 8c463b8..8c463b8 100644
--- a/repo/system/mtdev.xibuild
+++ b/repo/system/mtdev/mtdev.xibuild
diff --git a/repo/system/musl-fts.xibuild b/repo/system/musl-fts/musl-fts.xibuild
index 508f84c..508f84c 100644
--- a/repo/system/musl-fts.xibuild
+++ b/repo/system/musl-fts/musl-fts.xibuild
diff --git a/repo/system/musl-legacy-compat.xibuild b/repo/system/musl-legacy-compat/musl-legacy-compat.xibuild
index 00ecaa1..00ecaa1 100644
--- a/repo/system/musl-legacy-compat.xibuild
+++ b/repo/system/musl-legacy-compat/musl-legacy-compat.xibuild
diff --git a/repo/system/musl-obstack.xibuild b/repo/system/musl-obstack/musl-obstack.xibuild
index bbc014d..bbc014d 100644
--- a/repo/system/musl-obstack.xibuild
+++ b/repo/system/musl-obstack/musl-obstack.xibuild
diff --git a/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch b/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch
new file mode 100644
index 0000000..b2f0a0f
--- /dev/null
+++ b/repo/system/musl/0001-riscv64-define-ELF_NFPREG.patch
@@ -0,0 +1,24 @@
+From e5d2823631bbfebacf48e1a34ed28f28d7cb2570 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 11 Jan 2021 09:40:33 -0800
+Subject: [PATCH] riscv64: define ELF_NFPREG
+
+ELF_NFPREG is used by some userspace applications like gdb
+---
+ arch/riscv64/bits/user.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
+index 2da743ea..0d37de0b 100644
+--- a/arch/riscv64/bits/user.h
++++ b/arch/riscv64/bits/user.h
+@@ -1,5 +1,6 @@
+ #include <signal.h>
+
+ #define ELF_NGREG 32
++#define ELF_NFPREG 33
+ typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
+ typedef union __riscv_mc_fp_state elf_fpregset_t;
+--
+2.30.1
+
diff --git a/repo/system/musl/change-scheduler-functions-Linux-compatib.patch b/repo/system/musl/change-scheduler-functions-Linux-compatib.patch
new file mode 100644
index 0000000..fb63dfd
--- /dev/null
+++ b/repo/system/musl/change-scheduler-functions-Linux-compatib.patch
@@ -0,0 +1,52 @@
+diff -uNr musl-1.2.2.orig/src/sched/sched_getparam.c musl-1.2.2/src/sched/sched_getparam.c
+--- musl-1.2.2.orig/src/sched/sched_getparam.c 2021-01-15 02:26:00.000000000 +0000
++++ musl-1.2.2/src/sched/sched_getparam.c 2021-12-23 00:31:16.590518270 +0000
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_getparam(pid_t pid, struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_getparam, pid, param);
+ }
+diff -uNr musl-1.2.2.orig/src/sched/sched_getscheduler.c musl-1.2.2/src/sched/sched_getscheduler.c
+--- musl-1.2.2.orig/src/sched/sched_getscheduler.c 2021-01-15 02:26:00.000000000 +0000
++++ musl-1.2.2/src/sched/sched_getscheduler.c 2021-12-23 00:33:32.949520644 +0000
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_getscheduler(pid_t pid)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_getscheduler, pid);
+ }
+diff -uNr musl-1.2.2.orig/src/sched/sched_setparam.c musl-1.2.2/src/sched/sched_setparam.c
+--- musl-1.2.2.orig/src/sched/sched_setparam.c 2021-01-15 02:26:00.000000000 +0000
++++ musl-1.2.2/src/sched/sched_setparam.c 2021-12-23 00:35:12.277522374 +0000
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_setparam(pid_t pid, const struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_setparam, pid, param);
+ }
+diff -uNr musl-1.2.2.orig/src/sched/sched_setscheduler.c musl-1.2.2/src/sched/sched_setscheduler.c
+--- musl-1.2.2.orig/src/sched/sched_setscheduler.c 2021-01-15 02:26:00.000000000 +0000
++++ musl-1.2.2/src/sched/sched_setscheduler.c 2021-12-23 00:36:37.548523859 +0000
+@@ -1,8 +1,7 @@
+ #include <sched.h>
+-#include <errno.h>
+ #include "syscall.h"
+
+ int sched_setscheduler(pid_t pid, int sched, const struct sched_param *param)
+ {
+- return __syscall_ret(-ENOSYS);
++ return syscall(SYS_sched_setscheduler, pid, sched, param);
+ }
diff --git a/repo/system/musl/fix-utmp-wtmp-paths.patch b/repo/system/musl/fix-utmp-wtmp-paths.patch
new file mode 100644
index 0000000..900abc7
--- /dev/null
+++ b/repo/system/musl/fix-utmp-wtmp-paths.patch
@@ -0,0 +1,29 @@
+diff -uNr musl-1.2.2.orig/include/paths.h musl-1.2.2/include/paths.h
+--- musl-1.2.2.orig/include/paths.h 2021-01-14 20:26:00.000000000 -0600
++++ musl-1.2.2/include/paths.h 2021-08-26 16:39:31.355618388 -0500
+@@ -18,9 +18,9 @@
+ #define _PATH_SHADOW "/etc/shadow"
+ #define _PATH_SHELLS "/etc/shells"
+ #define _PATH_TTY "/dev/tty"
+-#define _PATH_UTMP "/dev/null/utmp"
++#define _PATH_UTMP "/run/utmps/utmp"
+ #define _PATH_VI "/usr/bin/vi"
+-#define _PATH_WTMP "/dev/null/wtmp"
++#define _PATH_WTMP "/var/log/wtmp"
+
+ #define _PATH_DEV "/dev/"
+ #define _PATH_TMP "/tmp/"
+diff -uNr musl-1.2.2.orig/include/utmp.h musl-1.2.2/include/utmp.h
+--- musl-1.2.2.orig/include/utmp.h 2021-01-14 20:26:00.000000000 -0600
++++ musl-1.2.2/include/utmp.h 2021-08-26 16:37:11.567365982 -0500
+@@ -37,8 +37,8 @@
+
+ int login_tty(int);
+
+-#define _PATH_UTMP "/dev/null/utmp"
+-#define _PATH_WTMP "/dev/null/wtmp"
++#define _PATH_UTMP "/run/utmps/utmp"
++#define _PATH_WTMP "/var/log/wtmp"
+
+ #define UTMP_FILE _PATH_UTMP
+ #define WTMP_FILE _PATH_WTMP
diff --git a/repo/system/musl/handle-aux-at_base.patch b/repo/system/musl/handle-aux-at_base.patch
new file mode 100644
index 0000000..7c9f2dc
--- /dev/null
+++ b/repo/system/musl/handle-aux-at_base.patch
@@ -0,0 +1,46 @@
+This is required to make the gcompat ELF interpreter stub work with some
+packed binaries.
+
+diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
+index b125eb1..616c6a6 100644
+--- a/src/env/__init_tls.c
++++ b/src/env/__init_tls.c
+@@ -66,8 +66,10 @@ void *__copy_tls(unsigned char *mem)
+ }
+
+ #if ULONG_MAX == 0xffffffff
++typedef Elf32_Ehdr Ehdr;
+ typedef Elf32_Phdr Phdr;
+ #else
++typedef Elf64_Ehdr Ehdr;
+ typedef Elf64_Phdr Phdr;
+ #endif
+
+@@ -77,15 +79,23 @@ extern const size_t _DYNAMIC[];
+ static void static_init_tls(size_t *aux)
+ {
+ unsigned char *p;
+- size_t n;
++ size_t n, e;
+ Phdr *phdr, *tls_phdr=0;
+ size_t base = 0;
+ void *mem;
+
+- for (p=(void *)aux[AT_PHDR],n=aux[AT_PHNUM]; n; n--,p+=aux[AT_PHENT]) {
++ if (aux[AT_BASE]) {
++ Ehdr *ehdr = (void *)aux[AT_BASE];
++ p = (unsigned char *)aux[AT_BASE] + ehdr->e_phoff;
++ n = ehdr->e_phnum;
++ e = ehdr->e_phentsize;
++ } else {
++ p = (void *)aux[AT_PHDR];
++ n = aux[AT_PHNUM];
++ e = aux[AT_PHENT];
++ }
++ for (; n; n--, p+=e) {
+ phdr = (void *)p;
+- if (phdr->p_type == PT_PHDR)
+- base = aux[AT_PHDR] - phdr->p_vaddr;
+ if (phdr->p_type == PT_DYNAMIC && _DYNAMIC)
+ base = (size_t)_DYNAMIC - phdr->p_vaddr;
+ if (phdr->p_type == PT_TLS)
diff --git a/repo/system/musl.xibuild b/repo/system/musl/musl.xibuild
index 6f15382..6f15382 100644
--- a/repo/system/musl.xibuild
+++ b/repo/system/musl/musl.xibuild
diff --git a/repo/system/musl/qsort_r.patch b/repo/system/musl/qsort_r.patch
new file mode 100644
index 0000000..4ea6366
--- /dev/null
+++ b/repo/system/musl/qsort_r.patch
@@ -0,0 +1,213 @@
+Date: Tue, 9 Mar 2021 18:02:13 -0300
+From: Érico Nogueira <ericonr@...root.org>
+To: musl@...ts.openwall.com
+Cc: Érico Nogueira <ericonr@...root.org>
+Subject: [PATCH v3] add qsort_r and make qsort a wrapper around it
+
+we make qsort a wrapper by providing a wrapper_cmp function that uses
+the extra argument as a function pointer. should be optimized to a tail
+call on most architectures, as long as it's built with
+-fomit-frame-pointer, so the performance impact should be minimal.
+
+to keep the git history clean, for now qsort_r is implemented in qsort.c
+and qsort is implemented in qsort_nr.c. qsort.c also received a few
+trivial cleanups, including replacing (*cmp)() calls with cmp().
+qsort_nr.c contains only wrapper_cmp and qsort as a qsort_r wrapper
+itself.
+---
+
+Following suggestions from IRC, as few changes as possible to the files,
+a final clean up commit after this one would involve some git mv's (I
+won't make a patch for it). Added weak_alias to force qsort to use
+libc's qsort_r.
+
+If this can't be accepted due to the overhead on some archs (ppc, mips,
+arm in some situations?), maybe we could revisit v2 of the patch?
+
+ include/stdlib.h | 1 +
+ src/include/stdlib.h | 1 +
+ src/stdlib/qsort.c | 37 ++++++++++++++++++++-----------------
+ src/stdlib/qsort_nr.c | 14 ++++++++++++++
+ 4 files changed, 36 insertions(+), 17 deletions(-)
+ create mode 100644 src/stdlib/qsort_nr.c
+
+diff --git a/include/stdlib.h b/include/stdlib.h
+index b54a051f..0c0ced5f 100644
+--- a/include/stdlib.h
++++ b/include/stdlib.h
+@@ -158,6 +158,7 @@ struct __locale_struct;
+ float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+ double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+ long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
++void qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+ #endif
+
+ #if defined(_LARGEFILE64_SOURCE) || defined(_BSD_SOURCE)
+diff --git a/src/include/stdlib.h b/src/include/stdlib.h
+index e9da2015..812b04de 100644
+--- a/src/include/stdlib.h
++++ b/src/include/stdlib.h
+@@ -8,6 +8,7 @@ hidden void __env_rm_add(char *, char *);
+ hidden int __mkostemps(char *, int, int);
+ hidden int __ptsname_r(int, char *, size_t);
+ hidden char *__randname(char *);
++hidden void __qsort_r (void *, size_t, size_t, int (*)(const void *, const void *, void *), void *);
+
+ hidden void *__libc_malloc(size_t);
+ hidden void *__libc_malloc_impl(size_t);
+diff --git a/src/stdlib/qsort.c b/src/stdlib/qsort.c
+index da58fd31..20e40dda 100644
+--- a/src/stdlib/qsort.c
++++ b/src/stdlib/qsort.c
+@@ -24,6 +24,7 @@
+ /* Smoothsort, an adaptive variant of Heapsort. Memory usage: O(1).
+ Run time: Worst case O(n log n), close to O(n) in the mostly-sorted case. */
+
++#define _BSD_SOURCE
+ #include <stdint.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -31,7 +32,7 @@
+ #include "atomic.h"
+ #define ntz(x) a_ctz_l((x))
+
+-typedef int (*cmpfun)(const void *, const void *);
++typedef int (*cmpfun)(const void *, const void *, void *);
+
+ static inline int pntz(size_t p[2]) {
+ int r = ntz(p[0] - 1);
+@@ -88,7 +89,7 @@ static inline void shr(size_t p[2], int n)
+ p[1] >>= n;
+ }
+
+-static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size_t lp[])
++static void sift(unsigned char *head, size_t width, cmpfun cmp, void *arg, int pshift, size_t lp[])
+ {
+ unsigned char *rt, *lf;
+ unsigned char *ar[14 * sizeof(size_t) + 1];
+@@ -99,10 +100,10 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size
+ rt = head - width;
+ lf = head - width - lp[pshift - 2];
+
+- if((*cmp)(ar[0], lf) >= 0 && (*cmp)(ar[0], rt) >= 0) {
++ if(cmp(ar[0], lf, arg) >= 0 && cmp(ar[0], rt, arg) >= 0) {
+ break;
+ }
+- if((*cmp)(lf, rt) >= 0) {
++ if(cmp(lf, rt, arg) >= 0) {
+ ar[i++] = lf;
+ head = lf;
+ pshift -= 1;
+@@ -115,7 +116,7 @@ static void sift(unsigned char *head, size_t width, cmpfun cmp, int pshift, size
+ cycle(width, ar, i);
+ }
+
+-static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], int pshift, int trusty, size_t lp[])
++static void trinkle(unsigned char *head, size_t width, cmpfun cmp, void *arg, size_t pp[2], int pshift, int trusty, size_t lp[])
+ {
+ unsigned char *stepson,
+ *rt, *lf;
+@@ -130,13 +131,13 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2],
+ ar[0] = head;
+ while(p[0] != 1 || p[1] != 0) {
+ stepson = head - lp[pshift];
+- if((*cmp)(stepson, ar[0]) <= 0) {
++ if(cmp(stepson, ar[0], arg) <= 0) {
+ break;
+ }
+ if(!trusty && pshift > 1) {
+ rt = head - width;
+ lf = head - width - lp[pshift - 2];
+- if((*cmp)(rt, stepson) >= 0 || (*cmp)(lf, stepson) >= 0) {
++ if(cmp(rt, stepson, arg) >= 0 || cmp(lf, stepson, arg) >= 0) {
+ break;
+ }
+ }
+@@ -150,11 +151,11 @@ static void trinkle(unsigned char *head, size_t width, cmpfun cmp, size_t pp[2],
+ }
+ if(!trusty) {
+ cycle(width, ar, i);
+- sift(head, width, cmp, pshift, lp);
++ sift(head, width, cmp, arg, pshift, lp);
+ }
+ }
+
+-void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
++void __qsort_r(void *base, size_t nel, size_t width, cmpfun cmp, void *arg)
+ {
+ size_t lp[12*sizeof(size_t)];
+ size_t i, size = width * nel;
+@@ -173,16 +174,16 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
+
+ while(head < high) {
+ if((p[0] & 3) == 3) {
+- sift(head, width, cmp, pshift, lp);
++ sift(head, width, cmp, arg, pshift, lp);
+ shr(p, 2);
+ pshift += 2;
+ } else {
+ if(lp[pshift - 1] >= high - head) {
+- trinkle(head, width, cmp, p, pshift, 0, lp);
++ trinkle(head, width, cmp, arg, p, pshift, 0, lp);
+ } else {
+- sift(head, width, cmp, pshift, lp);
++ sift(head, width, cmp, arg, pshift, lp);
+ }
+-
++
+ if(pshift == 1) {
+ shl(p, 1);
+ pshift = 0;
+@@ -191,12 +192,12 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
+ pshift = 1;
+ }
+ }
+-
++
+ p[0] |= 1;
+ head += width;
+ }
+
+- trinkle(head, width, cmp, p, pshift, 0, lp);
++ trinkle(head, width, cmp, arg, p, pshift, 0, lp);
+
+ while(pshift != 1 || p[0] != 1 || p[1] != 0) {
+ if(pshift <= 1) {
+@@ -208,11 +209,13 @@ void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
+ pshift -= 2;
+ p[0] ^= 7;
+ shr(p, 1);
+- trinkle(head - lp[pshift] - width, width, cmp, p, pshift + 1, 1, lp);
++ trinkle(head - lp[pshift] - width, width, cmp, arg, p, pshift + 1, 1, lp);
+ shl(p, 1);
+ p[0] |= 1;
+- trinkle(head - width, width, cmp, p, pshift, 1, lp);
++ trinkle(head - width, width, cmp, arg, p, pshift, 1, lp);
+ }
+ head -= width;
+ }
+ }
++
++weak_alias(__qsort_r, qsort_r);
+diff --git a/src/stdlib/qsort_nr.c b/src/stdlib/qsort_nr.c
+new file mode 100644
+index 00000000..fe408fb1
+--- /dev/null
++++ b/src/stdlib/qsort_nr.c
+@@ -0,0 +1,14 @@
++#define _BSD_SOURCE
++#include <stdlib.h>
++
++typedef int (*cmpfun)(const void *, const void *);
++
++static int wrapper_cmp(const void *v1, const void *v2, void *cmp)
++{
++ return ((cmpfun)cmp)(v1, v2);
++}
++
++void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
++{
++ __qsort_r(base, nel, width, wrapper_cmp, cmp);
++}
+--
+2.30.2
diff --git a/repo/system/musl/syscall-cp-epoll.patch b/repo/system/musl/syscall-cp-epoll.patch
new file mode 100644
index 0000000..338620a
--- /dev/null
+++ b/repo/system/musl/syscall-cp-epoll.patch
@@ -0,0 +1,16 @@
+diff --git a/src/linux/epoll.c b/src/linux/epoll.c
+index deff5b10..93baa814 100644
+--- a/src/linux/epoll.c
++++ b/src/linux/epoll.c
+@@ -24,9 +24,9 @@ int epoll_ctl(int fd, int op, int fd2, struct epoll_event *ev)
+
+ int epoll_pwait(int fd, struct epoll_event *ev, int cnt, int to, const sigset_t *sigs)
+ {
+- int r = __syscall(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
++ int r = __syscall_cp(SYS_epoll_pwait, fd, ev, cnt, to, sigs, _NSIG/8);
+ #ifdef SYS_epoll_wait
+- if (r==-ENOSYS && !sigs) r = __syscall(SYS_epoll_wait, fd, ev, cnt, to);
++ if (r==-ENOSYS && !sigs) r = __syscall_cp(SYS_epoll_wait, fd, ev, cnt, to);
+ #endif
+ return __syscall_ret(r);
+ }
diff --git a/repo/system/ncurses.xibuild b/repo/system/ncurses/ncurses.xibuild
index 784ec63..784ec63 100644
--- a/repo/system/ncurses.xibuild
+++ b/repo/system/ncurses/ncurses.xibuild
diff --git a/repo/system/nettle.xibuild b/repo/system/nettle/nettle.xibuild
index a0107c5..a0107c5 100644
--- a/repo/system/nettle.xibuild
+++ b/repo/system/nettle/nettle.xibuild
diff --git a/repo/system/networkmanager/networkmanager-dispatcher.initd b/repo/system/networkmanager/networkmanager-dispatcher.initd
new file mode 100644
index 0000000..552cc15
--- /dev/null
+++ b/repo/system/networkmanager/networkmanager-dispatcher.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+
+supervisor=supervise-daemon
+command=/usr/libexec/nm-dispatcher
+command_args_foreground="--persist"
+
+description="Network Manager Dispatcher Daemon"
+
+depend() {
+ need dbus
+ before networkmanager
+}
diff --git a/repo/system/networkmanager/networkmanager.conf b/repo/system/networkmanager/networkmanager.conf
new file mode 100644
index 0000000..526d2e4
--- /dev/null
+++ b/repo/system/networkmanager/networkmanager.conf
@@ -0,0 +1,2 @@
+[main]
+dhcp=internal
diff --git a/repo/system/networkmanager/networkmanager.initd b/repo/system/networkmanager/networkmanager.initd
new file mode 100644
index 0000000..4ca6a0d
--- /dev/null
+++ b/repo/system/networkmanager/networkmanager.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+# Copyright (c) 2008 Saleem Abdulrasool <compnerd@compnerd.org>
+# Distributed under the terms of the GNU General Purpose License v2
+# $Header: $
+
+supervisor=supervise-daemon
+command=/usr/sbin/NetworkManager
+command_args_foreground="-n"
+
+description="Network Manager Daemon"
+
+depend() {
+ need dbus
+ provide net
+}
+
+# vim: set ft=gentoo-init-d ts=3 sw=3 et:
diff --git a/repo/system/networkmanager/networkmanager.rules b/repo/system/networkmanager/networkmanager.rules
new file mode 100644
index 0000000..66d21d6
--- /dev/null
+++ b/repo/system/networkmanager/networkmanager.rules
@@ -0,0 +1,9 @@
+// Let users in plugdev group modify NetworkManager
+polkit.addRule(function(action, subject) {
+ if (action.id == "org.freedesktop.NetworkManager.settings.modify.system" &&
+ subject.isInGroup("plugdev") && subject.active) {
+ return "yes";
+ }
+});
+
+
diff --git a/repo/system/networkmanager.xibuild b/repo/system/networkmanager/networkmanager.xibuild
index 910b601..910b601 100644
--- a/repo/system/networkmanager.xibuild
+++ b/repo/system/networkmanager/networkmanager.xibuild
diff --git a/repo/system/newt.xibuild b/repo/system/newt/newt.xibuild
index 6696f55..6696f55 100644
--- a/repo/system/newt.xibuild
+++ b/repo/system/newt/newt.xibuild
diff --git a/repo/system/nodejs/disable-running-gyp-on-shared-deps.patch b/repo/system/nodejs/disable-running-gyp-on-shared-deps.patch
new file mode 100644
index 0000000..f646201
--- /dev/null
+++ b/repo/system/nodejs/disable-running-gyp-on-shared-deps.patch
@@ -0,0 +1,20 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 26 Nov 2016 01:32:00 +0200
+Subject: Disable running gyp on shared deps
+
+Author: Stephen Gallagher <sgallagh@redhat.com>
+
+Modified 2016-11-26 by Jakub Jirutka <jakub@jirutka.cz> to update for
+Node.js 7.2.0
+
+--- a/Makefile
++++ b/Makefile
+@@ -141,7 +141,7 @@
+ echo "'test-code-cache' target is a noop"
+
+ out/Makefile: config.gypi common.gypi node.gyp \
+- deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
++ deps/uv/uv.gyp deps/llhttp/llhttp.gyp \
+ tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
+ tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
+ $(PYTHON) tools/gyp_node.py -f make
diff --git a/repo/system/nodejs/fix-build-with-system-c-ares.patch b/repo/system/nodejs/fix-build-with-system-c-ares.patch
new file mode 100644
index 0000000..8121891
--- /dev/null
+++ b/repo/system/nodejs/fix-build-with-system-c-ares.patch
@@ -0,0 +1,535 @@
+From aff98a5667c22794e2eaf658f6dfbee54cdd4a3b Mon Sep 17 00:00:00 2001
+From: Felix Yan <felixonmars@archlinux.org>
+Date: Thu, 12 Aug 2021 02:44:43 +0800
+Subject: [PATCH 1/2] deps: fix building with system c-ares on Linux
+Patch-Source: https://github.com/nodejs/node/pull/39739
+
+The change in #39724 breaks building with system c-ares
+(`--shared-cares`):
+```
+In file included from ../src/cares_wrap.cc:25:
+../src/cares_wrap.h:25:11: fatal error: ares_nameser.h: No such file or
+directory
+ 25 | # include <ares_nameser.h>
+ | ^~~~~~~~~~~~~~~~
+```
+
+Since `ares_nameser.h` isn't available with a default system c-ares
+installation, let's copy it as our private header here.
+
+Tested to build fine on Arch Linux with shared c-ares.
+---
+ src/ares_nameser.h | 482 +++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 482 insertions(+)
+ create mode 100644 src/ares_nameser.h
+
+diff --git a/src/ares_nameser.h b/src/ares_nameser.h
+new file mode 100644
+index 000000000000..5270e5a3a6a0
+--- /dev/null
++++ b/src/ares_nameser.h
+@@ -0,0 +1,482 @@
++
++#ifndef ARES_NAMESER_H
++#define ARES_NAMESER_H
++
++#ifdef HAVE_ARPA_NAMESER_H
++# include <arpa/nameser.h>
++#endif
++#ifdef HAVE_ARPA_NAMESER_COMPAT_H
++# include <arpa/nameser_compat.h>
++#endif
++
++/* ============================================================================
++ * arpa/nameser.h may or may not provide ALL of the below defines, so check
++ * each one individually and set if not
++ * ============================================================================
++ */
++
++#ifndef NS_PACKETSZ
++# define NS_PACKETSZ 512 /* maximum packet size */
++#endif
++
++#ifndef NS_MAXDNAME
++# define NS_MAXDNAME 256 /* maximum domain name */
++#endif
++
++#ifndef NS_MAXCDNAME
++# define NS_MAXCDNAME 255 /* maximum compressed domain name */
++#endif
++
++#ifndef NS_MAXLABEL
++# define NS_MAXLABEL 63
++#endif
++
++#ifndef NS_HFIXEDSZ
++# define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */
++#endif
++
++#ifndef NS_QFIXEDSZ
++# define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */
++#endif
++
++#ifndef NS_RRFIXEDSZ
++# define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
++#endif
++
++#ifndef NS_INT16SZ
++# define NS_INT16SZ 2
++#endif
++
++#ifndef NS_INADDRSZ
++# define NS_INADDRSZ 4
++#endif
++
++#ifndef NS_IN6ADDRSZ
++# define NS_IN6ADDRSZ 16
++#endif
++
++#ifndef NS_CMPRSFLGS
++# define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */
++#endif
++
++#ifndef NS_DEFAULTPORT
++# define NS_DEFAULTPORT 53 /* For both TCP and UDP. */
++#endif
++
++/* ============================================================================
++ * arpa/nameser.h should provide these enumerations always, so if not found,
++ * provide them
++ * ============================================================================
++ */
++#ifndef HAVE_ARPA_NAMESER_H
++
++typedef enum __ns_class {
++ ns_c_invalid = 0, /* Cookie. */
++ ns_c_in = 1, /* Internet. */
++ ns_c_2 = 2, /* unallocated/unsupported. */
++ ns_c_chaos = 3, /* MIT Chaos-net. */
++ ns_c_hs = 4, /* MIT Hesiod. */
++ /* Query class values which do not appear in resource records */
++ ns_c_none = 254, /* for prereq. sections in update requests */
++ ns_c_any = 255, /* Wildcard match. */
++ ns_c_max = 65536
++} ns_class;
++
++typedef enum __ns_type {
++ ns_t_invalid = 0, /* Cookie. */
++ ns_t_a = 1, /* Host address. */
++ ns_t_ns = 2, /* Authoritative server. */
++ ns_t_md = 3, /* Mail destination. */
++ ns_t_mf = 4, /* Mail forwarder. */
++ ns_t_cname = 5, /* Canonical name. */
++ ns_t_soa = 6, /* Start of authority zone. */
++ ns_t_mb = 7, /* Mailbox domain name. */
++ ns_t_mg = 8, /* Mail group member. */
++ ns_t_mr = 9, /* Mail rename name. */
++ ns_t_null = 10, /* Null resource record. */
++ ns_t_wks = 11, /* Well known service. */
++ ns_t_ptr = 12, /* Domain name pointer. */
++ ns_t_hinfo = 13, /* Host information. */
++ ns_t_minfo = 14, /* Mailbox information. */
++ ns_t_mx = 15, /* Mail routing information. */
++ ns_t_txt = 16, /* Text strings. */
++ ns_t_rp = 17, /* Responsible person. */
++ ns_t_afsdb = 18, /* AFS cell database. */
++ ns_t_x25 = 19, /* X_25 calling address. */
++ ns_t_isdn = 20, /* ISDN calling address. */
++ ns_t_rt = 21, /* Router. */
++ ns_t_nsap = 22, /* NSAP address. */
++ ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
++ ns_t_sig = 24, /* Security signature. */
++ ns_t_key = 25, /* Security key. */
++ ns_t_px = 26, /* X.400 mail mapping. */
++ ns_t_gpos = 27, /* Geographical position (withdrawn). */
++ ns_t_aaaa = 28, /* Ip6 Address. */
++ ns_t_loc = 29, /* Location Information. */
++ ns_t_nxt = 30, /* Next domain (security). */
++ ns_t_eid = 31, /* Endpoint identifier. */
++ ns_t_nimloc = 32, /* Nimrod Locator. */
++ ns_t_srv = 33, /* Server Selection. */
++ ns_t_atma = 34, /* ATM Address */
++ ns_t_naptr = 35, /* Naming Authority PoinTeR */
++ ns_t_kx = 36, /* Key Exchange */
++ ns_t_cert = 37, /* Certification record */
++ ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
++ ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
++ ns_t_sink = 40, /* Kitchen sink (experimentatl) */
++ ns_t_opt = 41, /* EDNS0 option (meta-RR) */
++ ns_t_apl = 42, /* Address prefix list (RFC3123) */
++ ns_t_ds = 43, /* Delegation Signer (RFC4034) */
++ ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */
++ ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */
++ ns_t_nsec = 47, /* Next Secure (RFC4034) */
++ ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */
++ ns_t_tkey = 249, /* Transaction key */
++ ns_t_tsig = 250, /* Transaction signature. */
++ ns_t_ixfr = 251, /* Incremental zone transfer. */
++ ns_t_axfr = 252, /* Transfer zone of authority. */
++ ns_t_mailb = 253, /* Transfer mailbox records. */
++ ns_t_maila = 254, /* Transfer mail agent records. */
++ ns_t_any = 255, /* Wildcard match. */
++ ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
++ ns_t_caa = 257, /* Certification Authority Authorization. */
++ ns_t_max = 65536
++} ns_type;
++
++typedef enum __ns_opcode {
++ ns_o_query = 0, /* Standard query. */
++ ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */
++ ns_o_status = 2, /* Name server status query (unsupported). */
++ /* Opcode 3 is undefined/reserved. */
++ ns_o_notify = 4, /* Zone change notification. */
++ ns_o_update = 5, /* Zone update message. */
++ ns_o_max = 6
++} ns_opcode;
++
++typedef enum __ns_rcode {
++ ns_r_noerror = 0, /* No error occurred. */
++ ns_r_formerr = 1, /* Format error. */
++ ns_r_servfail = 2, /* Server failure. */
++ ns_r_nxdomain = 3, /* Name error. */
++ ns_r_notimpl = 4, /* Unimplemented. */
++ ns_r_refused = 5, /* Operation refused. */
++ /* these are for BIND_UPDATE */
++ ns_r_yxdomain = 6, /* Name exists */
++ ns_r_yxrrset = 7, /* RRset exists */
++ ns_r_nxrrset = 8, /* RRset does not exist */
++ ns_r_notauth = 9, /* Not authoritative for zone */
++ ns_r_notzone = 10, /* Zone of record different from zone section */
++ ns_r_max = 11,
++ /* The following are TSIG extended errors */
++ ns_r_badsig = 16,
++ ns_r_badkey = 17,
++ ns_r_badtime = 18
++} ns_rcode;
++
++#endif /* HAVE_ARPA_NAMESER_H */
++
++
++/* ============================================================================
++ * arpa/nameser_compat.h typically sets these. However on some systems
++ * arpa/nameser.h does, but may not set all of them. Lets conditionally
++ * define each
++ * ============================================================================
++ */
++
++#ifndef PACKETSZ
++# define PACKETSZ NS_PACKETSZ
++#endif
++
++#ifndef MAXDNAME
++# define MAXDNAME NS_MAXDNAME
++#endif
++
++#ifndef MAXCDNAME
++# define MAXCDNAME NS_MAXCDNAME
++#endif
++
++#ifndef MAXLABEL
++# define MAXLABEL NS_MAXLABEL
++#endif
++
++#ifndef HFIXEDSZ
++# define HFIXEDSZ NS_HFIXEDSZ
++#endif
++
++#ifndef QFIXEDSZ
++# define QFIXEDSZ NS_QFIXEDSZ
++#endif
++
++#ifndef RRFIXEDSZ
++# define RRFIXEDSZ NS_RRFIXEDSZ
++#endif
++
++#ifndef INDIR_MASK
++# define INDIR_MASK NS_CMPRSFLGS
++#endif
++
++#ifndef NAMESERVER_PORT
++# define NAMESERVER_PORT NS_DEFAULTPORT
++#endif
++
++
++/* opcodes */
++#ifndef O_QUERY
++# define O_QUERY 0 /* ns_o_query */
++#endif
++#ifndef O_IQUERY
++# define O_IQUERY 1 /* ns_o_iquery */
++#endif
++#ifndef O_STATUS
++# define O_STATUS 2 /* ns_o_status */
++#endif
++#ifndef O_NOTIFY
++# define O_NOTIFY 4 /* ns_o_notify */
++#endif
++#ifndef O_UPDATE
++# define O_UPDATE 5 /* ns_o_update */
++#endif
++
++
++/* response codes */
++#ifndef SERVFAIL
++# define SERVFAIL ns_r_servfail
++#endif
++#ifndef NOTIMP
++# define NOTIMP ns_r_notimpl
++#endif
++#ifndef REFUSED
++# define REFUSED ns_r_refused
++#endif
++#if defined(_WIN32) && !defined(HAVE_ARPA_NAMESER_COMPAT_H) && defined(NOERROR)
++# undef NOERROR /* it seems this is already defined in winerror.h */
++#endif
++#ifndef NOERROR
++# define NOERROR ns_r_noerror
++#endif
++#ifndef FORMERR
++# define FORMERR ns_r_formerr
++#endif
++#ifndef NXDOMAIN
++# define NXDOMAIN ns_r_nxdomain
++#endif
++/* Non-standard response codes, use numeric values */
++#ifndef YXDOMAIN
++# define YXDOMAIN 6 /* ns_r_yxdomain */
++#endif
++#ifndef YXRRSET
++# define YXRRSET 7 /* ns_r_yxrrset */
++#endif
++#ifndef NXRRSET
++# define NXRRSET 8 /* ns_r_nxrrset */
++#endif
++#ifndef NOTAUTH
++# define NOTAUTH 9 /* ns_r_notauth */
++#endif
++#ifndef NOTZONE
++# define NOTZONE 10 /* ns_r_notzone */
++#endif
++#ifndef TSIG_BADSIG
++# define TSIG_BADSIG 16 /* ns_r_badsig */
++#endif
++#ifndef TSIG_BADKEY
++# define TSIG_BADKEY 17 /* ns_r_badkey */
++#endif
++#ifndef TSIG_BADTIME
++# define TSIG_BADTIME 18 /* ns_r_badtime */
++#endif
++
++
++/* classes */
++#ifndef C_IN
++# define C_IN 1 /* ns_c_in */
++#endif
++#ifndef C_CHAOS
++# define C_CHAOS 3 /* ns_c_chaos */
++#endif
++#ifndef C_HS
++# define C_HS 4 /* ns_c_hs */
++#endif
++#ifndef C_NONE
++# define C_NONE 254 /* ns_c_none */
++#endif
++#ifndef C_ANY
++# define C_ANY 255 /* ns_c_any */
++#endif
++
++
++/* types */
++#ifndef T_A
++# define T_A 1 /* ns_t_a */
++#endif
++#ifndef T_NS
++# define T_NS 2 /* ns_t_ns */
++#endif
++#ifndef T_MD
++# define T_MD 3 /* ns_t_md */
++#endif
++#ifndef T_MF
++# define T_MF 4 /* ns_t_mf */
++#endif
++#ifndef T_CNAME
++# define T_CNAME 5 /* ns_t_cname */
++#endif
++#ifndef T_SOA
++# define T_SOA 6 /* ns_t_soa */
++#endif
++#ifndef T_MB
++# define T_MB 7 /* ns_t_mb */
++#endif
++#ifndef T_MG
++# define T_MG 8 /* ns_t_mg */
++#endif
++#ifndef T_MR
++# define T_MR 9 /* ns_t_mr */
++#endif
++#ifndef T_NULL
++# define T_NULL 10 /* ns_t_null */
++#endif
++#ifndef T_WKS
++# define T_WKS 11 /* ns_t_wks */
++#endif
++#ifndef T_PTR
++# define T_PTR 12 /* ns_t_ptr */
++#endif
++#ifndef T_HINFO
++# define T_HINFO 13 /* ns_t_hinfo */
++#endif
++#ifndef T_MINFO
++# define T_MINFO 14 /* ns_t_minfo */
++#endif
++#ifndef T_MX
++# define T_MX 15 /* ns_t_mx */
++#endif
++#ifndef T_TXT
++# define T_TXT 16 /* ns_t_txt */
++#endif
++#ifndef T_RP
++# define T_RP 17 /* ns_t_rp */
++#endif
++#ifndef T_AFSDB
++# define T_AFSDB 18 /* ns_t_afsdb */
++#endif
++#ifndef T_X25
++# define T_X25 19 /* ns_t_x25 */
++#endif
++#ifndef T_ISDN
++# define T_ISDN 20 /* ns_t_isdn */
++#endif
++#ifndef T_RT
++# define T_RT 21 /* ns_t_rt */
++#endif
++#ifndef T_NSAP
++# define T_NSAP 22 /* ns_t_nsap */
++#endif
++#ifndef T_NSAP_PTR
++# define T_NSAP_PTR 23 /* ns_t_nsap_ptr */
++#endif
++#ifndef T_SIG
++# define T_SIG 24 /* ns_t_sig */
++#endif
++#ifndef T_KEY
++# define T_KEY 25 /* ns_t_key */
++#endif
++#ifndef T_PX
++# define T_PX 26 /* ns_t_px */
++#endif
++#ifndef T_GPOS
++# define T_GPOS 27 /* ns_t_gpos */
++#endif
++#ifndef T_AAAA
++# define T_AAAA 28 /* ns_t_aaaa */
++#endif
++#ifndef T_LOC
++# define T_LOC 29 /* ns_t_loc */
++#endif
++#ifndef T_NXT
++# define T_NXT 30 /* ns_t_nxt */
++#endif
++#ifndef T_EID
++# define T_EID 31 /* ns_t_eid */
++#endif
++#ifndef T_NIMLOC
++# define T_NIMLOC 32 /* ns_t_nimloc */
++#endif
++#ifndef T_SRV
++# define T_SRV 33 /* ns_t_srv */
++#endif
++#ifndef T_ATMA
++# define T_ATMA 34 /* ns_t_atma */
++#endif
++#ifndef T_NAPTR
++# define T_NAPTR 35 /* ns_t_naptr */
++#endif
++#ifndef T_KX
++# define T_KX 36 /* ns_t_kx */
++#endif
++#ifndef T_CERT
++# define T_CERT 37 /* ns_t_cert */
++#endif
++#ifndef T_A6
++# define T_A6 38 /* ns_t_a6 */
++#endif
++#ifndef T_DNAME
++# define T_DNAME 39 /* ns_t_dname */
++#endif
++#ifndef T_SINK
++# define T_SINK 40 /* ns_t_sink */
++#endif
++#ifndef T_OPT
++# define T_OPT 41 /* ns_t_opt */
++#endif
++#ifndef T_APL
++# define T_APL 42 /* ns_t_apl */
++#endif
++#ifndef T_DS
++# define T_DS 43 /* ns_t_ds */
++#endif
++#ifndef T_SSHFP
++# define T_SSHFP 44 /* ns_t_sshfp */
++#endif
++#ifndef T_RRSIG
++# define T_RRSIG 46 /* ns_t_rrsig */
++#endif
++#ifndef T_NSEC
++# define T_NSEC 47 /* ns_t_nsec */
++#endif
++#ifndef T_DNSKEY
++# define T_DNSKEY 48 /* ns_t_dnskey */
++#endif
++#ifndef T_TKEY
++# define T_TKEY 249 /* ns_t_tkey */
++#endif
++#ifndef T_TSIG
++# define T_TSIG 250 /* ns_t_tsig */
++#endif
++#ifndef T_IXFR
++# define T_IXFR 251 /* ns_t_ixfr */
++#endif
++#ifndef T_AXFR
++# define T_AXFR 252 /* ns_t_axfr */
++#endif
++#ifndef T_MAILB
++# define T_MAILB 253 /* ns_t_mailb */
++#endif
++#ifndef T_MAILA
++# define T_MAILA 254 /* ns_t_maila */
++#endif
++#ifndef T_ANY
++# define T_ANY 255 /* ns_t_any */
++#endif
++#ifndef T_ZXFR
++# define T_ZXFR 256 /* ns_t_zxfr */
++#endif
++#ifndef T_CAA
++# define T_CAA 257 /* ns_t_caa */
++#endif
++#ifndef T_MAX
++# define T_MAX 65536 /* ns_t_max */
++#endif
++
++
++#endif /* ARES_NAMESER_H */
+
+From db4643979ee676b3a3d6cdf2fb597d399cf8013f Mon Sep 17 00:00:00 2001
+From: Felix Yan <felixonmars@archlinux.org>
+Date: Fri, 13 Aug 2021 00:01:59 +0800
+Subject: [PATCH 2/2] build: ignore cpplint for third-party ares_nameser.h
+
+---
+ Makefile | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Makefile b/Makefile
+index ec4c774748cd..c418995c53c1 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1289,6 +1289,7 @@ jslint-ci: lint-js-ci
+ LINT_CPP_ADDON_DOC_FILES_GLOB = test/addons/??_*/*.cc test/addons/??_*/*.h
+ LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB))
+ LINT_CPP_EXCLUDE ?=
++LINT_CPP_EXCLUDE += src/ares_nameser.h
+ LINT_CPP_EXCLUDE += src/node_root_certs.h
+ LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES)
+ LINT_CPP_EXCLUDE += $(wildcard test/js-native-api/??_*/*.cc test/js-native-api/??_*/*.h test/node-api/??_*/*.cc test/node-api/??_*/*.h)
diff --git a/repo/system/nodejs.xibuild b/repo/system/nodejs/nodejs.xibuild
index b4918c8..b4918c8 100644
--- a/repo/system/nodejs.xibuild
+++ b/repo/system/nodejs/nodejs.xibuild
diff --git a/repo/system/nspr.xibuild b/repo/system/nspr/nspr.xibuild
index 30a47da..30a47da 100644
--- a/repo/system/nspr.xibuild
+++ b/repo/system/nspr/nspr.xibuild
diff --git a/repo/system/nss/nss-config.in b/repo/system/nss/nss-config.in
new file mode 100644
index 0000000..f8f893e
--- /dev/null
+++ b/repo/system/nss/nss-config.in
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+prefix=@prefix@
+
+major_version=@MOD_MAJOR_VERSION@
+minor_version=@MOD_MINOR_VERSION@
+patch_version=@MOD_PATCH_VERSION@
+
+usage()
+{
+ cat <<EOF
+Usage: nss-config [OPTIONS] [LIBRARIES]
+Options:
+ [--prefix[=DIR]]
+ [--exec-prefix[=DIR]]
+ [--includedir[=DIR]]
+ [--libdir[=DIR]]
+ [--version]
+ [--libs]
+ [--cflags]
+Dynamic Libraries:
+ nss
+ nssutil
+ ssl
+ smime
+EOF
+ exit $1
+}
+
+if test $# -eq 0; then
+ usage 1 1>&2
+fi
+
+lib_ssl=yes
+lib_smime=yes
+lib_nss=yes
+lib_nssutil=yes
+
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+
+ case $1 in
+ --prefix=*)
+ prefix=$optarg
+ ;;
+ --prefix)
+ echo_prefix=yes
+ ;;
+ --exec-prefix=*)
+ exec_prefix=$optarg
+ ;;
+ --exec-prefix)
+ echo_exec_prefix=yes
+ ;;
+ --includedir=*)
+ includedir=$optarg
+ ;;
+ --includedir)
+ echo_includedir=yes
+ ;;
+ --libdir=*)
+ libdir=$optarg
+ ;;
+ --libdir)
+ echo_libdir=yes
+ ;;
+ --version)
+ echo ${major_version}.${minor_version}.${patch_version}
+ ;;
+ --cflags)
+ echo_cflags=yes
+ ;;
+ --libs)
+ echo_libs=yes
+ ;;
+ ssl)
+ lib_ssl=yes
+ ;;
+ smime)
+ lib_smime=yes
+ ;;
+ nss)
+ lib_nss=yes
+ ;;
+ nssutil)
+ lib_nssutil=yes
+ ;;
+ *)
+ usage 1 1>&2
+ ;;
+ esac
+ shift
+done
+
+# Set variables that may be dependent upon other variables
+if test -z "$exec_prefix"; then
+ exec_prefix=`pkg-config --variable=exec_prefix nss`
+fi
+if test -z "$includedir"; then
+ includedir=`pkg-config --variable=includedir nss`
+fi
+if test -z "$libdir"; then
+ libdir=`pkg-config --variable=libdir nss`
+fi
+
+if test "$echo_prefix" = "yes"; then
+ echo $prefix
+fi
+
+if test "$echo_exec_prefix" = "yes"; then
+ echo $exec_prefix
+fi
+
+if test "$echo_includedir" = "yes"; then
+ echo $includedir
+fi
+
+if test "$echo_libdir" = "yes"; then
+ echo $libdir
+fi
+
+if test "$echo_cflags" = "yes"; then
+ echo -I$includedir
+fi
+
+if test "$echo_libs" = "yes"; then
+ libdirs="-Wl,-rpath-link,$libdir -L$libdir"
+ if test -n "$lib_ssl"; then
+ libdirs="$libdirs -lssl${major_version}"
+ fi
+ if test -n "$lib_smime"; then
+ libdirs="$libdirs -lsmime${major_version}"
+ fi
+ if test -n "$lib_nss"; then
+ libdirs="$libdirs -lnss${major_version}"
+ fi
+ if test -n "$lib_nssutil"; then
+ libdirs="$libdirs -lnssutil${major_version}"
+ fi
+ echo $libdirs
+fi
+
diff --git a/repo/system/nss/nss-softokn.pc.in b/repo/system/nss/nss-softokn.pc.in
new file mode 100644
index 0000000..50485ac
--- /dev/null
+++ b/repo/system/nss/nss-softokn.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: NSS-SOFTOKN
+Description: Network Security Services Softoken PKCS #11 Module
+Version: %SOFTOKEN_VERSION%
+Requires: nspr >= %NSPR_VERSION%, nss-util >= %NSSUTIL_VERSION%
+Libs: -lfreebl3 -lnssdbm3 -lsoftokn3
+Cflags: -I${includedir}/private
diff --git a/repo/system/nss/nss-util.pc.in b/repo/system/nss/nss-util.pc.in
new file mode 100644
index 0000000..1310248
--- /dev/null
+++ b/repo/system/nss/nss-util.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: NSS-UTIL
+Description: Network Security Services Utility Library
+Version: %NSSUTIL_VERSION%
+Requires: nspr >= %NSPR_VERSION%
+Libs: -L${libdir} -lnssutil3
+Cflags: -I${includedir}
diff --git a/repo/system/nss/nss.pc.in b/repo/system/nss/nss.pc.in
new file mode 100644
index 0000000..d47b9e1
--- /dev/null
+++ b/repo/system/nss/nss.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+exec_prefix=%exec_prefix%
+libdir=%libdir%
+includedir=%includedir%
+
+Name: NSS
+Description: Network Security Services
+Version: %NSS_VERSION%
+Requires: nspr >= %NSPR_VERSION%
+Libs: -lssl3 -lsmime3 -lnss3 -lnssutil3
+Cflags: -I${includedir}
diff --git a/repo/system/nss.xibuild b/repo/system/nss/nss.xibuild
index 07aa866..07aa866 100644
--- a/repo/system/nss.xibuild
+++ b/repo/system/nss/nss.xibuild
diff --git a/repo/system/nsss.xibuild b/repo/system/nsss/nsss.xibuild
index 2623641..2623641 100644
--- a/repo/system/nsss.xibuild
+++ b/repo/system/nsss/nsss.xibuild
diff --git a/repo/system/openntpd/libtls-standalone.patch b/repo/system/openntpd/libtls-standalone.patch
new file mode 100644
index 0000000..3b5d8e4
--- /dev/null
+++ b/repo/system/openntpd/libtls-standalone.patch
@@ -0,0 +1,20 @@
+diff --git a/configure.ac b/configure.ac
+index 88884c2..b0c0697 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -60,8 +60,13 @@ AM_CONDITIONAL([HAVE_CLOCK_GETRES], [test "x$ac_cv_func_clock_getres" = xyes])
+ AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "x$ac_cv_func_clock_gettime" = xyes])
+
+ # check for libtls
+-AC_SEARCH_LIBS([tls_config_set_ca_mem],[tls],
+- [LIBS="$LIBS -ltls -lssl -lcrypto"],,[-lssl -lcrypto])
++PKG_CHECK_MODULES([LIBTLS], [libtls],[],[
++ PKG_CHECK_MODULES([LIBTLS], [libtls-standalone])
++ ])
++AC_SEARCH_LIBS([tls_config_set_ca_mem],[tls tls-standalone],
++ [LIBS="$LIBS $LIBTLS_LIBS"
++ CFLAGS="$CFLAGS $LIBTLS_CFLAGS"],
++ ,[$LIBTLS_LIBS])
+ AC_CHECK_FUNCS([tls_config_set_ca_mem])
+
+ # check if libtls uses 3-argument tls_write
diff --git a/repo/system/openntpd/ntp-user.patch b/repo/system/openntpd/ntp-user.patch
new file mode 100644
index 0000000..200676c
--- /dev/null
+++ b/repo/system/openntpd/ntp-user.patch
@@ -0,0 +1,13 @@
+diff --git a/src/ntpd.h b/src/ntpd.h
+index 6403391..cc41d42 100644
+--- a/src/ntpd.h
++++ b/src/ntpd.h
+@@ -37,7 +37,7 @@
+ #define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
+
+ #ifndef NTPD_USER
+-#define NTPD_USER "_ntp"
++#define NTPD_USER "ntp"
+ #endif
+
+ #ifndef SYSCONFDIR
diff --git a/repo/system/openntpd/openntpd.confd b/repo/system/openntpd/openntpd.confd
new file mode 100644
index 0000000..ec002b7
--- /dev/null
+++ b/repo/system/openntpd/openntpd.confd
@@ -0,0 +1,3 @@
+# See ntpd(8) man page ... some popular options:
+# -s Set the time immediately at startup
+#NTPD_OPTS=
diff --git a/repo/system/openntpd/openntpd.initd b/repo/system/openntpd/openntpd.initd
new file mode 100644
index 0000000..dc9a9ae
--- /dev/null
+++ b/repo/system/openntpd/openntpd.initd
@@ -0,0 +1,14 @@
+#!/sbin/openrc-run
+
+name="NTP Server"
+command=/usr/sbin/ntpd
+command_args="-d $NTPD_OPTS"
+command_background=yes
+pidfile=/run/$RC_SVCNAME.pid
+required_files=/etc/ntpd.conf
+
+depend() {
+ need net
+ provide ntp-client
+ use dns logger
+}
diff --git a/repo/system/openntpd.xibuild b/repo/system/openntpd/openntpd.xibuild
index 5dfd7e9..5dfd7e9 100644
--- a/repo/system/openntpd.xibuild
+++ b/repo/system/openntpd/openntpd.xibuild
diff --git a/repo/system/openrc/0001-call-sbin-mkmntdirs-in-localmount-OpenRC-service.patch b/repo/system/openrc/0001-call-sbin-mkmntdirs-in-localmount-OpenRC-service.patch
new file mode 100644
index 0000000..3d41060
--- /dev/null
+++ b/repo/system/openrc/0001-call-sbin-mkmntdirs-in-localmount-OpenRC-service.patch
@@ -0,0 +1,25 @@
+From 78245081fe109ed7777b79ba9c99890d56c21272 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 1 Feb 2017 04:04:52 +0000
+Subject: [PATCH] call /sbin/mkmntdirs in localmount OpenRC service
+
+---
+ init.d/localmount.in | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/init.d/localmount.in b/init.d/localmount.in
+index c571504a..14189396 100644
+--- a/init.d/localmount.in
++++ b/init.d/localmount.in
+@@ -21,6 +21,8 @@ depend()
+
+ start()
+ {
++ [ -x /sbin/mkmntdirs ] && mkmntdirs
++
+ # Mount local filesystems in /etc/fstab.
+ # The types variable must start with no, and must be a type
+ local critical= types="noproc" x= no_netdev= rc=
+--
+2.33.1
+
diff --git a/repo/system/openrc/0002-fsck-don-t-add-C0-to-busybox-fsck.patch b/repo/system/openrc/0002-fsck-don-t-add-C0-to-busybox-fsck.patch
new file mode 100644
index 0000000..1d79818
--- /dev/null
+++ b/repo/system/openrc/0002-fsck-don-t-add-C0-to-busybox-fsck.patch
@@ -0,0 +1,35 @@
+From b143f35a45d59708365a52e329fd8caa6475a9bb Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 28 Nov 2017 13:35:10 +0100
+Subject: [PATCH] fsck: don't add -C0 to busybox fsck
+
+---
+ init.d/fsck.in | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/init.d/fsck.in b/init.d/fsck.in
+index 7052d808..99a9ae4f 100644
+--- a/init.d/fsck.in
++++ b/init.d/fsck.in
+@@ -82,7 +82,7 @@ start()
+ local skiptypes
+ skiptypes=$(printf 'no%s,' ${net_fs_list} ${extra_net_fs_list})
+ [ "${skiptypes}" = "no," ] && skiptypes=""
+- fsck_opts="$fsck_opts -C0 -T -t ${skiptypes}noopts=_netdev"
++ fsck_opts="$fsck_opts -T -t ${skiptypes}noopts=_netdev"
+ if [ -z "$fsck_passno" -a -z "$fsck_mnt" ]; then
+ fsck_args=${fsck_args:--A -p}
+ if echo 2>/dev/null >/.test.$$; then
+@@ -90,6 +90,9 @@ start()
+ fsck_opts="$fsck_opts -R"
+ fi
+ fi
++ if [ "$(readlink -f $(which fsck))" != "/bin/busybox" ]; then
++ fsck_opts="$fsck_opts -C0"
++ fi
+ fi
+
+ trap : INT QUIT
+--
+2.33.1
+
diff --git a/repo/system/openrc/0003-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch b/repo/system/openrc/0003-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch
new file mode 100644
index 0000000..546ccb7
--- /dev/null
+++ b/repo/system/openrc/0003-rc-pull-in-sysinit-and-boot-as-stacked-levels-when-n.patch
@@ -0,0 +1,70 @@
+From 17f33c1968a51484eefdafbfb5b8fef5ac13d215 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 1 Feb 2017 04:17:14 +0000
+Subject: [PATCH] rc: pull in sysinit and boot as stacked levels when needed
+
+We need start services from sysinit and boot runlevel, even if the new
+runlevel is empty.
+
+This fixes problem introduced with commit 7716bf31 (Fix stacked runlevel
+support), at which the start_services list are no longer used to start
+the services.
+
+This also make sure that all services in sysinit and boot runlevels are
+started before switching to next. This was not guaranteed when switching
+to a non-empty runlevel.
+
+Fixes issue #54.
+---
+ src/rc/rc.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/rc/rc.c b/src/rc/rc.c
+index ef46925d..82786074 100644
+--- a/src/rc/rc.c
++++ b/src/rc/rc.c
+@@ -729,6 +729,7 @@ int main(int argc, char **argv)
+ const char *bootlevel = NULL;
+ char *newlevel = NULL;
+ const char *systype = NULL;
++ RC_STRINGLIST *runlevel_chain;
+ RC_STRINGLIST *deporder = NULL;
+ RC_STRINGLIST *tmplist;
+ RC_STRING *service;
+@@ -986,6 +987,7 @@ int main(int argc, char **argv)
+ main_hotplugged_services = rc_services_in_state(RC_SERVICE_HOTPLUGGED);
+ main_start_services = rc_services_in_runlevel_stacked(newlevel ?
+ newlevel : runlevel);
++ runlevel_chain = rc_runlevel_stacks(newlevel ? newlevel : runlevel);
+ if (strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SHUTDOWN) != 0 &&
+ strcmp(newlevel ? newlevel : runlevel, RC_LEVEL_SYSINIT) != 0)
+ {
+@@ -1003,6 +1005,7 @@ int main(int argc, char **argv)
+ tmplist = rc_services_in_runlevel(bootlevel);
+ TAILQ_CONCAT(main_start_services, tmplist, entries);
+ free(tmplist);
++ rc_stringlist_add(runlevel_chain, bootlevel);
+ }
+ if (main_hotplugged_services) {
+ TAILQ_FOREACH(service, main_hotplugged_services,
+@@ -1011,6 +1014,7 @@ int main(int argc, char **argv)
+ service->value);
+ }
+ }
++ rc_stringlist_add(runlevel_chain, RC_LEVEL_SYSINIT);
+ }
+
+ parallel = rc_conf_yesno("rc_parallel");
+@@ -1067,9 +1071,6 @@ int main(int argc, char **argv)
+
+ /* If we have a list of services to start then... */
+ if (main_start_services) {
+- /* Get a list of the chained runlevels which compose the target runlevel */
+- RC_STRINGLIST *runlevel_chain = rc_runlevel_stacks(runlevel);
+-
+ /* Loop through them in reverse order. */
+ RC_STRING *rlevel;
+ TAILQ_FOREACH_REVERSE(rlevel, runlevel_chain, rc_stringlist, entries)
+--
+2.33.1
+
diff --git a/repo/system/openrc/0004-make-consolefont-service-compatible-with-busyboxs-se.patch b/repo/system/openrc/0004-make-consolefont-service-compatible-with-busyboxs-se.patch
new file mode 100644
index 0000000..b92b5ac
--- /dev/null
+++ b/repo/system/openrc/0004-make-consolefont-service-compatible-with-busyboxs-se.patch
@@ -0,0 +1,70 @@
+From 613fb7f437c42e0ed01b2366b597598235e64a2d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Wed, 17 Aug 2016 17:52:58 +0200
+Subject: [PATCH] make consolefont service compatible with busyboxs setfont
+ applet
+
+Compared to kdbs setfont program it doesn't support -O and -m.
+---
+ conf.d/consolefont | 11 ++---------
+ init.d/consolefont.in | 7 ++-----
+ 2 files changed, 4 insertions(+), 14 deletions(-)
+
+diff --git a/conf.d/consolefont b/conf.d/consolefont
+index e01ae842..75544b2f 100644
+--- a/conf.d/consolefont
++++ b/conf.d/consolefont
+@@ -3,16 +3,9 @@
+ #
+ # consolefont specifies the default font that you'd like Linux to use on the
+ # console. You can find a good selection of fonts in /usr/share/consolefonts;
+-# you shouldn't specify the trailing ".psf.gz", just the font name below.
+-# To use the default console font, comment out the CONSOLEFONT setting below.
+-consolefont="default8x16"
++consolefont="default8x16.psf.gz"
+
+ # consoletranslation is the charset map file to use. Leave commented to use
+ # the default one. Have a look in /usr/share/consoletrans for a selection of
+ # map files you can use.
+-#consoletranslation="8859-1_to_uni"
+-
+-# unicodemap is the unicode map file to use. Leave commented to use the
+-# default one. Have a look in /usr/share/unimaps for a selection of map files
+-# you can use.
+-#unicodemap="iso01"
++#consoletranslation="8859-1_to_uni.trans"
+diff --git a/init.d/consolefont.in b/init.d/consolefont.in
+index d65dd14c..ccb6ee87 100644
+--- a/init.d/consolefont.in
++++ b/init.d/consolefont.in
+@@ -22,7 +22,6 @@ start()
+ {
+ ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}}
+ consolefont=${consolefont:-${CONSOLEFONT}}
+- unicodemap=${unicodemap:-${UNICODEMAP}}
+ consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}}
+
+ if [ -z "$consolefont" ]; then
+@@ -43,9 +42,6 @@ start()
+ if [ -n "$consoletranslation" ]; then
+ param="$param -m $consoletranslation"
+ fi
+- if [ -n "${unicodemap}" ]; then
+- param="$param -u $unicodemap"
+- fi
+
+ # Set the console font
+ ebegin "Setting console font [$consolefont]"
+@@ -63,7 +59,8 @@ start()
+ # Store the font so we can use it ASAP on boot
+ if [ $retval -eq 0 ] && checkpath -W "$RC_LIBEXECDIR"; then
+ mkdir -p "$RC_LIBEXECDIR"/console
+- setfont -O "$RC_LIBEXECDIR"/console/font
++ zcat "/usr/share/consolefonts/$consolefont" \
++ > "$RC_LIBEXECDIR"/console/font
+ fi
+
+ return $retval
+--
+2.33.1
+
diff --git a/repo/system/openrc/0005-Support-early-loading-of-keymap-if-kbd-is-installed.patch b/repo/system/openrc/0005-Support-early-loading-of-keymap-if-kbd-is-installed.patch
new file mode 100644
index 0000000..f25d984
--- /dev/null
+++ b/repo/system/openrc/0005-Support-early-loading-of-keymap-if-kbd-is-installed.patch
@@ -0,0 +1,31 @@
+From a07970bf087c089f467eefa30c2476f17f6e9536 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Thu, 7 Mar 2019 16:55:53 +0100
+Subject: [PATCH] Support early loading of keymap if kbd is installed
+
+Early loading of the keymap with busybox was never supported and would
+require modifying the save-keymaps services as well. Since no one
+complained that it doesn't work with busybox so far just make it work
+with kbd for now.
+---
+ sh/init-early.sh.Linux.in | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sh/init-early.sh.Linux.in b/sh/init-early.sh.Linux.in
+index f304e924..7571ff3d 100644
+--- a/sh/init-early.sh.Linux.in
++++ b/sh/init-early.sh.Linux.in
+@@ -48,8 +48,8 @@ if service_present "$RC_DEFAULTLEVEL" consolefont ||
+ fi
+
+ # Try and set a keyboard map as early as possible
+-if service_present "$RC_DEFAULTLEVEL" keymaps ||
+- service_present "$RC_BOOTLEVEL" keymaps; then
++if service_present "$RC_DEFAULTLEVEL" loadkeys ||
++ service_present "$RC_BOOTLEVEL" loadkeys; then
+ kbd_mode $kmode -C "$CONSOLE" 2>/dev/null
+ if [ -r "$RC_LIBEXECDIR"/console/keymap ]; then
+ loadkeys -q "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
+--
+2.33.1
+
diff --git a/repo/system/openrc/0006-Add-support-for-starting-services-in-a-specified-VRF.patch b/repo/system/openrc/0006-Add-support-for-starting-services-in-a-specified-VRF.patch
new file mode 100644
index 0000000..6f7ed69
--- /dev/null
+++ b/repo/system/openrc/0006-Add-support-for-starting-services-in-a-specified-VRF.patch
@@ -0,0 +1,101 @@
+From c250503412b061e69a99cfe12514e47fc06b5885 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Fri, 14 Feb 2020 16:02:43 +0000
+Subject: [PATCH] Add support for starting services in a specified VRF.
+
+The venerable iproute2 utility has recently introduced support
+for executing programs in specific VRFs which are virtualized
+routing tables. These are typically used to isolate different
+networking planes from each other, for security or flexibility
+reasons.
+
+Services which use the normal supervisor/start-stop-daemon
+pattern can be configured by setting the vrf variable in the
+/etc/conf.d tree for the service.
+
+This allows for things like configuring the sshd service to
+run in a management VRF, which is useful for high assurance
+environments where the management plane is intended to be
+isolated.
+
+Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
+---
+ sh/openrc-run.sh.in | 6 ++++++
+ sh/runit.sh | 2 +-
+ sh/s6.sh | 2 +-
+ sh/start-stop-daemon.sh | 2 +-
+ sh/supervise-daemon.sh | 2 +-
+ 5 files changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
+index 5c84af45..a1f374b0 100644
+--- a/sh/openrc-run.sh.in
++++ b/sh/openrc-run.sh.in
+@@ -236,6 +236,12 @@ if ! sourcex -e "$_conf_d/$RC_SVCNAME.$RC_RUNLEVEL"; then
+ fi
+ unset _conf_d
+
++# If we are configured to run in a VRF, provide a hint for that
++RC_VRF_EXEC=""
++if [ -n "$vrf" ]; then
++ RC_VRF_EXEC="/sbin/ip vrf exec $vrf"
++fi
++
+ # load service supervisor functions
+ sourcex "@LIBEXECDIR@/sh/runit.sh"
+ sourcex "@LIBEXECDIR@/sh/s6.sh"
+diff --git a/sh/runit.sh b/sh/runit.sh
+index 5d82c9f6..c0186a43 100644
+--- a/sh/runit.sh
++++ b/sh/runit.sh
+@@ -23,7 +23,7 @@ runit_start()
+ local i=0 retval=1
+ # it can take upto 5 seconds for runsv to start
+ while [ $i -lt 6 ] ; do
+- if sv start "${service_link}" > /dev/null 2>&1; then
++ if ${RC_VRF_EXEC} sv start "${service_link}" > /dev/null 2>&1; then
+ retval=0
+ break
+ fi
+diff --git a/sh/s6.sh b/sh/s6.sh
+index acbe965b..1f339703 100644
+--- a/sh/s6.sh
++++ b/sh/s6.sh
+@@ -37,7 +37,7 @@ s6_start()
+ ln -sf "${s6_service_path}" "${s6_service_link}"
+ s6-svscanctl -na "${RC_SVCDIR}"/s6-scan
+ sleep 1.5
+- s6-svc -u "${s6_service_link}"
++ ${RC_VRF_EXEC} s6-svc -u "${s6_service_link}"
+ if [ -n "$s6_svwait_options_start" ]; then
+ s6-svwait ${s6_svwait_options_start} "${s6_service_link}"
+ fi
+diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
+index 2e549ae1..5e7a1b88 100644
+--- a/sh/start-stop-daemon.sh
++++ b/sh/start-stop-daemon.sh
+@@ -45,7 +45,7 @@ ssd_start()
+ #the eval call is necessary for cases like:
+ # command_args="this \"is a\" test"
+ # to work properly.
+- eval start-stop-daemon --start \
++ eval ${RC_VRF_EXEC} start-stop-daemon --start \
+ --exec $command \
+ ${chroot:+--chroot} $chroot \
+ ${directory:+--chdir} $directory \
+diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh
+index e403a789..259b8166 100644
+--- a/sh/supervise-daemon.sh
++++ b/sh/supervise-daemon.sh
+@@ -24,7 +24,7 @@ supervise_start()
+ # The eval call is necessary for cases like:
+ # command_args="this \"is a\" test"
+ # to work properly.
+- eval supervise-daemon "${RC_SVCNAME}" --start \
++ eval ${RC_VRF_EXEC} supervise-daemon "${RC_SVCNAME}" --start \
+ ${retry:+--retry} $retry \
+ ${directory:+--chdir} $directory \
+ ${chroot:+--chroot} $chroot \
+--
+2.33.1
+
diff --git a/repo/system/openrc/0007-Clean-up-staticroute-config-remove-irrelevant-parts-.patch b/repo/system/openrc/0007-Clean-up-staticroute-config-remove-irrelevant-parts-.patch
new file mode 100644
index 0000000..34100ef
--- /dev/null
+++ b/repo/system/openrc/0007-Clean-up-staticroute-config-remove-irrelevant-parts-.patch
@@ -0,0 +1,47 @@
+From f406231dc9a49b67ca558983de80513f95078309 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Wed, 8 Sep 2021 23:51:11 -0600
+Subject: [PATCH] Clean up staticroute config - remove irrelevant parts (for
+ BSD, Hurd) and suggest that route(8) is legacy.
+
+---
+ conf.d/staticroute | 23 +++--------------------
+ 1 file changed, 3 insertions(+), 20 deletions(-)
+
+diff --git a/conf.d/staticroute b/conf.d/staticroute
+index 19d0961f..49d0e0bb 100644
+--- a/conf.d/staticroute
++++ b/conf.d/staticroute
+@@ -1,26 +1,9 @@
+-# Static routes are defined differently depending on your operating
+-# system, so please be sure to use the correct syntax.
+ # Do not use this file to define the default route.
+ # In all settings, multiple routes should be separated using ; or new lines.
+
+-# Define static routes on Linux using route. See route(8) for syntax.
+-#staticroute="net 192.168.0.0 netmask 255.255.255.0 gw 10.73.1.1
+-#net 192.168.1.0 netmask 255.255.255.0 gw 10.73.1.1"
+-
+ # Define static routes on Linux using iproute2. See ip(8) for syntax.
+ #staticiproute="192.168.0.0/24 via 10.73.1.1; 192.168.1.0/24 via 10.73.1.1"
+
+-# Define static routes on GNU/Hurd. See route(8) for syntax.
+-# /etc/route.conf(5) takes precedence over this configuration.
+-# FIXME: "net ..." not supported
+-#staticroute="net 192.168.0.0 -netmask 255.255.255.0 --address 10.73.1.1
+-#net 192.168.1.0 -netmask 255.255.255.0 --address 10.73.1.1"
+-
+-# Define static routes on GNU/KFreeBSD. See route(8) for syntax.
+-#staticroute="net 192.168.0.0 10.73.1.1 netmask 255.255.255.0
+-#net 192.168.1.0 10.73.1.1 netmask 255.255.255.0"
+-
+-# Define static routes on other BSD systems. See route(8) for syntax.
+-# /etc/route.conf(5) takes precedence over this configuration.
+-#staticroute="net 192.168.0.0 -netmask 255.255.255.0 10.73.1.1
+-#net 192.168.1.0 -netmask 255.255.255.0 10.73.1.1"
++# Or define static routes on Linux using route (legacy). See route(8) for syntax.
++#staticroute="net 192.168.0.0 netmask 255.255.255.0 gw 10.73.1.1
++#net 192.168.1.0 netmask 255.255.255.0 gw 10.73.1.1"
+--
+2.33.1
+
diff --git a/repo/system/openrc/0008-bootmisc-switch-wipe_tmp-setting-to-no-by-default.patch b/repo/system/openrc/0008-bootmisc-switch-wipe_tmp-setting-to-no-by-default.patch
new file mode 100644
index 0000000..f498d05
--- /dev/null
+++ b/repo/system/openrc/0008-bootmisc-switch-wipe_tmp-setting-to-no-by-default.patch
@@ -0,0 +1,44 @@
+From a756576ae62e4f24a2ea36e87053187cdfc1be63 Mon Sep 17 00:00:00 2001
+From: Ariadne Conill <ariadne@dereferenced.org>
+Date: Wed, 13 Oct 2021 21:12:10 -0600
+Subject: [PATCH] bootmisc: switch wipe_tmp setting to no by default
+
+When wipe_tmp=yes, an insufficiently bounded rm -rf occurs that,
+under specific unknown circumstances, can escape into other filesystems
+resulting in data loss.
+
+See alpine/aports#13070.
+---
+ conf.d/bootmisc | 2 +-
+ init.d/bootmisc.in | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/conf.d/bootmisc b/conf.d/bootmisc
+index dd5b08e0..5cf18d33 100644
+--- a/conf.d/bootmisc
++++ b/conf.d/bootmisc
+@@ -3,7 +3,7 @@ clean_tmp_dirs="/tmp"
+
+ # Should we wipe the tmp paths completely or just selectively remove known
+ # locks / files / etc... ?
+-wipe_tmp="YES"
++wipe_tmp="NO"
+
+ # Write the initial dmesg log into /var/log/dmesg after boot
+ # This may be useful if you need the kernel boot log afterwards
+diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
+index b1a849a3..8485110a 100644
+--- a/init.d/bootmisc.in
++++ b/init.d/bootmisc.in
+@@ -17,7 +17,7 @@ depend()
+ keyword -prefix -timeout
+ }
+
+-: ${wipe_tmp:=${WIPE_TMP:-yes}}
++: ${wipe_tmp:=${WIPE_TMP:-no}}
+ : ${log_dmesg:=${LOG_DMESG:-yes}}
+
+ cleanup_tmp_dir()
+--
+2.33.1
+
diff --git a/repo/system/openrc/0009-fix-bootmisc-mv-error.patch b/repo/system/openrc/0009-fix-bootmisc-mv-error.patch
new file mode 100644
index 0000000..e87f9bb
--- /dev/null
+++ b/repo/system/openrc/0009-fix-bootmisc-mv-error.patch
@@ -0,0 +1,27 @@
+From: Dermot Bradley <dermot_bradley@yahoo.com>
+Date: Sat, 29 Jan 2022 19:28 +0000
+Subject: prevent a bootmisc trying to move a nonexistant file
+
+During boot if the "previous_dmesg" setting is enabled in
+/etc/conf.d/bootmisc then during the 1st boot of a machine the
+bootmisc init.d script will attempt to move a nonexistant dmesg
+file, so generating an error on the console.
+
+Modify the script to only move an existing file.
+
+Upstream has merged this as PR 496 so it will be in the next release.
+
+---
+
+diff -aur a/init.d/bootmisc.in b/init.d/bootmisc.in
+--- a/init.d/bootmisc.in
++++ b/init.d/bootmisc.in
+@@ -226,7 +226,7 @@
+ case "$RC_SYS" in
+ VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;;
+ *)
+- if yesno ${previous_dmesg:-no}; then
++ if yesno ${previous_dmesg:-no} && [ -e /var/log/dmesg ]; then
+ mv /var/log/dmesg /var/log/dmesg.old
+ fi
+ dmesg > /var/log/dmesg
diff --git a/repo/system/openrc/0010-noexec-devfs.patch b/repo/system/openrc/0010-noexec-devfs.patch
new file mode 100644
index 0000000..9a8928c
--- /dev/null
+++ b/repo/system/openrc/0010-noexec-devfs.patch
@@ -0,0 +1,14 @@
+--- a/init.d/devfs.in
++++ b/init.d/devfs.in
+@@ -24,8 +24,9 @@ mount_dev()
+ action=--mount
+ conf_d_dir="${RC_SERVICE%/*/*}/conf.d"
+ msg=Mounting
+- # Some devices require exec, Bug #92921
+- mountopts="exec,nosuid,mode=0755"
++ # Some devices require exec, https://bugs.gentoo.org/92921
++ # Users with such requirements can use an fstab entry for /dev
++ mountopts="noexec,nosuid,mode=0755"
+ if yesno ${skip_mount_dev:-no} ; then
+ einfo "/dev will not be mounted due to user request"
+ return 0
diff --git a/repo/system/openrc/firstboot.initd b/repo/system/openrc/firstboot.initd
new file mode 100644
index 0000000..eac4ef8
--- /dev/null
+++ b/repo/system/openrc/firstboot.initd
@@ -0,0 +1,34 @@
+#!/sbin/openrc-run
+
+# The first boot init service
+
+# read kernel options
+init_KOPT() {
+ eval "set -- $(cat /proc/cmdline 2>/dev/null)"
+ for opt; do
+ case "$opt" in
+ ssh_*=*)
+ eval "KOPT_${opt%%=*}='${opt#*=}'" ;;
+ esac
+ done
+}
+
+start() {
+ rm -f /etc/runlevels/*/$RC_SVCNAME
+ init_KOPT
+ local rc=0
+ ebegin "Starting ${RC_SVCNAME}"
+ if [ -n "$KOPT_ssh_key" ] && [ ! -f "/root/.ssh/authorized_keys" ]; then
+ einfo "Fetching ssh keys"
+ mkdir -pm 700 /root/.ssh
+ checkpath -fm 0600 /root/.ssh/authorized_keys
+ case "$KOPT_ssh_key" in
+ https://*|ftps://*|http://*)
+ wget -q "$KOPT_ssh_key" -O /root/.ssh/authorized_keys
+ rc=$?;;
+ *) echo "$KOPT_ssh_key" > /root/.ssh/authorized_keys;;
+ esac
+ fi
+ eend $rc
+}
+
diff --git a/repo/system/openrc/hostname.initd b/repo/system/openrc/hostname.initd
new file mode 100644
index 0000000..4581595
--- /dev/null
+++ b/repo/system/openrc/hostname.initd
@@ -0,0 +1,18 @@
+#!/sbin/openrc-run
+
+description="Sets the hostname of the machine."
+
+depend() {
+ keyword -prefix -lxc -docker
+}
+
+start() {
+ if [ -s /etc/hostname ] ; then
+ name=$(cat /etc/hostname)
+ else
+ name="${hostname:-localhost}"
+ fi
+ ebegin "Setting hostname"
+ hostname $name
+ eend $?
+}
diff --git a/repo/system/openrc/hwdrivers.initd b/repo/system/openrc/hwdrivers.initd
new file mode 100644
index 0000000..80184c9
--- /dev/null
+++ b/repo/system/openrc/hwdrivers.initd
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+
+depend() {
+ need sysfs dev
+ before checkfs fsck
+ after modloop
+ keyword -vserver -lxc
+}
+
+# Load hardware drivers
+start() {
+ # check for boot option "nocoldplug"
+ if get_bootparam noautodetect; then
+ ewarn "Autodetection of hardware disabled from boot cmdline"
+ return 0
+ fi
+
+ ebegin "Loading hardware drivers"
+ find /sys -name modalias -type f -print0 | xargs -0 sort -u \
+ | xargs modprobe -b -a 2> /dev/null
+ # we run it twice so we detect all devices
+ find /sys -name modalias -type f -print0 | xargs -0 sort -u \
+ | xargs modprobe -b -a 2> /dev/null
+
+ # check if framebuffer drivers got pulled in
+ if [ -e /dev/fb0 ] && ! [ -e /sys/module/fbcon ]; then
+ modprobe -b -q fbcon
+ fi
+
+ eend 0
+}
+
diff --git a/repo/system/openrc/machine-id.initd b/repo/system/openrc/machine-id.initd
new file mode 100644
index 0000000..bdd0698
--- /dev/null
+++ b/repo/system/openrc/machine-id.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+
+description="Generate machine-id if needed"
+
+depend() {
+ need root dev
+}
+
+start() {
+ if [ -s /etc/machine-id ] ; then
+ return 0
+ fi
+ ebegin "Generating machine-id"
+ dd if=/dev/urandom status=none bs=16 count=1 \
+ | md5sum | cut -d' ' -f1 > /etc/machine-id
+ eend $?
+}
diff --git a/repo/system/openrc/modloop.confd b/repo/system/openrc/modloop.confd
new file mode 100644
index 0000000..6966429
--- /dev/null
+++ b/repo/system/openrc/modloop.confd
@@ -0,0 +1,6 @@
+# Enable loadable module support when running from RAM
+# when OverlayFS support is available in the kernel.
+# 0 means default tmpfs size (50% of physical RAM).
+# for more information please see kernel documention at:
+# https://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt
+overlay_size=0
diff --git a/repo/system/openrc/modloop.initd b/repo/system/openrc/modloop.initd
new file mode 100755
index 0000000..fb7006c
--- /dev/null
+++ b/repo/system/openrc/modloop.initd
@@ -0,0 +1,153 @@
+#!/sbin/openrc-run
+
+# script that will mount image with modules
+
+depend() {
+ after dev-mount
+ before checkfs fsck hwdrivers modules hwclock dev sysfs
+ keyword -vserver -lxc
+}
+
+# read kernel options
+init_KOPT() {
+ for opt in $(cat /proc/cmdline 2>/dev/null); do
+ case "$opt" in
+ modloop=*|modloop_verify=*)
+ eval "KOPT_${opt%%=*}='${opt#*=}'" ;;
+ esac
+ done
+}
+
+mountdirs() {
+ awk '$2 !~ /^\/(sys|proc|dev|run)/ && $2 != "/" {print $2}' /proc/mounts
+}
+
+find_modloop() {
+ local dir="$1"
+ local kver=$(uname -r)
+ local oifs="$IFS"
+ IFS=$'\n'
+ set -- $(blkid "$dir"/boot/* "$dir"/*)
+ IFS="$oifs"
+ for line; do
+ img=${line%%:*}
+ verify_modloop "$img" || eerror "Failed to verify signature of $img!"
+ mount "$img" -o loop,ro /.modloop || continue
+ if [ -d /.modloop/modules/$kver ]; then
+ return 0
+ fi
+ umount /.modloop
+ done
+ return 1
+}
+
+verify_modloop() {
+ local modloop=$1 key=
+ if ! yesno "${KOPT_modloop_verify:=yes}"; then
+ return 0
+ fi
+ for key in /etc/apk/keys/*.pub; do
+ local sig=/var/cache/misc/${modloop##*/}.SIGN.RSA.${key##*/}
+ if [ -f "$sig" ]; then
+ if ! command -v openssl > /dev/null; then
+ ewarn "Missing openssl. Modloop verification disabled!"
+ return 0
+ fi
+ einfo "Verifying modloop"
+ openssl dgst -sha1 -verify "$key" -signature "$sig" "$modloop" \
+ >/dev/null 2>&1 || return 1
+ fi
+ done
+}
+
+find_backing_file() {
+ local dir="$1"
+ local dev=$(df -P "$dir" | tail -1 | awk '{print $1}')
+ cat /sys/block/${dev#/dev/}/loop/backing_file 2>/dev/null
+}
+
+start() {
+ local modloop= mount_opts= modloop_dldir="/lib"
+ init_KOPT
+
+ case "$KOPT_modloop" in
+ none) return 0;;
+ http://*|https://*|ftp://*)
+ modloop=$modloop_dldir/${KOPT_modloop##*/}
+ if [ ! -f "$modloop" ]; then
+ mkdir -p "$modloop_dldir"
+ wget -P "$modloop_dldir" "$KOPT_modloop" || eend 1
+ fi
+ ;;
+ *)
+ for dir in $(mountdirs); do
+ if [ -f "$dir"/$KOPT_modloop ]; then
+ modloop="$dir/${KOPT_modloop##/}"
+ alpine_mnt="$dir"
+ break
+ fi
+ done
+ ;;
+ esac
+
+ ebegin "Mounting modloop $modloop"
+ mkdir -p /.modloop
+ if [ -n "$modloop" ]; then
+ verify_modloop "$modloop" || eerror "Failed to verify signature of $img!"
+ mount -o loop,ro $modloop /.modloop
+ eend $? || return 1
+ else
+ for dir in $(mountdirs); do
+ if find_modloop "$dir"; then
+ alpine_mnt="$dir"
+ break
+ fi
+ done
+ if [ -d /.modloop/modules/$(uname -r) ]; then
+ eend 0
+ else
+ eend 1 || return 1
+ fi
+ fi
+
+ #use overlayfs if available and configured
+ if grep -q -w "overlay$" /proc/filesystems && [ ! -z ${unionfs_size+x} ]; then
+ ewarn "Use of unionfs_size is deprecated use overlay_size instead"
+ overlay_size="$unionfs_size"
+ fi
+ if grep -q -w "overlay$" /proc/filesystems && [ -n "$overlay_size" ]; then
+ ebegin "OverlayFS detected, mounting modloop rw"
+ [ "$overlay_size" != 0 ] && mount_ops="-o size=$overlay_size"
+ mkdir -p /.modoverlayfs /lib/modules
+ mount -t tmpfs $mount_ops tmpfs /.modoverlayfs
+ mkdir -p /.modoverlayfs/modules /.modoverlayfs/work
+ mount -t overlay -o upperdir=/.modoverlayfs/modules,lowerdir=/lib/modules:/.modloop/modules,workdir=/.modoverlayfs/work overlay /lib/modules
+ depmod -A
+ eend $? || return 1
+ else
+ rm -rf /lib/modules && ln -sf /.modloop/modules /lib/
+ fi
+
+ # copy firmware if there are any
+ if [ -d $alpine_mnt/firmware ]; then
+ ebegin "Copying firmware from $alpine_mnt/firmware"
+ cp -R -a $alpine_mnt/firmware /lib/
+ eend $?
+ elif [ -d /lib/modules/firmware ]; then
+ rmdir /lib/firmware 2>/dev/null \
+ && ln -s /lib/modules/firmware /lib/
+ fi
+ return 0
+}
+
+stop() {
+ local ret=0
+ local mnt; for mnt in /lib/modules /.modoverlayfs /.modloop; do
+ if mountinfo --quiet "$mnt"; then
+ ebegin "Unmounting $mnt"
+ umount -d "$mnt" || ret=1
+ fi
+ done
+ eend $ret || return 1
+}
+
diff --git a/repo/system/openrc/modules.initd b/repo/system/openrc/modules.initd
new file mode 100644
index 0000000..3cd141e
--- /dev/null
+++ b/repo/system/openrc/modules.initd
@@ -0,0 +1,80 @@
+#!/sbin/openrc-run
+
+description="Loads a user defined list of kernel modules."
+
+depend()
+{
+ before hwclock hwdrivers
+ keyword -openvz -prefix -vserver -lxc
+}
+
+start() {
+ yesno $rc_verbose && verbose=yes
+
+ ebegin "Loading modules"
+ eindent
+ for f in /lib/modules-load.d/*.conf \
+ /usr/lib/modules-load.d/*.conf; do
+
+ if ! [ -f "$f" ]; then
+ continue
+ fi
+
+ if [ -f /etc/modules-load.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /etc/modules-load.d/${f##*/}"
+ continue
+ fi
+
+ if [ -f /run/modules-load.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /run/modules-load.d/${f##*/}"
+ continue
+ fi
+
+ veinfo "Processing $f"
+ sed -e 's/\#.*//g' -e '/^[[:space:]]*$/d' < "$f" \
+ | while read module args; do
+ modprobe -q $module $args
+ done
+ done
+
+ if [ -f /etc/modules ]; then
+ veinfo "Processing /etc/modules"
+ sed -e 's/\#.*//g' -e '/^[[:space:]]*$/d' < /etc/modules \
+ | while read module args; do
+ modprobe -q $module $args
+ done
+ fi
+
+ for f in /etc/modules-load.d/*.conf; do
+ if [ ! -f "$f" ]; then
+ continue
+ fi
+
+ if [ -f /run/modules-load.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /run/modules-load.d/${f##*/}"
+ continue
+ fi
+
+ veinfo "Processing $f"
+ sed -e 's/\#.*//g' -e '/^[[:space:]]*$/d' < "$f" \
+ | while read module args; do
+ modprobe -q $module $args
+ done
+ done
+
+ for f in /run/modules-load.d/*.conf; do
+ if [ ! -f "$f" ]; then
+ continue
+ fi
+
+ veinfo "Processing $f"
+ sed -e 's/\#.*//g' -e '/^[[:space:]]*$/d' < "$f" \
+ | while read module args; do
+ modprobe -q $module $args
+ done
+ done
+ eoutdent
+
+ eend $?
+}
+
diff --git a/repo/system/openrc/networking.initd b/repo/system/openrc/networking.initd
new file mode 100644
index 0000000..417f4a3
--- /dev/null
+++ b/repo/system/openrc/networking.initd
@@ -0,0 +1,88 @@
+#!/sbin/openrc-run
+
+# note that the spoofprotect, syncoockies and ip_forward options are set in
+# /etc/sysctl.conf
+
+: ${cfgfile:="/etc/network/interfaces"}
+: ${ifquery:="ifquery"}
+: ${ifstate:="/run/ifstate"}
+
+single_iface="${RC_SVCNAME#*.}"
+if [ "$single_iface" = "$RC_SVCNAME" ]; then
+ single_iface=
+fi
+
+depend() {
+ need localmount
+ want dev-settle
+ after bootmisc hwdrivers modules
+ provide net
+ keyword -jail -prefix -vserver -docker
+}
+
+# find interfaces we want to start
+find_ifaces() {
+ if [ -n "$single_iface" ]; then
+ echo $single_iface
+ return 0
+ fi
+
+ if command -v "$ifquery" >/dev/null; then
+ $ifquery -i "$cfgfile" --list --auto
+ return
+ fi
+
+ # fallback in case ifquery does not exist
+ awk '$1 == "auto" {for (i = 2; i <= NF; i = i + 1) printf("%s ", $i)}' "$cfgfile"
+}
+
+# return the list of interfaces we should try stop
+find_running_ifaces() {
+ if [ -n "$single_iface" ]; then
+ echo $single_iface
+ return 0
+ fi
+
+ if command -v "$ifquery" >/dev/null; then
+ $ifquery --state-file $ifstate -i "$cfgfile" --running
+ return
+ fi
+
+ # fallback
+ awk -F= '{print $2}' $ifstate
+}
+
+start() {
+ local iface= ret=1
+ ebegin "Starting networking"
+ eindent
+ for iface in $(find_ifaces); do
+ local r=0
+ ebegin "$iface"
+ if ! ifup -i "$cfgfile" $iface >/dev/null; then
+ ifdown -i "$cfgfile" $iface >/dev/null 2>&1
+ r=1
+ fi
+ # atleast one interface needs to be started for action
+ # to be success
+ eend $r && ret=0
+ done
+ eoutdent
+ return $ret
+}
+
+stop() {
+ local iface=
+ # Don't stop the network at shutdown.
+ yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0
+
+ ebegin "Stopping networking"
+ eindent
+ for iface in $(find_running_ifaces); do
+ ebegin "$iface"
+ ifdown -i "$cfgfile" -f $iface >/dev/null
+ eend $?
+ done
+ eoutdent
+ return 0
+}
diff --git a/repo/system/openrc/openrc.logrotate b/repo/system/openrc/openrc.logrotate
new file mode 100644
index 0000000..5e5e64b
--- /dev/null
+++ b/repo/system/openrc/openrc.logrotate
@@ -0,0 +1,4 @@
+/var/log/rc.log {
+ missingok
+ notifempty
+}
diff --git a/repo/system/openrc/openrc.post-install b/repo/system/openrc/openrc.post-install
new file mode 100644
index 0000000..1c27350
--- /dev/null
+++ b/repo/system/openrc/openrc.post-install
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+rc_update() {
+ local svc="$1"
+ local level="$2"
+ mkdir -p /etc/runlevels/$level
+ ln -sf /etc/init.d/$svc /etc/runlevels/$level
+}
+
+if [ ! -d etc/rcS.d ] && [ ! -d etc/rcL.d ]; then
+ exit 0
+fi
+
+for i in etc/rc[SL].d/*; do
+ [ -L "$i" ] || continue
+ oldsvc=${i##*/S[0-9][0-9]}
+ # some services are renamed
+ case "$oldsvc" in
+ modutils) svc=modules;;
+ procps) svc=sysctl;;
+ bootmisc.sh) svc=bootmisc;;
+ keymap) svc=keymaps;;
+ rc.local) svc=local;;
+ *) svc=$oldsvc;;
+ esac
+
+ # add the service to correct "runlevel"
+ case "$svc" in
+ syslog|klogd)
+ rc_update $svc sysinit;;
+ hwclock|modules|sysctl|hostname|keymaps|bootmisc)
+ rc_update $svc boot;;
+ *) rc_update $svc default;;
+ esac
+
+ rm $i
+done
+
diff --git a/repo/system/openrc/openrc.post-upgrade b/repo/system/openrc/openrc.post-upgrade
new file mode 100644
index 0000000..8884202
--- /dev/null
+++ b/repo/system/openrc/openrc.post-upgrade
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# in 0.8.0-r1 the state dir moved from /libexec/rc/init.d to /lib/rc/init.d
+# and with 0.10 it moved to /run/openrc
+
+mkdir -p /run/openrc
+for dir in /libexec /lib; do
+ [ -d $dir/rc/init.d ] || continue
+
+ for i in $dir/rc/init.d/* ; do
+ [ -e "$i" ] || continue
+ if [ -e /run/openrc/${i##*/} ]; then
+ rm -r $i
+ else
+ mv $i /run/openrc/
+ fi
+ done
+
+ rmdir $dir/rc/init.d $dir/rc /libexec 2>/dev/null
+done
+
+# create rc.local compat
+if [ -f /etc/rc.local ]; then
+ cat >/etc/local.d/rc.local-compat.start<<__EOF__
+#!/bin/sh
+
+# this is only here for compatibility reasons
+if [ -f /etc/rc.local ]; then
+ . /etc/rc.local
+fi
+__EOF__
+ chmod +x /etc/local.d/rc.local-compat.start
+fi
+
+exit 0
diff --git a/repo/system/openrc.xibuild b/repo/system/openrc/openrc.xibuild
index fb99da4..fb99da4 100644
--- a/repo/system/openrc.xibuild
+++ b/repo/system/openrc/openrc.xibuild
diff --git a/repo/system/openrc/rc.conf b/repo/system/openrc/rc.conf
new file mode 100644
index 0000000..fdeb653
--- /dev/null
+++ b/repo/system/openrc/rc.conf
@@ -0,0 +1,313 @@
+# Global OpenRC configuration settings
+
+# Set to "YES" if you want the rc system to try and start services
+# in parallel for a slight speed improvement. When running in parallel we
+# prefix the service output with its name as the output will get
+# jumbled up.
+# WARNING: whilst we have improved parallel, it can still potentially lock
+# the boot process. Don't file bugs about this unless you can supply
+# patches that fix it without breaking other things!
+rc_parallel="YES"
+
+# Set rc_interactive to "YES" and you'll be able to press the I key during
+# boot so you can choose to start specific services. Set to "NO" to disable
+# this feature. This feature is automatically disabled if rc_parallel is
+# set to YES.
+#rc_interactive="YES"
+
+# If we need to drop to a shell, you can specify it here.
+# If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
+# otherwise /bin/sh
+# Linux users could specify /sbin/sulogin
+rc_shell=/bin/sh
+
+# Do we allow any started service in the runlevel to satisfy the dependency
+# or do we want all of them regardless of state? For example, if net.eth0
+# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
+# both will be started, but services that depend on 'net' will work if either
+# one comes up. With rc_depend_strict="YES" we would require them both to
+# come up.
+#rc_depend_strict="YES"
+
+# rc_hotplug controls which services we allow to be hotplugged.
+# A hotplugged service is one started by a dynamic dev manager when a matching
+# hardware device is found.
+# Hotplugged services appear in the "hotplugged" runlevel.
+# If rc_hotplug is set to any value, we compare the name of this service
+# to every pattern in the value, from left to right, and we allow the
+# service to be hotplugged if it matches a pattern, or if it matches no
+# patterns. Patterns can include shell wildcards.
+# To disable services from being hotplugged, prefix patterns with "!".
+#If rc_hotplug is not set or is empty, all hotplugging is disabled.
+# Example - rc_hotplug="net.wlan !net.*"
+# This allows net.wlan and any service not matching net.* to be hotplugged.
+# Example - rc_hotplug="!net.*"
+# This allows services that do not match "net.*" to be hotplugged.
+
+# rc_logger launches a logging daemon to log the entire rc process to
+# /var/log/rc.log
+# NOTE: Linux systems require the devfs service to be started before
+# logging can take place and as such cannot log the sysinit runlevel.
+#rc_logger="NO"
+
+# Through rc_log_path you can specify a custom log file.
+# The default value is: /var/log/rc.log
+#rc_log_path="/var/log/rc.log"
+
+# If you want verbose output for OpenRC, set this to yes. If you want
+# verbose output for service foo only, set it to yes in /etc/conf.d/foo.
+#rc_verbose=no
+
+# By default we filter the environment for our running scripts. To allow other
+# variables through, add them here. Use a * to allow all variables through.
+#rc_env_allow="VAR1 VAR2"
+
+# By default we assume that all daemons will start correctly.
+# However, some do not - a classic example is that they fork and return 0 AND
+# then child barfs on a configuration error. Or the daemon has a bug and the
+# child crashes. You can set the number of milliseconds start-stop-daemon
+# waits to check that the daemon is still running after starting here.
+# The default is 0 - no checking.
+#rc_start_wait=100
+
+# rc_nostop is a list of services which will not stop when changing runlevels.
+# This still allows the service itself to be stopped when called directly.
+#rc_nostop=""
+
+# rc will attempt to start crashed services by default.
+# However, it will not stop them by default as that could bring down other
+# critical services.
+#rc_crashed_stop=NO
+#rc_crashed_start=YES
+
+# Set rc_nocolor to yes if you do not want colors displayed in OpenRC
+# output.
+#rc_nocolor=NO
+
+##############################################################################
+# MISC CONFIGURATION VARIABLES
+# There variables are shared between many init scripts
+
+# Set unicode to YES to turn on unicode support for keyboards and screens.
+unicode="YES"
+
+# This is how long fuser should wait for a remote server to respond. The
+# default is 60 seconds, but it can be adjusted here.
+#rc_fuser_timeout=60
+
+# Below is the default list of network fstypes.
+#
+# afs ceph cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs
+# nfs nfs4 ocfs2 shfs smbfs
+#
+# If you would like to add to this list, you can do so by adding your
+# own fstypes to the following variable.
+#extra_net_fs_list=""
+
+##############################################################################
+# SERVICE CONFIGURATION VARIABLES
+# These variables are documented here, but should be configured in
+# /etc/conf.d/foo for service foo and NOT enabled here unless you
+# really want them to work on a global basis.
+# If your service has characters in its name which are not legal in
+# shell variable names and you configure the variables for it in this
+# file, those characters should be replaced with underscores in the
+# variable names as shown below.
+
+# Some daemons are started and stopped via start-stop-daemon.
+# We can set some things on a per service basis, like the nicelevel.
+#SSD_NICELEVEL="-19"
+# Or the ionice level. The format is class[:data] , just like the
+# --ionice start-stop-daemon parameter.
+#SSD_IONICELEVEL="2:2"
+
+# Pass ulimit parameters
+# If you are using bash in POSIX mode for your shell, note that the
+# ulimit command uses a block size of 512 bytes for the -c and -f
+# options
+#rc_ulimit="-u 30"
+
+# It's possible to define extra dependencies for services like so
+#rc_config="/etc/foo"
+#rc_need="openvpn"
+#rc_use="net.eth0"
+#rc_after="clock"
+#rc_before="local"
+#rc_provide="!net"
+
+# You can also enable the above commands here for each service. Below is an
+# example for service foo.
+#rc_foo_config="/etc/foo"
+#rc_foo_need="openvpn"
+#rc_foo_after="clock"
+
+# Below is an example for service foo-bar. Note that the '-' is illegal
+# in a shell variable name, so we convert it to an underscore.
+# example for service foo-bar.
+#rc_foo_bar_config="/etc/foo-bar"
+#rc_foo_bar_need="openvpn"
+#rc_foo_bar_after="clock"
+
+# You can also remove dependencies.
+# This is mainly used for saying which services do NOT provide net.
+#rc_net_tap0_provide="!net"
+
+# This is the subsystem type.
+# It is used to match against keywords set by the keyword call in the
+# depend function of service scripts.
+#
+# It should be set to the value representing the environment this file is
+# PRESENTLY in, not the virtualization the environment is capable of.
+# If it is commented out, automatic detection will be used.
+#
+# The list below shows all possible settings as well as the host
+# operating systems where they can be used and autodetected.
+#
+# "" - nothing special
+# "docker" - Docker container manager (Linux)
+# "jail" - Jail (DragonflyBSD or FreeBSD)
+# "lxc" - Linux Containers
+# "openvz" - Linux OpenVZ
+# "prefix" - Prefix
+# "rkt" - CoreOS container management system (Linux)
+# "subhurd" - Hurd subhurds (to be checked)
+# "systemd-nspawn" - Container created by systemd-nspawn (Linux)
+# "uml" - Usermode Linux
+# "vserver" - Linux vserver
+# "xen0" - Xen0 Domain (Linux and NetBSD)
+# "xenU" - XenU Domain (Linux and NetBSD)
+#rc_sys=""
+
+# if you use openrc-init, which is currently only available on Linux,
+# this is the default runlevel to activate after "sysinit" and "boot"
+# when booting.
+#rc_default_runlevel="default"
+
+# on Linux and Hurd, this is the number of ttys allocated for logins
+# It is used in the consolefont, keymaps, numlock and termencoding
+# service scripts.
+rc_tty_number=12
+
+##############################################################################
+# LINUX CGROUPS RESOURCE MANAGEMENT
+
+# This sets the mode used to mount cgroups.
+# "hybrid" mounts cgroups version 2 on /sys/fs/cgroup/unified and
+# cgroups version 1 on /sys/fs/cgroup.
+# "legacy" mounts cgroups version 1 on /sys/fs/cgroup
+# "unified" mounts cgroups version 2 on /sys/fs/cgroup
+#rc_cgroup_mode="hybrid"
+
+# This is a list of controllers which should be enabled for cgroups version 2
+# when hybrid mode is being used.
+# Controllers listed here will not be available for cgroups version 1.
+#rc_cgroup_controllers=""
+
+# This variable contains the cgroups version 2 settings for your services.
+# If this is set in this file, the settings will apply to all services.
+# If you want different settings for each service, place the settings in
+# /etc/conf.d/foo for service foo.
+# The format is to specify the setting and value followed by a newline.
+# Multiple settings and values can be specified.
+# For example, you would use this to set the maximum memory and maximum
+# number of pids for a service.
+#rc_cgroup_settings="
+#memory.max 10485760
+#pids.max max
+#"
+#
+# For more information about the adjustments that can be made with
+# cgroups version 2, see Documentation/cgroups-v2.txt in the linux kernel
+# source tree.
+#rc_cgroup_settings=""
+
+# This switch controls whether or not cgroups version 1 controllers are
+# individually mounted under
+# /sys/fs/cgroup in hybrid or legacy mode.
+#rc_controller_cgroups="YES"
+
+# The following setting turns on the memory.use_hierarchy setting in the
+# root memory cgroup for cgroups v1.
+# It must be set to yes in this file if you want this functionality.
+#rc_cgroup_memory_use_hierarchy="NO"
+
+# The following settings allow you to set up values for the cgroups version 1
+# controllers for your services.
+# They can be set in this file;, however, if you do this, the settings
+# will apply to all of your services.
+# If you want different settings for each service, place the settings in
+# /etc/conf.d/foo for service foo.
+# The format is to specify the names of the settings followed by their
+# values. Each variable can hold multiple settings.
+# For example, you would use this to set the cpu.shares setting in the
+# cpu controller to 512 for your service.
+# rc_cgroup_cpu="
+# cpu.shares 512
+# "
+#
+# For more information about the adjustments that can be made with
+# cgroups version 1, see Documentation/cgroups-v1/* in the linux kernel
+# source tree.
+
+# Set the blkio controller settings for this service.
+#rc_cgroup_blkio=""
+
+# Set the cpu controller settings for this service.
+#rc_cgroup_cpu=""
+
+# Add this service to the cpuacct controller (any value means yes).
+#rc_cgroup_cpuacct=""
+
+# Set the cpuset controller settings for this service.
+#rc_cgroup_cpuset=""
+
+# Set the devices controller settings for this service.
+#rc_cgroup_devices=""
+
+# Set the hugetlb controller settings for this service.
+#rc_cgroup_hugetlb=""
+
+# Set the memory controller settings for this service.
+#rc_cgroup_memory=""
+
+# Set the net_cls controller settings for this service.
+#rc_cgroup_net_cls=""
+
+# Set the net_prio controller settings for this service.
+#rc_cgroup_net_prio=""
+
+# Set the pids controller settings for this service.
+#rc_cgroup_pids=""
+
+# Set this to YES if you want all of the processes in a service's cgroup
+# killed when the service is stopped or restarted.
+# Be aware that setting this to yes means all of a service's
+# child processes will be killed. Keep this in mind if you set this to
+# yes here instead of for the individual services in
+# /etc/conf.d/<service>.
+# To perform this cleanup manually for a stopped service, you can
+# execute cgroup_cleanup with /etc/init.d/<service> cgroup_cleanup or
+# rc-service <service> cgroup_cleanup.
+# The process followed in this cleanup is the following:
+# 1. send stopsig (sigterm if it isn't set) to all processes left in the
+# cgroup immediately followed by sigcont.
+# 2. Send sighup to all processes in the cgroup if rc_send_sighup is
+# yes.
+# 3. delay for rc_timeout_stopsec seconds.
+# 4. send sigkill to all processes in the cgroup unless disabled by
+# setting rc_send_sigkill to no.
+# rc_cgroup_cleanup="NO"
+
+# If this is yes, we will send sighup to the processes in the cgroup
+# immediately after stopsig and sigcont.
+#rc_send_sighup="NO"
+
+# This is the amount of time in seconds that we delay after sending sigcont
+# and optionally sighup, before we optionally send sigkill to all
+# processes in the # cgroup.
+# The default is 90 seconds.
+#rc_timeout_stopsec="90"
+
+# If this is set to no, we do not send sigkill to all processes in the
+# cgroup.
+#rc_send_sigkill="YES"
diff --git a/repo/system/openrc/seedrng.patch b/repo/system/openrc/seedrng.patch
new file mode 100644
index 0000000..ff61d81
--- /dev/null
+++ b/repo/system/openrc/seedrng.patch
@@ -0,0 +1,640 @@
+From 076c2552aeff88a27fe275dfaae61dedf4bb4bd5 Mon Sep 17 00:00:00 2001
+From: "Jason A. Donenfeld" <Jason@zx2c4.com>
+Date: Thu, 24 Mar 2022 22:07:16 -0600
+Subject: [PATCH] Use seedrng for seeding the random number generator
+
+The RNG can't actually be seeded from a shell script, due to the
+reliance on ioctls. For this reason, the seedrng project provides a
+basic script meant to be copy and pasted into projects like OpenRC and
+tweaked as needed: https://git.zx2c4.com/seedrng/about/
+
+This commit imports it into OpenRC and wires up /etc/init.d/urandom to
+call it. It shouldn't be called by other things on the system, so it
+lives in rc_sbindir.
+
+Closes #506.
+Closes #507.
+
+Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
+---
+ AUTHORS | 1 +
+ conf.d/urandom | 9 +-
+ init.d/urandom.in | 41 ++--
+ src/rc/Makefile | 6 +-
+ src/rc/meson.build | 10 +-
+ src/rc/seedrng.c | 453 +++++++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 499 insertions(+), 21 deletions(-)
+ create mode 100644 src/rc/seedrng.c
+
+diff --git a/AUTHORS b/AUTHORS
+index 0616d5175..ede0f471b 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -43,6 +43,7 @@ Ian Stakenvicius <axs@gentoo.org>
+ Jakob Drexel <jake42@rommel.stw.uni-erlangen.de>
+ James Le Cuirot <chewi@aura-online.co.uk>
+ Jan Psota <jasiu@belsznica.pl>
++Jason A. Donenfeld <Jason@zx2c4.com>
+ Jason Zaman <jason@perfinion.com>
+ Joe Harvell <jharvell@dogpad.net>
+ Joe M <joe9mail@gmail.com>
+diff --git a/conf.d/urandom b/conf.d/urandom
+index f721a2491..744e4f702 100644
+--- a/conf.d/urandom
++++ b/conf.d/urandom
+@@ -2,4 +2,11 @@
+ # (say for crypt swap), so you will need to customize this
+ # behavior. If you have /var on a separate partition, then
+ # make sure this path lives on your root device somewhere.
+-urandom_seed="/var/lib/misc/random-seed"
++seed_dir="/var/lib/seedrng"
++lock_file="/var/run/seedrng.lock"
++
++# Set this to true if you do not want seed files to actually
++# credit the RNG. Set this if you plan to replicate this
++# file system image and do not have the wherewithal to first
++# delete the contents of /var/lib/seedrng.
++skip_credit="false"
+diff --git a/init.d/urandom.in b/init.d/urandom.in
+index 0d6ab66e0..cda431fdb 100644
+--- a/init.d/urandom.in
++++ b/init.d/urandom.in
+@@ -1,5 +1,5 @@
+ #!@SBINDIR@/openrc-run
+-# Copyright (c) 2007-2015 The OpenRC Authors.
++# Copyright (c) 2007-2022 The OpenRC Authors.
+ # See the Authors file at the top-level directory of this distribution and
+ # https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
+ #
+@@ -9,7 +9,10 @@
+ # This file may not be copied, modified, propagated, or distributed
+ # except according to the terms contained in the LICENSE file.
+
+-: ${urandom_seed:=${URANDOM_SEED:-/var/lib/misc/random-seed}}
++export SEEDRNG_SEED_DIR="${seed_dir:-/var/lib/seedrng}"
++export SEEDRNG_LOCK_FILE="${lock_file:-/var/run/seedrng.lock}"
++export SEEDRNG_SKIP_CREDIT="${skip_credit:-false}"
++: ${urandom_seed:=${SEEDRNG_SEED_DIR}/../misc/random-seed}
+ description="Initializes the random number generator."
+
+ depend()
+@@ -21,33 +24,35 @@ depend()
+
+ save_seed()
+ {
+- local psz=1
+-
+- if [ -e /proc/sys/kernel/random/poolsize ]; then
+- : $(( psz = $(cat /proc/sys/kernel/random/poolsize) / 4096 ))
+- fi
+-
+ ( # sub shell to prevent umask pollution
+ umask 077
+- dd if=/dev/urandom of="$urandom_seed" count=${psz} 2>/dev/null
++ dd if=/dev/urandom of="$urandom_seed" count=1 2>/dev/null
+ )
+ }
+
+ start()
+ {
+- [ -c /dev/urandom ] || return
+- if [ -f "$urandom_seed" ]; then
+- ebegin "Initializing random number generator"
+- cat "$urandom_seed" > /dev/urandom
+- eend $? "Error initializing random number generator"
++ if [ "$RC_UNAME" = Linux ]; then
++ seedrng
++ else
++ [ -c /dev/urandom ] || return
++ if [ -f "$urandom_seed" ]; then
++ ebegin "Initializing random number generator"
++ cat "$urandom_seed" > /dev/urandom
++ eend $? "Error initializing random number generator"
++ fi
++ rm -f "$urandom_seed" && save_seed
+ fi
+- rm -f "$urandom_seed" && save_seed
+ return 0
+ }
+
+ stop()
+ {
+- ebegin "Saving random seed"
+- save_seed
+- eend $? "Failed to save random seed"
++ if [ "$RC_UNAME" = Linux ]; then
++ seedrng
++ else
++ ebegin "Saving random seed"
++ save_seed
++ eend $? "Failed to save random seed"
++ fi
+ }
+diff --git a/src/rc/Makefile b/src/rc/Makefile
+index fd796d920..62539f134 100644
+--- a/src/rc/Makefile
++++ b/src/rc/Makefile
+@@ -15,7 +15,7 @@ endif
+
+ ifeq (${OS},Linux)
+ SRCS+= kill_all.c openrc-init.c openrc-shutdown.c rc-sysvinit.c broadcast.c \
+- rc-wtmp.c
++ rc-wtmp.c seedrng.c
+ endif
+
+ CLEANFILES= version.h rc-selinux.o
+@@ -47,6 +47,7 @@ RC_SBINPROGS= mark_service_starting mark_service_started \
+
+ ifeq (${OS},Linux)
+ RC_BINPROGS+= kill_all
++RC_SBINPROGS+= seedrng
+ SBINPROGS+= openrc-init openrc-shutdown
+ endif
+
+@@ -180,3 +181,6 @@ shell_var: shell_var.o
+
+ swclock: swclock.o _usage.o rc-misc.o
+ ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
++
++seedrng: seedrng.o
++ ${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ $^ ${LDADD}
+diff --git a/src/rc/meson.build b/src/rc/meson.build
+index 8fdf3ac3b..b724c51f2 100644
+--- a/src/rc/meson.build
++++ b/src/rc/meson.build
+@@ -268,7 +268,15 @@ if os == 'Linux'
+ link_with: [libeinfo,librc],
+ install: true,
+ install_dir: rc_bindir)
+- endif
++
++ executable('seedrng',
++ ['seedrng.c'],
++ c_args : cc_branding_flags,
++ include_directories: [incdir, einfo_incdir, rc_incdir],
++ link_with: [libeinfo, librc],
++ install: true,
++ install_dir: rc_sbindir)
++endif
+
+ executable('shell_var',
+ ['shell_var.c'],
+diff --git a/src/rc/seedrng.c b/src/rc/seedrng.c
+new file mode 100644
+index 000000000..c1f941457
+--- /dev/null
++++ b/src/rc/seedrng.c
+@@ -0,0 +1,453 @@
++/*
++ * seedrng.c
++ * Seed kernel RNG from seed file, based on code from:
++ * https://git.zx2c4.com/seedrng/about/
++ */
++
++/*
++ * Copyright (c) 2022 The OpenRC Authors.
++ * See the Authors file at the top-level directory of this distribution and
++ * https://github.com/OpenRC/openrc/blob/HEAD/AUTHORS
++ *
++ * This file is part of OpenRC. It is subject to the license terms in
++ * the LICENSE file found in the top-level directory of this
++ * distribution and at https://github.com/OpenRC/openrc/blob/HEAD/LICENSE
++ * This file may not be copied, modified, propagated, or distributed
++ * except according to the terms contained in the LICENSE file.
++ */
++
++#include <linux/random.h>
++#include <sys/random.h>
++#include <sys/ioctl.h>
++#include <sys/file.h>
++#include <sys/stat.h>
++#include <sys/types.h>
++#include <fcntl.h>
++#include <poll.h>
++#include <unistd.h>
++#include <time.h>
++#include <errno.h>
++#include <endian.h>
++#include <stdbool.h>
++#include <stdint.h>
++#include <string.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++#include "rc.h"
++#include "einfo.h"
++#include "helpers.h"
++
++#ifndef GRND_INSECURE
++#define GRND_INSECURE 0x0004 /* Apparently some headers don't ship with this yet. */
++#endif
++
++static const char *SEED_DIR;
++static const char *LOCK_FILE;
++static char *CREDITABLE_SEED;
++static char *NON_CREDITABLE_SEED;
++
++enum blake2s_lengths {
++ BLAKE2S_BLOCK_LEN = 64,
++ BLAKE2S_HASH_LEN = 32,
++ BLAKE2S_KEY_LEN = 32
++};
++
++enum seedrng_lengths {
++ MAX_SEED_LEN = 512,
++ MIN_SEED_LEN = BLAKE2S_HASH_LEN
++};
++
++struct blake2s_state {
++ uint32_t h[8];
++ uint32_t t[2];
++ uint32_t f[2];
++ uint8_t buf[BLAKE2S_BLOCK_LEN];
++ unsigned int buflen;
++ unsigned int outlen;
++};
++
++#define le32_to_cpup(a) le32toh(*(a))
++#define cpu_to_le32(a) htole32(a)
++#ifndef ARRAY_SIZE
++#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
++#endif
++#ifndef DIV_ROUND_UP
++#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
++#endif
++
++static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words)
++{
++ while (words--) {
++ *buf = cpu_to_le32(*buf);
++ ++buf;
++ }
++}
++
++static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words)
++{
++ while (words--) {
++ *buf = le32_to_cpup(buf);
++ ++buf;
++ }
++}
++
++static inline uint32_t ror32(uint32_t word, unsigned int shift)
++{
++ return (word >> (shift & 31)) | (word << ((-shift) & 31));
++}
++
++static const uint32_t blake2s_iv[8] = {
++ 0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
++ 0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL
++};
++
++static const uint8_t blake2s_sigma[10][16] = {
++ { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
++ { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
++ { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
++ { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
++ { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
++ { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
++ { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
++ { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
++ { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
++ { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
++};
++
++static void blake2s_set_lastblock(struct blake2s_state *state)
++{
++ state->f[0] = -1;
++}
++
++static void blake2s_increment_counter(struct blake2s_state *state, const uint32_t inc)
++{
++ state->t[0] += inc;
++ state->t[1] += (state->t[0] < inc);
++}
++
++static void blake2s_init_param(struct blake2s_state *state, const uint32_t param)
++{
++ int i;
++
++ memset(state, 0, sizeof(*state));
++ for (i = 0; i < 8; ++i)
++ state->h[i] = blake2s_iv[i];
++ state->h[0] ^= param;
++}
++
++static void blake2s_init(struct blake2s_state *state, const size_t outlen)
++{
++ blake2s_init_param(state, 0x01010000 | outlen);
++ state->outlen = outlen;
++}
++
++static void blake2s_compress(struct blake2s_state *state, const uint8_t *block, size_t nblocks, const uint32_t inc)
++{
++ uint32_t m[16];
++ uint32_t v[16];
++ int i;
++
++ while (nblocks > 0) {
++ blake2s_increment_counter(state, inc);
++ memcpy(m, block, BLAKE2S_BLOCK_LEN);
++ le32_to_cpu_array(m, ARRAY_SIZE(m));
++ memcpy(v, state->h, 32);
++ v[ 8] = blake2s_iv[0];
++ v[ 9] = blake2s_iv[1];
++ v[10] = blake2s_iv[2];
++ v[11] = blake2s_iv[3];
++ v[12] = blake2s_iv[4] ^ state->t[0];
++ v[13] = blake2s_iv[5] ^ state->t[1];
++ v[14] = blake2s_iv[6] ^ state->f[0];
++ v[15] = blake2s_iv[7] ^ state->f[1];
++
++#define G(r, i, a, b, c, d) do { \
++ a += b + m[blake2s_sigma[r][2 * i + 0]]; \
++ d = ror32(d ^ a, 16); \
++ c += d; \
++ b = ror32(b ^ c, 12); \
++ a += b + m[blake2s_sigma[r][2 * i + 1]]; \
++ d = ror32(d ^ a, 8); \
++ c += d; \
++ b = ror32(b ^ c, 7); \
++} while (0)
++
++#define ROUND(r) do { \
++ G(r, 0, v[0], v[ 4], v[ 8], v[12]); \
++ G(r, 1, v[1], v[ 5], v[ 9], v[13]); \
++ G(r, 2, v[2], v[ 6], v[10], v[14]); \
++ G(r, 3, v[3], v[ 7], v[11], v[15]); \
++ G(r, 4, v[0], v[ 5], v[10], v[15]); \
++ G(r, 5, v[1], v[ 6], v[11], v[12]); \
++ G(r, 6, v[2], v[ 7], v[ 8], v[13]); \
++ G(r, 7, v[3], v[ 4], v[ 9], v[14]); \
++} while (0)
++ ROUND(0);
++ ROUND(1);
++ ROUND(2);
++ ROUND(3);
++ ROUND(4);
++ ROUND(5);
++ ROUND(6);
++ ROUND(7);
++ ROUND(8);
++ ROUND(9);
++
++#undef G
++#undef ROUND
++
++ for (i = 0; i < 8; ++i)
++ state->h[i] ^= v[i] ^ v[i + 8];
++
++ block += BLAKE2S_BLOCK_LEN;
++ --nblocks;
++ }
++}
++
++static void blake2s_update(struct blake2s_state *state, const void *inp, size_t inlen)
++{
++ const size_t fill = BLAKE2S_BLOCK_LEN - state->buflen;
++ const uint8_t *in = inp;
++
++ if (!inlen)
++ return;
++ if (inlen > fill) {
++ memcpy(state->buf + state->buflen, in, fill);
++ blake2s_compress(state, state->buf, 1, BLAKE2S_BLOCK_LEN);
++ state->buflen = 0;
++ in += fill;
++ inlen -= fill;
++ }
++ if (inlen > BLAKE2S_BLOCK_LEN) {
++ const size_t nblocks = DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_LEN);
++ blake2s_compress(state, in, nblocks - 1, BLAKE2S_BLOCK_LEN);
++ in += BLAKE2S_BLOCK_LEN * (nblocks - 1);
++ inlen -= BLAKE2S_BLOCK_LEN * (nblocks - 1);
++ }
++ memcpy(state->buf + state->buflen, in, inlen);
++ state->buflen += inlen;
++}
++
++static void blake2s_final(struct blake2s_state *state, uint8_t *out)
++{
++ blake2s_set_lastblock(state);
++ memset(state->buf + state->buflen, 0, BLAKE2S_BLOCK_LEN - state->buflen);
++ blake2s_compress(state, state->buf, 1, state->buflen);
++ cpu_to_le32_array(state->h, ARRAY_SIZE(state->h));
++ memcpy(out, state->h, state->outlen);
++}
++
++static size_t determine_optimal_seed_len(void)
++{
++ size_t ret = 0;
++ char poolsize_str[11] = { 0 };
++ int fd = open("/proc/sys/kernel/random/poolsize", O_RDONLY);
++
++ if (fd < 0 || read(fd, poolsize_str, sizeof(poolsize_str) - 1) < 0) {
++ ewarn("Unable to determine pool size, falling back to %u bits: %s", MIN_SEED_LEN * 8, strerror(errno));
++ ret = MIN_SEED_LEN;
++ } else
++ ret = DIV_ROUND_UP(strtoul(poolsize_str, NULL, 10), 8);
++ if (fd >= 0)
++ close(fd);
++ if (ret < MIN_SEED_LEN)
++ ret = MIN_SEED_LEN;
++ else if (ret > MAX_SEED_LEN)
++ ret = MAX_SEED_LEN;
++ return ret;
++}
++
++static int read_new_seed(uint8_t *seed, size_t len, bool *is_creditable)
++{
++ ssize_t ret;
++ int urandom_fd;
++
++ *is_creditable = false;
++ ret = getrandom(seed, len, GRND_NONBLOCK);
++ if (ret == (ssize_t)len) {
++ *is_creditable = true;
++ return 0;
++ }
++ if (ret == -1 && errno == ENOSYS) {
++ struct pollfd random_fd = {
++ .fd = open("/dev/random", O_RDONLY),
++ .events = POLLIN
++ };
++ if (random_fd.fd < 0)
++ return -errno;
++ *is_creditable = poll(&random_fd, 1, 0) == 1;
++ close(random_fd.fd);
++ } else if (getrandom(seed, len, GRND_INSECURE) == (ssize_t)len)
++ return 0;
++ urandom_fd = open("/dev/urandom", O_RDONLY);
++ if (urandom_fd < 0)
++ return -errno;
++ ret = read(urandom_fd, seed, len);
++ if (ret == (ssize_t)len)
++ ret = 0;
++ else
++ ret = -errno ? -errno : -EIO;
++ close(urandom_fd);
++ return ret;
++}
++
++static int seed_rng(uint8_t *seed, size_t len, bool credit)
++{
++ struct {
++ int entropy_count;
++ int buf_size;
++ uint8_t buffer[MAX_SEED_LEN];
++ } req = {
++ .entropy_count = credit ? len * 8 : 0,
++ .buf_size = len
++ };
++ int random_fd, ret;
++
++ if (len > sizeof(req.buffer))
++ return -EFBIG;
++ memcpy(req.buffer, seed, len);
++
++ random_fd = open("/dev/random", O_RDWR);
++ if (random_fd < 0)
++ return -errno;
++ ret = ioctl(random_fd, RNDADDENTROPY, &req);
++ if (ret)
++ ret = -errno ? -errno : -EIO;
++ close(random_fd);
++ return ret;
++}
++
++static int seed_from_file_if_exists(const char *filename, bool credit, struct blake2s_state *hash)
++{
++ uint8_t seed[MAX_SEED_LEN];
++ ssize_t seed_len;
++ int fd, dfd, ret = 0;
++
++ fd = open(filename, O_RDONLY);
++ if (fd < 0 && errno == ENOENT)
++ return 0;
++ else if (fd < 0) {
++ ret = -errno;
++ eerror("Unable to open seed file: %s", strerror(errno));
++ return ret;
++ }
++ dfd = open(SEED_DIR, O_DIRECTORY | O_RDONLY);
++ if (dfd < 0) {
++ ret = -errno;
++ close(fd);
++ eerror("Unable to open seed directory: %s", strerror(errno));
++ return ret;
++ }
++ seed_len = read(fd, seed, sizeof(seed));
++ if (seed_len < 0) {
++ ret = -errno;
++ eerror("Unable to read seed file: %s", strerror(errno));
++ }
++ close(fd);
++ if (ret) {
++ close(dfd);
++ return ret;
++ }
++ if ((unlink(filename) < 0 || fsync(dfd) < 0) && seed_len) {
++ ret = -errno;
++ eerror("Unable to remove seed after reading, so not seeding: %s", strerror(errno));
++ }
++ close(dfd);
++ if (ret)
++ return ret;
++ if (!seed_len)
++ return 0;
++
++ blake2s_update(hash, &seed_len, sizeof(seed_len));
++ blake2s_update(hash, seed, seed_len);
++
++ einfo("Seeding %zd bits %s crediting", seed_len * 8, credit ? "and" : "without");
++ ret = seed_rng(seed, seed_len, credit);
++ if (ret < 0)
++ eerror("Unable to seed: %s", strerror(-ret));
++ return ret;
++}
++
++static void populate_global_paths(void)
++{
++ SEED_DIR = getenv("SEEDRNG_SEED_DIR");
++ if (!SEED_DIR || !*SEED_DIR)
++ SEED_DIR = "/var/lib/seedrng";
++ LOCK_FILE = getenv("SEEDRNG_LOCK_FILE");
++ if (!LOCK_FILE || !*LOCK_FILE)
++ LOCK_FILE = "/var/run/seedrng.lock";
++ xasprintf(&CREDITABLE_SEED, "%s/seed.credit", SEED_DIR);
++ xasprintf(&NON_CREDITABLE_SEED, "%s/seed.no-credit", SEED_DIR);
++}
++
++int main(int argc _unused, char *argv[] _unused)
++{
++ static const char seedrng_prefix[] = "SeedRNG v1 Old+New Prefix";
++ static const char seedrng_failure[] = "SeedRNG v1 No New Seed Failure";
++ int ret, fd, lock, program_ret = 0;
++ uint8_t new_seed[MAX_SEED_LEN];
++ size_t new_seed_len;
++ bool new_seed_creditable;
++ struct timespec realtime = { 0 }, boottime = { 0 };
++ struct blake2s_state hash;
++
++ umask(0077);
++ if (getuid())
++ eerrorx("This rc helper program requires root");
++
++ populate_global_paths();
++ blake2s_init(&hash, BLAKE2S_HASH_LEN);
++ blake2s_update(&hash, seedrng_prefix, strlen(seedrng_prefix));
++ clock_gettime(CLOCK_REALTIME, &realtime);
++ clock_gettime(CLOCK_BOOTTIME, &boottime);
++ blake2s_update(&hash, &realtime, sizeof(realtime));
++ blake2s_update(&hash, &boottime, sizeof(boottime));
++
++ if (mkdir(SEED_DIR, 0700) < 0 && errno != EEXIST)
++ eerrorx("Unable to create \"%s\" directory: %s", SEED_DIR, strerror(errno));
++
++ lock = open(LOCK_FILE, O_WRONLY | O_CREAT, 0000);
++ if (lock < 0 || flock(lock, LOCK_EX) < 0)
++ eerrorx("Unable to open lock file: %s", strerror(errno));
++
++ ret = seed_from_file_if_exists(NON_CREDITABLE_SEED, false, &hash);
++ if (ret < 0)
++ program_ret |= 1 << 1;
++ ret = seed_from_file_if_exists(CREDITABLE_SEED, !rc_yesno(getenv("SEEDRNG_SKIP_CREDIT")), &hash);
++ if (ret < 0)
++ program_ret |= 1 << 2;
++
++ new_seed_len = determine_optimal_seed_len();
++ ret = read_new_seed(new_seed, new_seed_len, &new_seed_creditable);
++ if (ret < 0) {
++ eerror("Unable to read new seed: %s", strerror(-ret));
++ new_seed_len = BLAKE2S_HASH_LEN;
++ strncpy((char *)new_seed, seedrng_failure, new_seed_len);
++ program_ret |= 1 << 3;
++ }
++ blake2s_update(&hash, &new_seed_len, sizeof(new_seed_len));
++ blake2s_update(&hash, new_seed, new_seed_len);
++ blake2s_final(&hash, new_seed + new_seed_len - BLAKE2S_HASH_LEN);
++
++ einfo("Saving %zu bits of %s seed for next boot", new_seed_len * 8, new_seed_creditable ? "creditable" : "non-creditable");
++ fd = open(NON_CREDITABLE_SEED, O_WRONLY | O_CREAT | O_TRUNC, 0400);
++ if (fd < 0) {
++ eerror("Unable to open seed file for writing: %s", strerror(errno));
++ program_ret |= 1 << 4;
++ goto out;
++ }
++ if (write(fd, new_seed, new_seed_len) != (ssize_t)new_seed_len || fsync(fd) < 0) {
++ eerror("Unable to write seed file: %s", strerror(errno));
++ program_ret |= 1 << 5;
++ goto out;
++ }
++ if (new_seed_creditable && rename(NON_CREDITABLE_SEED, CREDITABLE_SEED) < 0) {
++ ewarn("Unable to make new seed creditable: %s", strerror(errno));
++ program_ret |= 1 << 6;
++ }
++out:
++ close(fd);
++ close(lock);
++ return program_ret;
++}
diff --git a/repo/system/openrc/sysctl.initd b/repo/system/openrc/sysctl.initd
new file mode 100644
index 0000000..befdb91
--- /dev/null
+++ b/repo/system/openrc/sysctl.initd
@@ -0,0 +1,87 @@
+#!/sbin/openrc-run
+
+depend()
+{
+ after clock
+ before bootmisc logger
+ keyword -prefix -systemd-nspawn -vserver
+}
+
+start()
+{
+ local quiet retval=0 status
+ ebegin "Configuring kernel parameters"
+
+ yesno $rc_verbose || quiet=-q
+
+ eindent
+
+ for f in /lib/sysctl.d/*.conf \
+ /usr/lib/sysctl.d/*.conf; do
+
+ if [ -f /etc/sysctl.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /etc/sysctl.d/${f##*/}"
+ continue
+ fi
+
+ if [ -f /run/sysctl.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /run/sysctl.d/${f##*/}"
+ continue
+ fi
+
+ if [ -f "$f" ]; then
+ vebegin "applying $f"
+ sysctl $quiet -p "$f"
+ status=$?
+ if [ $status -gt 0 ]; then
+ # Don't change retval= since we expect some package/distro provided
+ # sysctl configurations to break, so just warn when the user wants
+ # verbose messages
+ vewarn "Unable to configure kernel parameters from $f"
+ fi
+ fi
+ done
+
+ for f in /etc/sysctl.d/*.conf; do
+
+ if [ -f /run/sysctl.d/"${f##*/}" ]; then
+ veinfo "Ignoring $f due to /run/sysctl.d/${f##*/}"
+ continue
+ fi
+
+ if [ -f "$f" ]; then
+ vebegin "applying $f"
+ sysctl $quiet -p "$f"
+ status=$?
+ if [ $status -gt 0 ]; then
+ retval=$(( $retval + $status ))
+ eerror "Unable to configure kernel parameters from $f"
+ fi
+ fi
+ done
+
+ if [ -f /etc/sysctl.conf ]; then
+ vebegin "applying /etc/sysctl.conf"
+ sysctl $quiet -p /etc/sysctl.conf
+ status=$?
+ if [ $status -gt 0 ]; then
+ retval=$(( $retval + $status ))
+ eerror "Unable to configure kernel parameters from /etc/sysctl.conf"
+ fi
+ fi
+
+ for f in /run/sysctl.d/*.conf; do
+ if [ -f "$f" ]; then
+ vebegin "applying $f"
+ sysctl $quiet -p "$f"
+ status=$?
+ if [ $status -gt 0 ]; then
+ retval=$(( $retval + $status ))
+ eerror "Unable to configure kernel parameters from $f"
+ fi
+ fi
+ done
+ eoutdent
+
+ eend $retval
+}
diff --git a/repo/system/openrc/sysfsconf.initd b/repo/system/openrc/sysfsconf.initd
new file mode 100644
index 0000000..433e51d
--- /dev/null
+++ b/repo/system/openrc/sysfsconf.initd
@@ -0,0 +1,66 @@
+#!/sbin/openrc-run
+
+description="Set sysfs variables from /etc/sysfs.conf and /etc/sysfs.d/*.conf"
+conffile=/etc/sysfs.conf
+confdir=/etc/sysfs.d
+
+depend() {
+ need sysfs
+}
+
+setval() {
+ local value="$1" attrib="$2"
+ # Some fields need a terminating newline, others
+ # need the terminating newline to be absent :-(
+ echo -n "$value" > "$attrib" 2>/dev/null \
+ || echo "$value" > "$attrib"
+}
+
+load_conffile() {
+ local file="$1"
+ while read line; do
+ local line=${line%%#*}
+ local cmd= attrib= value=
+ set -- $line
+ if [ $# -eq 0 ]; then
+ continue
+ fi
+ case "$1$3" in
+ mode=) cmd=chmod
+ attrib="$2"
+ value="$4"
+ ;;
+ owner=) cmd=chown
+ attrib="$2"
+ value="$4"
+ ;;
+ *) if [ "$2" = "=" ]; then
+ cmd=setval
+ attrib="$1"
+ value="$3"
+ fi
+ ;;
+ esac
+ if ! [ -e "/sys/$attrib" ]; then
+ eerror "$attrib: unknown attribute"
+ continue
+ fi
+ if [ -z "$attrib" ] || [ -z "$value" ]; then
+ eerror "syntax error in $file: '$line'"
+ continue
+ fi
+ $cmd "$value" "/sys/$attrib"
+ done < "$file"
+}
+
+start() {
+ [ -r "$conffile" -o -d "$confdir" ] || return 0
+ ebegin "Setting sysfs variables"
+ for file in $confdir/*.conf $conffile; do
+ [ -r "$file" ] || continue
+ load_conffile "$file" || return 1
+ done
+ eend 0
+
+}
+
diff --git a/repo/system/openrc/test-networking.sh b/repo/system/openrc/test-networking.sh
new file mode 100644
index 0000000..5e5f70b
--- /dev/null
+++ b/repo/system/openrc/test-networking.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# unit tests for find_ifaces and find_running_ifaces in networking.initd
+
+cfgfile=/tmp/openrc-test-network.$$
+sourcefile=$cfgfile.source
+sourcedir=$cfgfile.d
+ifstate=$cfgfile.state
+
+cat >$cfgfile<<EOF
+auto eth0
+iface eth0 inet dhcp
+
+source $sourcefile
+
+source-directory $sourcedir
+EOF
+
+cat >$sourcefile<<EOF
+auto eth1
+iface eth1 inet dhcp
+EOF
+
+mkdir -p $sourcedir
+cat >$sourcedir/a<<EOF
+auto eth2
+iface eth2 inet dhcp
+EOF
+
+cat >$ifstate<<EOF
+eth4=eth4 1
+EOF
+
+errors=0
+fail() {
+ echo "$@"
+ errors=$(( $errors + 1))
+}
+
+# test fallback, when ifquery does not exist
+ifquery=does-not-exist
+. ./networking.initd
+
+find_ifaces | grep -q -w eth0 || fail "Did not find eth0"
+find_ifaces | grep -q -E '(eth1|eth2)' && fail "Unexpectedly found eth1 or eth2"
+
+# test that ifquery finds source and source-directory
+unset ifquery
+. ./networking.initd
+for i in eth0 eth1 eth2; do
+ find_ifaces | grep -q -w "$i" || fail "Did not find $i"
+done
+
+# test that ifquery picks up the running state file
+find_running_ifaces | grep -q -w "eth4" || fail "Did not detect eth4 running"
+
+
+# test /etc/init.d/net.eth5
+RC_SVCNAME=net.eth5
+. ./networking.initd
+find_ifaces | grep -q -w "eth5" || fail "Did not detect eth5"
+find_running_ifaces | grep -q -w "eth5" || fail "Did not detect eth5 running"
+
+rm -rf $cfgfile $sourcefile $sourcedir $ifstate
+exit $errors
diff --git a/repo/system/openssl.xibuild b/repo/system/openssl/openssl.xibuild
index b30ea90..b30ea90 100644
--- a/repo/system/openssl.xibuild
+++ b/repo/system/openssl/openssl.xibuild
diff --git a/repo/system/pahole.xibuild b/repo/system/pahole/pahole.xibuild
index 6b57291..6b57291 100644
--- a/repo/system/pahole.xibuild
+++ b/repo/system/pahole/pahole.xibuild
diff --git a/repo/system/pam/other.pamd b/repo/system/pam/other.pamd
new file mode 100644
index 0000000..20bdb74
--- /dev/null
+++ b/repo/system/pam/other.pamd
@@ -0,0 +1,11 @@
+
+auth required pam_warn.so
+auth required pam_deny.so
+account required pam_warn.so
+account required pam_deny.so
+password required pam_warn.so
+password required pam_deny.so
+session required pam_warn.so
+session required pam_deny.so
+
+
diff --git a/repo/system/pam.xibuild b/repo/system/pam/pam.xibuild
index 366ec3c..366ec3c 100644
--- a/repo/system/pam.xibuild
+++ b/repo/system/pam/pam.xibuild
diff --git a/repo/system/pam/system-account.pamd b/repo/system/pam/system-account.pamd
new file mode 100644
index 0000000..b36f26d
--- /dev/null
+++ b/repo/system/pam/system-account.pamd
@@ -0,0 +1 @@
+account required pam_unix.so
diff --git a/repo/system/pam/system-auth.pamd b/repo/system/pam/system-auth.pamd
new file mode 100644
index 0000000..5f85baf
--- /dev/null
+++ b/repo/system/pam/system-auth.pamd
@@ -0,0 +1,2 @@
+auth required pam_unix.so
+
diff --git a/repo/system/pam/system-password.pamd b/repo/system/pam/system-password.pamd
new file mode 100644
index 0000000..56d5122
--- /dev/null
+++ b/repo/system/pam/system-password.pamd
@@ -0,0 +1,3 @@
+# basic PAM configuration for Alpine.
+
+password required pam_unix.so nullok md5 sha512 shadow try_first_pass
diff --git a/repo/system/pam/system-session.pamd b/repo/system/pam/system-session.pamd
new file mode 100644
index 0000000..5e25d29
--- /dev/null
+++ b/repo/system/pam/system-session.pamd
@@ -0,0 +1,3 @@
+
+session required pam_unix.so
+
diff --git a/repo/system/pcre.xibuild b/repo/system/pcre/pcre.xibuild
index dc86f46..dc86f46 100644
--- a/repo/system/pcre.xibuild
+++ b/repo/system/pcre/pcre.xibuild
diff --git a/repo/system/pcre2.xibuild b/repo/system/pcre2/pcre2.xibuild
index 46e35e9..46e35e9 100644
--- a/repo/system/pcre2.xibuild
+++ b/repo/system/pcre2/pcre2.xibuild
diff --git a/repo/system/pcsc-lite.xibuild b/repo/system/pcsc-lite/pcsc-lite.xibuild
index 86d86d1..86d86d1 100644
--- a/repo/system/pcsc-lite.xibuild
+++ b/repo/system/pcsc-lite/pcsc-lite.xibuild
diff --git a/repo/system/perl-xml-parser.xibuild b/repo/system/perl-xml-parser/perl-xml-parser.xibuild
index bd73b3f..bd73b3f 100644
--- a/repo/system/perl-xml-parser.xibuild
+++ b/repo/system/perl-xml-parser/perl-xml-parser.xibuild
diff --git a/repo/system/perl/musl-locale.patch b/repo/system/perl/musl-locale.patch
new file mode 100644
index 0000000..65839f1
--- /dev/null
+++ b/repo/system/perl/musl-locale.patch
@@ -0,0 +1,37 @@
+diff --git a/locale.c b/locale.c
+index 7653340..7243cb1 100644
+--- a/locale.c
++++ b/locale.c
+@@ -581,6 +581,10 @@ S_emulate_setlocale(const int category,
+
+ return (char *) querylocale(mask, cur_obj);
+
++# elif defined(_NL_LOCALE_NAME)
++
++ return (char *) nl_langinfo_l(_NL_LOCALE_NAME(category), cur_obj);
++
+ # else
+
+ /* If this assert fails, adjust the size of curlocales in intrpvar.h */
+@@ -737,7 +741,7 @@ S_emulate_setlocale(const int category,
+
+ /* Here, we are switching locales. */
+
+-# ifndef HAS_QUERYLOCALE
++# if !defined(HAS_QUERYLOCALE) && !defined(_NL_LOCALE_NAME)
+
+ if (strEQ(locale, "")) {
+
+@@ -1094,6 +1098,12 @@ S_emulate_setlocale(const int category,
+ locale = querylocale(mask, new_obj);
+ }
+
++# elif defined(_NL_LOCALE_NAME)
++
++ if (strEQ(locale, "")) {
++ locale = nl_langinfo_l(_NL_LOCALE_NAME(category), new_obj);
++ }
++
+ # else
+
+ /* Here, 'locale' is the return value */
diff --git a/repo/system/perl/musl-skip-dst-test.patch b/repo/system/perl/musl-skip-dst-test.patch
new file mode 100644
index 0000000..d217ecc
--- /dev/null
+++ b/repo/system/perl/musl-skip-dst-test.patch
@@ -0,0 +1,13 @@
+diff --git a/cpan/Time-Piece/t/02core_dst.t b/cpan/Time-Piece/t/02core_dst.t
+index 3f54fff..4b1faa8 100644
+--- a/cpan/Time-Piece/t/02core_dst.t
++++ b/cpan/Time-Piece/t/02core_dst.t
+@@ -119,7 +119,7 @@ cmp_ok($t->month_last_day, '==', 31); # test more
+
+
+ SKIP: {
+- skip "Extra tests for Linux, BSD only.", 8 unless $is_linux or $is_mac or $is_bsd;
++ skip "Extra tests for Linux, BSD only.", 8 unless $is_mac or $is_bsd;
+
+ local $ENV{TZ} = "EST5EDT4";
+ Time::Piece::_tzset();
diff --git a/repo/system/perl/musl-stack-size.patch b/repo/system/perl/musl-stack-size.patch
new file mode 100644
index 0000000..08a9ef0
--- /dev/null
+++ b/repo/system/perl/musl-stack-size.patch
@@ -0,0 +1,16 @@
+Tests fails on s390x due to low thread stack size
+upstream report: https://github.com/Perl/perl5/issues/18160
+
+diff --git a/t/thread_it.pl b/t/thread_it.pl
+index f38a580..e8c450a 100644
+--- a/t/thread_it.pl
++++ b/t/thread_it.pl
+@@ -36,7 +36,7 @@ my $curr = threads->create({
+ stack_size => $^O eq 'hpux' ? 524288 :
+ $^O eq 'darwin' ? 2000000:
+ $^O eq 'VMS' ? 150000 :
+- $^O eq 'aix' ? 1500000 : 0,
++ $^O eq 'aix' ? 1500000 : 256*1024,
+ }, sub {
+ run_tests();
+ return defined &curr_test ? curr_test() : ()
diff --git a/repo/system/perl.xibuild b/repo/system/perl/perl.xibuild
index 494b9f1..494b9f1 100644
--- a/repo/system/perl.xibuild
+++ b/repo/system/perl/perl.xibuild
diff --git a/repo/system/perl/skip-test-due-to-busybox-ps.patch b/repo/system/perl/skip-test-due-to-busybox-ps.patch
new file mode 100644
index 0000000..ac3becc
--- /dev/null
+++ b/repo/system/perl/skip-test-due-to-busybox-ps.patch
@@ -0,0 +1,13 @@
+diff --git a/t/op/magic.t b/t/op/magic.t
+index 27c1d43..91882f4 100644
+--- a/t/op/magic.t
++++ b/t/op/magic.t
+@@ -408,7 +408,7 @@ EOP
+ # argv[0] assignment and by calling prctl()
+ {
+ SKIP: {
+- skip "We don't have prctl() here, or we're on Android", 2 unless $Config{d_prctl_set_name} && $^O ne 'android';
++ skip "Skip test to avoid external ps(1) dependency", 2;
+
+ # We don't really need these tests. prctl() is tested in the
+ # Kernel, but test it anyway for our sanity. If something doesn't
diff --git a/repo/system/perl/zlib-test.patch b/repo/system/perl/zlib-test.patch
new file mode 100644
index 0000000..1cb8f5e
--- /dev/null
+++ b/repo/system/perl/zlib-test.patch
@@ -0,0 +1,80 @@
+diff --git a/cpan/Compress-Raw-Zlib/t/02zlib.t b/cpan/Compress-Raw-Zlib/t/02zlib.t
+index 64c8944..9b2e9cb 100644
+--- a/cpan/Compress-Raw-Zlib/t/02zlib.t
++++ b/cpan/Compress-Raw-Zlib/t/02zlib.t
+@@ -13,6 +13,7 @@ use bytes;
+ use Test::More ;
+ use CompTestUtils;
+
++use constant ZLIB_1_2_12_0 => 0x12C0;
+
+ BEGIN
+ {
+@@ -490,7 +491,16 @@ SKIP:
+ last if $status == Z_STREAM_END or $status != Z_OK ;
+ }
+
+- cmp_ok $status, '==', Z_DATA_ERROR ;
++ # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib
++ if (ZLIB_VERNUM >= ZLIB_1_2_12_0)
++ {
++ cmp_ok $status, '==', Z_STREAM_END ;
++ }
++ else
++ {
++ cmp_ok $status, '==', Z_DATA_ERROR ;
++ }
++
+ is $GOT, $goodbye ;
+
+
+@@ -514,7 +524,17 @@ SKIP:
+ is length($rest), $len2, "expected compressed output";
+
+ $GOT = '';
+- cmp_ok $k->inflate($rest, $GOT), '==', Z_DATA_ERROR, "inflate returns Z_DATA_ERROR";
++ $status = $k->inflate($rest, $GOT);
++ # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib
++ if (ZLIB_VERNUM >= ZLIB_1_2_12_0)
++ {
++ cmp_ok $status, '==', Z_STREAM_END ;
++ }
++ else
++ {
++ cmp_ok $status, '==', Z_DATA_ERROR ;
++ }
++
+ is $GOT, $goodbye ;
+ }
+
+diff --git a/cpan/IO-Compress/t/cz-03zlib-v1.t b/cpan/IO-Compress/t/cz-03zlib-v1.t
+index 9b75f9b..41734d0 100644
+--- a/cpan/IO-Compress/t/cz-03zlib-v1.t
++++ b/cpan/IO-Compress/t/cz-03zlib-v1.t
+@@ -14,6 +14,8 @@ use Test::More ;
+ use CompTestUtils;
+ use Symbol;
+
++use constant ZLIB_1_2_12_0 => 0x12C0;
++
+ BEGIN
+ {
+ # use Test::NoWarnings, if available
+@@ -700,7 +702,16 @@ EOM
+
+ ($GOT, $status) = $k->inflate($rest) ;
+
+- ok $status == Z_DATA_ERROR ;
++ # Z_STREAM_END returned by 1.12.2, Z_DATA_ERROR for older zlib
++ if (ZLIB_VERNUM >= ZLIB_1_2_12_0)
++ {
++ cmp_ok $status, '==', Z_STREAM_END ;
++ }
++ else
++ {
++ cmp_ok $status, '==', Z_DATA_ERROR ;
++ }
++
+ ok $Z . $GOT eq $goodbye ;
+ }
+
diff --git a/repo/system/polkit/files/polkit-1 b/repo/system/polkit/files/polkit-1
new file mode 100644
index 0000000..df1b69a
--- /dev/null
+++ b/repo/system/polkit/files/polkit-1
@@ -0,0 +1,9 @@
+# Begin /etc/pam.d/polkit-1
+
+auth include system-auth
+account include system-account
+password include system-password
+session include system-session
+
+# End /etc/pam.d/polkit-1
+
diff --git a/repo/system/polkit/patches/CVE-2021-4034.patch b/repo/system/polkit/patches/CVE-2021-4034.patch
new file mode 100644
index 0000000..a06300a
--- /dev/null
+++ b/repo/system/polkit/patches/CVE-2021-4034.patch
@@ -0,0 +1,79 @@
+From a2bf5c9c83b6ae46cbd5c779d3055bff81ded683 Mon Sep 17 00:00:00 2001
+From: Jan Rybar <jrybar@redhat.com>
+Date: Tue, 25 Jan 2022 17:21:46 +0000
+Subject: [PATCH] pkexec: local privilege escalation (CVE-2021-4034)
+
+---
+ src/programs/pkcheck.c | 5 +++++
+ src/programs/pkexec.c | 23 ++++++++++++++++++++---
+ 2 files changed, 25 insertions(+), 3 deletions(-)
+
+diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c
+index f1bb4e1..768525c 100644
+--- a/src/programs/pkcheck.c
++++ b/src/programs/pkcheck.c
+@@ -363,6 +363,11 @@ main (int argc, char *argv[])
+ local_agent_handle = NULL;
+ ret = 126;
+
++ if (argc < 1)
++ {
++ exit(126);
++ }
++
+ /* Disable remote file access from GIO. */
+ setenv ("GIO_USE_VFS", "local", 1);
+
+diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
+index 7698c5c..84e5ef6 100644
+--- a/src/programs/pkexec.c
++++ b/src/programs/pkexec.c
+@@ -488,6 +488,15 @@ main (int argc, char *argv[])
+ pid_t pid_of_caller;
+ gpointer local_agent_handle;
+
++
++ /*
++ * If 'pkexec' is called THIS wrong, someone's probably evil-doing. Don't be nice, just bail out.
++ */
++ if (argc<1)
++ {
++ exit(127);
++ }
++
+ ret = 127;
+ authority = NULL;
+ subject = NULL;
+@@ -614,10 +623,10 @@ main (int argc, char *argv[])
+
+ path = g_strdup (pwstruct.pw_shell);
+ if (!path)
+- {
++ {
+ g_printerr ("No shell configured or error retrieving pw_shell\n");
+ goto out;
+- }
++ }
+ /* If you change this, be sure to change the if (!command_line)
+ case below too */
+ command_line = g_strdup (path);
+@@ -636,7 +645,15 @@ main (int argc, char *argv[])
+ goto out;
+ }
+ g_free (path);
+- argv[n] = path = s;
++ path = s;
++
++ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated.
++ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination
++ */
++ if (argv[n] != NULL)
++ {
++ argv[n] = path;
++ }
+ }
+ if (access (path, F_OK) != 0)
+ {
+--
+GitLab
+
diff --git a/repo/system/polkit/patches/make-innetgr-optional.patch b/repo/system/polkit/patches/make-innetgr-optional.patch
new file mode 100644
index 0000000..8459c67
--- /dev/null
+++ b/repo/system/polkit/patches/make-innetgr-optional.patch
@@ -0,0 +1,239 @@
+See https://gitlab.freedesktop.org/polkit/polkit/merge_requests/10
+
+From 778bb45e0e0cbabe2b04adf67a500af1dab09768 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Wed, 11 Jul 2018 04:54:26 -0500
+Subject: [PATCH] make netgroup support optional
+
+On at least Linux/musl and Linux/uclibc, netgroup support is not
+available. PolKit fails to compile on these systems for that reason.
+
+This change makes netgroup support conditional on the presence of the
+setnetgrent(3) function which is required for the support to work. If
+that function is not available on the system, an error will be returned
+to the administrator if unix-netgroup: is specified in configuration.
+
+Fixes bug 50145.
+
+Closes polkit/polkit#14.
+
+Signed-off-by: A. Wilcox <AWilcox@Wilcox-Tech.com>
+---
+diff --git a/configure.ac b/configure.ac
+index 4ac2219..ca478df 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -100,7 +100,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
+ [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
+ AC_SUBST(EXPAT_LIBS)
+
+-AC_CHECK_FUNCS(clearenv fdatasync)
++AC_CHECK_FUNCS(clearenv fdatasync setnetgrent)
+
+ if test "x$GCC" = "xyes"; then
+ LDFLAGS="-Wl,--as-needed $LDFLAGS"
+diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
+index 3aa1f7f..10e9c17 100644
+--- a/src/polkit/polkitidentity.c
++++ b/src/polkit/polkitidentity.c
+@@ -182,7 +182,15 @@ polkit_identity_from_string (const gchar *str,
+ }
+ else if (g_str_has_prefix (str, "unix-netgroup:"))
+ {
++#ifndef HAVE_SETNETGRENT
++ g_set_error (error,
++ POLKIT_ERROR,
++ POLKIT_ERROR_FAILED,
++ "Netgroups are not available on this machine ('%s')",
++ str);
++#else
+ identity = polkit_unix_netgroup_new (str + sizeof "unix-netgroup:" - 1);
++#endif
+ }
+
+ if (identity == NULL && (error != NULL && *error == NULL))
+@@ -344,6 +352,13 @@ polkit_identity_new_for_gvariant (GVariant *variant,
+ GVariant *v;
+ const char *name;
+
++#ifndef HAVE_SETNETGRENT
++ g_set_error (error,
++ POLKIT_ERROR,
++ POLKIT_ERROR_FAILED,
++ "Netgroups are not available on this machine");
++ goto out;
++#else
+ v = lookup_asv (details_gvariant, "name", G_VARIANT_TYPE_STRING, error);
+ if (v == NULL)
+ {
+@@ -353,6 +368,7 @@ polkit_identity_new_for_gvariant (GVariant *variant,
+ name = g_variant_get_string (v, NULL);
+ ret = polkit_unix_netgroup_new (name);
+ g_variant_unref (v);
++#endif
+ }
+ else
+ {
+diff --git a/src/polkit/polkitunixnetgroup.c b/src/polkit/polkitunixnetgroup.c
+index 8a2b369..83f8d4a 100644
+--- a/src/polkit/polkitunixnetgroup.c
++++ b/src/polkit/polkitunixnetgroup.c
+@@ -194,6 +194,9 @@ polkit_unix_netgroup_set_name (PolkitUnixNetgroup *group,
+ PolkitIdentity *
+ polkit_unix_netgroup_new (const gchar *name)
+ {
++#ifndef HAVE_SETNETGRENT
++ g_assert_not_reached();
++#endif
+ g_return_val_if_fail (name != NULL, NULL);
+ return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_NETGROUP,
+ "name", name,
+diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
+index 056d9a8..36c2f3d 100644
+--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
++++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
+@@ -2233,25 +2233,26 @@ get_users_in_net_group (PolkitIdentity *group,
+ GList *ret;
+
+ ret = NULL;
++#ifdef HAVE_SETNETGRENT
+ name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
+
+-#ifdef HAVE_SETNETGRENT_RETURN
++# ifdef HAVE_SETNETGRENT_RETURN
+ if (setnetgrent (name) == 0)
+ {
+ g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno));
+ goto out;
+ }
+-#else
++# else
+ setnetgrent (name);
+-#endif
++# endif /* HAVE_SETNETGRENT_RETURN */
+
+ for (;;)
+ {
+-#if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
++# if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD)
+ const char *hostname, *username, *domainname;
+-#else
++# else
+ char *hostname, *username, *domainname;
+-#endif
++# endif /* defined(HAVE_NETBSD) || defined(HAVE_OPENBSD) */
+ PolkitIdentity *user;
+ GError *error = NULL;
+
+@@ -2282,6 +2283,7 @@ get_users_in_net_group (PolkitIdentity *group,
+
+ out:
+ endnetgrent ();
++#endif /* HAVE_SETNETGRENT */
+ return ret;
+ }
+
+diff --git a/src/polkitbackend/polkitbackendjsauthority.cpp b/src/polkitbackend/polkitbackendjsauthority.cpp
+index ca17108..da95180 100644
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp
+@@ -1520,6 +1520,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
+
+ JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
+
++#ifdef HAVE_SETNETGRENT
+ JS::RootedString usrstr (authority->priv->cx);
+ usrstr = args[0].toString();
+ user = JS_EncodeStringToUTF8 (cx, usrstr);
+@@ -1534,6 +1535,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
+ {
+ is_in_netgroup = true;
+ }
++ #endif
+
+ ret = true;
+
+diff --git a/test/polkit/polkitidentitytest.c b/test/polkit/polkitidentitytest.c
+index e91967b..e829aaa 100644
+--- a/test/polkit/polkitidentitytest.c
++++ b/test/polkit/polkitidentitytest.c
+@@ -19,6 +19,7 @@
+ * Author: Nikki VonHollen <vonhollen@google.com>
+ */
+
++#include "config.h"
+ #include "glib.h"
+ #include <polkit/polkit.h>
+ #include <polkit/polkitprivate.h>
+@@ -145,11 +146,15 @@ struct ComparisonTestData comparison_test_data [] = {
+ {"unix-group:root", "unix-group:jane", FALSE},
+ {"unix-group:jane", "unix-group:jane", TRUE},
+
++#ifdef HAVE_SETNETGRENT
+ {"unix-netgroup:foo", "unix-netgroup:foo", TRUE},
+ {"unix-netgroup:foo", "unix-netgroup:bar", FALSE},
++#endif
+
+ {"unix-user:root", "unix-group:root", FALSE},
++#ifdef HAVE_SETNETGRENT
+ {"unix-user:jane", "unix-netgroup:foo", FALSE},
++#endif
+
+ {NULL},
+ };
+@@ -181,11 +186,13 @@ main (int argc, char *argv[])
+ g_test_add_data_func ("/PolkitIdentity/group_string_2", "unix-group:jane", test_string);
+ g_test_add_data_func ("/PolkitIdentity/group_string_3", "unix-group:users", test_string);
+
++#ifdef HAVE_SETNETGRENT
+ g_test_add_data_func ("/PolkitIdentity/netgroup_string", "unix-netgroup:foo", test_string);
++ g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant);
++#endif
+
+ g_test_add_data_func ("/PolkitIdentity/user_gvariant", "unix-user:root", test_gvariant);
+ g_test_add_data_func ("/PolkitIdentity/group_gvariant", "unix-group:root", test_gvariant);
+- g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant);
+
+ add_comparison_tests ();
+
+diff --git a/test/polkit/polkitunixnetgrouptest.c b/test/polkit/polkitunixnetgrouptest.c
+index 3701ba1..e3352eb 100644
+--- a/test/polkit/polkitunixnetgrouptest.c
++++ b/test/polkit/polkitunixnetgrouptest.c
+@@ -19,6 +19,7 @@
+ * Author: Nikki VonHollen <vonhollen@google.com>
+ */
+
++#include "config.h"
+ #include "glib.h"
+ #include <polkit/polkit.h>
+ #include <string.h>
+@@ -69,7 +70,9 @@ int
+ main (int argc, char *argv[])
+ {
+ g_test_init (&argc, &argv, NULL);
++#ifdef HAVE_SETNETGRENT
+ g_test_add_func ("/PolkitUnixNetgroup/new", test_new);
+ g_test_add_func ("/PolkitUnixNetgroup/set_name", test_set_name);
++#endif
+ return g_test_run ();
+ }
+diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c
+index f97e0e0..fc52149 100644
+--- a/test/polkitbackend/test-polkitbackendjsauthority.c
++++ b/test/polkitbackend/test-polkitbackendjsauthority.c
+@@ -137,12 +137,14 @@ test_get_admin_identities (void)
+ "unix-group:users"
+ }
+ },
++#ifdef HAVE_SETNETGRENT
+ {
+ "net.company.action3",
+ {
+ "unix-netgroup:foo"
+ }
+ },
++#endif
+ };
+ guint n;
+
diff --git a/repo/system/polkit.xibuild b/repo/system/polkit/polkit.xibuild
index eb236bc..eb236bc 100644
--- a/repo/system/polkit.xibuild
+++ b/repo/system/polkit/polkit.xibuild
diff --git a/repo/system/popt.xibuild b/repo/system/popt/popt.xibuild
index 31796a7..31796a7 100644
--- a/repo/system/popt.xibuild
+++ b/repo/system/popt/popt.xibuild
diff --git a/repo/system/psmisc.xibuild b/repo/system/psmisc/psmisc.xibuild
index 61d767f..61d767f 100644
--- a/repo/system/psmisc.xibuild
+++ b/repo/system/psmisc/psmisc.xibuild
diff --git a/repo/system/queue-standalone.xibuild b/repo/system/queue-standalone/queue-standalone.xibuild
index c58dec8..c58dec8 100644
--- a/repo/system/queue-standalone.xibuild
+++ b/repo/system/queue-standalone/queue-standalone.xibuild
diff --git a/repo/system/re2.xibuild b/repo/system/re2/re2.xibuild
index 4dd0e5d..4dd0e5d 100644
--- a/repo/system/re2.xibuild
+++ b/repo/system/re2/re2.xibuild
diff --git a/repo/system/readline.xibuild b/repo/system/readline/readline.xibuild
index 5b93318..5b93318 100644
--- a/repo/system/readline.xibuild
+++ b/repo/system/readline/readline.xibuild
diff --git a/repo/system/rtmpdump.xibuild b/repo/system/rtmpdump/rtmpdump.xibuild
index cac7356..cac7356 100644
--- a/repo/system/rtmpdump.xibuild
+++ b/repo/system/rtmpdump/rtmpdump.xibuild
diff --git a/repo/system/sbase.xibuild b/repo/system/sbase/sbase.xibuild
index a380c9e..a380c9e 100644
--- a/repo/system/sbase.xibuild
+++ b/repo/system/sbase/sbase.xibuild
diff --git a/repo/system/sed.xibuild b/repo/system/sed/sed.xibuild
index ddb7102..ddb7102 100644
--- a/repo/system/sed.xibuild
+++ b/repo/system/sed/sed.xibuild
diff --git a/repo/system/sh.xibuild b/repo/system/sh/sh.xibuild
index db37812..db37812 100644
--- a/repo/system/sh.xibuild
+++ b/repo/system/sh/sh.xibuild
diff --git a/repo/system/shadow/chage.pamd b/repo/system/shadow/chage.pamd
new file mode 100644
index 0000000..3f277f8
--- /dev/null
+++ b/repo/system/shadow/chage.pamd
@@ -0,0 +1,11 @@
+# Begin /etc/pam.d/chage
+
+# always allow root
+auth sufficient pam_rootok.so
+
+# include system auth and account settings
+auth include system-auth
+account include system-account
+
+# End /etc/pam.d/chage
+
diff --git a/repo/system/shadow/chpasswd.pamd b/repo/system/shadow/chpasswd.pamd
new file mode 100644
index 0000000..81afbee
--- /dev/null
+++ b/repo/system/shadow/chpasswd.pamd
@@ -0,0 +1,12 @@
+# Begin /etc/pam.d/newusers
+
+# always allow root
+auth sufficient pam_rootok.so
+
+# include system auth and account settings
+auth include system-auth
+account include system-account
+password include system-password
+
+# End /etc/pam.d/newusers
+
diff --git a/repo/system/shadow/login.pamd b/repo/system/shadow/login.pamd
new file mode 100644
index 0000000..c6410c1
--- /dev/null
+++ b/repo/system/shadow/login.pamd
@@ -0,0 +1,46 @@
+# Begin /etc/pam.d/login
+
+# Set failure delay before next prompt to 3 seconds
+auth optional pam_faildelay.so delay=3000000
+
+# Check to make sure that the user is allowed to login
+auth requisite pam_nologin.so
+
+# Check to make sure that root is allowed to login
+# Disabled by default. You will need to create /etc/securetty
+# file for this module to function. See man 5 securetty.
+#auth required pam_securetty.so
+
+# Additional group memberships - disabled by default
+#auth optional pam_group.so
+
+# include system auth settings
+auth include system-auth
+
+# check access for the user
+account required pam_access.so
+
+# include system account settings
+account include system-account
+
+# Set default environment variables for the user
+session required pam_env.so
+
+# Set resource limits for the user
+session required pam_limits.so
+
+# Display date of last login - Disabled by default
+#session optional pam_lastlog.so
+
+# Display the message of the day - Disabled by default
+#session optional pam_motd.so
+
+# Check user's mail - Disabled by default
+#session optional pam_mail.so standard quiet
+
+# include system session and password settings
+session include system-session
+password include system-password
+
+# End /etc/pam.d/login
+
diff --git a/repo/system/shadow/newusers.pamd b/repo/system/shadow/newusers.pamd
new file mode 100644
index 0000000..57f5cfa
--- /dev/null
+++ b/repo/system/shadow/newusers.pamd
@@ -0,0 +1,12 @@
+# Begin /etc/pam.d/chpasswd
+
+# always allow root
+auth sufficient pam_rootok.so
+
+# include system auth and account settings
+auth include system-auth
+account include system-account
+password include system-password
+
+# End /etc/pam.d/chpasswd
+
diff --git a/repo/system/shadow/passwd.pamd b/repo/system/shadow/passwd.pamd
new file mode 100644
index 0000000..83459e3
--- /dev/null
+++ b/repo/system/shadow/passwd.pamd
@@ -0,0 +1,6 @@
+# Begin /etc/pam.d/passwd
+
+password include system-password
+
+# End /etc/pam.d/passwd
+
diff --git a/repo/system/shadow.xibuild b/repo/system/shadow/shadow.xibuild
index 22bd2f1..22bd2f1 100644
--- a/repo/system/shadow.xibuild
+++ b/repo/system/shadow/shadow.xibuild
diff --git a/repo/system/shadow/su.pamd b/repo/system/shadow/su.pamd
new file mode 100644
index 0000000..ca6ab90
--- /dev/null
+++ b/repo/system/shadow/su.pamd
@@ -0,0 +1,27 @@
+# Begin /etc/pam.d/su
+
+# always allow root
+auth sufficient pam_rootok.so
+
+# Allow users in the wheel group to execute su without a password
+# disabled by default
+#auth sufficient pam_wheel.so trust use_uid
+
+# include system auth settings
+auth include system-auth
+
+# limit su to users in the wheel group
+# disabled by default
+#auth required pam_wheel.so use_uid
+
+# include system account settings
+account include system-account
+
+# Set default environment variables for the service user
+session required pam_env.so
+
+# include system session settings
+session include system-session
+
+# End /etc/pam.d/su
+
diff --git a/repo/system/shared-mime-info.xibuild b/repo/system/shared-mime-info/shared-mime-info.xibuild
index cb6b887..cb6b887 100644
--- a/repo/system/shared-mime-info.xibuild
+++ b/repo/system/shared-mime-info/shared-mime-info.xibuild
diff --git a/repo/system/skalibs.xibuild b/repo/system/skalibs/skalibs.xibuild
index 0833b6c..0833b6c 100644
--- a/repo/system/skalibs.xibuild
+++ b/repo/system/skalibs/skalibs.xibuild
diff --git a/repo/system/slang.xibuild b/repo/system/slang/slang.xibuild
index b480936..b480936 100644
--- a/repo/system/slang.xibuild
+++ b/repo/system/slang/slang.xibuild
diff --git a/repo/system/snappy/cmakelists.patch b/repo/system/snappy/cmakelists.patch
new file mode 100644
index 0000000..d6576a8
--- /dev/null
+++ b/repo/system/snappy/cmakelists.patch
@@ -0,0 +1,76 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -213,19 +219,28 @@
+ "snappy-stubs-public.h.in"
+ "${PROJECT_BINARY_DIR}/snappy-stubs-public.h")
+
++# When BUILD_SHARED_LIBS is:
++# ON it will generate a SHARED library
++# OFF it will generate a STATIC library
+ add_library(snappy "")
+-target_sources(snappy
+- PRIVATE
++
++# Used to generate both lib types
++if (BUILD_SHARED_LIBS AND BUILD_STATIC_LIBS)
++ add_library(snappy_static STATIC "")
++ set_target_properties(snappy_static PROPERTIES OUTPUT_NAME snappy)
++ install(TARGETS snappy_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
++endif ()
++
++set(SNAPPY_SOURCE_PRIVATE
+ "snappy-internal.h"
+ "snappy-stubs-internal.h"
+ "snappy-c.cc"
+ "snappy-sinksource.cc"
+ "snappy-stubs-internal.cc"
+ "snappy.cc"
+- "${PROJECT_BINARY_DIR}/config.h"
++ "${PROJECT_BINARY_DIR}/config.h")
+
+- # Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
+- $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC>
++set(SNAPPY_SOURCE_PUBLIC
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-c.h>
+ $<INSTALL_INTERFACE:include/snappy-c.h>
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy-sinksource.h>
+@@ -233,18 +248,32 @@
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/snappy.h>
+ $<INSTALL_INTERFACE:include/snappy.h>
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/snappy-stubs-public.h>
+- $<INSTALL_INTERFACE:include/snappy-stubs-public.h>
+-)
+-target_include_directories(snappy
+- PUBLIC
++ $<INSTALL_INTERFACE:include/snappy-stubs-public.h>)
++
++set(SNAPPY_INCLUDE_DIRS
+ $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
+- $<INSTALL_INTERFACE:include>
+-)
++ $<INSTALL_INTERFACE:include>)
++
++# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
++target_sources(snappy PRIVATE ${SNAPPY_SOURCE_PRIVATE}
++ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
++
++target_include_directories(snappy PUBLIC ${SNAPPY_INCLUDE_DIRS})
++
++target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
++
++# Only CMake 3.3+ supports PUBLIC sources in targets exported by "install".
++target_sources(snappy_static PRIVATE ${SNAPPY_SOURCE_PRIVATE}
++ $<$<VERSION_GREATER:CMAKE_VERSION,3.2>:PUBLIC> ${SNAPPY_SOURCE_PUBLIC})
++
++target_include_directories(snappy_static PUBLIC ${SNAPPY_INCLUDE_DIRS})
++
++target_compile_definitions(snappy_static PRIVATE -DHAVE_CONFIG_H)
++
+ set_target_properties(snappy
+ PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR})
+
+-target_compile_definitions(snappy PRIVATE -DHAVE_CONFIG_H)
+ if(BUILD_SHARED_LIBS)
+ set_target_properties(snappy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
+ endif(BUILD_SHARED_LIBS)
diff --git a/repo/system/snappy/fix-inline.patch b/repo/system/snappy/fix-inline.patch
new file mode 100644
index 0000000..96484e0
--- /dev/null
+++ b/repo/system/snappy/fix-inline.patch
@@ -0,0 +1,13 @@
+Patch-Source: https://github.com/google/snappy/pull/128
+
+--- a/snappy.cc
++++ b/snappy.cc
+@@ -1014,7 +1014,7 @@
+ }
+
+ SNAPPY_ATTRIBUTE_ALWAYS_INLINE
+-size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
++inline size_t AdvanceToNextTag(const uint8_t** ip_p, size_t* tag) {
+ const uint8_t*& ip = *ip_p;
+ // This section is crucial for the throughput of the decompression loop.
+ // The latency of an iteration is fundamentally constrained by the
diff --git a/repo/system/snappy/rtti.patch b/repo/system/snappy/rtti.patch
new file mode 100644
index 0000000..80f89ff
--- /dev/null
+++ b/repo/system/snappy/rtti.patch
@@ -0,0 +1,56 @@
+From f73b11e87dfbe1cb4862b8ee489679d99534f40b Mon Sep 17 00:00:00 2001
+From: Tim Serong <tserong@suse.com>
+Date: Wed, 27 Oct 2021 18:49:04 +1100
+Subject: [PATCH] Re-enable RTTI (needed in order to subclass Source, etc.)
+
+Commit c98344f in snappy 1.1.9 disabled RTTI, which means the
+snappy library no longer exports typeinfo for snappy::Source,
+snappy::Sink, ..., so users of the library can't subclass these
+classes anymore.
+
+Here's a trivial reproducer:
+
+ #include <snappy-sinksource.h>
+ class MySource : snappy::Source {
+ public:
+ size_t Available() const override { return 0; }
+ const char *Peek(size_t *len) override { return NULL; }
+ void Skip(size_t n) override {}
+ };
+ int main(int argc, char **argv) {
+ MySource m;
+ return 0;
+ }
+
+Try `g++ -o snappy-test ./snappy-test.cc -lsnappy` with the above
+and the linker will fail with "undefined reference to `typeinfo
+for snappy::Source'" if RTTI was disabled in the snappy build.
+---
+ CMakeLists.txt | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 6eef485..755605d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -51,10 +51,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHs-c-")
+ add_definitions(-D_HAS_EXCEPTIONS=0)
+-
+- # Disable RTTI.
+- string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
+ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ # Use -Wall for clang and gcc.
+ if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
+@@ -77,9 +73,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
+
+- # Disable RTTI.
+- string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+ endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+
+ # BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to make
diff --git a/repo/system/snappy.xibuild b/repo/system/snappy/snappy.xibuild
index e266327..e266327 100644
--- a/repo/system/snappy.xibuild
+++ b/repo/system/snappy/snappy.xibuild
diff --git a/repo/system/sqlite3.xibuild b/repo/system/sqlite3/sqlite3.xibuild
index 12f7210..12f7210 100644
--- a/repo/system/sqlite3.xibuild
+++ b/repo/system/sqlite3/sqlite3.xibuild
diff --git a/repo/system/startup-notification.xibuild b/repo/system/startup-notification/startup-notification.xibuild
index 08d7a85..08d7a85 100644
--- a/repo/system/startup-notification.xibuild
+++ b/repo/system/startup-notification/startup-notification.xibuild
diff --git a/repo/system/sysklogd/sysklogd.initd b/repo/system/sysklogd/sysklogd.initd
new file mode 100644
index 0000000..74b13bd
--- /dev/null
+++ b/repo/system/sysklogd/sysklogd.initd
@@ -0,0 +1,3 @@
+#!/sbin/openrc-run
+
+command=/bin/syslogd
diff --git a/repo/system/sysklogd.xibuild b/repo/system/sysklogd/sysklogd.xibuild
index 87370e4..87370e4 100644
--- a/repo/system/sysklogd.xibuild
+++ b/repo/system/sysklogd/sysklogd.xibuild
diff --git a/repo/system/syslinux/0018-prevent-pow-optimization.patch b/repo/system/syslinux/0018-prevent-pow-optimization.patch
new file mode 100644
index 0000000..0c42c7b
--- /dev/null
+++ b/repo/system/syslinux/0018-prevent-pow-optimization.patch
@@ -0,0 +1,36 @@
+From: Lukas Schwaighofer <lukas@schwaighofer.name>
+Date: Tue, 26 Feb 2019 23:13:58 +0100
+Subject: Prevent optimizing the pow() function
+
+With the current GCC 8.2.0 from Debian, a section of code calling pow() in
+zzjson_parse.c is turned into a sequence calling exp(). Since no exp()
+implementation is available in syslinux those optimizations need to be
+disabled.
+---
+ com32/gpllib/zzjson/zzjson_parse.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/com32/gpllib/zzjson/zzjson_parse.c b/com32/gpllib/zzjson/zzjson_parse.c
+index ecb6f61..e66a9d8 100644
+--- a/com32/gpllib/zzjson/zzjson_parse.c
++++ b/com32/gpllib/zzjson/zzjson_parse.c
+@@ -138,6 +138,10 @@ static ZZJSON *parse_string2(ZZJSON_CONFIG *config) {
+ return zzjson;
+ }
+
++static double __attribute__((optimize("O0"))) pow_noopt(double x, double y) {
++ return pow(x, y);
++}
++
+ static ZZJSON *parse_number(ZZJSON_CONFIG *config) {
+ ZZJSON *zzjson;
+ unsigned long long ival = 0, expo = 0;
+@@ -213,7 +217,7 @@ skipexpo:
+ if (dbl) {
+ dval = sign * (long long) ival;
+ dval += sign * frac;
+- dval *= pow(10.0, (double) signexpo * expo);
++ dval *= pow_noopt(10.0, (double) signexpo * expo);
+ }
+
+ zzjson = config->calloc(1, sizeof(ZZJSON));
diff --git a/repo/system/syslinux/fix-sysmacros.patch b/repo/system/syslinux/fix-sysmacros.patch
new file mode 100644
index 0000000..dd622e8
--- /dev/null
+++ b/repo/system/syslinux/fix-sysmacros.patch
@@ -0,0 +1,12 @@
+diff --git a/extlinux/main.c b/extlinux/main.c
+index a7ebd49..69bb164 100644
+--- a/extlinux/main.c
++++ b/extlinux/main.c
+@@ -41,6 +41,7 @@
+ #include <sys/types.h>
+ #include <sys/mount.h>
+ #include <sys/vfs.h>
++#include <sys/sysmacros.h>
+
+ #include "linuxioctl.h"
+
diff --git a/repo/system/syslinux/gcc-10.patch b/repo/system/syslinux/gcc-10.patch
new file mode 100644
index 0000000..b5bbad0
--- /dev/null
+++ b/repo/system/syslinux/gcc-10.patch
@@ -0,0 +1,109 @@
+From 951928f2cad5682c2844e6bd0f7201236c5d9b66 Mon Sep 17 00:00:00 2001
+From: Merlin Mathesius <mmathesi@redhat.com>
+Date: Wed, 13 May 2020 08:02:27 -0500
+Subject: [PATCH] Workaround multiple definition of symbol errors
+
+---
+ com32/cmenu/Makefile | 2 +-
+ com32/elflink/ldlinux/Makefile | 2 +-
+ com32/gpllib/Makefile | 2 +-
+ com32/hdt/Makefile | 2 +-
+ core/Makefile | 2 +-
+ dos/Makefile | 2 +-
+ efi/Makefile | 2 +-
+ 7 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
+index b81b68ed..2ae989c4 100644
+--- a/com32/cmenu/Makefile
++++ b/com32/cmenu/Makefile
+@@ -49,7 +49,7 @@ makeoutputdirs:
+ @mkdir -p $(OBJ)/libmenu
+
+ libmenu/libmenu.elf: $(LIBMENU)
+- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) \
++ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) \
+ -o $@ $^
+
+ tidy dist:
+diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
+index 87c0d362..2be2a01a 100644
+--- a/com32/elflink/ldlinux/Makefile
++++ b/com32/elflink/ldlinux/Makefile
+@@ -33,7 +33,7 @@ endif
+ all: $(BTARGET) ldlinux_lnx.a
+
+ ldlinux.elf : $(OBJS)
+- $(LD) $(LDFLAGS) -soname $(SONAME) -o $@ $^ $(LIBS)
++ $(LD) $(LDFLAGS) -z muldefs -soname $(SONAME) -o $@ $^ $(LIBS)
+
+ LNXCFLAGS += -D__export='__attribute__((visibility("default")))'
+ LNXLIBOBJS = get_key.lo
+diff --git a/com32/gpllib/Makefile b/com32/gpllib/Makefile
+index 1fec9145..2d764d0b 100644
+--- a/com32/gpllib/Makefile
++++ b/com32/gpllib/Makefile
+@@ -24,7 +24,7 @@ makeoutputdirs:
+ $(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b))
+
+ libgpl.elf : $(LIBOBJS)
+- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
++ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
+
+ tidy dist clean:
+ find . \( -name \*.o -o -name .\*.d -o -name \*.tmp \) -print0 | \
+diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
+index 61736d05..1d947857 100644
+--- a/com32/hdt/Makefile
++++ b/com32/hdt/Makefile
+@@ -52,7 +52,7 @@ QEMU ?= qemu-kvm
+ all: $(MODULES) $(TESTFILES)
+
+ hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
+- $(LD) $(LDFLAGS) -o $@ $^
++ $(LD) $(LDFLAGS) -z muldefs -o $@ $^
+
+ memtest:
+ -[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
+diff --git a/core/Makefile b/core/Makefile
+index 46cb037c..f0cfcbe9 100644
+--- a/core/Makefile
++++ b/core/Makefile
+@@ -156,7 +156,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld
+ NASM_ELF = elf
+
+ %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS)
+- $(LD) $(LDFLAGS) -pie -Bsymbolic \
++ $(LD) $(LDFLAGS) -z muldefs -pie -Bsymbolic \
+ -T $(LDSCRIPT) \
+ --unresolved-symbols=report-all \
+ -E --hash-style=gnu -M -o $@ $< \
+diff --git a/dos/Makefile b/dos/Makefile
+index 4c930d19..5d1c72ca 100644
+--- a/dos/Makefile
++++ b/dos/Makefile
+@@ -19,7 +19,7 @@ include $(MAKEDIR)/embedded.mk
+ CFLAGS += -D__MSDOS__ -mregparm=3 -DREGPARM=3
+ # CFLAGS += -DDEBUG
+
+-LDFLAGS = -T $(SRC)/dosexe.ld
++LDFLAGS = -T $(SRC)/dosexe.ld -z muldefs
+ OPTFLAGS = -g
+ INCLUDES = -include code16.h -nostdinc -iwithprefix include \
+ -I$(SRC) -I$(SRC)/.. -I$(SRC)/../libfat \
+diff --git a/efi/Makefile b/efi/Makefile
+index bbf23f24..3dd922d5 100644
+--- a/efi/Makefile
++++ b/efi/Makefile
+@@ -69,7 +69,7 @@ $(OBJS): | $(OBJ)/$(ARCH)
+ BTARGET = syslinux.efi
+
+ syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
+- $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
++ $(LD) $(LDFLAGS) -z muldefs --strip-debug -o $@ $^ -lgnuefi -lefi
+
+ # We need to rename the .hash section because the EFI firmware
+ # linker really doesn't like it.
+--
+2.25.1
+
diff --git a/repo/system/syslinux/syslinux.post-upgrade b/repo/system/syslinux/syslinux.post-upgrade
new file mode 100644
index 0000000..9038866
--- /dev/null
+++ b/repo/system/syslinux/syslinux.post-upgrade
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# find given append opt
+get_append_opt() {
+ awk -v search="$1" '
+ $1 == "append" || $1 == "APPEND" {
+ split($0, a);
+ for (i in a) {
+ if (index(a[i], search) == 1) {
+ print a[i];
+ }
+ }
+ }' /boot/extlinux.conf | sort | uniq
+}
+
+# print default kernel options
+get_default_opts() {
+ awk '
+ $1 == "append" || $1 == "APPEND" {
+ opts="";
+ space="";
+ split($0, a);
+ for (i in a) {
+ if (i != 1 \
+ && (index(a[i], "root=") != 1) \
+ && (index(a[i], "initrd=") != 1) \
+ && (index(a[i], "modules=") != 1)) {
+ opts = opts space a[i];
+ space = " ";
+ }
+ }
+ print opts;
+ }
+ ' /boot/extlinux.conf | sort | uniq
+}
+
+if ! [ -f /boot/extlinux.conf ]; then
+ exit 0
+fi
+
+# check if we already have a generated extlinux.conf
+if grep -q '^# Generated by update-extlinux' /boot/extlinux.conf; then
+ exit 0
+fi
+
+# try fish out the kernel opts from extlinuix.conf's append line
+root=$(get_append_opt 'root=' | head -n 1)
+modules=$(get_append_opt 'modules=' | head -n 1)
+opts=$(get_default_opts | head -n 1)
+
+# populate update-extlinux.conf with the info we know
+if [ -n "$root" ]; then
+ sed -i -e "/^root=/s|.*|$root|g" /etc/update-extlinux.conf
+fi
+if [ -n "$modules" ]; then
+ sed -i -e "/^modules=/s|.*|$modules|g" /etc/update-extlinux.conf
+fi
+if [ -n "$opts" ]; then
+ sed -i -e "/^default_kernel_opts=/s|.*|default_kernel_opts=\"$opts\"|g" /etc/update-extlinux.conf
+fi
+
diff --git a/repo/system/syslinux/syslinux.trigger b/repo/system/syslinux/syslinux.trigger
new file mode 100644
index 0000000..fe91f43
--- /dev/null
+++ b/repo/system/syslinux/syslinux.trigger
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+update-extlinux --warn-only
diff --git a/repo/system/syslinux.xibuild b/repo/system/syslinux/syslinux.xibuild
index 19edc66..19edc66 100644
--- a/repo/system/syslinux.xibuild
+++ b/repo/system/syslinux/syslinux.xibuild
diff --git a/repo/system/syslinux/update-extlinux b/repo/system/syslinux/update-extlinux
new file mode 100644
index 0000000..4799cd3
--- /dev/null
+++ b/repo/system/syslinux/update-extlinux
@@ -0,0 +1,284 @@
+#!/bin/sh
+
+version=
+default=0
+timeout=5
+verbose=0
+
+conf=/boot/extlinux.conf
+myconf=/etc/update-extlinux.conf
+
+# read in extlinux settings
+if [ -f "$myconf" ]; then
+ . $myconf
+fi
+
+everbose() {
+ if [ "$verbose" = "0" ]; then
+ return
+ fi
+
+ echo $*
+}
+
+ewarn() {
+ echo "WARNING:" $@ >&2
+}
+
+eerror() {
+ echo "ERROR:" $@ >&2
+ return 1
+}
+
+usage() {
+ echo "usage: $0 [-v|--verbose] [--warn-only]"
+}
+
+while [ $# -gt 0 ]; do
+ opt="$1"
+ shift
+ case "$opt" in
+ -v|--verbose)
+ verbose=1
+ ;;
+ --warn-only)
+ warn_only=1
+ ;;
+ --)
+ break
+ ;;
+ -*)
+ usage
+ exit 1
+ ;;
+ esac
+done
+
+everbose "Updating extlinux configuration."
+
+if [ "x$root" = "x" ]; then
+ ewarn "Root device is not specified in $myconf."
+ blkid_export=$(blkid -o export /dev/root)
+ if [ -n "$blkid_export" ]; then
+ export $blkid_export
+ fi
+ if [ -z "$UUID" ]; then
+ # try parse /proc/mount for mounted /
+ dev=$(awk '$2 == "/" {dev=$1} END {print dev}' /proc/mounts)
+ if [ -n "$dev" ]; then
+ blkid_export=$(blkid -o export $dev)
+ if [ -n "$blkid_export" ]; then
+ export "$blkid_export"
+ fi
+ fi
+ fi
+ if [ -z "$UUID" ]; then
+ if [ -z "$dev" ]; then
+ if [ -n "$warn_only" ]; then
+ ewarn "Failed to detect root device. extlinux.conf is not updated"
+ exit 0
+ else
+ eerror "Failed to detect root device"
+ exit 1
+ fi
+ else
+ root=$dev
+ fi
+ else
+ root=UUID=$UUID
+ fi
+ everbose "Root device is: $root"
+fi
+
+rtimeout=$(( ${timeout} * 10 ))
+syslinux_menu=menu.c32
+menu_hidden=
+
+# vesa menu has been requested?
+if [ "$vesa_menu" = "1" ]; then
+ syslinux_menu=vesamenu.c32
+fi
+
+umask 0022
+rm -f $conf.new
+echo "# Generated by update-extlinux $version" > $conf.new
+if [ -n "$serial_port" ]; then
+ echo "SERIAL $serial_port ${serial_baud:-115200}" >> $conf.new
+fi
+echo "DEFAULT $syslinux_menu" >> $conf.new
+echo "PROMPT 0" >> $conf.new
+echo "MENU TITLE XiLinux/$(uname -s) Boot Menu" >> $conf.new
+if [ "$hidden" = "1" ]; then
+ echo "MENU HIDDEN" >> $conf.new
+fi
+echo "MENU AUTOBOOT XiLinux will be booted automatically in # seconds." >> $conf.new
+echo "TIMEOUT $rtimeout" >> $conf.new
+
+lst=0
+if [ -f "/boot/xen.gz" ]; then
+ for kernel in $(find /boot -name "vmlinuz-*" -type f); do
+ tag=$(basename $kernel | cut -b9-)
+ everbose "Found Xen hypervisor: /boot/xen.gz, kernel: $kernel"
+
+ if [ -f "/boot/initramfs-$tag" ]; then
+ everbose "Found initramfs: /boot/initramfs-$tag"
+ initramfs="initramfs-$tag"
+ else
+ initramfs=
+ fi
+ initramfs_stage="${initramfs:+---} $initramfs"
+
+ if [ -f "/boot/amd-ucode.img" ]; then
+ everbose "Found microcode for AMD CPUs: /boot/amd-ucode.img"
+ ucode_image_amd="amd-ucode.img"
+ case "$xen_opts" in
+ *ucode=scan* ) ;;
+ * ) xen_opts="$xen_opts ucode=scan" ;;
+ esac
+ fi
+ if [ -f "/boot/intel-ucode.img" ]; then
+ everbose "Found microcode for Intel CPUs: /boot/intel-ucode.img"
+ ucode_image_intel="intel-ucode.img"
+ case "$xen_opts" in
+ *ucode=scan* ) ;;
+ * ) xen_opts="$xen_opts ucode=scan" ;;
+ esac
+ fi
+ ucode_image_stage="${ucode_image_amd:+---} $ucode_image_amd ${ucode_image_intel:+---} $ucode_image_intel"
+
+ label=xen-$(grep -w -l $tag /usr/share/kernel/*/kernel.release \
+ | cut -d/ -f5)
+ if [ "$label" = "xen-" ]; then
+ label=xen-$lst
+ fi
+
+ dom0_kernel_stage="--- $(basename $kernel) root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts"
+
+ echo "LABEL $label" >> $conf.new
+ if [ "$label" = "$default" ]; then
+ echo " MENU DEFAULT" >> $conf.new
+ fi
+ echo " MENU LABEL Xen + Linux $tag" >> $conf.new
+ echo " COM32 mboot.c32" >> $conf.new
+ echo " APPEND xen.gz $xen_opts $dom0_kernel_stage $initramfs_stage $ucode_image_stage" >> $conf.new
+ echo "" >> $conf.new
+ lst=$(($lst + 1))
+ done
+fi
+
+for kernel in $(find /boot -name "vmlinuz*" -type f); do
+ case $kernel in
+ *vmlinuz) tag=vanilla;;
+ *vmlinuz-*) tag=$(basename $kernel | cut -b9-);;
+ *) continue;;
+ esac
+ everbose "Found kernel: $kernel"
+ label=$(grep -w -l $tag /usr/share/kernel/*/kernel.release | cut -d/ -f5)
+ if [ -z "$label" ]; then
+ if [ "$tag" = vanilla ]; then
+ label="vanilla"
+ else
+ label=$lst
+ fi
+ fi
+ echo "LABEL $label" >> $conf.new
+ if [ "$label" = "$default" ]; then
+ echo " MENU DEFAULT" >> $conf.new
+ fi
+ echo " MENU LABEL Linux $tag" >> $conf.new
+ echo " LINUX $(basename $kernel)" >> $conf.new
+ initrd=
+ if [ -f "/boot/initramfs-$tag" ]; then
+ everbose "Found initramfs: /boot/initramfs-$tag"
+ initrd="initramfs-$tag"
+ fi
+ if [ -f "/boot/amd-ucode.img" ]; then
+ everbose "Found microcode for AMD CPUs: /boot/amd-ucode.img"
+ initrd="amd-ucode.img${initrd:+,}${initrd}"
+ fi
+ if [ -f "/boot/intel-ucode.img" ]; then
+ everbose "Found microcode for Intel CPUs: /boot/intel-ucode.img"
+ initrd="intel-ucode.img${initrd:+,}${initrd}"
+ fi
+ echo " INITRD ${initrd}" >> $conf.new
+ echo " APPEND root=$root modules=${modules}${TYPE:+,$TYPE} $default_kernel_opts" >> $conf.new
+ echo "" >> $conf.new
+ lst=$(($lst + 1))
+done
+
+if [ -n "$password" ]; then
+ echo "NOESCAPE 1" >> $conf.new
+ echo "MENU MASTER PASSWD $password" >> $conf.new
+ echo "" >> $conf.new
+ chmod o-r $conf.new
+fi
+
+everbose "$lst entries found."
+
+for entry in /etc/update-extlinux.d/*; do
+ [ -f "$entry" ] && { cat $entry; echo ""; } >> $conf.new
+done
+
+echo "MENU SEPARATOR" >> $conf.new
+echo "" >> $conf.new
+
+if [ -f "/boot/hdt.c32" ]; then
+ everbose "Found Hardware Detection Tool: /boot/hdt.c32"
+ echo "LABEL hdt" >> $conf.new
+ echo " MENU LABEL Hardware info" >> $conf.new
+ if [ -n "$password" ]; then
+ echo " MENU PASSWD" >> $conf.new
+ fi
+ echo " COM32 hdt.c32" >> $conf.new
+ if [ -f "/boot/memtest" ]; then
+ everbose "Found memtest86+: /boot/memtest"
+ echo " APPEND memtest=memtest" >> $conf.new
+ fi
+ echo "" >> $conf.new
+elif [ -f "/boot/memtest" ]; then
+ everbose "Found memtest86+: /boot/memtest"
+ echo "LABEL memtest" >> $conf.new
+ echo " MENU LABEL Memtest86+" >> $conf.new
+ echo " KERNEL memtest" >> $conf.new
+ echo "" >> $conf.new
+fi
+
+for i in reboot poweroff; do
+ [ -f "/boot/$i.c32" ] || continue
+ everbose "Found $i"
+ # make first char capital
+ cap=$( echo $i | awk '{sub(".", substr(toupper($0),1,1), $0); print}' )
+ echo "LABEL $i" >> $conf.new
+ echo " MENU LABEL $cap" >> $conf.new
+ echo " COM32 $i.c32" >> $conf.new
+ echo "" >> $conf.new
+done
+
+if cmp -s $conf.new $conf; then
+ everbose "Configuration unchanged."
+ rm $conf.new
+fi
+
+if [ "$overwrite" != "1" ]; then
+ exit 0
+elif [ -f "$conf.new" ]; then
+ # keep a backup just in case
+ if [ -f "$conf" ]; then
+ mv $conf $conf.old
+ fi
+
+ mv $conf.new $conf
+fi
+
+everbose "Installing libutil.c32 libcom32.c32 mboot.c32 menu.c32 vesamenu.c32 to /boot."
+cp /usr/share/syslinux/libutil.c32 \
+ /usr/share/syslinux/libcom32.c32 \
+ /usr/share/syslinux/mboot.c32 \
+ /usr/share/syslinux/menu.c32 \
+ /usr/share/syslinux/vesamenu.c32 \
+ /boot
+
+case "$(findmnt -n -o FSTYPE -T /boot)" in
+ext*) extlinux --update /boot || [ -n "$warn_only" ];;
+esac
+
diff --git a/repo/system/syslinux/update-extlinux.conf b/repo/system/syslinux/update-extlinux.conf
new file mode 100644
index 0000000..1dddff2
--- /dev/null
+++ b/repo/system/syslinux/update-extlinux.conf
@@ -0,0 +1,74 @@
+# configuration for extlinux config builder
+
+# overwrite
+# Overwrite current /boot/extlinux.conf. If this is not '1' we will only
+# write to /boot/extlinux.conf.new
+overwrite=1
+
+# vesa_menu
+# use fancy vesa menu (vesamenu.c32) menus, won't work with serial
+vesa_menu=0
+
+# default_kernel_opts
+# default kernel options
+default_kernel_opts=quiet
+
+# modules
+# modules which should be loaded before pivot_root
+modules=sd-mod,usb-storage,ext4
+
+# root
+# root device - if not specified, will be guessed using
+# blkid -o export /dev/root
+root=
+
+# verbose
+# if set to non-zero, update-extlinux will be a lot more verbose.
+verbose=0
+
+# hidden
+# if set to non-zero, the boot menu will be hidden by default.
+hidden=1
+
+# timeout
+# number of seconds to wait before booting default
+timeout=3
+
+# default
+# default kernel to boot
+default=lts
+
+# serial_port
+# serial port number - if not specified, serial console will be disabled
+serial_port=
+
+# serial_baud
+# the baudrate for the serial port. Will use 115200 if unset
+serial_baud=115200
+
+# xen_opts
+# options to hand to xen hypervisor, useful ones are:
+# dom0_mem=384M (give domain-0 environment 384M ram)
+xen_opts=dom0_mem=384M
+
+# if you copy /usr/share/syslinux/reboot.c32 to /boot/, a menu entry
+# will be auto-generated for it
+
+# if you copy hdt.c32, libgpl.c32, and libmenu.c32 from /usr/share/syslinux/
+# to /boot/, a menu entry will be auto-generated for HDT
+
+# if you download and install /boot/memtest, then if HDT is present it
+# will use it, else a separate menu entry will be auto-generated for
+# memtest
+
+# optional password
+# you can generate a SHA512 password using: mkpasswd
+#
+# if you assign a password, you should make this file world-unreadable
+#
+# if a password is assigned, the menu entries can't be edited at boot
+# time, and HDT if present is password-protected
+#
+# you can also include "MENU PASSWD" in any custom entries you have in
+# /etc/update-extlinux.d/
+password=''
diff --git a/repo/system/tar.xibuild b/repo/system/tar/tar.xibuild
index 28c2da3..28c2da3 100644
--- a/repo/system/tar.xibuild
+++ b/repo/system/tar/tar.xibuild
diff --git a/repo/system/tcl.xibuild b/repo/system/tcl/tcl.xibuild
index 6495948..6495948 100644
--- a/repo/system/tcl.xibuild
+++ b/repo/system/tcl/tcl.xibuild
diff --git a/repo/system/tomlc99.xibuild b/repo/system/tomlc99/tomlc99.xibuild
index 6387c96..6387c96 100644
--- a/repo/system/tomlc99.xibuild
+++ b/repo/system/tomlc99/tomlc99.xibuild
diff --git a/repo/system/tree-sitter.xibuild b/repo/system/tree-sitter/tree-sitter.xibuild
index ccd2b77..ccd2b77 100644
--- a/repo/system/tree-sitter.xibuild
+++ b/repo/system/tree-sitter/tree-sitter.xibuild
diff --git a/repo/system/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch b/repo/system/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch
new file mode 100644
index 0000000..c4ae70b
--- /dev/null
+++ b/repo/system/tzdata/0001-posixtz-ensure-the-file-offset-we-pass-to-lseek-is-o.patch
@@ -0,0 +1,27 @@
+From e6765bd363d2dd1dcaeeae5117cc25aae53fb944 Mon Sep 17 00:00:00 2001
+From: William Pitcock <nenolod@dereferenced.org>
+Date: Thu, 28 Apr 2011 02:56:42 -0500
+Subject: [PATCH 1/2] posixtz: ensure the file offset we pass to lseek is off_t
+
+on 32-bit systems, sizeof(off_t) is 4, on 64-bit sizeof(off_t) is 8
+causing a word masking issue.
+---
+ posixtz.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/posixtz.c b/posixtz.c
+index cddcb3e..972ca31 100644
+--- a/posixtz-0.5/posixtz.c
++++ b/posixtz-0.5/posixtz.c
+@@ -36,7 +36,7 @@ char *posix_tz(const char *filename)
+ if (r != TZ_BUFLEN
+ || strncmp(buf, "TZif", 4) != 0
+ || (unsigned char)buf[4] < 2
+- || lseek(fd, -TZ_BUFLEN, SEEK_END) < 0
++ || lseek(fd, (off_t) -TZ_BUFLEN, SEEK_END) < 0
+ )
+ goto ERROR;
+
+--
+2.16.2
+
diff --git a/repo/system/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch b/repo/system/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch
new file mode 100644
index 0000000..6f61b25
--- /dev/null
+++ b/repo/system/tzdata/0002-fix-implicit-declaration-warnings-by-including-strin.patch
@@ -0,0 +1,28 @@
+From 89d4aece7ba679703060393ac95086fd514c7fc7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
+Date: Tue, 27 Mar 2018 19:09:44 +0200
+Subject: [PATCH 2/2] fix implicit declaration warnings by including string.h
+ and unistd.h
+
+string.h is needed for strncmp(3) and unistd.h is needed for read(3),
+close(3) and lseek(3).
+---
+ posixtz.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/posixtz.c b/posixtz.c
+index 972ca31..4a36e10 100644
+--- a/posixtz-0.5/posixtz.c
++++ b/posixtz-0.5/posixtz.c
+@@ -14,6 +14,8 @@
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <stdio.h>
++#include <string.h>
++#include <unistd.h>
+
+ #include "posixtz.h"
+
+--
+2.16.2
+
diff --git a/repo/system/tzdata.xibuild b/repo/system/tzdata/tzdata.xibuild
index 0813733..0813733 100644
--- a/repo/system/tzdata.xibuild
+++ b/repo/system/tzdata/tzdata.xibuild
diff --git a/repo/system/ubase.xibuild b/repo/system/ubase/ubase.xibuild
index 0fd1258..0fd1258 100644
--- a/repo/system/ubase.xibuild
+++ b/repo/system/ubase/ubase.xibuild
diff --git a/repo/system/udev-rules.xibuild b/repo/system/udev-rules/udev-rules.xibuild
index 9eda445..9eda445 100644
--- a/repo/system/udev-rules.xibuild
+++ b/repo/system/udev-rules/udev-rules.xibuild
diff --git a/repo/system/unibilium.xibuild b/repo/system/unibilium/unibilium.xibuild
index 9c170f7..9c170f7 100644
--- a/repo/system/unibilium.xibuild
+++ b/repo/system/unibilium/unibilium.xibuild
diff --git a/repo/system/utmps/btmpd.initd b/repo/system/utmps/btmpd.initd
new file mode 100644
index 0000000..b9acc72
--- /dev/null
+++ b/repo/system/utmps/btmpd.initd
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 2020-2021 Laurent Bercot for Alpine Linux
+# Distributed under the terms of the ISC License.
+#
+name=btmpd
+description="utmps daemon for the btmp service"
+
+command=/bin/s6-ipcserver
+command_args="/run/utmps/.btmpd-socket utmps-wtmpd btmp"
+command_user=utmp
+command_background=yes
+directory=/var/log/btmpd
+pidfile=/run/utmps/btmpd.pid
+
+depend() {
+ need localmount utmp-prepare
+ after bootmisc
+ before networking
+}
+
+start_pre() {
+ checkpath -d -o utmp:utmp -m 0755 /run/utmps
+ checkpath -d -o utmp:utmp -m 2755 /var/log/btmpd
+}
diff --git a/repo/system/utmps/btmpd.logrotate b/repo/system/utmps/btmpd.logrotate
new file mode 100644
index 0000000..b681d90
--- /dev/null
+++ b/repo/system/utmps/btmpd.logrotate
@@ -0,0 +1,6 @@
+/var/log/btmpd/btmp {
+ missingok
+ monthly
+ create 0644 utmp utmp
+ rotate 3
+}
diff --git a/repo/system/utmps/utmp-init.initd b/repo/system/utmps/utmp-init.initd
new file mode 100644
index 0000000..acb4dbe
--- /dev/null
+++ b/repo/system/utmps/utmp-init.initd
@@ -0,0 +1,21 @@
+#!/sbin/openrc-run
+# Copyright 2020-2022 Laurent Bercot for Alpine Linux
+# Distributed under the terms of the ISC License.
+#
+description="clearing and initialization of the utmp database"
+
+depend() {
+ need utmp-prepare utmpd wtmpd
+ before networking
+ after clock
+}
+
+start() {
+ # Create an empty utmp file
+ checkpath -F -f -m 0644 -o utmp:utmp /run/utmps/utmp
+
+ # Write the initial records as sysvinit/busybox init would do.
+ # 20018 = 256 * 'N' + '2'. Don't ask.
+ utmps-write -t 2000 -uw -l reboot -p 0 -h "$(uname -r)" -- '~~' BOOT_TIME '~'
+ utmps-write -t 2000 -uw -l runlevel -p 20018 -h "$(uname -r)" -- '~~' RUN_LVL '~'
+}
diff --git a/repo/system/utmps/utmp-prepare.initd b/repo/system/utmps/utmp-prepare.initd
new file mode 100644
index 0000000..9f61249
--- /dev/null
+++ b/repo/system/utmps/utmp-prepare.initd
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 2020-2022 Laurent Bercot for Alpine Linux
+# Distributed under the terms of the ISC License.
+#
+description="preparation of the utmp databases"
+
+depend() {
+ before networking
+ after clock
+}
+
+start() {
+ if ! test -L /var/log/utmp || test "$(readlink /var/log/utmp)" != /run/utmps/utmp ; then
+ rm -f /var/log/utmp
+ ln -s /run/utmps/utmp /var/log/utmp
+ fi
+ if ! test -L /var/log/wtmp || test "$(readlink /var/log/wtmp)" != wtmpd/wtmp ; then
+ rm -f /var/log/wtmp
+ ln -s wtmpd/wtmp /var/log/wtmp
+ fi
+ if ! test -L /var/log/btmp || test "$(readlink /var/log/btmp)" != btmpd/btmp ; then
+ rm -f /var/log/btmp
+ ln -s btmpd/btmp /var/log/btmp
+ fi
+}
diff --git a/repo/system/utmps/utmpd.initd b/repo/system/utmps/utmpd.initd
new file mode 100644
index 0000000..d04c6b9
--- /dev/null
+++ b/repo/system/utmps/utmpd.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+# Copyright 2020-2021 Laurent Bercot for Alpine Linux
+# Distributed under the terms of the ISC License.
+#
+name="utmpd"
+description="utmps daemon for the utmp service"
+
+command=/bin/s6-ipcserver
+command_args="/run/utmps/.utmpd-socket utmps-utmpd"
+command_user=utmp
+command_background=yes
+directory=/run/utmps
+pidfile=/run/utmps/utmpd.pid
+
+depend() {
+ need utmp-prepare
+ after bootmisc
+ before networking
+}
+
+start_pre() {
+ checkpath -d -o utmp:utmp -m 0755 /run/utmps
+}
diff --git a/repo/system/utmps.xibuild b/repo/system/utmps/utmps.xibuild
index 900aae8..900aae8 100644
--- a/repo/system/utmps.xibuild
+++ b/repo/system/utmps/utmps.xibuild
diff --git a/repo/system/utmps/wtmpd.initd b/repo/system/utmps/wtmpd.initd
new file mode 100644
index 0000000..8d3f624
--- /dev/null
+++ b/repo/system/utmps/wtmpd.initd
@@ -0,0 +1,24 @@
+#!/sbin/openrc-run
+# Copyright 2020-2021 Laurent Bercot for Alpine Linux
+# Distributed under the terms of the ISC License.
+#
+name=wtmpd
+description="utmps daemon for the wtmp service"
+
+command=/bin/s6-ipcserver
+command_args="/run/utmps/.wtmpd-socket utmps-wtmpd wtmp"
+command_user=utmp
+command_background=yes
+directory=/var/log/wtmpd
+pidfile=/run/utmps/wtmpd.pid
+
+depend() {
+ need localmount utmp-prepare
+ after bootmisc
+ before networking
+}
+
+start_pre() {
+ checkpath -d -o utmp:utmp -m 0755 /run/utmps
+ checkpath -d -o utmp:utmp -m 2755 /var/log/wtmpd
+}
diff --git a/repo/system/utmps/wtmpd.logrotate b/repo/system/utmps/wtmpd.logrotate
new file mode 100644
index 0000000..bb23536
--- /dev/null
+++ b/repo/system/utmps/wtmpd.logrotate
@@ -0,0 +1,6 @@
+/var/log/wtmpd/wtmp {
+ missingok
+ monthly
+ create 0644 utmp utmp
+ rotate 3
+}
diff --git a/repo/system/xxhash.xibuild b/repo/system/xxhash/xxhash.xibuild
index 6691fd9..6691fd9 100644
--- a/repo/system/xxhash.xibuild
+++ b/repo/system/xxhash/xxhash.xibuild
diff --git a/repo/system/xz.xibuild b/repo/system/xz/xz.xibuild
index a1d4e17..a1d4e17 100644
--- a/repo/system/xz.xibuild
+++ b/repo/system/xz/xz.xibuild
diff --git a/repo/system/zip.xibuild b/repo/system/zip/zip.xibuild
index e356b10..e356b10 100644
--- a/repo/system/zip.xibuild
+++ b/repo/system/zip/zip.xibuild
diff --git a/repo/system/zlib.xibuild b/repo/system/zlib/zlib.xibuild
index 15dbe59..15dbe59 100644
--- a/repo/system/zlib.xibuild
+++ b/repo/system/zlib/zlib.xibuild
diff --git a/repo/system/zstd.xibuild b/repo/system/zstd/zstd.xibuild
index 827025e..827025e 100644
--- a/repo/system/zstd.xibuild
+++ b/repo/system/zstd/zstd.xibuild