@@ -1,6 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
# Top level Makefile for iproute2
+-include config.mk
+
ifeq ("$(origin V)", "command line")
VERBOSE = $(V)
endif
@@ -13,7 +15,6 @@ MAKEFLAGS += --no-print-directory
endif
PREFIX?=/usr
-LIBDIR?=$(PREFIX)/lib
SBINDIR?=/sbin
CONFDIR?=/etc/iproute2
NETNS_RUN_DIR?=/var/run/netns
@@ -60,7 +61,7 @@ SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa
LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a
LDLIBS += $(LIBNETLINK)
-all: config
+all: config.mk
@set -e; \
for i in $(SUBDIRS); \
do echo; echo $$i; $(MAKE) -C $$i; done
@@ -80,7 +81,7 @@ help:
@echo "Make Arguments:"
@echo " V=[0|1] - set build verbosity level"
-config:
+config.mk:
@if [ ! -f config.mk -o configure -nt config.mk ]; then \
sh configure $(KERNEL_INCLUDE); \
fi
@@ -157,6 +157,19 @@ check_prefix()
fi
}
+check_lib_dir()
+{
+ echo -n "lib directory: "
+ if [ -n "$LIBDIR" ]; then
+ eval echo "$LIBDIR"
+ eval echo "LIBDIR:=$LIBDIR" >> $CONFIG
+ return
+ fi
+
+ eval echo "${prefix}/lib"
+ eval echo "LIBDIR:=${prefix}/lib" >> $CONFIG
+}
+
check_ipt()
{
if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
@@ -495,6 +508,7 @@ usage()
cat <<EOF
Usage: $0 [OPTIONS]
--include_dir Path to iproute2 include dir
+ --libdir Path to iproute2 lib dir
--libbpf_dir Path to libbpf DESTDIR
--libbpf_force Enable/disable libbpf by force. Available options:
on: require link against libbpf, quit config if no libbpf support
@@ -518,6 +532,13 @@ else
shift
fi
shift ;;
+ --libdir*)
+ LIBDIR="${1#*=}"
+ if [ "$LIBDIR" == "--libdir" ]; then
+ LIBDIR="$2"
+ shift
+ fi
+ shift ;;
--libbpf_dir*)
LIBBPF_DIR="${1#*=}"
if [ "$LIBBPF_DIR" == "--libbpf_dir" ]; then
@@ -576,6 +597,7 @@ fi
echo
check_prefix
+check_lib_dir
if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
echo -n "iptables modules directory: "
check_ipt_lib_dir
This commit allows users/packagers to choose a lib directory to store iproute2 lib files. At the moment iproute2 ship lib files in /usr/lib and offers no way to modify this setting. However, according to the FHS, distros may choose "one or more variants of the /lib directory on systems which support more than one binary format" (e.g. /usr/lib64 on Fedora). As Luca states in commit a3272b93725a ("configure: restore backward compatibility"), packaging systems may assume that 'configure' is from autotools, and try to pass it some parameters. Allowing the '--libdir=/path/to/libdir' syntax, we can use this to our advantage, and let the lib directory to be chosen by the distro packaging system. Signed-off-by: Andrea Claudi <aclaudi@redhat.com> --- Makefile | 7 ++++--- configure | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-)