All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 v2 0/3] configure: add support for libdir and
@ 2021-10-04 19:50 Andrea Claudi
  2021-10-04 19:50 ` [PATCH iproute2 v2 1/3] configure: support --param=value style Andrea Claudi
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Andrea Claudi @ 2021-10-04 19:50 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, bluca

This series add support for the libdir parameter in iproute2 configure
system. The idea is to make use of the fact that packaging systems may
assume that 'configure' comes from autotools allowing a syntax similar
to the autotools one, and using it to tell iproute2 where the distro
expects to find its lib files.

Patch 1 introduces support for the --param=value style on current
params, for uniformity.

Patch 2 add the --prefix option, that may be used by some packaging
systems when calling the configure script.

Patch 3 add the --libdir option to the configure script, and also drops
the static LIBDIR var from the Makefile.

Changelog:
----------
v1 -> v2
  - consolidate '--param value' and '--param=value' use cases, as
    suggested by David Ahern.
  - Added patch 2 to manage the --prefix option, used by the Debian
    packaging system, as reported by Luca Boccassi, and use it when
    setting lib directory.

Andrea Claudi (3):
  configure: support --param=value style
  configure: add the --prefix option
  configure: add the --libdir option

 Makefile  |  7 +++---
 configure | 72 +++++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 66 insertions(+), 13 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH iproute2 v2 1/3] configure: support --param=value style
  2021-10-04 19:50 [PATCH iproute2 v2 0/3] configure: add support for libdir and Andrea Claudi
@ 2021-10-04 19:50 ` Andrea Claudi
  2021-10-05 13:54   ` David Ahern
  2021-10-04 19:50 ` [PATCH iproute2 v2 2/3] configure: add the --prefix option Andrea Claudi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Andrea Claudi @ 2021-10-04 19:50 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, bluca

This commit makes it possible to specify values for configure params
using the common autotools configure syntax '--param=value'.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 configure | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 7f4f3bd9..cebfda6e 100755
--- a/configure
+++ b/configure
@@ -501,18 +501,30 @@ if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
 else
 	while true; do
 		case "$1" in
-			--include_dir)
-				INCLUDE=$2
-				shift 2 ;;
-			--libbpf_dir)
-				LIBBPF_DIR="$2"
-				shift 2 ;;
-			--libbpf_force)
-				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
+			--include_dir*)
+				INCLUDE="${1#*=}"
+				if [ "$INCLUDE" == "--include_dir" ]; then
+					INCLUDE=$2
+					shift
+				fi
+				shift ;;
+			--libbpf_dir*)
+				LIBBPF_DIR="${1#*=}"
+				if [ "$LIBBPF_DIR" == "--libbpf_dir" ]; then
+					LIBBPF_DIR="$2"
+					shift
+				fi
+				shift ;;
+			--libbpf_force*)
+				LIBBPF_FORCE="${1#*=}"
+				if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then
+					LIBBPF_FORCE="$2"
+					shift
+				fi
+				if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then
 					usage 1
 				fi
-				LIBBPF_FORCE=$2
-				shift 2 ;;
+				shift ;;
 			-h | --help)
 				usage 0 ;;
 			"")
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH iproute2 v2 2/3] configure: add the --prefix option
  2021-10-04 19:50 [PATCH iproute2 v2 0/3] configure: add support for libdir and Andrea Claudi
  2021-10-04 19:50 ` [PATCH iproute2 v2 1/3] configure: support --param=value style Andrea Claudi
@ 2021-10-04 19:50 ` Andrea Claudi
  2021-10-04 19:50 ` [PATCH iproute2 v2 3/3] configure: add the --libdir option Andrea Claudi
  2021-10-05 10:14 ` [PATCH iproute2 v2 0/3] configure: add support for libdir and Luca Boccassi
  3 siblings, 0 replies; 6+ messages in thread
From: Andrea Claudi @ 2021-10-04 19:50 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, bluca

This commit add the '--prefix' option to the iproute2 configure script.

This mimics the '--prefix' option that autotools configure provides, and
will be used later to allow users or packagers to set the lib directory.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 configure | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/configure b/configure
index cebfda6e..f51247a8 100755
--- a/configure
+++ b/configure
@@ -148,6 +148,15 @@ EOF
 	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
 }
 
+check_prefix()
+{
+	if [ -n "$PREFIX" ]; then
+		prefix="$PREFIX"
+	else
+		prefix="/usr"
+	fi
+}
+
 check_ipt()
 {
 	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
@@ -490,6 +499,7 @@ Usage: $0 [OPTIONS]
 	--libbpf_force		Enable/disable libbpf by force. Available options:
 				  on: require link against libbpf, quit config if no libbpf support
 				  off: disable libbpf probing
+	--prefix		Path prefix of the lib files to install
 	-h | --help		Show this usage info
 EOF
 	exit $1
@@ -525,6 +535,13 @@ else
 					usage 1
 				fi
 				shift ;;
+			--prefix*)
+				PREFIX="${1#*=}"
+				if [ "$PREFIX" == "--prefix" ]; then
+					PREFIX="$2"
+					shift
+				fi
+				shift ;;
 			-h | --help)
 				usage 0 ;;
 			"")
