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

Closed
opened 2018-03-07 21:24:51 +00:00 by TingPing · 2 comments
TingPing commented 2018-03-07 21:24:51 +00:00 (Migrated from github.com)

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: 75fa8c2afb/glib/gwin32.c (L219-L308)

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

`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 commented 2018-03-07 22:23:17 +00:00 (Migrated from github.com)

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.

This is probably a dumb patch but it seems to have the right result: ```patch 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.

I prefer to unconditionally set PKGCONF_PKG_PKGF_REDEFINE_PREFIX on
Windows, so that it could be opted out. See cli/main.c.

On Wed, Mar 7, 2018 at 4:23 PM, TingPing notifications@github.com wrote:

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


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/pkgconf/pkgconf/issues/176#issuecomment-371306686,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABc7DFaOmknExS5swaf4MxukCUUIvvzJks5tcF3VgaJpZM4ShLnD
.

I prefer to unconditionally set PKGCONF_PKG_PKGF_REDEFINE_PREFIX on Windows, so that it could be opted out. See cli/main.c. On Wed, Mar 7, 2018 at 4:23 PM, TingPing <notifications@github.com> wrote: > 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 > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/pkgconf/pkgconf/issues/176#issuecomment-371306686>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/ABc7DFaOmknExS5swaf4MxukCUUIvvzJks5tcF3VgaJpZM4ShLnD> > . >
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ariadne/pkgconf#176
There is no content yet.