Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From ec309e20b5a27d42a5fb915c328d61e924ab5f19 Mon Sep 17 00:00:00 2001 |
| 2 | From: Hongxu Jia <hongxu.jia@windriver.com> |
| 3 | Date: Thu, 29 Mar 2018 15:12:17 +0800 |
| 4 | Subject: [PATCH] support pkgconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | |
| 6 | Upstream-Status: Pending |
| 7 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 8 | Rebase to 1.28 |
| 9 | |
| 10 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> |
| 11 | --- |
| 12 | configure.ac | 1 + |
| 13 | src/Makefile.am | 4 ++- |
| 14 | src/gpg-error.m4 | 71 +++-------------------------------------------------- |
| 15 | src/gpg-error.pc.in | 11 +++++++++ |
| 16 | 4 files changed, 18 insertions(+), 69 deletions(-) |
| 17 | create mode 100644 src/gpg-error.pc.in |
| 18 | |
| 19 | diff --git a/configure.ac b/configure.ac |
| 20 | index aca9300..f7794e9 100644 |
| 21 | --- a/configure.ac |
| 22 | +++ b/configure.ac |
| 23 | @@ -621,6 +621,7 @@ AC_CONFIG_FILES([src/Makefile tests/Makefile]) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 24 | AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd]) |
| 25 | AC_CONFIG_FILES([src/versioninfo.rc src/gpg-error.w32-manifest]) |
| 26 | AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config]) |
| 27 | +AC_CONFIG_FILES([src/gpg-error.pc]) |
| 28 | |
| 29 | AC_OUTPUT |
| 30 | |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 31 | diff --git a/src/Makefile.am b/src/Makefile.am |
| 32 | index 268c2ab..95f8459 100644 |
| 33 | --- a/src/Makefile.am |
| 34 | +++ b/src/Makefile.am |
| 35 | @@ -87,6 +87,8 @@ bin_SCRIPTS = gpg-error-config |
| 36 | nodist_bin_SCRIPTS = gpgrt-config |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | m4datadir = $(datadir)/aclocal |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 38 | m4data_DATA = gpg-error.m4 gpgrt.m4 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | +pkgconfigdir = $(libdir)/pkgconfig |
| 40 | +pkgconfig_DATA = gpg-error.pc |
| 41 | |
| 42 | EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ |
| 43 | mkerrnos.awk errnos.in README \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 44 | @@ -94,7 +96,7 @@ EXTRA_DIST = mkstrtable.awk err-sources.h.in err-codes.h.in \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | mkheader.c gpg-error.h.in mkw32errmap.c w32-add.h w32ce-add.h \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 46 | err-sources.h err-codes.h gpg-error-config.in gpg-error.m4 gpgrt.m4 \ |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 47 | gpg-error.vers gpg-error.def.in \ |
| 48 | - versioninfo.rc.in gpg-error.w32-manifest.in \ |
| 49 | + versioninfo.rc.in gpg-error.w32-manifest.in gpg-error.pc \ |
| 50 | $(lock_obj_pub) |
| 51 | |
| 52 | BUILT_SOURCES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \ |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 53 | diff --git a/src/gpg-error.m4 b/src/gpg-error.m4 |
| 54 | index 60c88d8..2ef7e3e 100644 |
| 55 | --- a/src/gpg-error.m4 |
| 56 | +++ b/src/gpg-error.m4 |
| 57 | @@ -26,73 +26,13 @@ dnl is added to the gpg_config_script_warn variable. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 58 | dnl |
| 59 | AC_DEFUN([AM_PATH_GPG_ERROR], |
| 60 | [ AC_REQUIRE([AC_CANONICAL_HOST]) |
| 61 | - gpg_error_config_prefix="" |
| 62 | - dnl --with-libgpg-error-prefix=PFX is the preferred name for this option, |
| 63 | - dnl since that is consistent with how our three siblings use the directory/ |
| 64 | - dnl package name in --with-$dir_name-prefix=PFX. |
| 65 | - AC_ARG_WITH(libgpg-error-prefix, |
| 66 | - AC_HELP_STRING([--with-libgpg-error-prefix=PFX], |
| 67 | - [prefix where GPG Error is installed (optional)]), |
| 68 | - [gpg_error_config_prefix="$withval"]) |
| 69 | - |
| 70 | - dnl Accept --with-gpg-error-prefix and make it work the same as |
| 71 | - dnl --with-libgpg-error-prefix above, for backwards compatibility, |
| 72 | - dnl but do not document this old, inconsistently-named option. |
| 73 | - AC_ARG_WITH(gpg-error-prefix,, |
| 74 | - [gpg_error_config_prefix="$withval"]) |
| 75 | + min_gpg_error_version=ifelse([$1], ,0.0,$1) |
| 76 | |
| 77 | - if test x"${GPG_ERROR_CONFIG}" = x ; then |
| 78 | - if test x"${gpg_error_config_prefix}" != x ; then |
| 79 | - GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config" |
| 80 | - else |
| 81 | - case "${SYSROOT}" in |
| 82 | - /*) |
| 83 | - if test -x "${SYSROOT}/bin/gpg-error-config" ; then |
| 84 | - GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config" |
| 85 | - fi |
| 86 | - ;; |
| 87 | - '') |
| 88 | - ;; |
| 89 | - *) |
| 90 | - AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) |
| 91 | - ;; |
| 92 | - esac |
| 93 | - fi |
| 94 | - fi |
| 95 | + PKG_CHECK_MODULES(GPG_ERROR, [gpg-error >= $min_gpg_error_version], [ok=yes], [ok=no]) |
| 96 | |
| 97 | - AC_PATH_PROG(GPG_ERROR_CONFIG, gpg-error-config, no) |
| 98 | - min_gpg_error_version=ifelse([$1], ,0.0,$1) |
| 99 | - AC_MSG_CHECKING(for GPG Error - version >= $min_gpg_error_version) |
| 100 | - ok=no |
| 101 | - if test "$GPG_ERROR_CONFIG" != "no" \ |
| 102 | - && test -f "$GPG_ERROR_CONFIG" ; then |
| 103 | - req_major=`echo $min_gpg_error_version | \ |
| 104 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\1/'` |
| 105 | - req_minor=`echo $min_gpg_error_version | \ |
| 106 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\)/\2/'` |
| 107 | - gpg_error_config_version=`$GPG_ERROR_CONFIG $gpg_error_config_args --version` |
| 108 | - major=`echo $gpg_error_config_version | \ |
| 109 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` |
| 110 | - minor=`echo $gpg_error_config_version | \ |
| 111 | - sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` |
| 112 | - if test "$major" -gt "$req_major"; then |
| 113 | - ok=yes |
| 114 | - else |
| 115 | - if test "$major" -eq "$req_major"; then |
| 116 | - if test "$minor" -ge "$req_minor"; then |
| 117 | - ok=yes |
| 118 | - fi |
| 119 | - fi |
| 120 | - fi |
| 121 | - fi |
| 122 | if test $ok = yes; then |
| 123 | - GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` |
| 124 | - GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` |
| 125 | - GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null` |
| 126 | - GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null` |
| 127 | - AC_MSG_RESULT([yes ($gpg_error_config_version)]) |
| 128 | ifelse([$2], , :, [$2]) |
| 129 | - gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none` |
| 130 | + gpg_error_config_host=`$PKG_CONFIG --variable=host gpg-error` |
| 131 | if test x"$gpg_error_config_host" != xnone ; then |
| 132 | if test x"$gpg_error_config_host" != x"$host" ; then |
| 133 | AC_MSG_WARN([[ |
| 134 | @@ -107,11 +47,6 @@ AC_DEFUN([AM_PATH_GPG_ERROR], |
| 135 | fi |
| 136 | fi |
| 137 | else |
| 138 | - GPG_ERROR_CFLAGS="" |
| 139 | - GPG_ERROR_LIBS="" |
| 140 | - GPG_ERROR_MT_CFLAGS="" |
| 141 | - GPG_ERROR_MT_LIBS="" |
| 142 | - AC_MSG_RESULT(no) |
| 143 | ifelse([$3], , :, [$3]) |
| 144 | fi |
| 145 | AC_SUBST(GPG_ERROR_CFLAGS) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 146 | diff --git a/src/gpg-error.pc.in b/src/gpg-error.pc.in |
| 147 | new file mode 100644 |
| 148 | index 0000000..bc0b174 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 149 | --- /dev/null |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 150 | +++ b/src/gpg-error.pc.in |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 151 | @@ -0,0 +1,11 @@ |
| 152 | +prefix=@prefix@ |
| 153 | +exec_prefix=@exec_prefix@ |
| 154 | +libdir=@libdir@ |
| 155 | +includedir=@includedir@ |
| 156 | +host=@GPG_ERROR_CONFIG_HOST@ |
| 157 | + |
| 158 | +Name: gpg-error |
| 159 | +Description: a library that defines common error values for all GnuPG components |
| 160 | +Version: @VERSION@ |
| 161 | +Libs: -L${libdir} -lgpg-error |
| 162 | +Cflags: -I${includedir} |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 163 | -- |
| 164 | 1.8.3.1 |
| 165 | |