From 0b0a2881ff7c8e54e82e2c736e9bc1e4af1d65b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Wed, 5 Jun 2024 17:20:12 +0200 Subject: [PATCH] build,qt: Support building Qt bindings as nested package of gpgme * autogen-all.sh (packages): Add lang/qt. * configure.ac: Add qt to available languages if subdir exists. Add qt to nested languages if enabled to generate corresponding make targets. Call configure script of nested qt package recursively. * lang/qt/configure.ac: Check if qgpgme is built as nested package and set GPGME_CFLAGS, GPGME_LIBS, GPGMEPP_CFLAGS, and GPGMEPP_LIBS accordingly. -- This re-adds the ability to build the Qt bindings together with gpgme with a single `configure && make` command (if building from git). GnuPG-bug-id: 7110 --- autogen-all.sh | 2 +- configure.ac | 10 +++++++++- lang/qt/configure.ac | 41 ++++++++++++++++++++++++++++++++++------- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/autogen-all.sh b/autogen-all.sh index a57863fe..88fb15f7 100755 --- a/autogen-all.sh +++ b/autogen-all.sh @@ -15,7 +15,7 @@ prog=$(basename "$0") -packages=". lang/cpp" +packages=". lang/cpp lang/qt" fatal () { echo "${prog}:" "$*" >&2 diff --git a/configure.ac b/configure.ac index bb21e754..7ec79226 100644 --- a/configure.ac +++ b/configure.ac @@ -238,7 +238,7 @@ have_macos_system=no build_w32_glib=no available_languages="cl" default_languages="cl" -for lang in cpp; do +for lang in cpp qt; do if test -d $srcdir/lang/$lang; then available_languages="$available_languages $lang" fi @@ -360,6 +360,10 @@ LIST_MEMBER("cpp", $enabled_languages) if test "$found" = "1"; then nested_languages="$nested_languages cpp" fi +LIST_MEMBER("qt", $enabled_languages) +if test "$found" = "1"; then + nested_languages="$nested_languages qt" +fi AC_SUBST(NESTED_LANGUAGES, $nested_languages) @@ -843,6 +847,10 @@ LIST_MEMBER("cpp", $enabled_languages) if test "$found" = "1"; then AC_CONFIG_SUBDIRS([lang/cpp]) fi +LIST_MEMBER("qt", $enabled_languages) +if test "$found" = "1"; then + AC_CONFIG_SUBDIRS([lang/qt]) +fi AC_OUTPUT diff --git a/lang/qt/configure.ac b/lang/qt/configure.ac index b99a74e8..e4f3666e 100644 --- a/lang/qt/configure.ac +++ b/lang/qt/configure.ac @@ -469,16 +469,43 @@ AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME, AM_CONDITIONAL(USE_GPGRT_CONFIG, [test -n "$GPGRT_CONFIG" \ -a "$ac_cv_path_GPG_ERROR_CONFIG" = no]) -# And for gpgme. +# Check for gpgme and gpgmepp. have_gpgme=no -AM_PATH_GPGME("$NEED_GPGME_VERSION", - have_gpgme=yes, have_gpgme=no) - -# And for gpgmepp. have_gpgmepp=no -AM_PATH_GPGMEPP("$NEED_GPGMEPP_VERSION", - have_gpgmepp=yes, have_gpgmepp=no) +# Check if qgpgme is built as nested package of gpgme +builddir=`pwd` +if test "${srcdir%/lang/qt}/lang/qt" == "$srcdir" -a \ + "${builddir%/lang/qt}/lang/qt" == "$builddir"; then + AC_MSG_CHECKING(for GpgME - assuming nested build) + gpgme_build_dir=${builddir%/lang/qt} + if test -f "$gpgme_build_dir/src/gpgme.h"; then + GPGME_CFLAGS="-I$gpgme_build_dir/src" + GPGME_LIBS="$gpgme_build_dir/src/libgpgme.la" + have_gpgme=yes + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + AC_MSG_CHECKING(for GpgME++ - assuming nested build) + gpgmepp_build_dir=${builddir%/lang/qt}/lang/cpp + if test -f "$gpgmepp_build_dir/src/gpgmepp_version.h"; then + GPGMEPP_CFLAGS="-I$gpgmepp_build_dir/src" + GPGMEPP_LIBS="$gpgmepp_build_dir/src/libgpgmepp.la" + have_gpgmepp=yes + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +fi +if test "$have_gpgme" = "no"; then + AM_PATH_GPGME("$NEED_GPGME_VERSION", + have_gpgme=yes, have_gpgme=no) +fi +if test "$have_gpgmepp" = "no"; then + AM_PATH_GPGMEPP("$NEED_GPGMEPP_VERSION", + have_gpgmepp=yes, have_gpgmepp=no) +fi # Last check. die=no