You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2017/06/14 17:41:30 UTC
svn commit: r1798731 - in /subversion/trunk: build/ac-macros/compiler.m4
build/ac-macros/kwallet.m4 subversion/libsvn_auth_kwallet/kwallet.cpp
Author: philip
Date: Wed Jun 14 17:41:29 2017
New Revision: 1798731
URL: http://svn.apache.org/viewvc?rev=1798731&view=rev
Log:
Add KDE 5 support to the KWallet auth provider. The --with-kwallet
option now looks for KDE 5 before looking for KDE 4. Both 4 and 5
use the same underlying storage and so passwords written by one can
be read by the other.
* build/ac-macros/kwallet.m4 (SVN_LIB_KWALLET): Detect KDE 4 and 5.
* build/ac-macros/compiler.m4 (SVN_CXX_MODE_SETUP11): New, set -std=c++11.
* subversion/libsvn_auth_kwallet/kwallet.cpp
(kwallet_password_get, kwallet_password_set): Support KDE 4 and 5.
Modified:
subversion/trunk/build/ac-macros/compiler.m4
subversion/trunk/build/ac-macros/kwallet.m4
subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp
Modified: subversion/trunk/build/ac-macros/compiler.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/compiler.m4?rev=1798731&r1=1798730&r2=1798731&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/compiler.m4 (original)
+++ subversion/trunk/build/ac-macros/compiler.m4 Wed Jun 14 17:41:29 2017
@@ -126,3 +126,18 @@ AC_DEFUN([SVN_CXX_MODE_SETUP],
SVN_CXXFLAGS_ADD_IFELSE([-Werror=unknown-warning-option])
fi
])
+
+dnl The KWallet provider needs to use C++11 mode when using KDE 5
+AC_DEFUN([SVN_CXX_MODE_SETUP11],
+[
+ CXXFLAGS_KEEP="$CXXFLAGS"
+ CXXFLAGS=""
+
+ if test "$GXX" = "yes"; then
+ SVN_CXXFLAGS_ADD_IFELSE([-std=c++11])
+ fi
+
+ CXXMODEFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS_KEEP"
+ AC_SUBST(CXXMODEFLAGS)
+])
Modified: subversion/trunk/build/ac-macros/kwallet.m4
URL: http://svn.apache.org/viewvc/subversion/trunk/build/ac-macros/kwallet.m4?rev=1798731&r1=1798730&r2=1798731&view=diff
==============================================================================
--- subversion/trunk/build/ac-macros/kwallet.m4 (original)
+++ subversion/trunk/build/ac-macros/kwallet.m4 Wed Jun 14 17:41:29 2017
@@ -26,7 +26,7 @@ AC_DEFUN(SVN_LIB_KWALLET,
[
AC_ARG_WITH(kwallet,
[AS_HELP_STRING([[--with-kwallet[=PATH]]],
- [Enable use of KWallet (KDE 4) for auth credentials])],
+ [Enable use of KWallet (KDE 5 or 4) for auth credentials])],
[svn_lib_kwallet="$withval"],
[svn_lib_kwallet=no])
@@ -42,40 +42,59 @@ AC_DEFUN(SVN_LIB_KWALLET,
if test "$APR_HAS_DSO" = "yes"; then
if test -n "$PKG_CONFIG"; then
if test "$HAVE_DBUS" = "yes"; then
- AC_MSG_CHECKING([for QtCore, QtDBus, QtGui])
- if $PKG_CONFIG --exists QtCore QtDBus QtGui; then
- AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([for Qt])
+ if $PKG_CONFIG --exists Qt5Core Qt5DBus Qt5Gui; then
+ AC_MSG_RESULT([yes, Qt5])
+ qt_pkg_config_names="Qt5Core Qt5DBus Qt5Gui"
+ kde_config_name="kf5-config"
+ kde_inc_names="KF5/KWallet KF5/KCoreAddons KF5/KI18n"
+ kde_lib_names="-lKF5Wallet -lKF5I18n -lKF5CoreAddons -lQt5Gui -lQt5DBus -lQt5Core"
+ elif $PKG_CONFIG --exists QtCore QtDBus QtGui; then
+ AC_MSG_RESULT([yes, Qt4])
+ qt_pkg_config_names="QtCore QtDBus QtGui"
+ kde_config_name="kde4-config"
+ kde_inc_names="/"
+ kde_lib_names="-lkdeui -lkdecore -lQtGui -lQtDBus -lQtCore"
+ fi
+ if test -n "$qt_pkg_config_names"; then
if test "$svn_lib_kwallet" != "yes"; then
- AC_MSG_CHECKING([for kde4-config])
- KDE4_CONFIG="$svn_lib_kwallet/bin/kde4-config"
- if test -f "$KDE4_CONFIG" && test -x "$KDE4_CONFIG"; then
+ AC_MSG_CHECKING([for $kde_config_name])
+ KDE_CONFIG="$svn_lib_kwallet/bin/$kde_config_name"
+ if test -f "$KDE_CONFIG" && test -x "$KDE_CONFIG"; then
AC_MSG_RESULT([yes])
else
- KDE4_CONFIG=""
+ KDE_CONFIG=""
AC_MSG_RESULT([no])
fi
else
- AC_PATH_PROG(KDE4_CONFIG, kde4-config)
+ AC_PATH_PROG(KDE_CONFIG, $kde_config_name)
fi
- if test -n "$KDE4_CONFIG"; then
- AC_MSG_CHECKING([for KWallet])
+ if test -n "$KDE_CONFIG"; then
+ if test $kde_config_name = "kf5-config"; then
+ dnl KF5 does not compile with -std=c++98
+ SVN_CXX_MODE_SETUP11
+ fi
old_CXXFLAGS="$CXXFLAGS"
old_LDFLAGS="$LDFLAGS"
old_LIBS="$LIBS"
- for d in [`$PKG_CONFIG --cflags QtCore QtDBus QtGui`]; do
+ AC_MSG_CHECKING([for KWallet])
+ for d in [`$PKG_CONFIG --cflags $qt_pkg_config_names`]; do
if test -n ["`echo "$d" | $EGREP -- '^-D[^[:space:]]*'`"]; then
CPPFLAGS="$CPPFLAGS $d"
fi
done
- qt_include_dirs="`$PKG_CONFIG --cflags-only-I QtCore QtDBus QtGui`"
- kde_incdir="`$KDE4_CONFIG --install include`"
- SVN_KWALLET_INCLUDES="$DBUS_CPPFLAGS $qt_include_dirs -I$kde_incdir"
- qt_libs_other_options="`$PKG_CONFIG --libs-only-other QtCore QtDBus QtGui`"
- SVN_KWALLET_LIBS="$DBUS_LIBS -lQtCore -lQtDBus -lQtGui -lkdecore -lkdeui $qt_libs_other_options"
- CXXFLAGS="$CXXFLAGS $SVN_KWALLET_INCLUDES"
+ qt_include_dirs="`$PKG_CONFIG --cflags-only-I $qt_pkg_config_names`"
+ kde_incdir="`$KDE_CONFIG --install include`"
+ for kde_inc_name in $kde_inc_names; do
+ kde_kwallet_includes="$kde_kwallet_includes -I$kde_incdir/$kde_inc_name"
+ done
+ SVN_KWALLET_INCLUDES="$DBUS_CPPFLAGS $qt_include_dirs $kde_kwallet_includes"
+ qt_libs_other_options="`$PKG_CONFIG --libs-only-other $qt_pkg_config_names`"
+ SVN_KWALLET_LIBS="$DBUS_LIBS $kde_lib_names $qt_libs_other_options"
+ CXXFLAGS="$CXXFLAGS $SVN_KWALLET_INCLUDES -fPIC"
LIBS="$LIBS $SVN_KWALLET_LIBS"
- qt_lib_dirs="`$PKG_CONFIG --libs-only-L QtCore QtDBus QtGui`"
- kde_libdir="`$KDE4_CONFIG --install lib`"
+ qt_lib_dirs="`$PKG_CONFIG --libs-only-L $qt_pkg_config_names`"
+ kde_libdir="`$KDE_CONFIG --install lib`"
LDFLAGS="$old_LDFLAGS `SVN_REMOVE_STANDARD_LIB_DIRS($qt_lib_dirs -L$kde_libdir)`"
AC_LANG(C++)
AC_LINK_IFELSE([AC_LANG_SOURCE([[
@@ -87,16 +106,19 @@ int main()
AC_MSG_RESULT([yes])
CXXFLAGS="$old_CXXFLAGS"
LIBS="$old_LIBS"
+ if test "$kde_config_name" = "kf5-config"; then
+ AC_DEFINE([SVN_HAVE_KF5], [1], [Defined if KF5 available])
+ fi
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot find KWallet])
fi
else
- AC_MSG_ERROR([cannot find kde4-config])
+ AC_MSG_ERROR([cannot find $kde_config_name])
fi
else
AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot find QtCore, QtDBus, QtGui])
+ AC_MSG_ERROR([cannot find Qt])
fi
else
AC_MSG_ERROR([cannot find D-Bus])
Modified: subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp?rev=1798731&r1=1798730&r2=1798731&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp (original)
+++ subversion/trunk/subversion/libsvn_auth_kwallet/kwallet.cpp Wed Jun 14 17:41:29 2017
@@ -39,8 +39,6 @@
#include <QtCore/QString>
#include <kaboutdata.h>
-#include <kcmdlineargs.h>
-#include <kcomponentdata.h>
#include <klocalizedstring.h>
#include <kwallet.h>
@@ -57,6 +55,10 @@
#include "svn_private_config.h"
+#ifndef SVN_HAVE_KF5
+#include <kcmdlineargs.h>
+#include <kcomponentdata.h>
+#endif
/*-----------------------------------------------------------------------*/
/* KWallet simple provider, puts passwords in KWallet */
@@ -221,6 +223,16 @@ kwallet_password_get(svn_boolean_t *done
app = new QCoreApplication(argc, q_argv);
}
+#if SVN_HAVE_KF5
+ KLocalizedString::setApplicationDomain("subversion"); /* translation domain */
+
+ /* componentName appears in KDE GUI prompts */
+ KAboutData aboutData(QStringLiteral("subversion"), /* componentName */
+ i18n(get_application_name(parameters,
+ pool)), /* displayName */
+ QStringLiteral(SVN_VER_NUMBER));
+ KAboutData::setApplicationData(aboutData);
+#else
KCmdLineArgs::init(q_argc, q_argv,
get_application_name(parameters, pool),
"subversion",
@@ -229,6 +241,8 @@ kwallet_password_get(svn_boolean_t *done
ki18n("Version control system"),
KCmdLineArgs::CmdLineArgKDE);
KComponentData component_data(KCmdLineArgs::aboutData());
+#endif
+
QString folder = QString::fromUtf8("Subversion");
QString key =
QString::fromUtf8(username) + "@" + QString::fromUtf8(realmstring);
@@ -291,6 +305,16 @@ kwallet_password_set(svn_boolean_t *done
app = new QCoreApplication(argc, q_argv);
}
+#if SVN_HAVE_KF5
+ KLocalizedString::setApplicationDomain("subversion"); /* translation domain */
+
+ /* componentName appears in KDE GUI prompts */
+ KAboutData aboutData(QStringLiteral("subversion"), /* componentName */
+ i18n(get_application_name(parameters,
+ pool)), /* displayName */
+ QStringLiteral(SVN_VER_NUMBER));
+ KAboutData::setApplicationData(aboutData);
+#else
KCmdLineArgs::init(q_argc, q_argv,
get_application_name(parameters, pool),
"subversion",
@@ -299,6 +323,8 @@ kwallet_password_set(svn_boolean_t *done
ki18n("Version control system"),
KCmdLineArgs::CmdLineArgKDE);
KComponentData component_data(KCmdLineArgs::aboutData());
+#endif
+
QString q_password = QString::fromUtf8(password);
QString folder = QString::fromUtf8("Subversion");
KWallet::Wallet *wallet = get_wallet(wallet_name, parameters);