blob: 3b2f59c2fcfee206b3e1c7ee874fecfa77632c97 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -05001From 0d7ec5b98dc6cbd35f56deaecec5ecfdaa944aee Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Richard Purdie <richard.purdie@linuxfoundation.org>
Brad Bishopc342db32019-05-15 21:57:59 -04003Date: Fri, 10 May 2019 14:23:55 +0800
4Subject: [PATCH] pkgconfig
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005
6Update gpgme to use pkgconfig instead of -config files since its
7simpler and less error prone when cross compiling.
8
9Upstream-Status: Denied [Upstream not interested in pkg-config support]
10RP 2015/4/17
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
Brad Bishopc342db32019-05-15 21:57:59 -040014Rebase to 1.13.0
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000016Rebase to 1.17.0
17Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Patrick Williams92b42cb2022-09-03 06:53:57 -050018
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019---
20 configure.ac | 1 +
21 src/Makefile.am | 4 +-
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000022 src/gpgme-pthread.pc.in | 15 ++++++
23 src/gpgme.m4 | 114 +++-------------------------------------
Brad Bishopc342db32019-05-15 21:57:59 -040024 src/gpgme.pc.in | 4 +-
25 5 files changed, 28 insertions(+), 110 deletions(-)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026 create mode 100644 src/gpgme-pthread.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027
28diff --git a/configure.ac b/configure.ac
Patrick Williams92b42cb2022-09-03 06:53:57 -050029index 9d696b9..5b4e730 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050030--- a/configure.ac
31+++ b/configure.ac
Patrick Williams92b42cb2022-09-03 06:53:57 -050032@@ -926,6 +926,7 @@ AC_CONFIG_FILES(Makefile src/Makefile
Brad Bishopc342db32019-05-15 21:57:59 -040033 src/gpgme-glib.pc
Brad Bishopd7bf8c12018-02-25 22:55:05 -050034 src/gpgme.h)
35 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
Brad Bishopc342db32019-05-15 21:57:59 -040036+AC_CONFIG_FILES(src/gpgme-pthread.pc)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
Brad Bishopc342db32019-05-15 21:57:59 -040038 AC_CONFIG_FILES(lang/cpp/tests/Makefile)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050039 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050040diff --git a/src/Makefile.am b/src/Makefile.am
Patrick Williams92b42cb2022-09-03 06:53:57 -050041index 67805a8..d38ba02 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050042--- a/src/Makefile.am
43+++ b/src/Makefile.am
Brad Bishopc342db32019-05-15 21:57:59 -040044@@ -20,11 +20,11 @@
Brad Bishopd7bf8c12018-02-25 22:55:05 -050045 ## Process this file with automake to produce Makefile.in
46
Brad Bishopc342db32019-05-15 21:57:59 -040047 pkgconfigdir = $(libdir)/pkgconfig
48-pkgconfig_DATA = gpgme.pc gpgme-glib.pc
49+pkgconfig_DATA = gpgme.pc gpgme-glib.pc gpgme-pthread.pc
50
Brad Bishopd7bf8c12018-02-25 22:55:05 -050051 EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \
Brad Bishopc342db32019-05-15 21:57:59 -040052 gpgme.h.in versioninfo.rc.in gpgme.def \
53- gpgme.pc.in gpgme-glib.pc.in
54+ gpgme.pc.in gpgme-glib.pc.in gpgme-pthread.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -050055
Patrick Williams92b42cb2022-09-03 06:53:57 -050056 if USE_GPGRT_CONFIG
57 noinst_SCRIPTS = gpgme-config
Brad Bishopd7bf8c12018-02-25 22:55:05 -050058diff --git a/src/gpgme-pthread.pc.in b/src/gpgme-pthread.pc.in
59new file mode 100644
60index 0000000..074bbf6
61--- /dev/null
62+++ b/src/gpgme-pthread.pc.in
63@@ -0,0 +1,15 @@
64+prefix=@prefix@
65+exec_prefix=@exec_prefix@
66+libdir=@libdir@
67+includedir=@includedir@
68+
69+# API info
70+api_version=@GPGME_CONFIG_API_VERSION@
71+host=@GPGME_CONFIG_HOST@
72+
73+Name: gpgme
74+Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program (deprecated)
75+Version: @VERSION@
76+Libs: -L${libdir} -lgpgme -lpthread
77+Cflags: -I${includedir}
78+Requires: libassuan gpg-error
79diff --git a/src/gpgme.m4 b/src/gpgme.m4
Patrick Williams92b42cb2022-09-03 06:53:57 -050080index 71b0010..5821895 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050081--- a/src/gpgme.m4
82+++ b/src/gpgme.m4
83@@ -79,7 +79,7 @@ dnl config script does not match the host specification the script
84 dnl is added to the gpg_config_script_warn variable.
85 dnl
86 AC_DEFUN([AM_PATH_GPGME],
87-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
88+[
89 tmp=ifelse([$1], ,1:0.4.2,$1)
90 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
91 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
92@@ -89,36 +89,12 @@ AC_DEFUN([AM_PATH_GPGME],
93 min_gpgme_version="$tmp"
94 fi
95
96- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
97- ok=no
98- if test "$GPGME_CONFIG" != "no" ; then
99- req_major=`echo $min_gpgme_version | \
100- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
101- req_minor=`echo $min_gpgme_version | \
102- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
103- req_micro=`echo $min_gpgme_version | \
104- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
105- if test "$gpgme_version_major" -gt "$req_major"; then
106- ok=yes
107- else
108- if test "$gpgme_version_major" -eq "$req_major"; then
109- if test "$gpgme_version_minor" -gt "$req_minor"; then
110- ok=yes
111- else
112- if test "$gpgme_version_minor" -eq "$req_minor"; then
113- if test "$gpgme_version_micro" -ge "$req_micro"; then
114- ok=yes
115- fi
116- fi
117- fi
118- fi
119- fi
120- fi
121+ PKG_CHECK_MODULES(GPGME, [gpgme >= $min_gpgme_version], [ok=yes], [ok=no])
122 if test $ok = yes; then
123 # If we have a recent GPGME, we should also check that the
124 # API is compatible.
125 if test "$req_gpgme_api" -gt 0 ; then
126- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
127+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
128 if test "$tmp" -gt 0 ; then
129 if test "$req_gpgme_api" -ne "$tmp" ; then
130 ok=no
131@@ -127,19 +103,11 @@ AC_DEFUN([AM_PATH_GPGME],
132 fi
133 fi
134 if test $ok = yes; then
135- GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
136- GPGME_LIBS=`$GPGME_CONFIG --libs`
137- AC_MSG_RESULT(yes)
138 ifelse([$2], , :, [$2])
139 _AM_PATH_GPGME_CONFIG_HOST_CHECK
140 else
141- GPGME_CFLAGS=""
142- GPGME_LIBS=""
143- AC_MSG_RESULT(no)
144 ifelse([$3], , :, [$3])
145 fi
146- AC_SUBST(GPGME_CFLAGS)
147- AC_SUBST(GPGME_LIBS)
148 ])
149
150 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
151@@ -148,7 +116,7 @@ dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
152 dnl and GPGME_PTHREAD_LIBS.
153 dnl
154 AC_DEFUN([AM_PATH_GPGME_PTHREAD],
155-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
156+[
157 tmp=ifelse([$1], ,1:0.4.2,$1)
158 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
159 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
160@@ -158,38 +126,12 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
161 min_gpgme_version="$tmp"
162 fi
163
164- AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
165- ok=no
166- if test "$GPGME_CONFIG" != "no" ; then
167- if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
168- req_major=`echo $min_gpgme_version | \
169- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
170- req_minor=`echo $min_gpgme_version | \
171- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
172- req_micro=`echo $min_gpgme_version | \
173- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
174- if test "$gpgme_version_major" -gt "$req_major"; then
175- ok=yes
176- else
177- if test "$gpgme_version_major" -eq "$req_major"; then
178- if test "$gpgme_version_minor" -gt "$req_minor"; then
179- ok=yes
180- else
181- if test "$gpgme_version_minor" -eq "$req_minor"; then
182- if test "$gpgme_version_micro" -ge "$req_micro"; then
183- ok=yes
184- fi
185- fi
186- fi
187- fi
188- fi
189- fi
190- fi
191+ PKG_CHECK_MODULES(GPGME_PTHREAD, [gpgme-pthread >= $min_gpgme_version], [ok=yes], [ok=no])
192 if test $ok = yes; then
193 # If we have a recent GPGME, we should also check that the
194 # API is compatible.
195 if test "$req_gpgme_api" -gt 0 ; then
196- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
197+ tmp=`$PKG_CONFIG --variable=api_version gpgme-pthread 2>/dev/null || echo 0`
198 if test "$tmp" -gt 0 ; then
199 if test "$req_gpgme_api" -ne "$tmp" ; then
200 ok=no
201@@ -198,19 +140,11 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
202 fi
203 fi
204 if test $ok = yes; then
205- GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
206- GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
207- AC_MSG_RESULT(yes)
208 ifelse([$2], , :, [$2])
209 _AM_PATH_GPGME_CONFIG_HOST_CHECK
210 else
211- GPGME_PTHREAD_CFLAGS=""
212- GPGME_PTHREAD_LIBS=""
213- AC_MSG_RESULT(no)
214 ifelse([$3], , :, [$3])
215 fi
216- AC_SUBST(GPGME_PTHREAD_CFLAGS)
217- AC_SUBST(GPGME_PTHREAD_LIBS)
218 ])
219
220
221@@ -229,36 +163,12 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
222 min_gpgme_version="$tmp"
223 fi
224
225- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
226- ok=no
227- if test "$GPGME_CONFIG" != "no" ; then
228- req_major=`echo $min_gpgme_version | \
229- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
230- req_minor=`echo $min_gpgme_version | \
231- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
232- req_micro=`echo $min_gpgme_version | \
233- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
234- if test "$gpgme_version_major" -gt "$req_major"; then
235- ok=yes
236- else
237- if test "$gpgme_version_major" -eq "$req_major"; then
238- if test "$gpgme_version_minor" -gt "$req_minor"; then
239- ok=yes
240- else
241- if test "$gpgme_version_minor" -eq "$req_minor"; then
242- if test "$gpgme_version_micro" -ge "$req_micro"; then
243- ok=yes
244- fi
245- fi
246- fi
247- fi
248- fi
249- fi
250+ PKG_CHECK_MODULES(GPGME_GLIB, [gpgme >= $min_gpgme_version glib-2.0], [ok=yes], [ok=no])
251 if test $ok = yes; then
252 # If we have a recent GPGME, we should also check that the
253 # API is compatible.
254 if test "$req_gpgme_api" -gt 0 ; then
255- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
256+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
257 if test "$tmp" -gt 0 ; then
258 if test "$req_gpgme_api" -ne "$tmp" ; then
259 ok=no
260@@ -267,17 +177,9 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
261 fi
262 fi
263 if test $ok = yes; then
264- GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
265- GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
266- AC_MSG_RESULT(yes)
267 ifelse([$2], , :, [$2])
268 _AM_PATH_GPGME_CONFIG_HOST_CHECK
269 else
270- GPGME_GLIB_CFLAGS=""
271- GPGME_GLIB_LIBS=""
272- AC_MSG_RESULT(no)
273 ifelse([$3], , :, [$3])
274 fi
275- AC_SUBST(GPGME_GLIB_CFLAGS)
276- AC_SUBST(GPGME_GLIB_LIBS)
277 ])
278diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000279index 80d59de..932645b 100644
Brad Bishopc342db32019-05-15 21:57:59 -0400280--- a/src/gpgme.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500281+++ b/src/gpgme.pc.in
Brad Bishopc342db32019-05-15 21:57:59 -0400282@@ -9,6 +9,6 @@ Name: gpgme
283 Description: GnuPG Made Easy to access GnuPG
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000284 Requires.private: gpg-error, libassuan
Brad Bishopc342db32019-05-15 21:57:59 -0400285 Version: @PACKAGE_VERSION@
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000286-Cflags: -I${includedir} @GPGME_CONFIG_CFLAGS@
287-Libs: -L${libdir} @GPGME_CONFIG_LIBS@
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500288+Cflags: -I${includedir}
Brad Bishopc342db32019-05-15 21:57:59 -0400289+Libs: -L${libdir} -lgpgme
290 URL: https://www.gnupg.org/software/gpgme/index.html