~kaniini/pkgconf

Revert "main: assume --modversion insted of --version if other flags or module names are provided" v1 PROPOSED

Andre Heider: 1
 Revert "main: assume --modversion insted of --version if other flags or module names are provided"

 1 files changed, 2 insertions(+), 12 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kaniini/pkgconf/patches/9170/mbox | git am -3
Learn more about email & git

[PATCH] Revert "main: assume --modversion insted of --version if other flags or module names are provided" Export this patch

This reverts commit 12a0eb124cea85586e57f33c91a1e4c73459eef6.

This "user friendly" behavior is actually detrimental. pkg-config is very
often wrapped in a shell script of cross-compiling toolchains. Such wrappers
may pass extra arguments, such as --static, (reasonably) not expecting that
to break --version. Some build systems (meson being one example) use
--version to determine whether pkg-config is usable. Naturally, the wrappers
fail this test, even though they would've worked with the original pkg-config.

Fixes #6
---
 cli/main.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/cli/main.c b/cli/main.c
index 563ec8f..fc698a4 100644
--- a/cli/main.c
+++ b/cli/main.c
@@ -1005,18 +1005,8 @@ main(int argc, char *argv[])

	if ((want_flags & PKG_VERSION) == PKG_VERSION)
	{
		if (argc > 2)
		{
			fprintf(stderr, "%s: --version specified with other options or module names, assuming --modversion.\n", argv[0]);

			want_flags &= ~PKG_VERSION;
			want_flags |= PKG_MODVERSION;
		}
		else
		{
			version();
			return EXIT_SUCCESS;
		}
		version();
		return EXIT_SUCCESS;
	}

	if ((want_flags & PKG_HELP) == PKG_HELP)
-- 
2.24.0