From: Andrea Claudi <hidden> Date: 2021-10-05 22:09:56
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:
----------
v2 -> v3
- Fix parsing error on prefix and libdir options.
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
From: Andrea Claudi <hidden> Date: 2021-10-05 22:10:02
This commit makes it possible to specify values for configure params
using the common autotools configure syntax '--param=value'.
Signed-off-by: Andrea Claudi <redacted>
---
configure | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
From: Andrea Claudi <hidden> Date: 2021-10-05 22:10:04
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 <redacted>
---
configure | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
@@ -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
From: Andrea Claudi <hidden> Date: 2021-10-05 22:10:14
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 <redacted>
---
Makefile | 7 ++++---
configure | 22 ++++++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
@@ -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=*)+ LIBDIR="${1#*=}"+ if [ "$LIBDIR" == "--libdir" ]; then+ LIBDIR="$2"+ shift+ fi+ shift ;; --libbpf_dir | --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
@@ -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_dir=*)
So here the code combines the two cases,
+ INCLUDE="${1#*=}"
+ if [ "$INCLUDE" == "--include_dir" ]; then
just to fiddle it apart again. Did you consider leaving the old cases in
place and adding separate ones for the --opt=val cases like so:
| --include_dir=*)
| INCLUDE="${1#*=}"
| shift
| ;;
[...]
+ --libbpf_force | --libbpf_force=*)
+ LIBBPF_FORCE="${1#*=}"
+ if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then
+ LIBBPF_FORCE="$2"
+ shift
+ fi
+ if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then
To avoid duplication here, I would move semantic checks into a second
step. This would allow for things like:
| --libbpf_force=invalid --libbpf_force=on
but separating the syntactic parsing from semantic checks might be
beneficial by itself, too.
Cheers, Phil
@@ -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_dir=*)
So here the code combines the two cases,
quoted
+ INCLUDE="${1#*=}"
+ if [ "$INCLUDE" == "--include_dir" ]; then
just to fiddle it apart again. Did you consider leaving the old cases in
place and adding separate ones for the --opt=val cases like so:
| --include_dir=*)
| INCLUDE="${1#*=}"
| shift
| ;;
[...]
That was my first proposal in v1 [1]. I changed it on David's suggestion
to consolidate the two cases into a single one.
Looking at the resulting code, v3 code results in an extra check to
discriminate between the two use cases, while v0 uses the "case"
structure to the same end.
quoted
+ --libbpf_force | --libbpf_force=*)
+ LIBBPF_FORCE="${1#*=}"
+ if [ "$LIBBPF_FORCE" == "--libbpf_force" ]; then
+ LIBBPF_FORCE="$2"
+ shift
+ fi
+ if [ "$LIBBPF_FORCE" != 'on' ] && [ "$LIBBPF_FORCE" != 'off' ]; then
To avoid duplication here, I would move semantic checks into a second
step. This would allow for things like:
| --libbpf_force=invalid --libbpf_force=on
but separating the syntactic parsing from semantic checks might be
beneficial by itself, too.
Yes, I agree with you. David, does this answer to your concern about v1?
If yes, I would proceed with a v4 integrating Phil's suggestions.
From: Phil Sutter <phil@nwl.cc> Date: 2021-10-06 10:19:07
Hi Andrea,
On Wed, Oct 06, 2021 at 11:49:34AM +0200, Andrea Claudi wrote:
[...]
That was my first proposal in v1 [1]. I changed it on David's suggestion
to consolidate the two cases into a single one.
Oh, sorry. I missed the 'v3' tag and hence didn't check any earlier
version.
Looking at the resulting code, v3 code results in an extra check to
discriminate between the two use cases, while v0 uses the "case"
structure to the same end.
Given that David explicitly requested the change I'm complaining about
in his reply to your initial version, I guess any further debate about
it is irrelevant.
Thanks, Phil
From: David Ahern <hidden> Date: 2021-10-06 14:27:55
On 10/6/21 4:18 AM, Phil Sutter wrote:
Hi Andrea,
On Wed, Oct 06, 2021 at 11:49:34AM +0200, Andrea Claudi wrote:
[...]
quoted
That was my first proposal in v1 [1]. I changed it on David's suggestion
to consolidate the two cases into a single one.
Oh, sorry. I missed the 'v3' tag and hence didn't check any earlier
version.
quoted
Looking at the resulting code, v3 code results in an extra check to
discriminate between the two use cases, while v0 uses the "case"
structure to the same end.
Given that David explicitly requested the change I'm complaining about
in his reply to your initial version, I guess any further debate about
it is irrelevant.
I did not like the exploding duplication of checks on the value just to
support '=' in the command line.
Phil's suggestion seems reasonable.