commit:     f5abf1319b37b89f49264d8e944ac1a9e7547b4d
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 13:58:22 2019 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 14:13:32 2019 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f5abf131

Don't compile multipath-tools; Copy from host

multipath-tools package doesn't really support a static
build: While we managed to build programs like multipath
statically, it still relied on dynamic libs for checkers
which we are unable to fix.

This commit will change --multipath support in that way that
we now require that sys-fs/multipath-tools is installed on
host system because we will copy binaries and used libraries
from host to initramfs.

Due to this change, you can't add multipath support in cross-
compile scenarios anymore.

Bug: https://bugs.gentoo.org/695510
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/software.sh                               |  21 ---
 gen_determineargs.sh                               |  29 ++++
 gen_initramfs.sh                                   |  19 +--
 gkbuilds/eudev.gkbuild                             |  46 ------
 gkbuilds/multipath-tools.gkbuild                   |  62 --------
 gkbuilds/userspace-rcu.gkbuild                     |  17 ---
 .../multipath-tools-0.7.5-respect-flags.patch      |  19 ---
 .../multipath-tools-0.8.0-respect-sysroot.patch    |  55 -------
 .../0.8.0/multipath-tools-0.8.0-static-libs.patch  | 159 ---------------------
 9 files changed, 40 insertions(+), 387 deletions(-)

diff --git a/defaults/software.sh b/defaults/software.sh
index 363013f..793c90e 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -58,13 +58,6 @@ 
GKPKG_DROPBEAR_SRCTAR="${GKPKG_DROPBEAR_SRCTAR:-${DISTDIR}/dropbear-${GKPKG_DROP
 GKPKG_DROPBEAR_SRCDIR="${GKPKG_DROPBEAR_SRCDIR:-dropbear-${GKPKG_DROPBEAR_PV}}"
 
GKPKG_DROPBEAR_BINPKG="${GKPKG_DROPBEAR_BINPKG:-%%CACHE%%/dropbear-${GKPKG_DROPBEAR_PV}-%%ARCH%%.tar.xz}"
 
-GKPKG_EUDEV_PN="eudev"
-GKPKG_EUDEV_PV="${GKPKG_EUDEV_PV:-VERSION_EUDEV}"
-GKPKG_EUDEV_DEPS=""
-GKPKG_EUDEV_SRCTAR="${GKPKG_EUDEV_SRCTAR:-${DISTDIR}/eudev-${GKPKG_EUDEV_PV}.tar.gz}"
-GKPKG_EUDEV_SRCDIR="${GKPKG_EUDEV_SRCDIR:-eudev-${GKPKG_EUDEV_PV}}"
-GKPKG_EUDEV_BINPKG="${GKPKG_EUDEV_BINPKG:-%%CACHE%%/eudev-${GKPKG_EUDEV_PV}-%%ARCH%%.tar.xz}"
-
 GKPKG_EXPAT_PN="expat"
 GKPKG_EXPAT_PV="${GKPKG_EXPAT_PV:-VERSION_EXPAT}"
 GKPKG_EXPAT_DEPS=""
@@ -149,13 +142,6 @@ 
GKPKG_MDADM_SRCDIR="${GKPKG_MDADM_SRCDIR:-mdadm-${GKPKG_MDADM_PV}}"
 
GKPKG_MDADM_SRCTAR="${GKPKG_MDADM_SRCTAR:-${DISTDIR}/mdadm-${GKPKG_MDADM_PV}.tar.xz}"
 
GKPKG_MDADM_BINPKG="${GKPKG_MDADM_BINPKG:-%%CACHE%%/mdadm-${GKPKG_MDADM_PV}-%%ARCH%%.tar.xz}"
 
-GKPKG_MULTIPATH_TOOLS_PN="multipath-tools"
-GKPKG_MULTIPATH_TOOLS_PV="${GKPKG_MULTIPATH_TOOLS_PV:-VERSION_MULTIPATH_TOOLS}"
-GKPKG_MULTIPATH_TOOLS_DEPS="json-c libaio userspace-rcu eudev lvm"
-GKPKG_MULTIPATH_TOOLS_SRCTAR="${GKPKG_MULTIPATH_TOOLS_SRCTAR:-${DISTDIR}/multipath-tools-${GKPKG_MULTIPATH_TOOLS_PV}.tar.gz}"
-GKPKG_MULTIPATH_TOOLS_SRCDIR="${GKPKG_MULTIPATH_TOOLS_SRCDIR:-multipath-tools-${GKPKG_MULTIPATH_TOOLS_PV}-eb688e1}"
-GKPKG_MULTIPATH_TOOLS_BINPKG="${GKPKG_MULTIPATH_TOOLS_BINPKG:-%%CACHE%%/multipath-tools-${GKPKG_MULTIPATH_TOOLS_PV}-%%ARCH%%.tar.xz}"
-
 GKPKG_POPT_PN="popt"
 GKPKG_POPT_PV="${GKPKG_POPT_PV:-VERSION_POPT}"
 GKPKG_POPT_DEPS=""
