All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 iproute2] configure: add support for libdir param
@ 2021-10-02 16:41 Andrea Claudi
  2021-10-02 16:41 ` [PATCH 1/2 iproute2] configure: support --param=value style Andrea Claudi
  2021-10-02 16:41 ` [PATCH 2/2 iproute2] configure: add the --libdir param Andrea Claudi
  0 siblings, 2 replies; 6+ messages in thread
From: Andrea Claudi @ 2021-10-02 16:41 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.

The first patch introduce support for the --param=value style on current
params, for uniformity.

The second patch add support for the libdir param to the configure, and
also drops the static LIBDIR var from the Makefile.

Andrea Claudi (2):
  configure: support --param=value style
  configure: add the --libdir param

 Makefile  |  7 ++++---
 configure | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 3 deletions(-)

-- 
2.31.1


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

* [PATCH 1/2 iproute2] configure: support --param=value style
  2021-10-02 16:41 [PATCH 0/2 iproute2] configure: add support for libdir param Andrea Claudi
@ 2021-10-02 16:41 ` Andrea Claudi
  2021-10-04  1:28   ` David Ahern
  2021-10-02 16:41 ` [PATCH 2/2 iproute2] configure: add the --libdir param Andrea Claudi
  1 sibling, 1 reply; 6+ messages in thread
From: Andrea Claudi @ 2021-10-02 16:41 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 | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure b/configure
index 7f4f3bd9..f0c81ee1 100755
--- a/configure
+++ b/configure
@@ -504,15 +504,28 @@ else
 			--include_dir)
 				INCLUDE=$2
 				shift 2 ;;
+			--include_dir=*)
+				INCLUDE="${1#*=}"
+				shift ;;
 			--libbpf_dir)
 				LIBBPF_DIR="$2"
 				shift 2 ;;
+			--libbpf_dir=*)
+				LIBBPF_DIR="${1#*=}"
+				shift ;;
 			--libbpf_force)
 				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
 					usage 1
 				fi
 				LIBBPF_FORCE=$2
 				shift 2 ;;
+			--libbpf_force=*)
+				libbpf_f="${1#*=}"
+				if [ "$libbpf_f" != 'on' ] && [ "$libbpf_f" != 'off' ]; then
+					usage 1
+				fi
+				LIBBPF_FORCE="$libbpf_f"
+				shift ;;
 			-h | --help)
 				usage 0 ;;
 			"")
-- 
2.31.1


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

* [PATCH 2/2 iproute2] configure: add the --libdir param
  2021-10-02 16:41 [PATCH 0/2 iproute2] configure: add support for libdir param Andrea Claudi
  2021-10-02 16:41 ` [PATCH 1/2 iproute2] configure: support --param=value style Andrea Claudi
@ 2021-10-02 16:41 ` Andrea Claudi
  2021-10-04 11:52   ` Luca Boccassi
  1 sibling, 1 reply; 6+ messages in thread
From: Andrea Claudi @ 2021-10-02 16:41 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 | 21 +++++++++++++++++++++
 2 files changed, 25 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 f0c81ee1..a1b0261a 100755
--- a/configure
+++ b/configure
@@ -148,6 +148,19 @@ EOF
 	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
 }
 
+check_lib_dir()
+{
+	echo -n "lib directory: "
+	if [ -n "$LIB_DIR" ]; then
+		echo "$LIB_DIR"
+		echo "LIBDIR:=$LIB_DIR" >> $CONFIG
+		return
+	fi
+
+	echo "/usr/lib"
+	echo "LIBDIR:=/usr/lib" >> $CONFIG
+}
+
 check_ipt()
 {
 	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
@@ -486,6 +499,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
@@ -507,6 +521,12 @@ else
 			--include_dir=*)
 				INCLUDE="${1#*=}"
 				shift ;;
+			--libdir)
+				LIB_DIR="$2"
+				shift 2 ;;
+			--libdir=*)
+				LIB_DIR="${1#*=}"
+				shift ;;
 			--libbpf_dir)
 				LIBBPF_DIR="$2"
 				shift 2 ;;
