Fri Nov 17 10:20:25 2023 UTC ()
mk/configure/pkg-config-override.mk: support whitespace before Libs:
Some pkg-config files have whitespace in the beginning of their
statements. Such files work with pkgconf but our overrides don't
work with them. So handle such cases as well.


(nros)
diff -r1.5 -r1.6 pkgsrc/mk/configure/pkg-config-override.mk

cvs diff -r1.5 -r1.6 pkgsrc/mk/configure/pkg-config-override.mk (expand / switch to unified diff)

--- pkgsrc/mk/configure/pkg-config-override.mk 2020/05/04 18:06:56 1.5
+++ pkgsrc/mk/configure/pkg-config-override.mk 2023/11/17 10:20:25 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: pkg-config-override.mk,v 1.5 2020/05/04 18:06:56 rillig Exp $ 1# $NetBSD: pkg-config-override.mk,v 1.6 2023/11/17 10:20:25 nros Exp $
2 2
3# Package-settable variables: 3# Package-settable variables:
4# 4#
5# PKGCONFIG_OVERRIDE 5# PKGCONFIG_OVERRIDE
6# The list of pkg-config files relative to WRKSRC in which the 6# The list of pkg-config files relative to WRKSRC in which the
7# compiler flags need to be adjusted. 7# compiler flags need to be adjusted.
8# 8#
9# PKGCONFIG_OVERRIDE_STAGE 9# PKGCONFIG_OVERRIDE_STAGE
10# The stage in which the pkg-config files will be adjusted. By 10# The stage in which the pkg-config files will be adjusted. By
11# default, this is pre-configure. 11# default, this is pre-configure.
12# 12#
13 13
14###################################################################### 14######################################################################
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17### pkg-config-override inserts the compiler's "rpath" flag into 17### pkg-config-override inserts the compiler's "rpath" flag into
18### pkg-config data files so that ``pkg-config --ldflags <module>'' will 18### pkg-config data files so that ``pkg-config --ldflags <module>'' will
19### return the full set of compiler flags needed to find libraries at 19### return the full set of compiler flags needed to find libraries at
20### run-time. 20### run-time.
21### 21###
22.PHONY: pkg-config-override 22.PHONY: pkg-config-override
23pkg-config-override: 23pkg-config-override:
24 @${DO_NADA} 24 @${DO_NADA}
25 25
26.if defined(_USE_RPATH) && !empty(_USE_RPATH:M[yY][eE][sS]) 26.if defined(_USE_RPATH) && !empty(_USE_RPATH:M[yY][eE][sS])
27pkg-config-override: subst-pkgconfig 27pkg-config-override: subst-pkgconfig
28 28
29PKGCONFIG_OVERRIDE_SED= \ 29PKGCONFIG_OVERRIDE_SED= \
30 '/^Libs:.*[ ]/s|-L\([ ]*[^ ]*\)|${COMPILER_RPATH_FLAG}\1 -L\1|g' 30 '/^[ ]*Libs:.*[ ]/s|-L\([ ]*[^ ]*\)|${COMPILER_RPATH_FLAG}\1 -L\1|g'
31PKGCONFIG_OVERRIDE_STAGE?= pre-configure 31PKGCONFIG_OVERRIDE_STAGE?= pre-configure
32 32
33SUBST_CLASSES+= _pkgconfig 33SUBST_CLASSES+= _pkgconfig
34. if ${PKGCONFIG_OVERRIDE_STAGE} == "pre-configure" 34. if ${PKGCONFIG_OVERRIDE_STAGE} == "pre-configure"
35SUBST_STAGE._pkgconfig= do-configure-pre-hook 35SUBST_STAGE._pkgconfig= do-configure-pre-hook
36. elif ${PKGCONFIG_OVERRIDE_STAGE} == "post-configure" 36. elif ${PKGCONFIG_OVERRIDE_STAGE} == "post-configure"
37SUBST_STAGE._pkgconfig= do-configure-post-hook 37SUBST_STAGE._pkgconfig= do-configure-post-hook
38. else 38. else
39SUBST_STAGE._pkgconfig= ${PKGCONFIG_OVERRIDE_STAGE} 39SUBST_STAGE._pkgconfig= ${PKGCONFIG_OVERRIDE_STAGE}
40. endif 40. endif
41SUBST_MESSAGE._pkgconfig= Adding run-time search paths to pkg-config files. 41SUBST_MESSAGE._pkgconfig= Adding run-time search paths to pkg-config files.
42SUBST_FILES._pkgconfig= ${PKGCONFIG_OVERRIDE:S/^${WRKSRC}\///} 42SUBST_FILES._pkgconfig= ${PKGCONFIG_OVERRIDE:S/^${WRKSRC}\///}
43SUBST_SED._pkgconfig= ${PKGCONFIG_OVERRIDE_SED} 43SUBST_SED._pkgconfig= ${PKGCONFIG_OVERRIDE_SED}