summaryrefslogtreecommitdiff
path: root/package/lvm/patches
diff options
context:
space:
mode:
Diffstat (limited to 'package/lvm/patches')
-rw-r--r--package/lvm/patches/0001-configure-support-builds-without-versioning.patch273
-rw-r--r--package/lvm/patches/patch-Makefile_in20
-rw-r--r--package/lvm/patches/patch-conf_Makefile_in23
-rw-r--r--package/lvm/patches/patch-configure_in45
-rw-r--r--package/lvm/patches/patch-lib_mm_memlock_c76
-rw-r--r--package/lvm/patches/patch-libdm_Makefile_in49
-rw-r--r--package/lvm/patches/patch-make_tmpl_in28
-rw-r--r--package/lvm/patches/patch-scripts_Makefile_in12
-rw-r--r--package/lvm/patches/patch-tools_Makefile_in48
-rw-r--r--package/lvm/patches/patch-tools_lvmcmdline_c34
10 files changed, 273 insertions, 335 deletions
diff --git a/package/lvm/patches/0001-configure-support-builds-without-versioning.patch b/package/lvm/patches/0001-configure-support-builds-without-versioning.patch
new file mode 100644
index 000000000..49c20cccc
--- /dev/null
+++ b/package/lvm/patches/0001-configure-support-builds-without-versioning.patch
@@ -0,0 +1,273 @@
+From 7a45d4d688d4966664ca94619b2ad0fc8d333d77 Mon Sep 17 00:00:00 2001
+From: Zdenek Kabelac <zkabelac@redhat.com>
+Date: Mon, 29 Mar 2021 21:46:12 +0200
+Subject: [PATCH] configure: support builds without versioning
+
+Not all libc (like musl, uclibc dietlibc) libraries support full symbol
+version resolution in runtime like glibc.
+Add support to not generate symbol versions when compiling against them.
+
+Additionally libdevmapper.so was broken when compiled against
+uclibc. Runtime linker loader caused calling dm_task_get_info_base()
+function recursively, leading to segmentation fault.
+
+Introduce --with-symvers=STYLE option, which allows to choose
+between gnu and disabled symbol versioning. By default gnu symbol
+versioning is used.
+__GNUC__ check is replaced now with GNU_SYMVER.
+Additionally ld version script is included only in
+case of gnu option, which slightly reduces output size.
+
+Providing --without-symvers to configure script when building against
+uclibc library fixes segmentation fault error described above, due to
+lack of several versions of the same symbol in libdevmapper.so
+library.
+
+Based on:
+https://patchwork.kernel.org/project/dm-devel/patch/20180831144817.31207-1-m.niestroj@grinn-global.com/
+
+Suggested-by: Marcin Niestroj <m.niestroj@grinn-global.com>
+---
+ configure | 35 ++++++++++++++++++++++++++++++++---
+ configure.ac | 26 +++++++++++++++++++++++---
+ include/configure.h.in | 3 +++
+ lib/misc/lib.h | 4 ++--
+ libdm/datastruct/bitset.c | 4 +---
+ libdm/ioctl/libdm-iface.c | 2 +-
+ libdm/libdm-deptree.c | 2 +-
+ libdm/libdm-stats.c | 2 +-
+ 8 files changed, 64 insertions(+), 14 deletions(-)
+
+diff --git a/configure b/configure
+index bb8d502209d60..eeb8397a27d0b 100755
+--- a/configure
++++ b/configure
+@@ -942,6 +942,7 @@ enable_cmirrord
+ with_cmirrord_pidfile
+ enable_debug
+ with_optimisation
++with_symvers
+ enable_profiling
+ enable_valgrind_pool
+ enable_devmapper
+@@ -1792,6 +1793,8 @@ Optional Packages:
+ --with-cmirrord-pidfile=PATH
+ cmirrord pidfile [PID_DIR/cmirrord.pid]
+ --with-optimisation=OPT C optimisation flag [OPT=-O2]
++ --with-symvers=STYLE use symbol versioning of the shared library
++ [default=gnu]
+ --with-lvmlockd-pidfile=PATH
+ lvmlockd pidfile [PID_DIR/lvmlockd.pid]
+ --with-lvmetad-pidfile=PATH
+@@ -3168,13 +3171,11 @@ if test -z "$CFLAGS"; then :
+ fi
+ case "$host_os" in
+ linux*)
+- CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ # equivalent to -rdynamic
+ ELDFLAGS="-Wl,--export-dynamic"
+ # FIXME Generate list and use --dynamic-list=.dlopen.sym
+ CLDWHOLEARCHIVE="-Wl,-whole-archive"
+ CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
+- LDDEPS="$LDDEPS .export.sym"
+ LIB_SUFFIX=so
+ DEVMAPPER=yes
+ BUILD_LVMETAD=no
+@@ -3190,7 +3191,6 @@ case "$host_os" in
+ ;;
+ darwin*)
+ CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
+- CLDFLAGS="$CLDFLAGS"
+ ELDFLAGS=
+ CLDWHOLEARCHIVE="-all_load"
+ CLDNOWHOLEARCHIVE=
+@@ -11182,6 +11182,35 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $COPTIMISE_FLAG" >&5
+ $as_echo "$COPTIMISE_FLAG" >&6; }
+
++################################################################################
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use symbol versioning" >&5
++$as_echo_n "checking whether to use symbol versioning... " >&6; }
++
++# Check whether --with-symvers was given.
++if test "${with_symvers+set}" = set; then :
++ withval=$with_symvers; case "$withval" in
++ gnu|no) symvers=$withval ;;
++ *) as_fn_error $? "Unknown argument to with-symvers" "$LINENO" 5 ;;
++ esac
++else
++ symvers=gnu
++fi
++
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $symvers" >&5
++$as_echo "$symvers" >&6; }
++
++if test "$GCC" = "yes" && test "$symvers" = "gnu" ; then
++
++$as_echo "#define GNU_SYMVER 1" >>confdefs.h
++
++ case "$host_os" in
++ linux*)
++ CLDFLAGS="${CLDFLAGS-"$LDFLAGS"} -Wl,--version-script,.export.sym"
++ LDDEPS="$LDDEPS .export.sym"
++ ;;
++ esac
++fi
++
+ ################################################################################
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to gather gcov profiling data" >&5
+ $as_echo_n "checking whether to gather gcov profiling data... " >&6; }
+diff --git a/configure.ac b/configure.ac
+index f040a5a713d7f..a2697d15c9150 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -30,13 +30,11 @@ AC_CANONICAL_TARGET([])
+ AS_IF([test -z "$CFLAGS"], [COPTIMISE_FLAG="-O2"])
+ case "$host_os" in
+ linux*)
+- CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
+ # equivalent to -rdynamic
+ ELDFLAGS="-Wl,--export-dynamic"
+ # FIXME Generate list and use --dynamic-list=.dlopen.sym
+ CLDWHOLEARCHIVE="-Wl,-whole-archive"
+ CLDNOWHOLEARCHIVE="-Wl,-no-whole-archive"
+- LDDEPS="$LDDEPS .export.sym"
+ LIB_SUFFIX=so
+ DEVMAPPER=yes
+ BUILD_LVMETAD=no
+@@ -52,7 +50,6 @@ case "$host_os" in
+ ;;
+ darwin*)
+ CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
+- CLDFLAGS="$CLDFLAGS"
+ ELDFLAGS=
+ CLDWHOLEARCHIVE="-all_load"
+ CLDNOWHOLEARCHIVE=
+@@ -981,6 +978,29 @@ AC_ARG_WITH(optimisation,
+ COPTIMISE_FLAG=$withval)
+ AC_MSG_RESULT($COPTIMISE_FLAG)
+
++################################################################################
++dnl -- Symbol versioning
++AC_MSG_CHECKING(whether to use symbol versioning)
++AC_ARG_WITH(symvers,
++ AC_HELP_STRING([--with-symvers=STYLE],
++ [use symbol versioning of the shared library [default=gnu]]),
++ [ case "$withval" in
++ gnu|no) symvers=$withval ;;
++ *) AC_MSG_ERROR(Unknown argument to with-symvers) ;;
++ esac], symvers=gnu)
++AC_MSG_RESULT($symvers)
++
++if test "$GCC" = "yes" && test "$symvers" = "gnu" ; then
++ AC_DEFINE(GNU_SYMVER, 1,
++ [Define to use GNU versioning in the shared library.])
++ case "$host_os" in
++ linux*)
++ CLDFLAGS="${CLDFLAGS-"$LDFLAGS"} -Wl,--version-script,.export.sym"
++ LDDEPS="$LDDEPS .export.sym"
++ ;;
++ esac
++fi
++
+ ################################################################################
+ dnl -- Enable profiling
+ AC_MSG_CHECKING(whether to gather gcov profiling data)
+diff --git a/include/configure.h.in b/include/configure.h.in
+index 49663e484e0b2..af0fa31e063a3 100644
+--- a/include/configure.h.in
++++ b/include/configure.h.in
+@@ -150,6 +150,9 @@
+ /* Path to fsadm binary. */
+ #undef FSADM_PATH
+
++/* Define to use GNU versioning in the shared library. */
++#undef GNU_SYMVER
++
+ /* Define to 1 if you have the `alarm' function. */
+ #undef HAVE_ALARM
+
+diff --git a/lib/misc/lib.h b/lib/misc/lib.h
+index d7fa5c721c118..3cd7a76ae3486 100644
+--- a/lib/misc/lib.h
++++ b/lib/misc/lib.h
+@@ -42,7 +42,7 @@
+ * specified version string.
+ *
+ * Since versioning is only available when compiling with GCC the entire
+- * compatibility version should be enclosed in '#if defined(__GNUC__)',
++ * compatibility version should be enclosed in '#if defined(GNU_SYMVER)',
+ * for example:
+ *
+ * int dm_foo(int bar)
+@@ -67,7 +67,7 @@
+ * versions of library symbols prior to the introduction of symbol
+ * versioning: it must never be used for new symbols.
+ */
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ #define DM_EXPORT_SYMBOL(func, ver) \
+ __asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver )
+ #define DM_EXPORT_SYMBOL_BASE(func) \
+diff --git a/libdm/datastruct/bitset.c b/libdm/datastruct/bitset.c
+index b0826e1eb54ec..642587e5472b1 100644
+--- a/libdm/datastruct/bitset.c
++++ b/libdm/datastruct/bitset.c
+@@ -242,7 +242,7 @@ bad:
+ return NULL;
+ }
+
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+ * Maintain backward compatibility with older versions that did not
+ * accept a 'min_num_bits' argument to dm_bitset_parse_list().
+@@ -254,6 +254,4 @@ dm_bitset_t dm_bitset_parse_list_v1_02_129(const char *str, struct dm_pool *mem)
+ }
+ DM_EXPORT_SYMBOL(dm_bitset_parse_list, 1_02_129);
+
+-#else /* if defined(__GNUC__) */
+-
+ #endif
+diff --git a/libdm/ioctl/libdm-iface.c b/libdm/ioctl/libdm-iface.c
+index 14186e680d97d..4be7ab34a704f 100644
+--- a/libdm/ioctl/libdm-iface.c
++++ b/libdm/ioctl/libdm-iface.c
+@@ -2176,7 +2176,7 @@ void dm_lib_exit(void)
+ _version_checked = 0;
+ }
+
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+ * Maintain binary backward compatibility.
+ * Version script mechanism works with 'gcc' compatible compilers only.
+diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
+index ba1ed1991a0cf..802db076e27f1 100644
+--- a/libdm/libdm-deptree.c
++++ b/libdm/libdm-deptree.c
+@@ -3849,7 +3849,7 @@ void dm_tree_node_set_callback(struct dm_tree_node *dnode,
+ dnode->callback_data = data;
+ }
+
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ /*
+ * Backward compatible implementations.
+ *
+diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
+index a3697c74dfde8..9f09f1c2f082e 100644
+--- a/libdm/libdm-stats.c
++++ b/libdm/libdm-stats.c
+@@ -5069,7 +5069,7 @@ int dm_stats_start_filemapd(int fd, uint64_t group_id, const char *path,
+ * current dm_stats_create_region() version.
+ */
+
+-#if defined(__GNUC__)
++#if defined(GNU_SYMVER)
+ int dm_stats_create_region_v1_02_106(struct dm_stats *dms, uint64_t *region_id,
+ uint64_t start, uint64_t len, int64_t step,
+ int precise, const char *program_id,
+--
+2.33.1
+
diff --git a/package/lvm/patches/patch-Makefile_in b/package/lvm/patches/patch-Makefile_in
deleted file mode 100644
index 305822e5b..000000000
--- a/package/lvm/patches/patch-Makefile_in
+++ /dev/null
@@ -1,20 +0,0 @@
---- LVM2.2.02.177.orig/Makefile.in 2017-12-18 21:44:34.000000000 +0100
-+++ LVM2.2.02.177/Makefile.in 2018-06-07 03:09:57.000000000 +0200
-@@ -18,7 +18,7 @@ top_builddir = @top_builddir@
- abs_top_builddir = @abs_top_builddir@
- abs_top_srcdir = @abs_top_srcdir@
-
--SUBDIRS = conf daemons include lib libdaemon libdm man scripts tools
-+SUBDIRS = conf daemons include lib libdaemon libdm scripts tools
-
- ifeq ("@UDEV_RULES@", "yes")
- SUBDIRS += udev
-@@ -69,7 +69,7 @@ liblvm.device-mapper: include.device-map
- daemons.device-mapper: libdm.device-mapper
- tools.device-mapper: libdm.device-mapper
- scripts.device-mapper: include.device-mapper
--device-mapper: tools.device-mapper daemons.device-mapper man.device-mapper
-+device-mapper: tools.device-mapper daemons.device-mapper
-
- ifeq ("@INTL@", "yes")
- lib.pofile: include.pofile
diff --git a/package/lvm/patches/patch-conf_Makefile_in b/package/lvm/patches/patch-conf_Makefile_in
deleted file mode 100644
index 5b910dba7..000000000
--- a/package/lvm/patches/patch-conf_Makefile_in
+++ /dev/null
@@ -1,23 +0,0 @@
---- LVM2.2.02.168.orig/conf/Makefile.in 2016-12-01 00:17:28.000000000 +0100
-+++ LVM2.2.02.168/conf/Makefile.in 2017-03-27 19:47:20.000000000 +0200
-@@ -37,14 +37,16 @@ generate:
-
- install_conf: $(CONFSRC)
- @if [ ! -e $(confdir)/$(CONFDEST) ]; then \
-- echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST)"; \
-- $(INSTALL_WDATA) -D $< $(confdir)/$(CONFDEST); \
-+ echo "$(INSTALL_WDATA) $< $(confdir)/$(CONFDEST)"; \
-+ $(INSTALL_DIR) $(confdir); \
-+ $(INSTALL_WDATA) $< $(confdir)/$(CONFDEST); \
- fi
-
- install_localconf: $(CONFLOCAL)
- @if [ ! -e $(confdir)/$(CONFLOCAL) ]; then \
-- echo "$(INSTALL_WDATA) -D $< $(confdir)/$(CONFLOCAL)"; \
-- $(INSTALL_WDATA) -D $< $(confdir)/$(CONFLOCAL); \
-+ echo "$(INSTALL_WDATA) $< $(confdir)/$(CONFLOCAL)"; \
-+ $(INSTALL_DIR) $(confdir); \
-+ $(INSTALL_WDATA) $< $(confdir)/$(CONFLOCAL); \
- fi
-
- install_profiles: $(PROFILES)
diff --git a/package/lvm/patches/patch-configure_in b/package/lvm/patches/patch-configure_in
deleted file mode 100644
index a1b99eae9..000000000
--- a/package/lvm/patches/patch-configure_in
+++ /dev/null
@@ -1,45 +0,0 @@
---- LVM2.2.02.177.orig/configure.in 2017-12-18 21:44:34.000000000 +0100
-+++ LVM2.2.02.177/configure.in 2018-06-07 03:09:58.000000000 +0200
-@@ -29,7 +29,7 @@ AC_CANONICAL_TARGET([])
-
- AS_IF([test -z "$CFLAGS"], [COPTIMISE_FLAG="-O2"])
- case "$host_os" in
-- linux*)
-+ *)
- CLDFLAGS="$CLDFLAGS -Wl,--version-script,.export.sym"
- # equivalent to -rdynamic
- ELDFLAGS="-Wl,--export-dynamic"
-@@ -50,21 +50,6 @@ case "$host_os" in
- FSADM=yes
- BLKDEACTIVATE=yes
- ;;
-- darwin*)
-- CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
-- CLDFLAGS="$CLDFLAGS"
-- ELDFLAGS=
-- CLDWHOLEARCHIVE="-all_load"
-- CLDNOWHOLEARCHIVE=
-- LIB_SUFFIX=dylib
-- DEVMAPPER=yes
-- ODIRECT=no
-- DM_IOCTLS=no
-- SELINUX=no
-- CLUSTER=none
-- FSADM=no
-- BLKDEACTIVATE=no
-- ;;
- esac
-
- ################################################################################
-@@ -111,10 +96,8 @@ AC_CHECK_HEADERS([assert.h ctype.h diren
- AC_CHECK_HEADERS(termios.h sys/statvfs.h sys/timerfd.h sys/vfs.h linux/magic.h linux/fiemap.h)
-
- case "$host_os" in
-- linux*)
-+ *)
- AC_CHECK_HEADERS(asm/byteorder.h linux/fs.h malloc.h,,AC_MSG_ERROR(bailing out)) ;;
-- darwin*)
-- AC_CHECK_HEADERS(machine/endian.h sys/disk.h,,AC_MSG_ERROR(bailing out)) ;;
- esac
-
- ################################################################################
diff --git a/package/lvm/patches/patch-lib_mm_memlock_c b/package/lvm/patches/patch-lib_mm_memlock_c
deleted file mode 100644
index af53ad132..000000000
--- a/package/lvm/patches/patch-lib_mm_memlock_c
+++ /dev/null
@@ -1,76 +0,0 @@
---- LVM2.2.02.177.orig/lib/mm/memlock.c 2017-12-18 21:44:35.000000000 +0100
-+++ LVM2.2.02.177/lib/mm/memlock.c 2018-06-07 03:09:58.000000000 +0200
-@@ -25,7 +25,6 @@
- #include <sys/mman.h>
- #include <sys/time.h>
- #include <sys/resource.h>
--#include <malloc.h>
-
- #ifdef HAVE_VALGRIND
- #include <valgrind.h>
-@@ -152,10 +151,8 @@ static void _touch_memory(void *mem, siz
- static void _allocate_memory(void)
- {
- #ifndef VALGRIND_POOL
-- void *stack_mem;
-+ void *stack_mem, *temp_malloc_mem;
- struct rlimit limit;
-- int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
-- char *areas[max_areas];
-
- /* Check if we could preallocate requested stack */
- if ((getrlimit (RLIMIT_STACK, &limit) == 0) &&
-@@ -164,50 +161,13 @@ static void _allocate_memory(void)
- _touch_memory(stack_mem, _size_stack);
- /* FIXME else warn user setting got ignored */
-
-- /*
-- * When a brk() fails due to fragmented address space (which sometimes
-- * happens when we try to grab 8M or so), glibc will make a new
-- * arena. In this arena, the rules for using “direct” mmap are relaxed,
-- * circumventing the MAX_MMAPs and MMAP_THRESHOLD settings. We can,
-- * however, detect when this happens with mallinfo() and try to co-opt
-- * malloc into using MMAP as a MORECORE substitute instead of returning
-- * MMAP'd memory directly. Since MMAP-as-MORECORE does not munmap the
-- * memory on free(), this is good enough for our purposes.
-- */
-- while (missing > 0) {
-- struct mallinfo inf = mallinfo();
-- hblks = inf.hblks;
--
-- if ((areas[area] = malloc(_size_malloc_tmp)))
-- _touch_memory(areas[area], _size_malloc_tmp);
--
-- inf = mallinfo();
--
-- if (hblks < inf.hblks) {
-- /* malloc cheated and used mmap, even though we told it
-- not to; we try with twice as many areas, each half
-- the size, to circumvent the faulty logic in glibc */
-- free(areas[area]);
-- _size_malloc_tmp /= 2;
-- } else {
-- ++ area;
-- missing -= _size_malloc_tmp;
-- }
--
-- if (area == max_areas && missing > 0) {
-- /* Too bad. Warn the user and proceed, as things are
-- * most likely going to work out anyway. */
-- log_warn("WARNING: Failed to reserve memory, %d bytes missing.", missing);
-- break;
-- }
-- }
-+ if ((temp_malloc_mem = malloc(_size_malloc_tmp)))
-+ _touch_memory(temp_malloc_mem, _size_malloc_tmp);
-
- if ((_malloc_mem = malloc(_size_malloc)))
- _touch_memory(_malloc_mem, _size_malloc);
-
-- /* free up the reserves so subsequent malloc's can use that memory */
-- for (i = 0; i < area; ++i)
-- free(areas[i]);
-+ free(temp_malloc_mem);
- #endif
- }
-
diff --git a/package/lvm/patches/patch-libdm_Makefile_in b/package/lvm/patches/patch-libdm_Makefile_in
deleted file mode 100644
index 4943fab06..000000000
--- a/package/lvm/patches/patch-libdm_Makefile_in
+++ /dev/null
@@ -1,49 +0,0 @@
---- LVM2.2.02.168.orig/libdm/Makefile.in 2016-12-01 00:17:30.000000000 +0100
-+++ LVM2.2.02.168/libdm/Makefile.in 2017-03-27 20:24:52.000000000 +0200
-@@ -38,10 +38,7 @@ SOURCES =\
-
- INCLUDES = -I$(srcdir)/$(interface)
-
--ifeq ("@STATIC_LINK@", "yes")
- LIB_STATIC = $(interface)/libdevmapper.a
--endif
--
- LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX)
- LIB_VERSION = $(LIB_VERSION_DM)
- TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
-@@ -69,9 +66,7 @@ libdevmapper.$(LIB_SUFFIX) libdevmapper.
-
- INSTALL_TYPE = install_dynamic
-
--ifeq ("@STATIC_LINK@", "yes")
-- INSTALL_TYPE += install_static
--endif
-+INSTALL_TYPE += install_static
-
- ifeq ("@PKGCONFIG@", "yes")
- INSTALL_TYPE += install_pkgconfig
-@@ -82,7 +77,8 @@ install: $(INSTALL_TYPE) install_include
- install_device-mapper: install
-
- install_include: $(srcdir)/libdevmapper.h
-- $(INSTALL_DATA) -D $< $(includedir)/$(<F)
-+ $(INSTALL_DIR) $(includedir)
-+ $(INSTALL_DATA) $< $(includedir)/$(<F)
-
- install_dynamic: install_@interface@
-
-@@ -91,10 +87,12 @@ install_static: install_@interface@_stat
- install_ioctl: install_lib_shared
-
- install_pkgconfig: libdevmapper.pc
-- $(INSTALL_DATA) -D $< $(pkgconfigdir)/devmapper.pc
-+ $(INSTALL_DIR) $(pkgconfigdir)
-+ $(INSTALL_DATA) $< $(pkgconfigdir)/devmapper.pc
-
- install_ioctl_static: $(LIB_STATIC)
-- $(INSTALL_DATA) -D $< $(usrlibdir)/$(<F)
-+ $(INSTALL_DIR) $(usrlibdir)
-+ $(INSTALL_DATA) $< $(usrlibdir)/$(<F)
-
- CLEAN_TARGETS += ioctl/libdevmapper.a
- DISTCLEAN_TARGETS += libdevmapper.pc
diff --git a/package/lvm/patches/patch-make_tmpl_in b/package/lvm/patches/patch-make_tmpl_in
deleted file mode 100644
index 7ddf32071..000000000
--- a/package/lvm/patches/patch-make_tmpl_in
+++ /dev/null
@@ -1,28 +0,0 @@
---- LVM2.2.02.177.orig/make.tmpl.in 2017-12-18 21:44:35.000000000 +0100
-+++ LVM2.2.02.177/make.tmpl.in 2018-06-07 03:09:58.000000000 +0200
-@@ -468,7 +468,8 @@ $(LIB_SHARED): $(LIB_SHARED).$(LIB_VERSI
- CLEAN_TARGETS += $(LDDEPS) .exported_symbols_generated
-
- install_lib_shared: $(LIB_SHARED)
-- $(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION)
-+ $(INSTALL_DIR) $(libdir)
-+ $(INSTALL_PROGRAM) $< $(libdir)/$(<F).$(LIB_VERSION)
- $(INSTALL_DIR) $(usrlibdir)
- $(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
-
-@@ -476,11 +477,13 @@ install_lib_shared: $(LIB_SHARED)
- # and for compatibility links in libdir are created
- # when the code is fixed links could be removed.
- install_dm_plugin: $(LIB_SHARED)
-- $(INSTALL_PROGRAM) -D $< $(libdir)/device-mapper/$(<F)
-+ $(INSTALL_DIR) $(libdir)
-+ $(INSTALL_PROGRAM) $< $(libdir)/device-mapper/$(<F)
- $(LN_S) -f device-mapper/$(<F) $(libdir)/$(<F)
-
- install_lvm2_plugin: $(LIB_SHARED)
-- $(INSTALL_PROGRAM) -D $< $(libdir)/lvm2/$(<F)
-+ $(INSTALL_DIR) $(libdir)
-+ $(INSTALL_PROGRAM) $< $(libdir)/lvm2/$(<F)
- $(LN_S) -f lvm2/$(<F) $(libdir)/$(<F)
- $(LN_S) -f $(<F) $(libdir)/$(<F).$(LIB_VERSION)
- endif
diff --git a/package/lvm/patches/patch-scripts_Makefile_in b/package/lvm/patches/patch-scripts_Makefile_in
deleted file mode 100644
index af1cea8cb..000000000
--- a/package/lvm/patches/patch-scripts_Makefile_in
+++ /dev/null
@@ -1,12 +0,0 @@
---- LVM2.2.02.168.orig/scripts/Makefile.in 2016-12-01 00:17:31.000000000 +0100
-+++ LVM2.2.02.168/scripts/Makefile.in 2017-03-27 20:49:38.000000000 +0200
-@@ -51,7 +51,8 @@ vpath %.sh $(srcdir)
- vpath %.ocf $(srcdir)
-
- %_install: %.sh
-- $(INSTALL_PROGRAM) -D $< $(sbindir)/$(basename $(<F))
-+ $(INSTALL_DIR) $(sbindir)
-+ $(INSTALL_PROGRAM) $< $(sbindir)/$(basename $(<F))
-
- %_install: %.ocf
- $(INSTALL_DIR) $(ocf_scriptdir)
diff --git a/package/lvm/patches/patch-tools_Makefile_in b/package/lvm/patches/patch-tools_Makefile_in
deleted file mode 100644
index 9fc597990..000000000
--- a/package/lvm/patches/patch-tools_Makefile_in
+++ /dev/null
@@ -1,48 +0,0 @@
---- LVM2.2.02.177.orig/tools/Makefile.in 2017-12-18 21:44:35.000000000 +0100
-+++ LVM2.2.02.177/tools/Makefile.in 2018-06-07 03:15:42.000000000 +0200
-@@ -217,18 +217,21 @@ endif
- install_dmsetup_dynamic install_dmsetup_static
-
- install_cmdlib_include: $(srcdir)/lvm2cmd.h
-- $(INSTALL_DATA) -D $< $(includedir)/$(<F)
-+ $(INSTALL_DIR) $(includedir)
-+ $(INSTALL_DATA) $< $(includedir)/$(<F)
-
- install_cmdlib_dynamic: liblvm2cmd.$(LIB_SUFFIX)
-- $(INSTALL_PROGRAM) -D $< $(libdir)/$(<F).$(LIB_VERSION)
- $(INSTALL_DIR) $(usrlibdir)
-+ $(INSTALL_PROGRAM) $< $(libdir)/$(<F).$(LIB_VERSION)
- $(LN_S) -f $(USRLIB_RELPATH)$(<F).$(LIB_VERSION) $(usrlibdir)/$(<F)
-
- install_cmdlib_static: liblvm2cmd-static.a
-+ $(INSTALL_DIR) $(usrlibdir)
- $(INSTALL_DATA) -D $< $(usrlibdir)/liblvm2cmd.a
-
- install_tools_dynamic: lvm .commands
-- $(INSTALL_PROGRAM) -D lvm $(sbindir)/lvm
-+ $(INSTALL_DIR) $(sbindir)
-+ $(INSTALL_PROGRAM) lvm $(sbindir)/lvm
- @echo Creating symbolic links for individual commands in $(sbindir)
- @for v in `cat .commands`; do \
- echo "$(LN_S) -f lvm $(sbindir)/$$v"; \
-@@ -236,14 +239,17 @@ install_tools_dynamic: lvm .commands
- done;
-
- install_tools_static: lvm.static
-- $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
-+ $(INSTALL_DIR) $(staticdir)
-+ $(INSTALL_PROGRAM) $< $(staticdir)/$(<F)
-
- install_dmsetup_dynamic: dmsetup
-- $(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
-+ $(INSTALL_DIR) $(sbindir)
-+ $(INSTALL_PROGRAM) $< $(sbindir)/$(<F)
- $(LN_S) -f $(<F) $(sbindir)/dmstats
-
- install_dmsetup_static: dmsetup.static
-- $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
-+ $(INSTALL_DIR) $(staticdir)
-+ $(INSTALL_PROGRAM) $< $(staticdir)/$(<F)
- $(LN_S) -f $(<F) $(staticdir)/dmstats
-
- install_device-mapper: $(INSTALL_DMSETUP_TARGETS)
diff --git a/package/lvm/patches/patch-tools_lvmcmdline_c b/package/lvm/patches/patch-tools_lvmcmdline_c
deleted file mode 100644
index 8c5cb5c6b..000000000
--- a/package/lvm/patches/patch-tools_lvmcmdline_c
+++ /dev/null
@@ -1,34 +0,0 @@
---- LVM2.2.02.177.orig/tools/lvmcmdline.c 2017-12-18 21:44:35.000000000 +0100
-+++ LVM2.2.02.177/tools/lvmcmdline.c 2018-06-07 03:09:58.000000000 +0200
-@@ -3093,9 +3093,12 @@ int lvm_split(char *str, int *argc, char
- static int _check_standard_fds(void)
- {
- int err = is_valid_fd(STDERR_FILENO);
-+ FILE *stdin_stream = stdin;
-+ FILE *stdout_stream = stdout;
-+ FILE *stderr_stream = stderr;
-
- if (!is_valid_fd(STDIN_FILENO) &&
-- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
-+ !(stdin_stream = fopen(_PATH_DEVNULL, "r"))) {
- if (err)
- perror("stdin stream open");
- else
-@@ -3105,7 +3108,7 @@ static int _check_standard_fds(void)
- }
-
- if (!is_valid_fd(STDOUT_FILENO) &&
-- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
-+ !(stdout_stream = fopen(_PATH_DEVNULL, "w"))) {
- if (err)
- perror("stdout stream open");
- /* else no stdout */
-@@ -3113,7 +3116,7 @@ static int _check_standard_fds(void)
- }
-
- if (!is_valid_fd(STDERR_FILENO) &&
-- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
-+ !(stderr_stream = fopen(_PATH_DEVNULL, "w"))) {
- printf("stderr stream open: %s\n",
- strerror(errno));
- return 0;