@@ -559,6 +579,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
 fi
 
 echo
+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 1/2 iproute2] configure: support --param=value style
  2021-10-02 16:41 ` [PATCH 1/2 iproute2] configure: support --param=value style Andrea Claudi
@ 2021-10-04  1:28   ` David Ahern
  0 siblings, 0 replies; 6+ messages in thread
From: David Ahern @ 2021-10-04  1:28 UTC (permalink / raw)
  To: Andrea Claudi, netdev; +Cc: stephen, bluca

On 10/2/21 10:41 AM, Andrea Claudi wrote:
> diff --git a/configure b/configure
> index 7f4f3bd9..f0c81ee1 100755
> --- a/configure
> +++ b/configure
> @@ -504,15 +504,28 @@ else
>  			--include_dir)
>  				INCLUDE=$2
>  				shift 2 ;;
> +			--include_dir=*)
> +				INCLUDE="${1#*=}"
> +				shift ;;
>  			--libbpf_dir)
>  				LIBBPF_DIR="$2"
>  				shift 2 ;;
> +			--libbpf_dir=*)
> +				LIBBPF_DIR="${1#*=}"
> +				shift ;;

We should be able to consolidate these into 1 case like:

			--libbpf_dir|--libbpf_dir=)

and then handle the difference in argument style. e.g.,

			LIBBPF_FORCE="${1#*=}"
			if [ -z "${LIBBPF_FORCE}" ]; then
				LIBBPF_FORCE=$2
				shift
			fi

			....


>  			--libbpf_force)
>  				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
>  					usage 1
>  				fi
>  				LIBBPF_FORCE=$2
>  				shift 2 ;;
> +			--libbpf_force=*)
> +				libbpf_f="${1#*=}"
> +				if [ "$libbpf_f" != 'on' ] && [ "$libbpf_f" != 'off' ]; then
> +					usage 1
> +				fi
> +				LIBBPF_FORCE="$libbpf_f"
> +				shift ;;
>  			-h | --help)
>  				usage 0 ;;
>  			"")
> 


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

* Re: [PATCH 2/2 iproute2] configure: add the --libdir param
  2021-10-02 16:41 ` [PATCH 2/2 iproute2] configure: add the --libdir param Andrea Claudi
@ 2021-10-04 11:52   ` Luca Boccassi
  2021-10-04 12:45     ` Andrea Claudi
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Boccassi @ 2021-10-04 11:52 UTC (permalink / raw)
  To: Andrea Claudi, netdev; +Cc: stephen, dsahern

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

On Sat, 2021-10-02 at 18:41 +0200, Andrea Claudi wrote:
> 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 | 21 +++++++++++++++++++++
>  2 files changed, 25 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 f0c81ee1..a1b0261a 100755
> --- a/configure
> +++ b/configure
> @@ -148,6 +148,19 @@ EOF
>  	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
>  }
>  
> 
> +check_lib_dir()
> +{
> +	echo -n "lib directory: "
> +	if [ -n "$LIB_DIR" ]; then
> +		echo "$LIB_DIR"
> +		echo "LIBDIR:=$LIB_DIR" >> $CONFIG
> +		return
> +	fi
> +
> +	echo "/usr/lib"
> +	echo "LIBDIR:=/usr/lib" >> $CONFIG
> +}
> +
>  check_ipt()
>  {
>  	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
> @@ -486,6 +499,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
> @@ -507,6 +521,12 @@ else
>  			--include_dir=*)
>  				INCLUDE="${1#*=}"
>  				shift ;;
> +			--libdir)
> +				LIB_DIR="$2"
> +				shift 2 ;;
> +			--libdir=*)
> +				LIB_DIR="${1#*=}"
> +				shift ;;
>  			--libbpf_dir)
>  				LIBBPF_DIR="$2"
>  				shift 2 ;;
> @@ -559,6 +579,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
>  fi
>  
> 
>  echo
> +check_lib_dir
>  if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
>  	echo -n "iptables modules directory: "
>  	check_ipt_lib_dir

	./configure --build=x86_64-linux-gnu --prefix=/usr --
includedir=\${prefix}/include --mandir=\${prefix}/share/man --
infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --
disable-option-checking --disable-silent-rules --
libdir=\${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-
maintainer-mode --disable-dependency-tracking
TC schedulers
 ATM	yes
 IPT	using xtables
 IPSET  yes

lib directory: ${prefix}/lib/x86_64-linux-gnu


But you end up with:

/lib/x86_64-linux-gnu/tc

/usr disappears somewhere?

-- 
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 2/2 iproute2] configure: add the --libdir param
  2021-10-04 11:52   ` Luca Boccassi
