netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next 0/2] configure: convert global env to command-line options
@ 2021-05-31  9:47 Hangbin Liu
  2021-05-31  9:47 ` [PATCH iproute2-next 1/2] configure: add options ability Hangbin Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-05-31  9:47 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev, Hangbin Liu


This path set converts the global environment to command-line options
to make it easier for users to learn or remember the config options.

I only convert environment INCLUDE, LIBBPF_DIR, LIBBPF_FORCE at first.
The IPTC and IPTL are not converted as I don't know what they stand for.

Hangbin Liu (2):
  configure: add options ability
  configure: convert LIBBPF environment variables to command-line
    options

 configure | 49 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 6 deletions(-)

-- 
2.26.3


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

* [PATCH iproute2-next 1/2] configure: add options ability
  2021-05-31  9:47 [PATCH iproute2-next 0/2] configure: convert global env to command-line options Hangbin Liu
@ 2021-05-31  9:47 ` Hangbin Liu
  2021-05-31  9:47 ` [PATCH iproute2-next 2/2] configure: convert LIBBPF environment variables to command-line options Hangbin Liu
  2021-06-03  3:28 ` [PATCH iproute2-next 0/2] configure: convert global env " David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-05-31  9:47 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev, Hangbin Liu

There are more and more global environment variables that land everywhere
in configure, which is making user hard to know which one does what.
Using command-line options would make it easier for users to learn or
remember the config options.

This patch converts the INCLUDE variable to command option first. Check
if the first variable has '-' to compile with the old INCLUDE path
setting method.

Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
 configure | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 179eae08..c58419c2 100755
--- a/configure
+++ b/configure
@@ -7,7 +7,7 @@
 #                           off: disable libbpf probing
 #   LIBBPF_DIR              Path to libbpf DESTDIR to use
 
-INCLUDE=${1:-"$PWD/include"}
+INCLUDE="$PWD/include"
 
 # Output file which is input to Makefile
 CONFIG=config.mk
@@ -486,6 +486,35 @@ endif
 EOF
 }
 
+usage()
+{
+	cat <<EOF
+Usage: $0 [OPTIONS]
+	--include_dir		Path to iproute2 include dir
+	-h | --help		Show this usage info
+EOF
+	exit $1
+}
+
+# Compat with the old INCLUDE path setting method.
+if [ $# -eq 1 ] && [ "$(echo $1 | cut -c 1)" != '-' ]; then
+	INCLUDE="$1"
+else
+	while true; do
+		case "$1" in
+			--include_dir)
+				INCLUDE=$2
+				shift 2 ;;
+			-h | --help)
+				usage 0 ;;
+			"")
+				break ;;
+			*)
+				usage 1 ;;
+		esac
+	done
+fi
+
 echo "# Generated config based on" $INCLUDE >$CONFIG
 quiet_config >> $CONFIG
 
-- 
2.26.3


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

* [PATCH iproute2-next 2/2] configure: convert LIBBPF environment variables to command-line options
  2021-05-31  9:47 [PATCH iproute2-next 0/2] configure: convert global env to command-line options Hangbin Liu
  2021-05-31  9:47 ` [PATCH iproute2-next 1/2] configure: add options ability Hangbin Liu
@ 2021-05-31  9:47 ` Hangbin Liu
  2021-06-03  3:28 ` [PATCH iproute2-next 0/2] configure: convert global env " David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: Hangbin Liu @ 2021-05-31  9:47 UTC (permalink / raw)
  To: David Ahern; +Cc: Stephen Hemminger, netdev, Hangbin Liu

Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
 configure | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index c58419c2..0a4a0fc9 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # This is not an autoconf generated configure
-#
-# Influential LIBBPF environment variables:
-#   LIBBPF_FORCE={on,off}   on: require link against libbpf;
-#                           off: disable libbpf probing
-#   LIBBPF_DIR              Path to libbpf DESTDIR to use
 
 INCLUDE="$PWD/include"
 
@@ -491,6 +486,10 @@ usage()
 	cat <<EOF
 Usage: $0 [OPTIONS]
 	--include_dir		Path to iproute2 include 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
+				  off: disable libbpf probing
 	-h | --help		Show this usage info
 EOF
 	exit $1
@@ -505,6 +504,15 @@ else
 			--include_dir)
 				INCLUDE=$2
 				shift 2 ;;
+			--libbpf_dir)
+				LIBBPF_DIR="$2"
+				shift 2 ;;
+			--libbpf_force)
+				if [ "$2" != 'on' ] && [ "$2" != 'off' ]; then
+					usage 1
+				fi
+				LIBBPF_FORCE=$2
+				shift 2 ;;
 			-h | --help)
 				usage 0 ;;
 			"")
-- 
2.26.3


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

* Re: [PATCH iproute2-next 0/2] configure: convert global env to command-line options
  2021-05-31  9:47 [PATCH iproute2-next 0/2] configure: convert global env to command-line options Hangbin Liu
  2021-05-31  9:47 ` [PATCH iproute2-next 1/2] configure: add options ability Hangbin Liu
  2021-05-31  9:47 ` [PATCH iproute2-next 2/2] configure: convert LIBBPF environment variables to command-line options Hangbin Liu
@ 2021-06-03  3:28 ` David Ahern
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2021-06-03  3:28 UTC (permalink / raw)
  To: Hangbin Liu; +Cc: Stephen Hemminger, netdev

On 5/31/21 3:47 AM, Hangbin Liu wrote:
> 
> This path set converts the global environment to command-line options
> to make it easier for users to learn or remember the config options.
> 
> I only convert environment INCLUDE, LIBBPF_DIR, LIBBPF_FORCE at first.
> The IPTC and IPTL are not converted as I don't know what they stand for.
> 
> Hangbin Liu (2):
>   configure: add options ability
>   configure: convert LIBBPF environment variables to command-line
>     options
> 
>  configure | 49 +++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 43 insertions(+), 6 deletions(-)
> 

applied to iproute2-next. Thanks,

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

end of thread, other threads:[~2021-06-03  3:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31  9:47 [PATCH iproute2-next 0/2] configure: convert global env to command-line options Hangbin Liu
2021-05-31  9:47 ` [PATCH iproute2-next 1/2] configure: add options ability Hangbin Liu
2021-05-31  9:47 ` [PATCH iproute2-next 2/2] configure: convert LIBBPF environment variables to command-line options Hangbin Liu
2021-06-03  3:28 ` [PATCH iproute2-next 0/2] configure: convert global env " David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).