@@ -184,13 +170,6 @@ 
GKPKG_UNIONFS_FUSE_SRCDIR="${GKPKG_UNIONFS_FUSE_SRCDIR:-unionfs-fuse-${GKPKG_UNI
 
GKPKG_UNIONFS_FUSE_SRCTAR="${GKPKG_UNIONFS_FUSE_SRCTAR:-${DISTDIR}/unionfs-fuse-${GKPKG_UNIONFS_FUSE_PV}.tar.gz}"
 
GKPKG_UNIONFS_FUSE_BINPKG="${GKPKG_UNIONFS_FUSE_BINPKG:-%%CACHE%%/unionfs-fuse-${GKPKG_UNIONFS_FUSE_PV}-%%ARCH%%.tar.xz}"
 
-GKPKG_USERSPACE_RCU_PN="userspace-rcu"
-GKPKG_USERSPACE_RCU_PV="${GKPKG_USERSPACE_RCU_PV:-VERSION_USERSPACE_RCU}"
-GKPKG_USERSPACE_RCU_DEPS=""
-GKPKG_USERSPACE_RCU_SRCTAR="${GKPKG_USERSPACE_RCU_SRCTAR:-${DISTDIR}/userspace-rcu-${GKPKG_USERSPACE_RCU_PV}.tar.bz2}"
-GKPKG_USERSPACE_RCU_SRCDIR="${GKPKG_USERSPACE_RCU_SRCDIR:-userspace-rcu-${GKPKG_USERSPACE_RCU_PV}}"
-GKPKG_USERSPACE_RCU_BINPKG="${GKPKG_USERSPACE_RCU_BINPKG:-%%CACHE%%/userspace-rcu-${GKPKG_USERSPACE_RCU_PV}-%%ARCH%%.tar.xz}"
-
 GKPKG_UTIL_LINUX_PN="util-linux"
 GKPKG_UTIL_LINUX_PV="${GKPKG_UTIL_LINUX_PV:-VERSION_UTIL_LINUX}"
 GKPKG_UTIL_LINUX_DEPS=""

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index a27e980..cf76ee2 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -756,6 +756,35 @@ determine_real_args() {
                        gen_die "${error_msg}"
                fi
 
+               if isTrue "${MULTIPATH}"
+               then
+                       if isTrue "$(tc-is-cross-compiler)"
+                       then
+                               local error_msg="Using binpkg for 
multipath-tools is not supported."
+                               error_msg+=" Therefore we cannot cross-compile 
like requested!"
+                               gen_die "${error_msg}"
+                       fi
+
+                       if [ ! -x "/sbin/multipath" ]
+                       then
+                               local error_msg="'/sbin/multipath' is required 
for --multipath but file does not exist or is not executable!"
+                               error_msg+=" Is sys-fs/multipath-tools 
installed?"
+                               gen_die "${error_msg}"
+                       fi
+
+                       if [ ! -x "/lib/udev/scsi_id" ]
+                       then
+                               local error_msg="'/lib/udev/scsi_id' is 
required for --multipath but file does not exist or is not executable!"
+                               error_msg+=" This file is usually provided by 
sys-fs/{eudev,udev} or sys-apps/systemd!"
+                               gen_die "${error_msg}"
+                       fi
+
+                       if [ ! -s "/etc/multipath.conf" ]
+                       then
+                               gen_die "'/etc/multipath.conf' is required for 
--multipath but file does not exist or is empty!"
+                       fi
+               fi
+
                if ! isTrue "${BUSYBOX}"
                then
                        local -a FEATURES_REQUIRING_BUSYBOX

diff --git a/gen_initramfs.sh b/gen_initramfs.sh
index a27e2ca..d217440 100755
--- a/gen_initramfs.sh
+++ b/gen_initramfs.sh
@@ -534,19 +534,22 @@ append_multipath() {
                rm -r "${TDIR}" || gen_die "Failed to clean out existing 
'${TDIR}'!"
        fi
 
-       populate_binpkg ${PN}
-
        mkdir -p "${TDIR}"/etc || gen_die "Failed to create '${TDIR}/etc'!"
 
-       unpack "$(get_gkpkg_binpkg "${PN}")" "${TDIR}"
+       local libdir=$(get_chost_libdir)
+
+       copy_binaries \
+               "${TDIR}"\
+               /sbin/multipath \
+               /sbin/kpartx \
+               /sbin/mpathpersist \
+               ${libdir}/multipath/lib*.so \
+               /lib/udev/scsi_id
 
        cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!"
 
-       if [ -x /sbin/multipath ]
-       then
-               cp -aL /etc/multipath.conf "${TDIR}"/etc/multipath.conf 
2>/dev/null \
-                       || gen_die "Failed to copy '/etc/multipath.conf'!"
-       fi
+       cp -aL /etc/multipath.conf "${TDIR}"/etc/multipath.conf 2>/dev/null \
+               || gen_die "Failed to copy '/etc/multipath.conf'!"
 
        # /etc/scsi_id.config does not exist in newer udevs
        # copy it optionally.

diff --git a/gkbuilds/eudev.gkbuild b/gkbuilds/eudev.gkbuild
deleted file mode 100644
index 26dc8b2..0000000
--- a/gkbuilds/eudev.gkbuild
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-src_prepare() {
-       default
-
-       sed -i \
-               -e 's/scsi_id_LDADD = \\/scsi_id_LDADD = -all-static \\/' \
-               src/scsi_id/Makefile.in \
-               || die "Failed to add '-all-static' for scsi_id program!"
-}
-
-src_configure() {
-       export cc_cv_CFLAGS__flto=no
-
-       local myconf=(
-               ac_cv_search_cap_init=
-               ac_cv_header_sys_capability_h=yes
-               DBUS_CFLAGS=' '
-               DBUS_LIBS=' '
-               --enable-split-usr
-               --disable-manpages
-               --disable-hwdb
-               --enable-static
-               --disable-introspection
-               --disable-kmod
-               --disable-selinux
-               --disable-rule-generator
-       )
-
-       gkconf "${myconf[@]}"
-}
-
-src_install() {
-       default
-
-       "${STRIP}" --strip-all "${D}"/usr/lib/udev/*_id \
-               || die "Failed to strip '${D}/usr/lib/udev/*_id' programs!"
-
-       rm -rf \
-               "${D}"/etc \
-               "${D}"/sbin \
-               "${D}"/usr/bin \
-               "${D}"/usr/sbin \
-               "${D}"/usr/share
-}

diff --git a/gkbuilds/multipath-tools.gkbuild b/gkbuilds/multipath-tools.gkbuild
deleted file mode 100644
index b2c7bd9..0000000
--- a/gkbuilds/multipath-tools.gkbuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-src_prepare() {
-       default
-
-       sed -i \
-               -e '/libmpathpersist \\/d' \
-               -e '/multipathd \\/d' \
-               -e '/mpathpersist \\/d' \
-               Makefile || die "Failed to disable unneeded components!"
-}
-
-src_compile() {
-       local MYMAKEOPTS=( "V=1" )
-       MYMAKEOPTS+=( "sysroot='${BROOT}'" )
-       MYMAKEOPTS+=( "ENABLE_LIBDMMP=0" )
-       gkmake "${MYMAKEOPTS[@]}"
-}
-
-src_install() {
-       mkdir "${D}"/sbin || die "Failed to create '${D}/sbin'!"
-
-       cp -a multipath/multipath "${D}"/sbin/ \
-               || die "Failed to copy '${S}/multipath/multipath' to 
'${D}/sbin/'!"
-
-       "${STRIP}" --strip-all "${D}"/sbin/multipath \
-               || die "Failed to strip '${D}/sbin/multipath'!"
-
-       cp -a kpartx/kpartx "${D}"/sbin/ \
-               || die "Failed to copy '${S}/kpartx/kpartx' to '${D}/sbin/'!"
-
-       "${STRIP}" --strip-all "${D}"/sbin/kpartx \
-               || die "Failed to strip '${D}/sbin/kpartx'!"
-
-       mkdir -p "${D}"/lib/multipath || die "Failed to create 
'${D}/lib/multipath'!"
-
-       local -a CHECKERS
-       CHECKERS+=( 'libcheckcciss_tur.so' )
-       CHECKERS+=( 'libcheckdirectio.so' )
-       CHECKERS+=( 'libcheckemc_clariion.so' )
-       CHECKERS+=( 'libcheckhp_sw.so' )
-       CHECKERS+=( 'libcheckrdac.so' )
-       CHECKERS+=( 'libcheckreadsector0.so' )
-       CHECKERS+=( 'libchecktur.so' )
-
-       local checker_lib=
-       for checker_lib in "${CHECKERS[@]}"
-       do
-               cp -a libmultipath/checkers/${checker_lib} 
"${D}"/lib/multipath/ \
-                       || die "Failed to copy checker 
'${S}/libmultipath/checkers/${checker_lib}' to 
'${D}/lib/multipath/${checker_lib}'!"
-
-               "${STRIP}" --strip-all "${D}"/lib/multipath/${checker_lib} \
-                       || die "Failed to strip 
'${D}/lib/multipath/${checker_lib}'!"
-       done
-
-       # Copy file from eudev package into multipath-tools binpkg ...
-       mkdir -p "${D}"/lib/udev || die "Failed to create '${D}/lib/udev'!"
-
-       cp -a "${BROOT}"/usr/lib/udev/scsi_id "${D}"/lib/udev/ \
-               || die "Failed to copy '${BROOT}/usr/lib/udev/scsi_id' to 
'${D}/lib/udev/'!"    
-}

diff --git a/gkbuilds/userspace-rcu.gkbuild b/gkbuilds/userspace-rcu.gkbuild
deleted file mode 100644
index e214039..0000000
--- a/gkbuilds/userspace-rcu.gkbuild
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 1999-2019 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-src_configure() {
-       local myconf=(
-               --enable-shared
-               --enable-static
-       )
-
-       gkconf "${myconf[@]}"
-}
-
-src_install() {
-       default
-
-       rm -rf "${D}"/usr/share
-}

diff --git 
a/patches/multipath-tools/0.8.0/multipath-tools-0.7.5-respect-flags.patch 
b/patches/multipath-tools/0.8.0/multipath-tools-0.7.5-respect-flags.patch
deleted file mode 100644
index fef55ce..0000000
--- a/patches/multipath-tools/0.8.0/multipath-tools-0.7.5-respect-flags.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- multipath-tools-0.7.5/Makefile.inc
-+++ multipath-tools-0.7.5/Makefile.inc
-@@ -91,12 +91,13 @@
-                 -Wp,-D_FORTIFY_SOURCE=2 $(STACKPROT) \
-                 --param=ssp-buffer-size=4
- 
--CFLAGS                := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" 
-DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
--                 -MMD -MP $(CFLAGS)
-+CFLAGS                ?= $(OPTFLAGS)
-+CFLAGS                += -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" 
-DRUN_DIR=\"${RUN}\" \
-+                 -MMD -MP
- BIN_CFLAGS    = -fPIE -DPIE
- LIB_CFLAGS    = -fPIC
- SHARED_FLAGS  = -shared
--LDFLAGS               = -Wl,-z,relro -Wl,-z,now
-+LDFLAGS               += -Wl,-z,relro -Wl,-z,now
- BIN_LDFLAGS   = -pie
- 
- # Check whether a function with name $1 has been declared in header file $2.

diff --git 
a/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-respect-sysroot.patch 
b/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-respect-sysroot.patch
deleted file mode 100644
index 66ac85e..0000000
--- a/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-respect-sysroot.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-diff --git a/Makefile.inc b/Makefile.inc
-index fc728ca..825166f 100644
---- a/Makefile.inc
-+++ b/Makefile.inc
-@@ -45,7 +45,8 @@ ifndef SYSTEMDPATH
-       SYSTEMDPATH=usr/lib
- endif
- 
--prefix                =
-+sysroot               ?=
-+prefix                ?=
- exec_prefix   = $(prefix)
- usr_prefix    = $(prefix)
- bindir                = $(exec_prefix)/sbin
-diff --git a/kpartx/Makefile b/kpartx/Makefile
-index 7eb467e..0a3827b 100644
---- a/kpartx/Makefile
-+++ b/kpartx/Makefile
-@@ -8,7 +8,7 @@ LDFLAGS += $(BIN_LDFLAGS)
- 
- LIBDEPS += -ldevmapper
- 
--ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
-+ifneq ($(call 
check_func,dm_task_set_cookie,$(sysroot)/usr/include/libdevmapper.h),0)
-       CFLAGS += -DLIBDM_API_COOKIE
- endif
- 
-diff --git a/libmultipath/Makefile b/libmultipath/Makefile
-index a2be42e..becaef3 100644
---- a/libmultipath/Makefile
-+++ b/libmultipath/Makefile
-@@ -20,19 +20,19 @@ ifdef SYSTEMD
-       endif
- endif
- 
--ifneq ($(call check_func,dm_task_no_flush,/usr/include/libdevmapper.h),0)
-+ifneq ($(call 
check_func,dm_task_no_flush,$(sysroot)/usr/include/libdevmapper.h),0)
-       CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
- endif
- 
--ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
-+ifneq ($(call 
check_func,dm_task_set_cookie,$(sysroot)/usr/include/libdevmapper.h),0)
-       CFLAGS += -DLIBDM_API_COOKIE
- endif
- 
--ifneq ($(call 
check_func,udev_monitor_set_receive_buffer_size,/usr/include/libudev.h),0)
-+ifneq ($(call 
check_func,udev_monitor_set_receive_buffer_size,$(sysroot)/usr/include/libudev.h),0)
-       CFLAGS += -DLIBUDEV_API_RECVBUF
- endif
- 
--ifneq ($(call 
check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0)
-+ifneq ($(call 
check_func,dm_task_deferred_remove,$(sysroot)/usr/include/libdevmapper.h),0)
-       CFLAGS += -DLIBDM_API_DEFERRED
- endif
- 

diff --git 
a/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-static-libs.patch 
b/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-static-libs.patch
deleted file mode 100644
index c29d8b6..0000000
--- a/patches/multipath-tools/0.8.0/multipath-tools-0.8.0-static-libs.patch
+++ /dev/null
@@ -1,159 +0,0 @@
-diff --git a/Makefile.inc b/Makefile.inc
-index 76c81fc..6f3bc6d 100644
---- a/Makefile.inc
-+++ b/Makefile.inc
-@@ -101,7 +101,7 @@ BIN_CFLAGS = -fPIE -DPIE
- LIB_CFLAGS    = -fPIC
- SHARED_FLAGS  = -shared
- LDFLAGS               += -Wl,-z,relro -Wl,-z,now
--BIN_LDFLAGS   = -pie
-+BIN_LDFLAGS   = -pie -static
- 
- # Check whether a function with name $1 has been declared in header file $2.
- check_func = $(shell \
-diff --git a/kpartx/Makefile b/kpartx/Makefile
-index 0a3827b..f26101d 100644
---- a/kpartx/Makefile
-+++ b/kpartx/Makefile
-@@ -6,7 +6,7 @@ include ../Makefile.inc
- CFLAGS += $(BIN_CFLAGS) -I. -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
- LDFLAGS += $(BIN_LDFLAGS)
- 
--LIBDEPS += -ldevmapper
-+LIBDEPS += -ldevmapper -lm -lpthread
- 
- ifneq ($(call 
check_func,dm_task_set_cookie,$(sysroot)/usr/include/libdevmapper.h),0)
-       CFLAGS += -DLIBDM_API_COOKIE
-diff --git a/libmpathcmd/Makefile b/libmpathcmd/Makefile
-index 0f6b816..2fb81e4 100644
---- a/libmpathcmd/Makefile
-+++ b/libmpathcmd/Makefile
-@@ -1,19 +1,23 @@
- include ../Makefile.inc
- 
-+LIBNAME = libmpathcmd
- SONAME = 0
--DEVLIB = libmpathcmd.so
-+DEVLIB = $(LIBNAME).so
- LIBS = $(DEVLIB).$(SONAME)
- 
- CFLAGS += $(LIB_CFLAGS)
- 
- OBJS = mpath_cmd.o
- 
--all: $(LIBS)
-+all: $(LIBS) $(LIBNAME).a
- 
- $(LIBS): $(OBJS)
-       $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
-       $(LN) $@ $(DEVLIB)
- 
-+$(LIBNAME).a: $(OBJS) $(LIBDEPS)
-+      $(AR) $(ARFLAGS) $@ $^
-+
- install: $(LIBS)
-       $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
-       $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
-diff --git a/libmpathpersist/Makefile b/libmpathpersist/Makefile
-index 21fdad8..647176f 100644
---- a/libmpathpersist/Makefile
-+++ b/libmpathpersist/Makefile
-@@ -6,7 +6,7 @@ LIBS = $(DEVLIB).$(SONAME)
- 
- CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) 
-I$(mpathcmddir)
- 
--LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
-+LIBDEPS += -lm -lpthread -ldevmapper -ldl -L$(multipathdir) -lmultipath \
-          -L$(mpathcmddir) -lmpathcmd
- 
- OBJS = mpath_persist.o mpath_updatepr.o mpath_pr_ioctl.o
-diff --git a/libmultipath/Makefile b/libmultipath/Makefile
-index becaef3..5d3a09c 100644
---- a/libmultipath/Makefile
-+++ b/libmultipath/Makefile
-@@ -3,13 +3,14 @@
- #
- include ../Makefile.inc
- 
-+LIBNAME = libmultipath
- SONAME = 0
--DEVLIB = libmultipath.so
-+DEVLIB = $(LIBNAME).so
- LIBS = $(DEVLIB).$(SONAME)
- 
- CFLAGS += $(LIB_CFLAGS) -I$(mpathcmddir) -I$(mpathpersistdir) -I$(nvmedir)
- 
--LIBDEPS += -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd 
-lurcu -laio
-+LIBDEPS += -lm -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd 
-lurcu -laio
- 
- ifdef SYSTEMD
-       CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
-@@ -45,7 +46,7 @@ OBJS = memory.o parser.o vector.o devmapper.o callout.o \
-       lock.o file.o wwids.o prioritizers/alua_rtpg.o prkey.o \
-       io_err_stat.o dm-generic.o generic.o foreign.o nvme-lib.o
- 
--all: $(LIBS)
-+all: $(LIBS) $(LIBNAME).a
- 
- nvme-lib.o: nvme-lib.c nvme-ioctl.c nvme-ioctl.h
-       $(CC) $(CFLAGS) -Wno-unused-function -c -o $@ $<
-@@ -62,6 +63,9 @@ $(LIBS): $(OBJS)
-       $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS)
-       $(LN) $@ $(DEVLIB)
- 
-+$(LIBNAME).a: $(OBJS)
-+      $(AR) $(ARFLAGS) $@ $^
-+
- install:
-       $(INSTALL_PROGRAM) -d $(DESTDIR)$(syslibdir)
-       $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
-diff --git a/libmultipath/log.c b/libmultipath/log.c
-index debd36d..03d54b5 100644
---- a/libmultipath/log.c
-+++ b/libmultipath/log.c
-@@ -91,7 +91,7 @@ void free_logarea (void)
-       return;
- }
- 
--void log_close (void)
-+void mpt_log_close (void)
- {
-       free_logarea();
-       closelog();
-diff --git a/libmultipath/log.h b/libmultipath/log.h
-index 6551b5c..f0ed15c 100644
---- a/libmultipath/log.h
-+++ b/libmultipath/log.h
-@@ -32,7 +32,7 @@ struct logarea {
- extern struct logarea* la;
- 
- int log_init (char * progname, int size);
--void log_close (void);
-+void mpt_log_close (void);
- void log_reset (char * progname);
- int log_enqueue (int prio, const char * fmt, va_list ap);
- int log_dequeue (void *);
-diff --git a/libmultipath/log_pthread.c b/libmultipath/log_pthread.c
-index be57bb1..10f7228 100644
---- a/libmultipath/log_pthread.c
-+++ b/libmultipath/log_pthread.c
-@@ -131,5 +131,5 @@ void log_thread_stop (void)
-       pthread_mutex_destroy(&logev_lock);
-       pthread_cond_destroy(&logev_cond);
- 
--      log_close();
-+      mpt_log_close();
- }
-diff --git a/multipath/Makefile b/multipath/Makefile
-index 0828a8f..8bd6ce4 100644
---- a/multipath/Makefile
-+++ b/multipath/Makefile
-@@ -6,7 +6,7 @@ include ../Makefile.inc
- CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir)
- LDFLAGS += $(BIN_LDFLAGS)
- LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathcmddir) -lmpathcmd \
--      -lpthread -ldevmapper -ldl -ludev
-+      -lpthread -ldevmapper -laio -ldl -ludev -lm
- 
- EXEC = multipath
- 

Reply via email to