Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | Update gpgme to use pkgconfig instead of -config files since its |
| 2 | simpler and less error prone when cross compiling. |
| 3 | |
| 4 | Upstream-Status: Denied [Upstream not interested in pkg-config support] |
| 5 | RP 2015/4/17 |
| 6 | |
| 7 | diff --git a/configure.ac b/configure.ac |
| 8 | index 298a22b..c778b61 100644 |
| 9 | --- a/configure.ac |
| 10 | +++ b/configure.ac |
| 11 | @@ -622,6 +622,7 @@ AC_CONFIG_FILES(Makefile src/Makefile |
| 12 | src/versioninfo.rc |
| 13 | src/gpgme.h) |
| 14 | AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config) |
| 15 | +AC_CONFIG_FILES(src/gpgme.pc src/gpgme-pthread.pc) |
| 16 | AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd]) |
| 17 | AC_OUTPUT |
| 18 | |
| 19 | diff --git a/src/Makefile.am b/src/Makefile.am |
| 20 | index 58922f9..40d0dca 100644 |
| 21 | --- a/src/Makefile.am |
| 22 | +++ b/src/Makefile.am |
| 23 | @@ -20,11 +20,13 @@ |
| 24 | |
| 25 | # Note: moc_kdpipeiodevice should actually be a dependecy below. |
| 26 | EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \ |
| 27 | - gpgme.h.in versioninfo.rc.in gpgme.def moc_kdpipeiodevice.cpp |
| 28 | + gpgme.h.in versioninfo.rc.in gpgme.def moc_kdpipeiodevice.cpp gpgme.pc.in gpgme-pthread.pc.in |
| 29 | |
| 30 | bin_SCRIPTS = gpgme-config |
| 31 | m4datadir = $(datadir)/aclocal |
| 32 | m4data_DATA = gpgme.m4 |
| 33 | +pkgconfigdir = $(libdir)/pkgconfig |
| 34 | +pkgconfig_DATA = gpgme.pc gpgme-pthread.pc |
| 35 | nodist_include_HEADERS = gpgme.h |
| 36 | |
| 37 | bin_PROGRAMS = gpgme-tool |
| 38 | diff --git a/src/gpgme-pthread.pc.in b/src/gpgme-pthread.pc.in |
| 39 | new file mode 100644 |
| 40 | index 0000000..980a48e |
| 41 | --- /dev/null |
| 42 | +++ b/src/gpgme-pthread.pc.in |
| 43 | @@ -0,0 +1,15 @@ |
| 44 | +prefix=@prefix@ |
| 45 | +exec_prefix=@exec_prefix@ |
| 46 | +libdir=@libdir@ |
| 47 | +includedir=@includedir@ |
| 48 | + |
| 49 | +# API info |
| 50 | +api_version=@GPGME_CONFIG_API_VERSION@ |
| 51 | +host=@GPGME_CONFIG_HOST@ |
| 52 | + |
| 53 | +Name: gpgme |
| 54 | +Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program (threaded version) |
| 55 | +Version: @VERSION@ |
| 56 | +Libs: -L${libdir} -lgpgme-pthread -lpthread |
| 57 | +Cflags: -I${includedir} |
| 58 | +Requires: libassuan gpg-error |
| 59 | diff --git a/src/gpgme.m4 b/src/gpgme.m4 |
| 60 | index 6c2be44..d8a75cb 100644 |
| 61 | --- a/src/gpgme.m4 |
| 62 | +++ b/src/gpgme.m4 |
| 63 | @@ -79,7 +79,7 @@ dnl config script does not match the host specification the script |
| 64 | dnl is added to the gpg_config_script_warn variable. |
| 65 | dnl |
| 66 | AC_DEFUN([AM_PATH_GPGME], |
| 67 | -[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl |
| 68 | +[ |
| 69 | tmp=ifelse([$1], ,1:0.4.2,$1) |
| 70 | if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then |
| 71 | req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` |
| 72 | @@ -89,36 +89,12 @@ AC_DEFUN([AM_PATH_GPGME], |
| 73 | min_gpgme_version="$tmp" |
| 74 | fi |
| 75 | |
| 76 | - AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) |
| 77 | - ok=no |
| 78 | - if test "$GPGME_CONFIG" != "no" ; then |
| 79 | - req_major=`echo $min_gpgme_version | \ |
| 80 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 81 | - req_minor=`echo $min_gpgme_version | \ |
| 82 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 83 | - req_micro=`echo $min_gpgme_version | \ |
| 84 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 85 | - if test "$gpgme_version_major" -gt "$req_major"; then |
| 86 | - ok=yes |
| 87 | - else |
| 88 | - if test "$gpgme_version_major" -eq "$req_major"; then |
| 89 | - if test "$gpgme_version_minor" -gt "$req_minor"; then |
| 90 | - ok=yes |
| 91 | - else |
| 92 | - if test "$gpgme_version_minor" -eq "$req_minor"; then |
| 93 | - if test "$gpgme_version_micro" -ge "$req_micro"; then |
| 94 | - ok=yes |
| 95 | - fi |
| 96 | - fi |
| 97 | - fi |
| 98 | - fi |
| 99 | - fi |
| 100 | - fi |
| 101 | + PKG_CHECK_MODULES(GPGME, [gpgme >= $min_gpgme_version], [ok=yes], [ok=no]) |
| 102 | if test $ok = yes; then |
| 103 | # If we have a recent GPGME, we should also check that the |
| 104 | # API is compatible. |
| 105 | if test "$req_gpgme_api" -gt 0 ; then |
| 106 | - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` |
| 107 | + tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0` |
| 108 | if test "$tmp" -gt 0 ; then |
| 109 | if test "$req_gpgme_api" -ne "$tmp" ; then |
| 110 | ok=no |
| 111 | @@ -127,19 +103,11 @@ AC_DEFUN([AM_PATH_GPGME], |
| 112 | fi |
| 113 | fi |
| 114 | if test $ok = yes; then |
| 115 | - GPGME_CFLAGS=`$GPGME_CONFIG --cflags` |
| 116 | - GPGME_LIBS=`$GPGME_CONFIG --libs` |
| 117 | - AC_MSG_RESULT(yes) |
| 118 | ifelse([$2], , :, [$2]) |
| 119 | _AM_PATH_GPGME_CONFIG_HOST_CHECK |
| 120 | else |
| 121 | - GPGME_CFLAGS="" |
| 122 | - GPGME_LIBS="" |
| 123 | - AC_MSG_RESULT(no) |
| 124 | ifelse([$3], , :, [$3]) |
| 125 | fi |
| 126 | - AC_SUBST(GPGME_CFLAGS) |
| 127 | - AC_SUBST(GPGME_LIBS) |
| 128 | ]) |
| 129 | |
| 130 | dnl AM_PATH_GPGME_PTHREAD([MINIMUM-VERSION, |
| 131 | @@ -148,7 +116,7 @@ dnl Test for libgpgme and define GPGME_PTHREAD_CFLAGS |
| 132 | dnl and GPGME_PTHREAD_LIBS. |
| 133 | dnl |
| 134 | AC_DEFUN([AM_PATH_GPGME_PTHREAD], |
| 135 | -[ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl |
| 136 | +[ |
| 137 | tmp=ifelse([$1], ,1:0.4.2,$1) |
| 138 | if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then |
| 139 | req_gpgme_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'` |
| 140 | @@ -158,38 +126,12 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD], |
| 141 | min_gpgme_version="$tmp" |
| 142 | fi |
| 143 | |
| 144 | - AC_MSG_CHECKING(for GPGME pthread - version >= $min_gpgme_version) |
| 145 | - ok=no |
| 146 | - if test "$GPGME_CONFIG" != "no" ; then |
| 147 | - if `$GPGME_CONFIG --thread=pthread 2> /dev/null` ; then |
| 148 | - req_major=`echo $min_gpgme_version | \ |
| 149 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 150 | - req_minor=`echo $min_gpgme_version | \ |
| 151 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 152 | - req_micro=`echo $min_gpgme_version | \ |
| 153 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 154 | - if test "$gpgme_version_major" -gt "$req_major"; then |
| 155 | - ok=yes |
| 156 | - else |
| 157 | - if test "$gpgme_version_major" -eq "$req_major"; then |
| 158 | - if test "$gpgme_version_minor" -gt "$req_minor"; then |
| 159 | - ok=yes |
| 160 | - else |
| 161 | - if test "$gpgme_version_minor" -eq "$req_minor"; then |
| 162 | - if test "$gpgme_version_micro" -ge "$req_micro"; then |
| 163 | - ok=yes |
| 164 | - fi |
| 165 | - fi |
| 166 | - fi |
| 167 | - fi |
| 168 | - fi |
| 169 | - fi |
| 170 | - fi |
| 171 | + PKG_CHECK_MODULES(GPGME_PTHREAD, [gpgme-pthread >= $min_gpgme_version], [ok=yes], [ok=no]) |
| 172 | if test $ok = yes; then |
| 173 | # If we have a recent GPGME, we should also check that the |
| 174 | # API is compatible. |
| 175 | if test "$req_gpgme_api" -gt 0 ; then |
| 176 | - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` |
| 177 | + tmp=`$PKG_CONFIG --variable=api_version gpgme-pthread 2>/dev/null || echo 0` |
| 178 | if test "$tmp" -gt 0 ; then |
| 179 | if test "$req_gpgme_api" -ne "$tmp" ; then |
| 180 | ok=no |
| 181 | @@ -198,19 +140,11 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD], |
| 182 | fi |
| 183 | fi |
| 184 | if test $ok = yes; then |
| 185 | - GPGME_PTHREAD_CFLAGS=`$GPGME_CONFIG --thread=pthread --cflags` |
| 186 | - GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs` |
| 187 | - AC_MSG_RESULT(yes) |
| 188 | ifelse([$2], , :, [$2]) |
| 189 | _AM_PATH_GPGME_CONFIG_HOST_CHECK |
| 190 | else |
| 191 | - GPGME_PTHREAD_CFLAGS="" |
| 192 | - GPGME_PTHREAD_LIBS="" |
| 193 | - AC_MSG_RESULT(no) |
| 194 | ifelse([$3], , :, [$3]) |
| 195 | fi |
| 196 | - AC_SUBST(GPGME_PTHREAD_CFLAGS) |
| 197 | - AC_SUBST(GPGME_PTHREAD_LIBS) |
| 198 | ]) |
| 199 | |
| 200 | |
| 201 | @@ -229,36 +163,12 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], |
| 202 | min_gpgme_version="$tmp" |
| 203 | fi |
| 204 | |
| 205 | - AC_MSG_CHECKING(for GPGME - version >= $min_gpgme_version) |
| 206 | - ok=no |
| 207 | - if test "$GPGME_CONFIG" != "no" ; then |
| 208 | - req_major=`echo $min_gpgme_version | \ |
| 209 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 210 | - req_minor=`echo $min_gpgme_version | \ |
| 211 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 212 | - req_micro=`echo $min_gpgme_version | \ |
| 213 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` |
| 214 | - if test "$gpgme_version_major" -gt "$req_major"; then |
| 215 | - ok=yes |
| 216 | - else |
| 217 | - if test "$gpgme_version_major" -eq "$req_major"; then |
| 218 | - if test "$gpgme_version_minor" -gt "$req_minor"; then |
| 219 | - ok=yes |
| 220 | - else |
| 221 | - if test "$gpgme_version_minor" -eq "$req_minor"; then |
| 222 | - if test "$gpgme_version_micro" -ge "$req_micro"; then |
| 223 | - ok=yes |
| 224 | - fi |
| 225 | - fi |
| 226 | - fi |
| 227 | - fi |
| 228 | - fi |
| 229 | - fi |
| 230 | + PKG_CHECK_MODULES(GPGME_GLIB, [gpgme >= $min_gpgme_version glib-2.0], [ok=yes], [ok=no]) |
| 231 | if test $ok = yes; then |
| 232 | # If we have a recent GPGME, we should also check that the |
| 233 | # API is compatible. |
| 234 | if test "$req_gpgme_api" -gt 0 ; then |
| 235 | - tmp=`$GPGME_CONFIG --api-version 2>/dev/null || echo 0` |
| 236 | + tmp=`$PKG_CONFIG --variable=api_version gpgme 2>/dev/null || echo 0` |
| 237 | if test "$tmp" -gt 0 ; then |
| 238 | if test "$req_gpgme_api" -ne "$tmp" ; then |
| 239 | ok=no |
| 240 | @@ -267,17 +177,9 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], |
| 241 | fi |
| 242 | fi |
| 243 | if test $ok = yes; then |
| 244 | - GPGME_GLIB_CFLAGS=`$GPGME_CONFIG --glib --cflags` |
| 245 | - GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs` |
| 246 | - AC_MSG_RESULT(yes) |
| 247 | ifelse([$2], , :, [$2]) |
| 248 | _AM_PATH_GPGME_CONFIG_HOST_CHECK |
| 249 | else |
| 250 | - GPGME_GLIB_CFLAGS="" |
| 251 | - GPGME_GLIB_LIBS="" |
| 252 | - AC_MSG_RESULT(no) |
| 253 | ifelse([$3], , :, [$3]) |
| 254 | fi |
| 255 | - AC_SUBST(GPGME_GLIB_CFLAGS) |
| 256 | - AC_SUBST(GPGME_GLIB_LIBS) |
| 257 | ]) |
| 258 | diff --git a/src/gpgme.pc.in b/src/gpgme.pc.in |
| 259 | new file mode 100644 |
| 260 | index 0000000..b69539f |
| 261 | --- /dev/null |
| 262 | +++ b/src/gpgme.pc.in |
| 263 | @@ -0,0 +1,15 @@ |
| 264 | +prefix=@prefix@ |
| 265 | +exec_prefix=@exec_prefix@ |
| 266 | +libdir=@libdir@ |
| 267 | +includedir=@includedir@ |
| 268 | + |
| 269 | +# API info |
| 270 | +api_version=@GPGME_CONFIG_API_VERSION@ |
| 271 | +host=@GPGME_CONFIG_HOST@ |
| 272 | + |
| 273 | +Name: gpgme |
| 274 | +Description: GnuPG Made Easy (GPGME) is a C language library that allows to addsupport for cryptography to a program. |
| 275 | +Version: @VERSION@ |
| 276 | +Libs: -L${libdir} -lgpgme |
| 277 | +Cflags: -I${includedir} |
| 278 | +Requires: libassuan gpg-error |
| 279 | \ No newline at end of file |