blob: 176723cd1687914bad90c919e7419763f4215de2 [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001From 6492c952d61bb93a8bf8200c093d7e491456aa5a Mon Sep 17 00:00:00 2001
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002From: Richard Purdie <richard.purdie@linuxfoundation.org>
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08003Date: Fri, 29 Jun 2018 14:35:41 +0800
4Subject: [PATCH 1/7] 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 Bishop1a4b7ee2018-12-16 17:11:34 -080014Rebase to 1.11.1
Brad Bishopd7bf8c12018-02-25 22:55:05 -050015
16Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
17---
18 configure.ac | 1 +
19 src/Makefile.am | 4 +-
20 src/gpgme-pthread.pc.in | 15 +++++++
21 src/gpgme.m4 | 114 ++++--------------------------------------------
22 src/gpgme.pc.in | 15 +++++++
23 5 files changed, 42 insertions(+), 107 deletions(-)
24 create mode 100644 src/gpgme-pthread.pc.in
25 create mode 100644 src/gpgme.pc.in
26
27diff --git a/configure.ac b/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040028index af569ac..865bd10 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050029--- a/configure.ac
30+++ b/configure.ac
Brad Bishop19323692019-04-05 15:28:33 -040031@@ -895,6 +895,7 @@ AC_CONFIG_FILES(Makefile src/Makefile
Brad Bishopd7bf8c12018-02-25 22:55:05 -050032 src/versioninfo.rc
33 src/gpgme.h)
34 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
35+AC_CONFIG_FILES(src/gpgme.pc src/gpgme-pthread.pc)
36 AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
37 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
38 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
39diff --git a/src/Makefile.am b/src/Makefile.am
Brad Bishop19323692019-04-05 15:28:33 -040040index 1394c02..8451c3a 100644
Brad Bishopd7bf8c12018-02-25 22:55:05 -050041--- a/src/Makefile.am
42+++ b/src/Makefile.am
43@@ -19,12 +19,14 @@
44 ## Process this file with automake to produce Makefile.in
45
46 EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \
47- gpgme.h.in versioninfo.rc.in gpgme.def
48+ gpgme.h.in versioninfo.rc.in gpgme.def gpgme.pc.in gpgme-pthread.pc.in
49
50 bin_SCRIPTS = gpgme-config
51 m4datadir = $(datadir)/aclocal
52 m4data_DATA = gpgme.m4
53 nodist_include_HEADERS = gpgme.h
54+pkgconfigdir = $(libdir)/pkgconfig
55+pkgconfig_DATA = gpgme.pc gpgme-pthread.pc
56
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080057 bin_PROGRAMS = gpgme-tool gpgme-json
Brad Bishopd7bf8c12018-02-25 22:55:05 -050058
59diff --git a/src/gpgme-pthread.pc.in b/src/gpgme-pthread.pc.in
60new file mode 100644
61index 0000000..074bbf6
62--- /dev/null
63+++ b/src/gpgme-pthread.pc.in
64@@ -0,0 +1,15 @@
65+prefix=@prefix@
66+exec_prefix=@exec_prefix@
67+libdir=@libdir@
68+includedir=@includedir@
69+
70+# API info
71+api_version=@GPGME_CONFIG_API_VERSION@
72+host=@GPGME_CONFIG_HOST@
73+
74+Name: gpgme
75+Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program (deprecated)
76+Version: @VERSION@
77+Libs: -L${libdir} -lgpgme -lpthread
78+Cflags: -I${includedir}
79+Requires: libassuan gpg-error
80diff --git a/src/gpgme.m4 b/src/gpgme.m4
81index 6c2be44..d8a75cb 100644
82--- a/src/gpgme.m4
83+++ b/src/gpgme.m4
84@@ -79,7 +79,7 @@ dnl config script does not match the host specification the script
85 dnl is added to the gpg_config_script_warn variable.
86 dnl
87 AC_DEFUN([AM_PATH_GPGME],
88-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
89+[
90 tmp=ifelse([$1], ,1:0.4.2,$1)
91 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
92 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
93@@ -89,36 +89,12 @@ AC_DEFUN([AM_PATH_GPGME],
94 min_gpgme_version="$tmp"
95 fi
96
97- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
98- ok=no
99- if test "$GPGME_CONFIG" != "no" ; then
100- req_major=`echo $min_gpgme_version | \
101- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
102- req_minor=`echo $min_gpgme_version | \
103- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
104- req_micro=`echo $min_gpgme_version | \
105- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
106- if test "$gpgme_version_major" -gt "$req_major"; then
107- ok=yes
108- else
109- if test "$gpgme_version_major" -eq "$req_major"; then
110- if test "$gpgme_version_minor" -gt "$req_minor"; then
111- ok=yes
112- else
113- if test "$gpgme_version_minor" -eq "$req_minor"; then
114- if test "$gpgme_version_micro" -ge "$req_micro"; then
115- ok=yes
116- fi
117- fi
118- fi
119- fi
120- fi
121- fi
122+ PKG_CHECK_MODULES(GPGME, [gpgme >= $min_gpgme_version], [ok=yes], [ok=no])
123 if test $ok = yes; then
124 # If we have a recent GPGME, we should also check that the
125 # API is compatible.
126 if test "$req_gpgme_api" -gt 0 ; then
127- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
128+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
129 if test "$tmp" -gt 0 ; then
130 if test "$req_gpgme_api" -ne "$tmp" ; then
131 ok=no
132@@ -127,19 +103,11 @@ AC_DEFUN([AM_PATH_GPGME],
133 fi
134 fi
135 if test $ok = yes; then
136- GPGME_CFLAGS=`$GPGME_CONFIG --cflags`
137- GPGME_LIBS=`$GPGME_CONFIG --libs`
138- AC_MSG_RESULT(yes)
139 ifelse([$2], , :, [$2])
140 _AM_PATH_GPGME_CONFIG_HOST_CHECK
141 else
142- GPGME_CFLAGS=""
143- GPGME_LIBS=""
144- AC_MSG_RESULT(no)
145 ifelse([$3], , :, [$3])
146 fi
147- AC_SUBST(GPGME_CFLAGS)
148- AC_SUBST(GPGME_LIBS)
149 ])
150
151 dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION,
152@@ -148,7 +116,7 @@ dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS
153 dnl and GPGME_PTHREAD_LIBS.
154 dnl
155 AC_DEFUN([AM_PATH_GPGME_PTHREAD],
156-[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl
157+[
158 tmp=ifelse([$1], ,1:0.4.2,$1)
159 if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
160 req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
161@@ -158,38 +126,12 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
162 min_gpgme_version="$tmp"
163 fi
164
165- AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version)
166- ok=no
167- if test "$GPGME_CONFIG" != "no" ; then
168- if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then
169- req_major=`echo $min_gpgme_version | \
170- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
171- req_minor=`echo $min_gpgme_version | \
172- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
173- req_micro=`echo $min_gpgme_version | \
174- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
175- if test "$gpgme_version_major" -gt "$req_major"; then
176- ok=yes
177- else
178- if test "$gpgme_version_major" -eq "$req_major"; then
179- if test "$gpgme_version_minor" -gt "$req_minor"; then
180- ok=yes
181- else
182- if test "$gpgme_version_minor" -eq "$req_minor"; then
183- if test "$gpgme_version_micro" -ge "$req_micro"; then
184- ok=yes
185- fi
186- fi
187- fi
188- fi
189- fi
190- fi
191- fi
192+ PKG_CHECK_MODULES(GPGME_PTHREAD, [gpgme-pthread >= $min_gpgme_version], [ok=yes], [ok=no])
193 if test $ok = yes; then
194 # If we have a recent GPGME, we should also check that the
195 # API is compatible.
196 if test "$req_gpgme_api" -gt 0 ; then
197- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
198+ tmp=`$PKG_CONFIG --variable=api_version gpgme-pthread 2>/dev/null || echo 0`
199 if test "$tmp" -gt 0 ; then
200 if test "$req_gpgme_api" -ne "$tmp" ; then
201 ok=no
202@@ -198,19 +140,11 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD],
203 fi
204 fi
205 if test $ok = yes; then
206- GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags`
207- GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs`
208- AC_MSG_RESULT(yes)
209 ifelse([$2], , :, [$2])
210 _AM_PATH_GPGME_CONFIG_HOST_CHECK
211 else
212- GPGME_PTHREAD_CFLAGS=""
213- GPGME_PTHREAD_LIBS=""
214- AC_MSG_RESULT(no)
215 ifelse([$3], , :, [$3])
216 fi
217- AC_SUBST(GPGME_PTHREAD_CFLAGS)
218- AC_SUBST(GPGME_PTHREAD_LIBS)
219 ])
220
221
222@@ -229,36 +163,12 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
223 min_gpgme_version="$tmp"
224 fi
225
226- AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version)
227- ok=no
228- if test "$GPGME_CONFIG" != "no" ; then
229- req_major=`echo $min_gpgme_version | \
230- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
231- req_minor=`echo $min_gpgme_version | \
232- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
233- req_micro=`echo $min_gpgme_version | \
234- sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
235- if test "$gpgme_version_major" -gt "$req_major"; then
236- ok=yes
237- else
238- if test "$gpgme_version_major" -eq "$req_major"; then
239- if test "$gpgme_version_minor" -gt "$req_minor"; then
240- ok=yes
241- else
242- if test "$gpgme_version_minor" -eq "$req_minor"; then
243- if test "$gpgme_version_micro" -ge "$req_micro"; then
244- ok=yes
245- fi
246- fi
247- fi
248- fi
249- fi
250- fi
251+ PKG_CHECK_MODULES(GPGME_GLIB, [gpgme >= $min_gpgme_version glib-2.0], [ok=yes], [ok=no])
252 if test $ok = yes; then
253 # If we have a recent GPGME, we should also check that the
254 # API is compatible.
255 if test "$req_gpgme_api" -gt 0 ; then
256- tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0`
257+ tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0`
258 if test "$tmp" -gt 0 ; then
259 if test "$req_gpgme_api" -ne "$tmp" ; then
260 ok=no
261@@ -267,17 +177,9 @@ AC_DEFUN([AM_PATH_GPGME_GLIB],
262 fi
263 fi
264 if test $ok = yes; then
265- GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags`
266- GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs`
267- AC_MSG_RESULT(yes)
268 ifelse([$2], , :, [$2])
269 _AM_PATH_GPGME_CONFIG_HOST_CHECK
270 else
271- GPGME_GLIB_CFLAGS=""
272- GPGME_GLIB_LIBS=""
273- AC_MSG_RESULT(no)
274 ifelse([$3], , :, [$3])
275 fi
276- AC_SUBST(GPGME_GLIB_CFLAGS)
277- AC_SUBST(GPGME_GLIB_LIBS)
278 ])
279diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in
280new file mode 100644
281index 0000000..b69539f
282--- /dev/null
283+++ b/src/gpgme.pc.in
284@@ -0,0 +1,15 @@
285+prefix=@prefix@
286+exec_prefix=@exec_prefix@
287+libdir=@libdir@
288+includedir=@includedir@
289+
290+# API info
291+api_version=@GPGME_CONFIG_API_VERSION@
292+host=@GPGME_CONFIG_HOST@
293+
294+Name: gpgme
295+Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program.
296+Version: @VERSION@
297+Libs: -L${libdir} -lgpgme
298+Cflags: -I${includedir}
299+Requires: libassuan gpg-error
300\ No newline at end of file
301--
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08003022.7.4
Brad Bishopd7bf8c12018-02-25 22:55:05 -0500303