blob: 35c6b4056cd2697e4945779ef8719805876b313a [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001From 98ce65902b197faa8f660564613ca2e504c2f8f8 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>
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018---
19 configure.ac | 1 +
20 src/Makefile.am | 4 +-
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000021 src/gpgme-pthread.pc.in | 15 ++++++
22 src/gpgme.m4 | 114 +++-------------------------------------
Brad Bishopc342db32019-05-15 21:57:59 -040023 src/gpgme.pc.in | 4 +-
24 5 files changed, 28 insertions(+), 110 deletions(-)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050025 create mode 100644 src/gpgme-pthread.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -050026
27diff --git a/configure.ac b/configure.ac
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000028index 80ce79c..d7c0ac1 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029--- a/configure.ac
30+++ b/configure.ac
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000031@@ -905,6 +905,7 @@ AC_CONFIG_FILES(Makefile src/Makefile
Brad Bishopc342db32019-05-15 21:57:59 -040032 src/gpgme-glib.pc
Brad Bishopd7bf8c12018-02-25 22:55:05 -050033 src/gpgme.h)
34 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
Brad Bishopc342db32019-05-15 21:57:59 -040035+AC_CONFIG_FILES(src/gpgme-pthread.pc)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050036 AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
Brad Bishopc342db32019-05-15 21:57:59 -040037 AC_CONFIG_FILES(lang/cpp/tests/Makefile)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050039diff --git a/src/Makefile.am b/src/Makefile.am
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000040index 39c341f..3aca716 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041--- a/src/Makefile.am
42+++ b/src/Makefile.am
Brad Bishopc342db32019-05-15 21:57:59 -040043@@ -20,11 +20,11 @@
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044 ## Process this file with automake to produce Makefile.in
45
Brad Bishopc342db32019-05-15 21:57:59 -040046 pkgconfigdir = $(libdir)/pkgconfig
47-pkgconfig_DATA = gpgme.pc gpgme-glib.pc
48+pkgconfig_DATA = gpgme.pc gpgme-glib.pc gpgme-pthread.pc
49
Brad Bishopd7bf8c12018-02-25 22:55:05 -050050 EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \
Brad Bishopc342db32019-05-15 21:57:59 -040051 gpgme.h.in versioninfo.rc.in gpgme.def \
52- gpgme.pc.in gpgme-glib.pc.in
53+ gpgme.pc.in gpgme-glib.pc.in gpgme-pthread.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -050054
55 bin_SCRIPTS = gpgme-config
56 m4datadir = $(datadir)/aclocal
Brad Bishopd7bf8c12018-02-25 22:55:05 -050057diff --git a/src/gpgme-pthread.pc.in b/src/gpgme-pthread.pc.in
58new file mode 100644
59index 0000000..074bbf6
60--- /dev/null
61+++ b/src/gpgme-pthread.pc.in
62@@ -0,0 +1,15 @@
63+prefix=@prefix@
64+exec_prefix=@exec_prefix@
65+libdir=@libdir@
66+includedir=@includedir@
67+
68+# API info
69+api_version=@GPGME_CONFIG_API_VERSION@
70+host=@GPGME_CONFIG_HOST@
71+
72+Name: gpgme
73+Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program (deprecated)
74+Version: @VERSION@
75+Libs: -L${libdir} -lgpgme -lpthread
76+Cflags: -I${includedir}
77+Requires: libassuan gpg-error
78diff --git a/src/gpgme.m4 b/src/gpgme.m4
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000079index 71b0010..30ec151 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050080--- a/src/gpgme.m4
81+++ b/src/gpgme.m4
82@@ -79,7 +79,7 @@ dnl config script does not match the host specification the script
83 dnl is added to the gpg_config_script_warn variable.
84 dnl
85 AC_DEFUN([AM_PATH_GPGME],
86-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
87+[
88 tmp=ifelse([$1], ,1:0.4.2,$1)
89 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
90 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
91@@ -89,36 +89,12 @@ AC_DEFUN([AM_PATH_GPGME],
92 min_gpgme_version="$tmp"
93 fi
94
95- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
96- ok=no
97- if test "$GPGME_CONFIG" != "no" ; then
98- req_major=`echo $min_gpgme_version | \
99- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
100- req_minor=`echo $min_gpgme_version | \
101- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
102- req_micro=`echo $min_gpgme_version | \
103- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
104- if test "$gpgme_version_major" -gt "$req_major"; then
105- ok=yes
106- else
107- if test "$gpgme_version_major" -eq "$req_major"; then
108- if test "$gpgme_version_minor" -gt "$req_minor"; then
109- ok=yes
110- else
111- if test "$gpgme_version_minor" -eq "$req_minor"; then
112- if test "$gpgme_version_micro" -ge "$req_micro"; then
113- ok=yes
114- fi
115- fi
116- fi
117- fi
118- fi
119- fi
120+ PKG_CHECK_MODULES(GPGME, [gpgme >= $min_gpgme_version], [ok=yes], [ok=no])
121 if test $ok = yes; then
122 # If we have a recent GPGME, we should also check that the
123 # API is compatible.
124 if test "$req_gpgme_api" -gt 0 ; then
125- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
126+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
127 if test "$tmp" -gt 0 ; then
128 if test "$req_gpgme_api" -ne "$tmp" ; then
129 ok=no
130@@ -127,19 +103,11 @@ AC_DEFUN([AM_PATH_GPGME],
131 fi
132 fi
133 if test $ok = yes; then
134- GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
135- GPGME_LIBS=`$GPGME_CONFIG --libs`
136- AC_MSG_RESULT(yes)
137 ifelse([$2], , :, [$2])
138 _AM_PATH_GPGME_CONFIG_HOST_CHECK
139 else
140- GPGME_CFLAGS=""
141- GPGME_LIBS=""
142- AC_MSG_RESULT(no)
143 ifelse([$3], , :, [$3])
144 fi
145- AC_SUBST(GPGME_CFLAGS)
146- AC_SUBST(GPGME_LIBS)
147 ])
148
149 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
150@@ -148,7 +116,7 @@ dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
151 dnl and GPGME_PTHREAD_LIBS.
152 dnl
153 AC_DEFUN([AM_PATH_GPGME_PTHREAD],
154-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
155+[
156 tmp=ifelse([$1], ,1:0.4.2,$1)
157 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
158 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
159@@ -158,38 +126,12 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
160 min_gpgme_version="$tmp"
161 fi
162
163- AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
164- ok=no
165- if test "$GPGME_CONFIG" != "no" ; then
166- if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
167- req_major=`echo $min_gpgme_version | \
168- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
169- req_minor=`echo $min_gpgme_version | \
170- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
171- req_micro=`echo $min_gpgme_version | \
172- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
173- if test "$gpgme_version_major" -gt "$req_major"; then
174- ok=yes
175- else
176- if test "$gpgme_version_major" -eq "$req_major"; then
177- if test "$gpgme_version_minor" -gt "$req_minor"; then
178- ok=yes
179- else
180- if test "$gpgme_version_minor" -eq "$req_minor"; then
181- if test "$gpgme_version_micro" -ge "$req_micro"; then
182- ok=yes
183- fi
184- fi
185- fi
186- fi
187- fi
188- fi
189- fi
190+ PKG_CHECK_MODULES(GPGME_PTHREAD, [gpgme-pthread >= $min_gpgme_version], [ok=yes], [ok=no])
191 if test $ok = yes; then
192 # If we have a recent GPGME, we should also check that the
193 # API is compatible.
194 if test "$req_gpgme_api" -gt 0 ; then
195- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
196+ tmp=`$PKG_CONFIG --variable=api_version gpgme-pthread 2>/dev/null || echo 0`
197 if test "$tmp" -gt 0 ; then
198 if test "$req_gpgme_api" -ne "$tmp" ; then
199 ok=no
200@@ -198,19 +140,11 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
201 fi
202 fi
203 if test $ok = yes; then
204- GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
205- GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
206- AC_MSG_RESULT(yes)
207 ifelse([$2], , :, [$2])
208 _AM_PATH_GPGME_CONFIG_HOST_CHECK
209 else
210- GPGME_PTHREAD_CFLAGS=""
211- GPGME_PTHREAD_LIBS=""
212- AC_MSG_RESULT(no)
213 ifelse([$3], , :, [$3])
214 fi
215- AC_SUBST(GPGME_PTHREAD_CFLAGS)
216- AC_SUBST(GPGME_PTHREAD_LIBS)
217 ])
218
219
220@@ -229,36 +163,12 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
221 min_gpgme_version="$tmp"
222 fi
223
224- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
225- ok=no
226- if test "$GPGME_CONFIG" != "no" ; then
227- req_major=`echo $min_gpgme_version | \
228- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
229- req_minor=`echo $min_gpgme_version | \
230- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
231- req_micro=`echo $min_gpgme_version | \
232- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
233- if test "$gpgme_version_major" -gt "$req_major"; then
234- ok=yes
235- else
236- if test "$gpgme_version_major" -eq "$req_major"; then
237- if test "$gpgme_version_minor" -gt "$req_minor"; then
238- ok=yes
239- else
240- if test "$gpgme_version_minor" -eq "$req_minor"; then
241- if test "$gpgme_version_micro" -ge "$req_micro"; then
242- ok=yes
243- fi
244- fi
245- fi
246- fi
247- fi
248- fi
249+ PKG_CHECK_MODULES(GPGME_GLIB, [gpgme >= $min_gpgme_version glib-2.0], [ok=yes], [ok=no])
250 if test $ok = yes; then
251 # If we have a recent GPGME, we should also check that the
252 # API is compatible.
253 if test "$req_gpgme_api" -gt 0 ; then
254- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
255+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
256 if test "$tmp" -gt 0 ; then
257 if test "$req_gpgme_api" -ne "$tmp" ; then
258 ok=no
259@@ -267,17 +177,9 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
260 fi
261 fi
262 if test $ok = yes; then
263- GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
264- GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
265- AC_MSG_RESULT(yes)
266 ifelse([$2], , :, [$2])
267 _AM_PATH_GPGME_CONFIG_HOST_CHECK
268 else
269- GPGME_GLIB_CFLAGS=""
270- GPGME_GLIB_LIBS=""
271- AC_MSG_RESULT(no)
272 ifelse([$3], , :, [$3])
273 fi
274- AC_SUBST(GPGME_GLIB_CFLAGS)
275- AC_SUBST(GPGME_GLIB_LIBS)
276 ])
277diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000278index 80d59de..932645b 100644
Brad Bishopc342db32019-05-15 21:57:59 -0400279--- a/src/gpgme.pc.in
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500280+++ b/src/gpgme.pc.in
Brad Bishopc342db32019-05-15 21:57:59 -0400281@@ -9,6 +9,6 @@ Name: gpgme
282 Description: GnuPG Made Easy to access GnuPG
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000283 Requires.private: gpg-error, libassuan
Brad Bishopc342db32019-05-15 21:57:59 -0400284 Version: @PACKAGE_VERSION@
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000285-Cflags: -I${includedir} @GPGME_CONFIG_CFLAGS@
286-Libs: -L${libdir} @GPGME_CONFIG_LIBS@
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500287+Cflags: -I${includedir}
Brad Bishopc342db32019-05-15 21:57:59 -0400288+Libs: -L${libdir} -lgpgme
289 URL: https://www.gnupg.org/software/gpgme/index.html
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500290--
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00002912.25.1
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500292