netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Andrea Claudi <aclaudi@redhat.com>
Cc: netdev@vger.kernel.org, stephen@networkplumber.org,
	dsahern@gmail.com, bluca@debian.org, haliu@redhat.com
Subject: Re: [PATCH iproute2 v4 0/5] configure: add support for libdir and prefix option
Date: Thu, 7 Oct 2021 18:02:02 +0200	[thread overview]
Message-ID: <20211007160202.GG32194@orbyte.nwl.cc> (raw)
In-Reply-To: <cover.1633612111.git.aclaudi@redhat.com>

Hi Andrea,

On Thu, Oct 07, 2021 at 03:40:00PM +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.
> 
> Patches 1-2 fix a parsing issue on current configure options, that may
> trigger an endless loop when no value is provided with some options;

Hmm, "shift 2" is nasty. Good to be reminded that it fails if '$# < 2'.
I would avoid the loop using single shifts:

| case "$1" in
| --include_dir)
| 	shift
| 	INCLUDE=$1
| 	shift
| 	;;
| [...]

> Patch 3 introduces support for the --opt=value style on current options,
> for uniformity;

My idea to avoid code duplication was to move the semantic checks out of
the argument parsing loop, basically:

| [ -d "$INCLUDE" ] || usage 1
| case "$LIBBPF_FORCE" in
| 	on|off|"") ;;
| 	*) usage 1 ;;
| esac

after the loop or even before 'echo "# Generated config ...'. This
reduces the parsing loop to cases like:

| --include_dir)
| 	shift
| 	INCLUDE=$1
| 	shift
| 	;;
| --include_dir=*)
| 	INCLUDE=${1#*=}
| 	shift
| 	;;

> Patch 4 add the --prefix option, that may be used by some packaging
> systems when calling the configure script;

So this parses into $PREFIX and when checking it assigns to $prefix but
neither one of the two variables is used afterwards? Oh, there's patch
5 ...

> Patch 5 add the --libdir option, and also drops the static LIBDIR var
> from the Makefile

Can't you just:

| [ -n "$PREFIX" ] && echo "PREFIX=\"$PREFIX\"" >>config.mk
| [ -n "$LIBDIR" ] && echo "LIBDIR=\"$LIBDIR\"" >>config.mk

and leave the default ("?=") cases in Makefile in place?

Either way, calling 'eval' seems needless. I would avoid it at all
costs, "eval is evil". ;)

Cheers, Phil

  parent reply	other threads:[~2021-10-07 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 13:40 [PATCH iproute2 v4 0/5] configure: add support for libdir and prefix option Andrea Claudi
2021-10-07 13:40 ` [PATCH iproute2 v4 1/5] configure: fix parsing issue on include_dir option Andrea Claudi
2021-10-07 13:40 ` [PATCH iproute2 v4 2/5] configure: fix parsing issue on libbpf_dir option Andrea Claudi
2021-10-07 13:40 ` [PATCH iproute2 v4 3/5] configure: support --param=value style Andrea Claudi
2021-10-07 13:40 ` [PATCH iproute2 v4 4/5] configure: add the --prefix option Andrea Claudi
2021-10-07 13:40 ` [PATCH iproute2 v4 5/5] configure: add the --libdir option Andrea Claudi
2021-10-07 16:02 ` Phil Sutter [this message]
2021-10-08 13:08   ` [PATCH iproute2 v4 0/5] configure: add support for libdir and prefix option Andrea Claudi
2021-10-08 13:50     ` Phil Sutter
2021-10-08 16:19       ` Andrea Claudi
2021-10-09 23:45         ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211007160202.GG32194@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --cc=aclaudi@redhat.com \
    --cc=bluca@debian.org \
    --cc=dsahern@gmail.com \
    --cc=haliu@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).