@@ -558,6 +575,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 fi
 
 echo
+check_prefix
 if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 	echo -n "iptables modules directory: "
 	check_ipt_lib_dir
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH iproute2 v2 3/3] configure: add the --libdir option
  2021-10-04 19:50 [PATCH iproute2 v2 0/3] configure: add support for libdir and Andrea Claudi
  2021-10-04 19:50 ` [PATCH iproute2 v2 1/3] configure: support --param=value style Andrea Claudi
  2021-10-04 19:50 ` [PATCH iproute2 v2 2/3] configure: add the --prefix option Andrea Claudi
@ 2021-10-04 19:50 ` Andrea Claudi
  2021-10-05 10:14 ` [PATCH iproute2 v2 0/3] configure: add support for libdir and Luca Boccassi
  3 siblings, 0 replies; 6+ messages in thread
From: Andrea Claudi @ 2021-10-04 19:50 UTC (permalink / raw)
  To: netdev; +Cc: stephen, dsahern, bluca

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(-)

diff --git a/Makefile b/Makefile
index 5bc11477..45655ca4 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/configure b/configure
index f51247a8..38a81405 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2 v2 0/3] configure: add support for libdir and
  2021-10-04 19:50 [PATCH iproute2 v2 0/3] configure: add support for libdir and Andrea Claudi
                   ` (2 preceding siblings ...)
  2021-10-04 19:50 ` [PATCH iproute2 v2 3/3] configure: add the --libdir option Andrea Claudi
@ 2021-10-05 10:14 ` Luca Boccassi
  3 siblings, 0 replies; 6+ messages in thread
From: Luca Boccassi @ 2021-10-05 10:14 UTC (permalink / raw)
  To: Andrea Claudi, netdev; +Cc: stephen, dsahern

[-- Attachment #1: Type: text/plain, Size: 1473 bytes --]

On Mon, 2021-10-04 at 21:50 +0200, Andrea Claudi wrote:
> This series add support for the libdir parameter in iproute2 configure
> system. The idea is to make use of the fact that packaging systems may
> assume that 'configure' comes from autotools allowing a syntax similar
> to the autotools one, and using it to tell iproute2 where the distro
> expects to find its lib files.
> 
> Patch 1 introduces support for the --param=value style on current
> params, for uniformity.
> 
> Patch 2 add the --prefix option, that may be used by some packaging
> systems when calling the configure script.
> 
> Patch 3 add the --libdir option to the configure script, and also drops
> the static LIBDIR var from the Makefile.
> 
> Changelog:
> ----------
> v1 -> v2
>   - consolidate '--param value' and '--param=value' use cases, as
>     suggested by David Ahern.
>   - Added patch 2 to manage the --prefix option, used by the Debian
>     packaging system, as reported by Luca Boccassi, and use it when
>     setting lib directory.
> 
> Andrea Claudi (3):
>   configure: support --param=value style
>   configure: add the --prefix option
>   configure: add the --libdir option
> 
>  Makefile  |  7 +++---
>  configure | 72 +++++++++++++++++++++++++++++++++++++++++++++++--------
>  2 files changed, 66 insertions(+), 13 deletions(-)

Series-tested-by: Luca Boccassi <bluca@debian.org>

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2 v2 1/3] configure: support --param=value style
  2021-10-04 19:50 ` [PATCH iproute2 v2 1/3] configure: support --param=value style Andrea Claudi
@ 2021-10-05 13:54   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2021-10-05 13:54 UTC (permalink / raw)
  To: Andrea Claudi, netdev; +Cc: stephen, bluca

On 10/4/21 1:50 PM, Andrea Claudi wrote:
> diff --git a/configure b/configure
> index 7f4f3bd9..cebfda6e 100755
> --- a/configure
> +++ b/configure
> @@ -501,18 +501,30 @@ if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
>  else
>  	while true; do
>  		case "$1" in
> -			--include_dir)
> -				INCLUDE=$2
> -				shift 2 ;;
> -			--libbpf_dir)
> -				LIBBPF_DIR="$2"
> -				shift 2 ;;
> -			--libbpf_force)
> -				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
> +			--include_dir*)

this is going to match a lot more than just --include_dir and --include_dir=



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-05 14:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-04 19:50 [PATCH iproute2 v2 0/3] configure: add support for libdir and Andrea Claudi
2021-10-04 19:50 ` [PATCH iproute2 v2 1/3] configure: support --param=value style Andrea Claudi
2021-10-05 13:54   ` David Ahern
2021-10-04 19:50 ` [PATCH iproute2 v2 2/3] configure: add the --prefix option Andrea Claudi
2021-10-04 19:50 ` [PATCH iproute2 v2 3/3] configure: add the --libdir option Andrea Claudi
2021-10-05 10:14 ` [PATCH iproute2 v2 0/3] configure: add support for libdir and Luca Boccassi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.