Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Windows prefix behavior does not match pkg-config #176

Closed
TingPing opened this issue Mar 7, 2018 · 2 comments
Closed

On Windows prefix behavior does not match pkg-config #176

TingPing opened this issue Mar 7, 2018 · 2 comments

Comments

@TingPing
Copy link
Contributor

TingPing commented Mar 7, 2018

pkg-config on Windows will replace the prefix with the path to its binary which is required considering everything on Windows is assumed to be portable.

The exact pkg-config behavior is this: https://github.com/GNOME/glib/blob/75fa8c2afbab4f414d2eb03684d9f807bd690aef/glib/gwin32.c#L219-L308

It can be simplified a bit for pkgconf's usage though.

@TingPing
Copy link
Contributor Author

TingPing commented Mar 7, 2018

This is probably a dumb patch but it seems to have the right result:

From 4c3fa563cdec835c8a84db740722304f31028025 Mon Sep 17 00:00:00 2001
From: Patrick Griffis <tingping@tingping.se>
Date: Wed, 7 Mar 2018 17:18:55 +0000
Subject: [PATCH] Always rewrite prefix on Windows

This matches the pkg-config behavior and fixes relocating files
---
 libpkgconf/pkg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c
index 0feb4d6..d301124 100644
--- a/libpkgconf/pkg.c
+++ b/libpkgconf/pkg.c
@@ -368,7 +368,11 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
 			pkgconf_pkg_parser_keyword_set(client, pkg, lineno, key, value);
 			break;
 		case '=':
-			if (strcmp(key, client->prefix_varname) || !(client->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX))
+			if (strcmp(key, client->prefix_varname)
+#if !defined(_WIN32) && !defined(_WIN64) /* Always redefine on Windows */
+			    || !(client->flags & PKGCONF_PKG_PKGF_REDEFINE_PREFIX)
+#endif
+ 			)
 				pkgconf_tuple_add(client, &pkg->vars, key, value, true);
 			else
 			{
-- 
2.16.2.windows.1

pkg-config does also rewrite the lib and data dirs.

@kaniini
Copy link
Member

kaniini commented Mar 8, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants