Merge pull request #1686 from filnet/pkg-config

pkg-config: workaround glib-gettext.m4 error and don't override empty prefix setting
This commit is contained in:
Алексей
2016-09-23 11:42:26 +04:00
committed by GitHub
3 changed files with 97 additions and 3 deletions

View File

@@ -0,0 +1,75 @@
From a9ba1c78ed09b569e95ea36b2b9644a8f6bbc003 Mon Sep 17 00:00:00 2001
From: Dan Nicholson <dbn.lists@gmail.com>
Date: Wed, 24 Aug 2016 10:32:57 -0700
Subject: [PATCH] Don't override empty prefix setting
If the original prefix setting is empty, skip prepending the redefined
prefix to other variables. This works the same as if the pc file doesn't
have a prefix variable at all.
https://bugs.freedesktop.org/show_bug.cgi?id=97453-empty
---
check/Makefile.am | 1 +
check/check-relocatable | 7 +++++++
check/pkgconfig/empty-prefix.pc | 10 ++++++++++
parse.c | 1 +
4 files changed, 19 insertions(+)
create mode 100644 check/pkgconfig/empty-prefix.pc
diff --git a/check/Makefile.am b/check/Makefile.am
index f6d88e9..cf26019 100644
--- a/check/Makefile.am
+++ b/check/Makefile.am
@@ -99,6 +99,7 @@ EXTRA_DIST = \
gtk/xproto.pc \
gtk/xrender.pc \
tilde.pc \
+ pkgconfig/empty-prefix.pc \
pkgconfig/prefixdef.pc \
pkgconfig/prefixdef-expanded.pc \
pcfiledir.pc \
diff --git a/check/check-relocatable b/check/check-relocatable
index 589eddf..40c2c88 100755
--- a/check/check-relocatable
+++ b/check/check-relocatable
@@ -44,3 +44,10 @@ for pkg in prefixdef prefixdef-expanded; do
RESULT="-I/reloc/include -L/reloc/lib -lfoo"
run_test --dont-define-prefix --cflags --libs $pkg
done
+
+# Test prefix redefinition for .pc files with an empty prefix. In this
+# case, there should be no prefix adjustment to the other variables. The
+# result should be the same regardless of prefix redefinition.
+RESULT="-I/some/path/include -L/some/path/lib -lfoo"
+run_test --define-prefix --cflags --libs empty-prefix
+run_test --dont-define-prefix --cflags --libs empty-prefix
diff --git a/check/pkgconfig/empty-prefix.pc b/check/pkgconfig/empty-prefix.pc
new file mode 100644
index 0000000..9007250
--- /dev/null
+++ b/check/pkgconfig/empty-prefix.pc
@@ -0,0 +1,10 @@
+prefix=
+libdir=/some/path/lib
+includedir=/some/path/include
+
+Name: Empty prefix redefinition test
+Description: Test pkg-config empty prefix redefinition
+Version: 1.0.0
+Requires:
+Libs: -L${libdir} -lfoo
+Cflags: -I${includedir}
diff --git a/parse.c b/parse.c
index 4da6702..02ee834 100644
--- a/parse.c
+++ b/parse.c
@@ -1046,6 +1046,7 @@ parse_line (Package *pkg, const char *untrimmed, const char *path,
}
else if (define_prefix &&
pkg->orig_prefix != NULL &&
+ *(pkg->orig_prefix) != '\0' &&
strncmp (p, pkg->orig_prefix, strlen (pkg->orig_prefix)) == 0 &&
G_IS_DIR_SEPARATOR (p[strlen (pkg->orig_prefix)]))
{
--
2.5.5

View File

@@ -0,0 +1,13 @@
--- glib/m4macros/glib-gettext.m4.orig 2016-08-30 17:11:06.937292400 +0200
+++ glib/m4macros/glib-gettext.m4 2016-08-30 17:11:28.137412200 +0200
@@ -36,8 +36,8 @@
dnl try to pull in the installed version of these macros
dnl when running aclocal in the glib directory.
dnl
-m4_copy([AC_DEFUN],[glib_DEFUN])
-m4_copy([AC_REQUIRE],[glib_REQUIRE])
+m4_copy_force([AC_DEFUN],[glib_DEFUN])
+m4_copy_force([AC_REQUIRE],[glib_REQUIRE])
dnl
dnl At the end, if we're not within glib, we'll define the public
dnl definitions in terms of our private definitions.

View File

@@ -4,7 +4,7 @@ _realname=pkg-config
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.29.1
pkgrel=1
pkgrel=2
pkgdesc="A system for managing library compile/link flags (mingw-w64)"
arch=('any')
url="https://www.freedesktop.org/wiki/Software/pkg-config/"
@@ -17,28 +17,33 @@ source=(https://pkgconfig.freedesktop.org/releases/${_realname}-${pkgver}.tar.gz
0001-fix-double-slash-in-test.patch
0010-expand-paths.mingw.patch
0011-platform-dependent-separator-and-adjustable-prefix.mingw.patch
0012-Dont-override-empty-prefix-setting.patch
1001-Use-CreateFile-on-Win32-to-make-sure-g_unlink-always.patch
1003-g_abort.all.patch
1005-glib-send-log-messages-to-correct-stdout-and-stderr.patch
1017-glib-use-gnu-print-scanf.patch
1024-return-actually-written-data-in-printf.all.patch
1030-fix-stat.all.patch)
1030-fix-stat.all.patch
1031-fix-glib-gettext-m4-error.patch)
sha256sums=('beb43c9e064555469bd4390dcfd8030b1536e0aa103f08d7abf7ae8cac0cb001'
'85c031dec59a82f40cfad5223c1a440c1c633dcf9beb6feddf679af1d41bb8db'
'fe8f71995d56fd3d69d169031e54c91b9b01c74995143664a2455ec21c7377e1'
'e895eddd041d2c05abd15789cf2895f35e339702f36af34206a62241cdb42637'
'44bd237dad02781929937e696f8aaeef0ab382e3df41cb2593373afe33b6b7b3'
'ef81e82e15fb3a71bad770be17fe4fea3f4d9cdee238d6caa39807eeea5da3e3'
'3a6ef5b99f76504e58297d196d129df40f86f9b608dbc4f20cf135680ff558ab'
'94b705382b405bf8eae51c4f82afbf819b6caa5b3e51512be18c870b79947f88'
'bd2a8a53f320a4fe7d45d75fe3a4b16882dc27597618759a44e791ae831efccb'
'8421aed91370cf8eb5f0dde443bbc63e5dd4c238c586053eab4fbbae2e005d8c'
'9ba68777f48816cbee154084c10d0d577a021ef406606d5c2d230761cf82b66b')
'9ba68777f48816cbee154084c10d0d577a021ef406606d5c2d230761cf82b66b'
'9ee4a55eac8ec5a07abe69fd17b521a4013d06ad8ac9d27cb3a94d86c358e03e')
prepare() {
cd ${srcdir}/${_realname}-${pkgver}
patch -p1 -i ${srcdir}/0001-fix-double-slash-in-test.patch
patch -p1 -i ${srcdir}/0010-expand-paths.mingw.patch
patch -p1 -i ${srcdir}/0011-platform-dependent-separator-and-adjustable-prefix.mingw.patch
patch -p1 -i ${srcdir}/0012-Dont-override-empty-prefix-setting.patch
sed -i check/simple.pc -e "s,prefix=/usr,prefix=${MINGW_PREFIX},"
@@ -50,6 +55,7 @@ prepare() {
patch -Np1 -i "${srcdir}/1017-glib-use-gnu-print-scanf.patch"
patch -Np1 -i "${srcdir}/1024-return-actually-written-data-in-printf.all.patch"
patch -Np1 -i "${srcdir}/1030-fix-stat.all.patch"
patch -Np1 -i "${srcdir}/1031-fix-glib-gettext-m4-error.patch"
cd ..