From 79062a39e9bcb9731adbacd0bd9bcd0b59d19d0a Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 22 May 2022 17:47:09 +0100 Subject: fixes to allow for full build --- repo/util/fmt/fmt.xibuild | 17 ++++++++++ repo/util/llvm2/device-mapper.xibuild | 11 ------ repo/util/llvm2/dmeventd.initd | 26 -------------- repo/util/llvm2/fix-stdio-usage.patch | 49 --------------------------- repo/util/llvm2/llvm2.xibuild | 47 ------------------------- repo/util/llvm2/lvm.confd | 5 --- repo/util/llvm2/lvm.initd | 38 --------------------- repo/util/llvm2/mallinfo.patch | 11 ------ repo/util/llvm2/mlockall-default-config.patch | 22 ------------ repo/util/lvm2/device-mapper.xibuild | 11 ++++++ repo/util/lvm2/dmeventd.initd | 26 ++++++++++++++ repo/util/lvm2/fix-stdio-usage.patch | 49 +++++++++++++++++++++++++++ repo/util/lvm2/lvm.confd | 5 +++ repo/util/lvm2/lvm.initd | 38 +++++++++++++++++++++ repo/util/lvm2/lvm2.xibuild | 48 ++++++++++++++++++++++++++ repo/util/lvm2/mallinfo.patch | 11 ++++++ repo/util/lvm2/mlockall-default-config.patch | 22 ++++++++++++ repo/util/util-linux/util-linux.xibuild | 2 +- 18 files changed, 228 insertions(+), 210 deletions(-) create mode 100644 repo/util/fmt/fmt.xibuild delete mode 100644 repo/util/llvm2/device-mapper.xibuild delete mode 100644 repo/util/llvm2/dmeventd.initd delete mode 100644 repo/util/llvm2/fix-stdio-usage.patch delete mode 100644 repo/util/llvm2/llvm2.xibuild delete mode 100644 repo/util/llvm2/lvm.confd delete mode 100644 repo/util/llvm2/lvm.initd delete mode 100644 repo/util/llvm2/mallinfo.patch delete mode 100644 repo/util/llvm2/mlockall-default-config.patch create mode 100644 repo/util/lvm2/device-mapper.xibuild create mode 100644 repo/util/lvm2/dmeventd.initd create mode 100644 repo/util/lvm2/fix-stdio-usage.patch create mode 100644 repo/util/lvm2/lvm.confd create mode 100644 repo/util/lvm2/lvm.initd create mode 100644 repo/util/lvm2/lvm2.xibuild create mode 100644 repo/util/lvm2/mallinfo.patch create mode 100644 repo/util/lvm2/mlockall-default-config.patch (limited to 'repo/util') diff --git a/repo/util/fmt/fmt.xibuild b/repo/util/fmt/fmt.xibuild new file mode 100644 index 0000000..5c17a60 --- /dev/null +++ b/repo/util/fmt/fmt.xibuild @@ -0,0 +1,17 @@ +#!/bin/sh + +MAKEDEPS="make" +DEPS="musl sh" + +PKG_VER=0.8.6 +SOURCE=http://landley.net/toybox/downloads/toybox-$PKG_VER.tar.gz +DESC="fmt from toybox" + +build () { + ./configure + make fmt +} + +package () { + install -Dm755 fmt $PKG_DEST/usr/bin/ +} diff --git a/repo/util/llvm2/device-mapper.xibuild b/repo/util/llvm2/device-mapper.xibuild deleted file mode 100644 index 8db667b..0000000 --- a/repo/util/llvm2/device-mapper.xibuild +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -DESC="Device-mapper event daemon" - -package() { - install -Dm755 dmeventd.initd "$PKG_DEST"/etc/init.d/dmeventd - - add_from_main sbin/dmeventd - add_from_main usr/lib/libdevmapper.a "sbin/dm*" - add_from_main lib/libdevmapper* -} - diff --git a/repo/util/llvm2/dmeventd.initd b/repo/util/llvm2/dmeventd.initd deleted file mode 100644 index c46f8ba..0000000 --- a/repo/util/llvm2/dmeventd.initd +++ /dev/null @@ -1,26 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1,v 1.3 2014/02/08 21:17:46 robbat2 Exp $ - -PIDFILE=/run/dmeventd.pid -BIN=/sbin/dmeventd - -depend() { - # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that - # means dmeventd is NOT notified, as it cannot be safely running - after lvm device-mapper -} - -start() { - ebegin "Starting dmeventd" - start-stop-daemon --start --exec $BIN --pidfile $PIDFILE - eend $? -} - -stop() { - ebegin "Stopping dmeventd" - start-stop-daemon --stop --exec $BIN --pidfile $PIDFILE - eend $? -} - diff --git a/repo/util/llvm2/fix-stdio-usage.patch b/repo/util/llvm2/fix-stdio-usage.patch deleted file mode 100644 index 5ac99fd..0000000 --- a/repo/util/llvm2/fix-stdio-usage.patch +++ /dev/null @@ -1,49 +0,0 @@ ---- ./tools/lvmcmdline.c -+++ ./tools/lvmcmdline.c -@@ -1252,7 +1252,7 @@ - int err = is_valid_fd(STDERR_FILENO); - - if (!is_valid_fd(STDIN_FILENO) && -- !(stdin = fopen(_PATH_DEVNULL, "r"))) { -+ !freopen(_PATH_DEVNULL, "r", stdin)) { - if (err) - perror("stdin stream open"); - else -@@ -1262,7 +1262,7 @@ - } - - if (!is_valid_fd(STDOUT_FILENO) && -- !(stdout = fopen(_PATH_DEVNULL, "w"))) { -+ !freopen(_PATH_DEVNULL, "w", stdout)) { - if (err) - perror("stdout stream open"); - /* else no stdout */ -@@ -1270,7 +1270,7 @@ - } - - if (!is_valid_fd(STDERR_FILENO) && -- !(stderr = fopen(_PATH_DEVNULL, "w"))) { -+ !freopen(_PATH_DEVNULL, "w", stderr)) { - printf("stderr stream open: %s\n", - strerror(errno)); - return 0; ---- ./lib/commands/toolcontext.c -+++ ./lib/commands/toolcontext.c -@@ -1869,7 +1869,7 @@ - /* FIXME Make this configurable? */ - reset_lvm_errno(1); - --#ifndef VALGRIND_POOL -+#if !defined(VALGRIND_POOL) && defined(__GLIBC__) - /* Set in/out stream buffering before glibc */ - if (set_buffering - #ifdef SYS_gettid -@@ -2274,7 +2274,7 @@ - - if (cmd->pending_delete_mem) - dm_pool_destroy(cmd->pending_delete_mem); --#ifndef VALGRIND_POOL -+#if !defined(VALGRIND_POOL) && defined(__GLIBC__) - if (cmd->linebuffer) { - /* Reset stream buffering to defaults */ - if (is_valid_fd(STDIN_FILENO) && diff --git a/repo/util/llvm2/llvm2.xibuild b/repo/util/llvm2/llvm2.xibuild deleted file mode 100644 index cb364ec..0000000 --- a/repo/util/llvm2/llvm2.xibuild +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -NAME="llvm2" -DESC="Logical Volume Manager 2 utilities" - -MAKEDEPS="make " -DEPS="libaio util-linux musl device-mapper" - -PKG_VER=2.02.187 -SOURCE="https://mirrors.kernel.org/sourceware/lvm2/LVM2.$PKG_VER.tgz" -ADDITIONAL="mlockall-default-config.patch mallinfo.patch lvm.initd lvm.confd fix-stdio-usage.patch dmeventd.initd " - -prepare () { - apply_patches -} - -build () { - ./configure \ - --prefix=/usr \ - --bindir=/usr/bin \ - --sysconfdir=/etc \ - --disable-static \ - --enable-static_link \ - --disable-nls \ - --disable-readline \ - --enable-pkgconfig \ - --enable-applib \ - --with-thin=internal \ - --enable-dmeventd \ - --enable-cmdlib \ - --with-thin-check=/sbin/thin_check \ - --with-thin-dump=/sbin/thin_dump \ - --with-thin-repair=/sbin/thin_repair \ - --with-dmeventd-path=/sbin/dmeventd \ - --enable-udev_rules - - make -} - -package () { - make DESTDIR="$PKG_DEST" install - install -d "$PKG_DEST"/etc/lvm/archive "$PKG_DEST"/etc/lvm/backup - install -Dm755 lvm.initd "$PKG_DEST"/etc/init.d/lvm - install -Dm644 lvm.confd "$PKG_DEST"/etc/conf.d/lvm - ln -s libdevmapper.so.1.02 "$PKG_DEST"/lib/libdevmapper.so - -} diff --git a/repo/util/llvm2/lvm.confd b/repo/util/llvm2/lvm.confd deleted file mode 100644 index 9d150f6..0000000 --- a/repo/util/llvm2/lvm.confd +++ /dev/null @@ -1,5 +0,0 @@ -# LVM should normally only be started after mdadm-raid is available -# this is because LVM physical volumes are very often MD devices. - -rc_after="mdadm-raid" - diff --git a/repo/util/llvm2/lvm.initd b/repo/util/llvm2/lvm.initd deleted file mode 100644 index db6adbe..0000000 --- a/repo/util/llvm2/lvm.initd +++ /dev/null @@ -1,38 +0,0 @@ -#!/sbin/openrc-run - -depend() { - before checkfs fsck swap - after hwdrivers modules device-mapper -} - -dm_in_proc() { - local rc=0 i= - for i in devices misc; do - grep -qs 'device-mapper' /proc/$i - rc=$(($rc + $?)) - done - return $rc -} - -start() { - local rc=0 msg= - ebegin "Setting up the Logical Volume Manager" - if [ -e /proc/modules ] && ! dm_in_proc; then - modprobe dm-mod 2>/dev/null - fi - if [ -d /proc/lvm ] || dm_in_proc; then - vgscan --mknodes --ignorelockingfailure >/dev/null 2>&1 - vgchange --sysinit --activate y >/dev/null 2>&1 - rc=$? - else - rc=1 - fi - eend $rc -} - -stop() { - ebegin "Shutting down the Logical Volume Manager" - vgchange --ignorelockingfailure -a n >/dev/null 2>&1 - eend $? -} - diff --git a/repo/util/llvm2/mallinfo.patch b/repo/util/llvm2/mallinfo.patch deleted file mode 100644 index 471a6b2..0000000 --- a/repo/util/llvm2/mallinfo.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ./lib/mm/memlock.c.orig 2015-03-09 11:18:41.560028850 -0100 -+++ ./lib/mm/memlock.c 2015-03-09 11:19:54.504373309 -0100 -@@ -137,7 +137,7 @@ - - static void _allocate_memory(void) - { --#ifndef VALGRIND_POOL -+#if !defined(VALGRIND_POOL) && defined(__GLIBC__) - void *stack_mem; - struct rlimit limit; - int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks; diff --git a/repo/util/llvm2/mlockall-default-config.patch b/repo/util/llvm2/mlockall-default-config.patch deleted file mode 100644 index 305ddee..0000000 --- a/repo/util/llvm2/mlockall-default-config.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ./conf/example.conf.in.orig -+++ ./conf/example.conf.in -@@ -1352,7 +1352,7 @@ - # Use the old behavior of mlockall to pin all memory. - # Prior to version 2.02.62, LVM used mlockall() to pin the whole - # process's memory while activating devices. -- use_mlockall = 0 -+ use_mlockall = 1 - - # Configuration option activation/monitoring. - # Monitor LVs that are activated. ---- ./lib/config/defaults.h.orig -+++ ./lib/config/defaults.h -@@ -55,7 +55,7 @@ - #define DEFAULT_LVMLOCKD_LOCK_RETRIES 3 - #define DEFAULT_LVMETAD_UPDATE_WAIT_TIME 10 - #define DEFAULT_PRIORITISE_WRITE_LOCKS 1 --#define DEFAULT_USE_MLOCKALL 0 -+#define DEFAULT_USE_MLOCKALL 1 - #define DEFAULT_METADATA_READ_ONLY 0 - #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0 - #define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]" diff --git a/repo/util/lvm2/device-mapper.xibuild b/repo/util/lvm2/device-mapper.xibuild new file mode 100644 index 0000000..8db667b --- /dev/null +++ b/repo/util/lvm2/device-mapper.xibuild @@ -0,0 +1,11 @@ +#!/bin/sh +DESC="Device-mapper event daemon" + +package() { + install -Dm755 dmeventd.initd "$PKG_DEST"/etc/init.d/dmeventd + + add_from_main sbin/dmeventd + add_from_main usr/lib/libdevmapper.a "sbin/dm*" + add_from_main lib/libdevmapper* +} + diff --git a/repo/util/lvm2/dmeventd.initd b/repo/util/lvm2/dmeventd.initd new file mode 100644 index 0000000..c46f8ba --- /dev/null +++ b/repo/util/lvm2/dmeventd.initd @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/lvm2/files/dmeventd.initd-2.02.67-r1,v 1.3 2014/02/08 21:17:46 robbat2 Exp $ + +PIDFILE=/run/dmeventd.pid +BIN=/sbin/dmeventd + +depend() { + # As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that + # means dmeventd is NOT notified, as it cannot be safely running + after lvm device-mapper +} + +start() { + ebegin "Starting dmeventd" + start-stop-daemon --start --exec $BIN --pidfile $PIDFILE + eend $? +} + +stop() { + ebegin "Stopping dmeventd" + start-stop-daemon --stop --exec $BIN --pidfile $PIDFILE + eend $? +} + diff --git a/repo/util/lvm2/fix-stdio-usage.patch b/repo/util/lvm2/fix-stdio-usage.patch new file mode 100644 index 0000000..5ac99fd --- /dev/null +++ b/repo/util/lvm2/fix-stdio-usage.patch @@ -0,0 +1,49 @@ +--- ./tools/lvmcmdline.c ++++ ./tools/lvmcmdline.c +@@ -1252,7 +1252,7 @@ + int err = is_valid_fd(STDERR_FILENO); + + if (!is_valid_fd(STDIN_FILENO) && +- !(stdin = fopen(_PATH_DEVNULL, "r"))) { ++ !freopen(_PATH_DEVNULL, "r", stdin)) { + if (err) + perror("stdin stream open"); + else +@@ -1262,7 +1262,7 @@ + } + + if (!is_valid_fd(STDOUT_FILENO) && +- !(stdout = fopen(_PATH_DEVNULL, "w"))) { ++ !freopen(_PATH_DEVNULL, "w", stdout)) { + if (err) + perror("stdout stream open"); + /* else no stdout */ +@@ -1270,7 +1270,7 @@ + } + + if (!is_valid_fd(STDERR_FILENO) && +- !(stderr = fopen(_PATH_DEVNULL, "w"))) { ++ !freopen(_PATH_DEVNULL, "w", stderr)) { + printf("stderr stream open: %s\n", + strerror(errno)); + return 0; +--- ./lib/commands/toolcontext.c ++++ ./lib/commands/toolcontext.c +@@ -1869,7 +1869,7 @@ + /* FIXME Make this configurable? */ + reset_lvm_errno(1); + +-#ifndef VALGRIND_POOL ++#if !defined(VALGRIND_POOL) && defined(__GLIBC__) + /* Set in/out stream buffering before glibc */ + if (set_buffering + #ifdef SYS_gettid +@@ -2274,7 +2274,7 @@ + + if (cmd->pending_delete_mem) + dm_pool_destroy(cmd->pending_delete_mem); +-#ifndef VALGRIND_POOL ++#if !defined(VALGRIND_POOL) && defined(__GLIBC__) + if (cmd->linebuffer) { + /* Reset stream buffering to defaults */ + if (is_valid_fd(STDIN_FILENO) && diff --git a/repo/util/lvm2/lvm.confd b/repo/util/lvm2/lvm.confd new file mode 100644 index 0000000..9d150f6 --- /dev/null +++ b/repo/util/lvm2/lvm.confd @@ -0,0 +1,5 @@ +# LVM should normally only be started after mdadm-raid is available +# this is because LVM physical volumes are very often MD devices. + +rc_after="mdadm-raid" + diff --git a/repo/util/lvm2/lvm.initd b/repo/util/lvm2/lvm.initd new file mode 100644 index 0000000..db6adbe --- /dev/null +++ b/repo/util/lvm2/lvm.initd @@ -0,0 +1,38 @@ +#!/sbin/openrc-run + +depend() { + before checkfs fsck swap + after hwdrivers modules device-mapper +} + +dm_in_proc() { + local rc=0 i= + for i in devices misc; do + grep -qs 'device-mapper' /proc/$i + rc=$(($rc + $?)) + done + return $rc +} + +start() { + local rc=0 msg= + ebegin "Setting up the Logical Volume Manager" + if [ -e /proc/modules ] && ! dm_in_proc; then + modprobe dm-mod 2>/dev/null + fi + if [ -d /proc/lvm ] || dm_in_proc; then + vgscan --mknodes --ignorelockingfailure >/dev/null 2>&1 + vgchange --sysinit --activate y >/dev/null 2>&1 + rc=$? + else + rc=1 + fi + eend $rc +} + +stop() { + ebegin "Shutting down the Logical Volume Manager" + vgchange --ignorelockingfailure -a n >/dev/null 2>&1 + eend $? +} + diff --git a/repo/util/lvm2/lvm2.xibuild b/repo/util/lvm2/lvm2.xibuild new file mode 100644 index 0000000..eff7a0f --- /dev/null +++ b/repo/util/lvm2/lvm2.xibuild @@ -0,0 +1,48 @@ +#!/bin/sh + +NAME="lvm2" +DESC="Logical Volume Manager 2 utilities" + +MAKEDEPS="make " +DEPS="libaio util-linux musl device-mapper" + +PKG_VER=2.02.187 +SOURCE="https://mirrors.kernel.org/sourceware/lvm2/LVM2.$PKG_VER.tgz" +ADDITIONAL="mlockall-default-config.patch mallinfo.patch lvm.initd lvm.confd fix-stdio-usage.patch dmeventd.initd " + +prepare () { + apply_patches + autoreconf -fi +} + +build () { + ./configure \ + --prefix=/usr \ + --bindir=/usr/bin \ + --sysconfdir=/etc \ + --disable-static \ + --enable-static_link \ + --disable-nls \ + --disable-readline \ + --enable-pkgconfig \ + --enable-applib \ + --with-thin=internal \ + --enable-dmeventd \ + --enable-cmdlib \ + --with-thin-check=/sbin/thin_check \ + --with-thin-dump=/sbin/thin_dump \ + --with-thin-repair=/sbin/thin_repair \ + --with-dmeventd-path=/sbin/dmeventd \ + --enable-udev_rules + + make +} + +package () { + make DESTDIR="$PKG_DEST" install + install -d "$PKG_DEST"/etc/lvm/archive "$PKG_DEST"/etc/lvm/backup + install -Dm755 lvm.initd "$PKG_DEST"/etc/init.d/lvm + install -Dm644 lvm.confd "$PKG_DEST"/etc/conf.d/lvm + ln -s libdevmapper.so.1.02 "$PKG_DEST"/lib/libdevmapper.so + +} diff --git a/repo/util/lvm2/mallinfo.patch b/repo/util/lvm2/mallinfo.patch new file mode 100644 index 0000000..471a6b2 --- /dev/null +++ b/repo/util/lvm2/mallinfo.patch @@ -0,0 +1,11 @@ +--- ./lib/mm/memlock.c.orig 2015-03-09 11:18:41.560028850 -0100 ++++ ./lib/mm/memlock.c 2015-03-09 11:19:54.504373309 -0100 +@@ -137,7 +137,7 @@ + + static void _allocate_memory(void) + { +-#ifndef VALGRIND_POOL ++#if !defined(VALGRIND_POOL) && defined(__GLIBC__) + void *stack_mem; + struct rlimit limit; + int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks; diff --git a/repo/util/lvm2/mlockall-default-config.patch b/repo/util/lvm2/mlockall-default-config.patch new file mode 100644 index 0000000..305ddee --- /dev/null +++ b/repo/util/lvm2/mlockall-default-config.patch @@ -0,0 +1,22 @@ +--- ./conf/example.conf.in.orig ++++ ./conf/example.conf.in +@@ -1352,7 +1352,7 @@ + # Use the old behavior of mlockall to pin all memory. + # Prior to version 2.02.62, LVM used mlockall() to pin the whole + # process's memory while activating devices. +- use_mlockall = 0 ++ use_mlockall = 1 + + # Configuration option activation/monitoring. + # Monitor LVs that are activated. +--- ./lib/config/defaults.h.orig ++++ ./lib/config/defaults.h +@@ -55,7 +55,7 @@ + #define DEFAULT_LVMLOCKD_LOCK_RETRIES 3 + #define DEFAULT_LVMETAD_UPDATE_WAIT_TIME 10 + #define DEFAULT_PRIORITISE_WRITE_LOCKS 1 +-#define DEFAULT_USE_MLOCKALL 0 ++#define DEFAULT_USE_MLOCKALL 1 + #define DEFAULT_METADATA_READ_ONLY 0 + #define DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH 0 + #define DEFAULT_UNKNOWN_DEVICE_NAME "[unknown]" diff --git a/repo/util/util-linux/util-linux.xibuild b/repo/util/util-linux/util-linux.xibuild index 327d0db..92a6f38 100644 --- a/repo/util/util-linux/util-linux.xibuild +++ b/repo/util/util-linux/util-linux.xibuild @@ -12,7 +12,7 @@ build () { --libdir=/usr/lib \ --docdir=/usr/share/doc/util-linux-$PKG_VER\ --disable-static \ - runstatedir=/run + --runstatedir=/run make } -- cgit v1.2.1