@ 2021-10-04 12:45     ` Andrea Claudi
  0 siblings, 0 replies; 6+ messages in thread
From: Andrea Claudi @ 2021-10-04 12:45 UTC (permalink / raw)
  To: Luca Boccassi; +Cc: netdev, stephen, dsahern

On Mon, Oct 04, 2021 at 12:52:35PM +0100, Luca Boccassi wrote:
> On Sat, 2021-10-02 at 18:41 +0200, Andrea Claudi wrote:
> > 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 | 21 +++++++++++++++++++++
> >  2 files changed, 25 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 f0c81ee1..a1b0261a 100755
> > --- a/configure
> > +++ b/configure
> > @@ -148,6 +148,19 @@ EOF
> >  	rm -f $TMPDIR/ipttest.c $TMPDIR/ipttest
> >  }
> >  
> > 
> > +check_lib_dir()
> > +{
> > +	echo -n "lib directory: "
> > +	if [ -n "$LIB_DIR" ]; then
> > +		echo "$LIB_DIR"
> > +		echo "LIBDIR:=$LIB_DIR" >> $CONFIG
> > +		return
> > +	fi
> > +
> > +	echo "/usr/lib"
> > +	echo "LIBDIR:=/usr/lib" >> $CONFIG
> > +}
> > +
> >  check_ipt()
> >  {
> >  	if ! grep TC_CONFIG_XT $CONFIG > /dev/null; then
> > @@ -486,6 +499,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
> > @@ -507,6 +521,12 @@ else
> >  			--include_dir=*)
> >  				INCLUDE="${1#*=}"
> >  				shift ;;
> > +			--libdir)
> > +				LIB_DIR="$2"
> > +				shift 2 ;;
> > +			--libdir=*)
> > +				LIB_DIR="${1#*=}"
> > +				shift ;;
> >  			--libbpf_dir)
> >  				LIBBPF_DIR="$2"
> >  				shift 2 ;;
> > @@ -559,6 +579,7 @@ if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
> >  fi
> >  
> > 
> >  echo
> > +check_lib_dir
> >  if ! grep -q TC_CONFIG_NO_XT $CONFIG; then
> >  	echo -n "iptables modules directory: "
> >  	check_ipt_lib_dir
> 
> 	./configure --build=x86_64-linux-gnu --prefix=/usr --
> includedir=\${prefix}/include --mandir=\${prefix}/share/man --
> infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --
> disable-option-checking --disable-silent-rules --
> libdir=\${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-
> maintainer-mode --disable-dependency-tracking
> TC schedulers
>  ATM	yes
>  IPT	using xtables
>  IPSET  yes
> 
> lib directory: ${prefix}/lib/x86_64-linux-gnu
> 
> 
> But you end up with:
> 
> /lib/x86_64-linux-gnu/tc
> 
> /usr disappears somewhere?
>

Hi Luca,
and thanks for your review.

This is probably because my patch does not manage the --prefix option I
see in your command line. I'll fix this in v2.

Regards,
Andrea


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

end of thread, other threads:[~2021-10-04 12:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 16:41 [PATCH 0/2 iproute2] configure: add support for libdir param Andrea Claudi
2021-10-02 16:41 ` [PATCH 1/2 iproute2] configure: support --param=value style Andrea Claudi
2021-10-04  1:28   ` David Ahern
2021-10-02 16:41 ` [PATCH 2/2 iproute2] configure: add the --libdir param Andrea Claudi
2021-10-04 11:52   ` Luca Boccassi
2021-10-04 12:45     ` Andrea Claudi

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.