Merge pull request #8470 from lazka/pkgconf-1.7.4
pkgconfig: Update to 1.7.4
This commit is contained in:
138
mingw-w64-pkgconf/0001-fix-prefix-dirsep.patch
Normal file
138
mingw-w64-pkgconf/0001-fix-prefix-dirsep.patch
Normal file
@@ -0,0 +1,138 @@
|
||||
From 4f73f6a1d6a2cb7e599bf136e551526c6531a3f1 Mon Sep 17 00:00:00 2001
|
||||
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||
Date: Sat, 20 Mar 2021 11:01:14 +0100
|
||||
Subject: [PATCH] Rework path handling on native Windows
|
||||
|
||||
The current approach was to parse the .pc and, detect the prefix, throw
|
||||
everything together and at the end replace all \ with / to not produce invalid
|
||||
escape sequences.
|
||||
|
||||
This has the problem that escaping in .pc files is ignored and no longer
|
||||
possible. Also in case the prefix path has a space in it the result would be
|
||||
invalid because of missing escaping.
|
||||
|
||||
This changes the following things:
|
||||
|
||||
* We no longer normalize values at the end. Instead we assume .pc files use "/"
|
||||
as a directory separator or "\\", same format as under Unix. "\" alone no
|
||||
longer works. This shouldn't be a problem since most build tools produce .pc
|
||||
files with "/" like meson, cmake, autotools.
|
||||
|
||||
* When injecting the prefix at runtime we convert the prefix to use "/" and
|
||||
escape spaces so that in combination with the .pc content the result is a
|
||||
valid escaped path value again.
|
||||
|
||||
This patch has been used in MSYS2 for some months now.
|
||||
|
||||
See #212
|
||||
---
|
||||
libpkgconf/path.c | 13 ------------
|
||||
libpkgconf/pkg.c | 50 +++++++++++++++++++++++++++++++++++------------
|
||||
2 files changed, 38 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/libpkgconf/path.c b/libpkgconf/path.c
|
||||
index 89d2ce0..5884ed7 100644
|
||||
--- a/libpkgconf/path.c
|
||||
+++ b/libpkgconf/path.c
|
||||
@@ -331,18 +331,5 @@ pkgconf_path_relocate(char *buf, size_t buflen)
|
||||
free(tmpbuf);
|
||||
}
|
||||
|
||||
-#ifdef _WIN32
|
||||
- /*
|
||||
- * Rewrite any backslash path delimiters for best compatibility.
|
||||
- * Originally, we did this in cygwin/msys case, but now we build pkgconf
|
||||
- * natively on Windows without cygwin/msys, so do it in all cases.
|
||||
- */
|
||||
- for (ti = buf; *ti != '\0'; ti++)
|
||||
- {
|
||||
- if (*ti == '\\')
|
||||
- *ti = '/';
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
return true;
|
||||
}
|
||||
diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c
|
||||
index f302df3..3eafa6e 100644
|
||||
--- a/libpkgconf/pkg.c
|
||||
+++ b/libpkgconf/pkg.c
|
||||
@@ -214,6 +214,37 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen)
|
||||
return buf;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Takes a real path and converts it to a pkgconf value. This means normalizing
|
||||
+ * directory separators and escaping things (only spaces covered atm).
|
||||
+ *
|
||||
+ * This is useful for things like prefix/pcfiledir which might get injected
|
||||
+ * at runtime and are not sourced from the .pc file.
|
||||
+ *
|
||||
+ * "C:\foo bar\baz" -> "C:/foo\ bar/baz"
|
||||
+ * "/foo bar/baz" -> "/foo\ bar/baz"
|
||||
+ */
|
||||
+static char *
|
||||
+convert_path_to_value(const char *path)
|
||||
+{
|
||||
+ char *buf = calloc((strlen(path) + 1) * 2, 1);
|
||||
+ char *bptr = buf;
|
||||
+ const char *i;
|
||||
+
|
||||
+ for (i = path; *i != '\0'; i++)
|
||||
+ {
|
||||
+ if (*i == PKG_DIR_SEP_S)
|
||||
+ *bptr++ = '/';
|
||||
+ else if (*i == ' ') {
|
||||
+ *bptr++ = '\\';
|
||||
+ *bptr++ = *i;
|
||||
+ } else
|
||||
+ *bptr++ = *i;
|
||||
+ }
|
||||
+
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
remove_additional_separators(char *buf)
|
||||
{
|
||||
@@ -238,16 +269,6 @@ remove_additional_separators(char *buf)
|
||||
static void
|
||||
canonicalize_path(char *buf)
|
||||
{
|
||||
-#ifdef _WIN32
|
||||
- char *p = buf;
|
||||
-
|
||||
- while (*p) {
|
||||
- if (*p == '\\')
|
||||
- *p = '/';
|
||||
- p++;
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
remove_additional_separators(buf);
|
||||
}
|
||||
|
||||
@@ -294,8 +315,10 @@ pkgconf_pkg_parser_value_set(void *opaque, const size_t lineno, const char *keyw
|
||||
|
||||
if (relvalue != NULL)
|
||||
{
|
||||
+ char *prefix_value = convert_path_to_value(relvalue);
|
||||
pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true);
|
||||
- pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, relvalue, false);
|
||||
+ pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, prefix_value, false);
|
||||
+ free(prefix_value);
|
||||
}
|
||||
else
|
||||
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
|
||||
@@ -376,7 +399,10 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||
pkg->owner = client;
|
||||
pkg->filename = strdup(filename);
|
||||
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
||||
- pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pkg->pc_filedir, true);
|
||||
+
|
||||
+ char *pc_filedir_value = convert_path_to_value(pkg->pc_filedir);
|
||||
+ pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true);
|
||||
+ free(pc_filedir_value);
|
||||
|
||||
/* make module id */
|
||||
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
||||
@@ -1,16 +0,0 @@
|
||||
--- pkgconf-1.7.3/meson.build.orig 2020-10-18 17:27:40.210500600 +0200
|
||||
+++ pkgconf-1.7.3/meson.build 2020-10-18 17:27:00.204103200 +0200
|
||||
@@ -84,6 +84,13 @@
|
||||
soversion : '3',
|
||||
)
|
||||
|
||||
+pkg = import('pkgconfig')
|
||||
+pkg.generate(libpkgconf,
|
||||
+ name : 'libpkgconf',
|
||||
+ description : 'a library for accessing and manipulating development framework configuration',
|
||||
+ url: 'http://github.com/pkgconf/pkgconf',
|
||||
+ filebase : 'libpkgconf',
|
||||
+)
|
||||
|
||||
pkgconf_exe = executable('pkgconf',
|
||||
'cli/main.c',
|
||||
@@ -1,75 +0,0 @@
|
||||
--- pkgconf-1.7.3/libpkgconf/pkg.c.orig 2020-05-26 21:41:17.000000000 +0200
|
||||
+++ pkgconf-1.7.3/libpkgconf/pkg.c 2020-11-21 21:50:42.215275200 +0100
|
||||
@@ -214,6 +214,32 @@
|
||||
return buf;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Takes a path and converts it to a value.
|
||||
+ * This means normalizing directory separators and escaping
|
||||
+ * things (only spaces covered atm)
|
||||
+ */
|
||||
+static char *
|
||||
+path_to_value(const char *path)
|
||||
+{
|
||||
+ char *buf = calloc((strlen(path) + 1) * 2, 1);
|
||||
+ char *bptr = buf;
|
||||
+ const char *i;
|
||||
+
|
||||
+ for (i = path; *i != '\0'; i++)
|
||||
+ {
|
||||
+ if (*i == PKG_DIR_SEP_S)
|
||||
+ *bptr++ = '/';
|
||||
+ else if (*i == ' ') {
|
||||
+ *bptr++ = '\\';
|
||||
+ *bptr++ = *i;
|
||||
+ } else
|
||||
+ *bptr++ = *i;
|
||||
+ }
|
||||
+
|
||||
+ return buf;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
remove_additional_separators(char *buf)
|
||||
{
|
||||
@@ -238,16 +264,6 @@
|
||||
static void
|
||||
canonicalize_path(char *buf)
|
||||
{
|
||||
-#ifdef _WIN32
|
||||
- char *p = buf;
|
||||
-
|
||||
- while (*p) {
|
||||
- if (*p == '\\')
|
||||
- *p = '/';
|
||||
- p++;
|
||||
- }
|
||||
-#endif
|
||||
-
|
||||
remove_additional_separators(buf);
|
||||
}
|
||||
|
||||
@@ -294,8 +310,10 @@
|
||||
|
||||
if (relvalue != NULL)
|
||||
{
|
||||
+ char *prefix_value = path_to_value(relvalue);
|
||||
pkg->orig_prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, "orig_prefix", canonicalized_value, true);
|
||||
- pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, relvalue, false);
|
||||
+ pkg->prefix = pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, prefix_value, false);
|
||||
+ free(prefix_value);
|
||||
}
|
||||
else
|
||||
pkgconf_tuple_add(pkg->owner, &pkg->vars, keyword, value, true);
|
||||
@@ -376,7 +394,9 @@
|
||||
pkg->owner = client;
|
||||
pkg->filename = strdup(filename);
|
||||
pkg->pc_filedir = pkg_get_parent_dir(pkg);
|
||||
- pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pkg->pc_filedir, true);
|
||||
+ char *pc_filedir_value = path_to_value(pkg->pc_filedir);
|
||||
+ pkgconf_tuple_add(client, &pkg->vars, "pcfiledir", pc_filedir_value, true);
|
||||
+ free(pc_filedir_value);
|
||||
|
||||
/* make module id */
|
||||
if ((idptr = strrchr(pkg->filename, PKG_DIR_SEP_S)) != NULL)
|
||||
@@ -1,11 +0,0 @@
|
||||
--- pkgconf-1.7.3/libpkgconf/pkg.c.orig 2020-05-26 21:41:17.000000000 +0200
|
||||
+++ pkgconf-1.7.3/libpkgconf/pkg.c 2020-11-21 22:24:46.941942300 +0100
|
||||
@@ -100,7 +100,7 @@
|
||||
p = pkgconf_tuple_parse(client, &pkg->vars, value);
|
||||
|
||||
len = strcspn(p, " \t");
|
||||
- if (len)
|
||||
+ if (len != strlen(p))
|
||||
{
|
||||
i = p + (ptrdiff_t) len;
|
||||
*i = '\0';
|
||||
@@ -1,24 +0,0 @@
|
||||
From ab404bc25b94b638ee2d5bb7047e03b28da71787 Mon Sep 17 00:00:00 2001
|
||||
From: Ryan Scott <ryan.gl.scott@gmail.com>
|
||||
Date: Wed, 3 Feb 2021 06:54:52 -0500
|
||||
Subject: [PATCH] Fix #209
|
||||
|
||||
This commit fixes #209 by applying the suggestion from
|
||||
https://github.com/pkgconf/pkgconf/issues/209#issuecomment-771609136.
|
||||
---
|
||||
libpkgconf/pkg.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c
|
||||
index 02c990d..f302df3 100644
|
||||
--- a/libpkgconf/pkg.c
|
||||
+++ b/libpkgconf/pkg.c
|
||||
@@ -391,7 +391,7 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||
*/
|
||||
char *mungeptr;
|
||||
if ((mungeptr = strrchr(idptr, '/')) != NULL)
|
||||
- idptr = mungeptr++;
|
||||
+ idptr = ++mungeptr;
|
||||
#endif
|
||||
|
||||
pkg->id = strdup(idptr);
|
||||
@@ -3,8 +3,8 @@
|
||||
_realname=pkgconf
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=1.7.3
|
||||
pkgrel=6
|
||||
pkgver=1.7.4
|
||||
pkgrel=1
|
||||
pkgdesc='pkg-config compatible utility which does not depend on glib'
|
||||
url='https://github.com/pkgconf/pkgconf'
|
||||
arch=('any')
|
||||
@@ -18,34 +18,24 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
|
||||
"${MINGW_PACKAGE_PREFIX}-meson"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja")
|
||||
groups=("${MINGW_PACKAGE_PREFIX}-toolchain")
|
||||
source=(https://distfiles.dereferenced.org/pkgconf/$_realname-$pkgver.tar.gz
|
||||
0001-meson-write-pc-file.patch
|
||||
0003-size-t-format.patch
|
||||
0004-fix-prefix-dirsep.patch
|
||||
0005-fix-version-validate.patch
|
||||
0006-printf-format.patch
|
||||
0007-list-all-leading-slash.patch)
|
||||
sha256sums=('d040859b36880323209f347c7c936e40a748ee63e123e43a771791a64165d6b1'
|
||||
'9af1f0600ca15e5f285ba54f4cb334f5d7e00f1bc21b6f571d71acd747f303b6'
|
||||
source=("https://github.com/pkgconf/pkgconf/archive/refs/tags/$_realname-$pkgver.tar.gz"
|
||||
0001-fix-prefix-dirsep.patch
|
||||
0002-size-t-format.patch
|
||||
0003-printf-format.patch)
|
||||
sha256sums=('2828dcdef88098748c306281d64a630b4ccd0703b1d92b532c31411e531d3088'
|
||||
'fd446cc3f35528d6d3f67b5c46fca6e4fbfee3a35a8e0bae3d14e5ad020b7c8c'
|
||||
'1db5975d6b1db946ba1d71cc3cf390dec567899a89d7ef53f56f24f0058cdbe3'
|
||||
'8b2dd7551f9d6be9b202718fdcc6c526c5557831a703b617fc862a609be14450'
|
||||
'bddc97d669f7eda5d0e5b4fa023d684c394ff0f1cd5c9ccc38ecb514d9be2809'
|
||||
'a7efeef61b4af1c0813d9d8a211cde669a3e3fa2c97ed21e55487667769c567a'
|
||||
'df199a82318e82952b3f6adb643623167dae179042991b7c6b0502ced760a312')
|
||||
'a7efeef61b4af1c0813d9d8a211cde669a3e3fa2c97ed21e55487667769c567a')
|
||||
|
||||
prepare() {
|
||||
mv "${_realname}-${_realname}-${pkgver}" "${_realname}-${pkgver}"
|
||||
cd ${srcdir}/$_realname-$pkgver
|
||||
|
||||
patch -p1 -i ${srcdir}/0001-meson-write-pc-file.patch
|
||||
patch -p1 -i ${srcdir}/0003-size-t-format.patch
|
||||
# https://github.com/pkgconf/pkgconf/pull/217
|
||||
patch -p1 -i ${srcdir}/0001-fix-prefix-dirsep.patch
|
||||
|
||||
# properly convert paths to pc values and normalize dir seperators
|
||||
# while escaping spaces
|
||||
patch -p1 -i ${srcdir}/0004-fix-prefix-dirsep.patch
|
||||
|
||||
patch -p1 -i ${srcdir}/0005-fix-version-validate.patch
|
||||
patch -p1 -i ${srcdir}/0006-printf-format.patch
|
||||
patch -p1 -i ${srcdir}/0007-list-all-leading-slash.patch
|
||||
patch -p1 -i ${srcdir}/0002-size-t-format.patch
|
||||
patch -p1 -i ${srcdir}/0003-printf-format.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
Reference in New Issue
Block a user