Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
if: matrix.image.name == 'ubuntu'
run: |
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends dbus gtk-doc-tools intltool libaudit-dev libgcrypt20-dev libgirepository1.0-dev libglib2.0-dev libpam0g-dev libtool libxcb1-dev libxdmcp-dev libxklavier-dev python3 python3-gi python-is-python3 qtbase5-dev valac yelp-tools
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends dbus gtk-doc-tools intltool libaudit-dev libgcrypt20-dev libgirepository1.0-dev libglib2.0-dev libpam0g-dev libtool libxcb1-dev libxdmcp-dev libxklavier-dev python3 python3-gi python-is-python3 qtbase5-dev qt6-base-dev valac yelp-tools

- name: Install dependencies (Fedora)
if: matrix.image.name == 'fedora'
run: |
dnf install -y audit-libs-devel dbus-daemon gcc gcc-c++ gobject-introspection-devel glib2-devel gtk-doc intltool libgcrypt-devel libtool libxcb-devel libxklavier-devel libXdmcp-devel make pam-devel python3-gobject qt5-qtbase-devel redhat-rpm-config vala yelp-tools
dnf install -y audit-libs-devel dbus-daemon gcc gcc-c++ gobject-introspection-devel glib2-devel gtk-doc intltool libgcrypt-devel libtool libxcb-devel libxklavier-devel libXdmcp-devel make pam-devel python3-gobject qt5-qtbase-devel qt6-qtbase-devel redhat-rpm-config vala yelp-tools

- name: Build and test
run: |
Expand Down
33 changes: 32 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if test x"$enable_liblightdm_qt5" != "xno"; then
fi
])

AC_CHECK_TOOLS(MOC5, [moc-qt5 moc])
QT5_VALIDATE_MOC(MOC5)
if test x$MOC5 = x; then
compile_liblightdm_qt5=no
if test "x$enable_liblightdm_qt5" != xauto; then
Expand All @@ -121,6 +121,35 @@ if test x"$enable_liblightdm_qt5" != "xno"; then
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT5, test x"$compile_liblightdm_qt5" != "xno")

AC_ARG_ENABLE(liblightdm-qt6,
AS_HELP_STRING([--enable-liblightdm-qt6],[Enable LightDM client Qt6 libraries [[default=auto]]]),
[enable_liblightdm_qt6=$enableval],
[enable_liblightdm_qt6="auto"])
compile_liblightdm_qt6=no
if test x"$enable_liblightdm_qt6" != "xno"; then
PKG_CHECK_MODULES(LIBLIGHTDM_QT6, [
Qt6Core
Qt6DBus
Qt6Gui
],
[compile_liblightdm_qt6=yes],
[if test "x$enable_liblightdm_qt6" != xauto; then
AC_MSG_FAILURE(
[--enable-liblightdm-qt6 was given, but test for Qt6 failed])
fi
])

QT6_VALIDATE_MOC(MOC6)
if test x$MOC6 = x; then
compile_liblightdm_qt6=no
if test "x$enable_liblightdm_qt6" != xauto; then
AC_MSG_FAILURE(
[--enable-liblightdm-qt6 was given, but MOC not found])
fi
fi
fi
AM_CONDITIONAL(COMPILE_LIBLIGHTDM_QT6, test x"$compile_liblightdm_qt6" != "xno")

AC_ARG_ENABLE([libaudit],
AS_HELP_STRING([--enable-libaudit],
[Enable libaudit logging of login and logout events [[default=auto]]]),
Expand Down Expand Up @@ -212,6 +241,7 @@ liblightdm-gobject/liblightdm-gobject-1.pc
liblightdm-gobject/Makefile
liblightdm-qt/Makefile
liblightdm-qt/liblightdm-qt5-3.pc
liblightdm-qt/liblightdm-qt6-3.pc
po/Makefile.in
src/Makefile
tests/Makefile
Expand All @@ -237,6 +267,7 @@ echo "
GObject introspection: $found_introspection
Vala bindings: $enable_vala
liblightdm-qt5: $compile_liblightdm_qt5
liblightdm-qt6: $compile_liblightdm_qt6
libaudit support: $use_libaudit
Enable tests: $enable_tests
"
23 changes: 23 additions & 0 deletions liblightdm-qt/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ common_libadd = \
liblightdm_qt5_3_la_LIBADD = \
$(LIBLIGHTDM_QT5_LIBS) \
$(common_libadd)
liblightdm_qt6_3_la_LIBADD = \
$(LIBLIGHTDM_QT6_LIBS) \
$(common_libadd)

common_cflags = \
$(WARN_CXXFLAGS) \
Expand All @@ -15,6 +18,11 @@ liblightdm_qt5_3_la_CXXFLAGS = \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
$(LIBLIGHTDM_QT5_CFLAGS) \
$(common_cflags)
liblightdm_qt6_3_la_CXXFLAGS = \
-fPIC \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(5, 0, 0)" \
$(LIBLIGHTDM_QT6_CFLAGS) \
$(common_cflags)

common_headers = \
QLightDM/Greeter \
Expand All @@ -27,6 +35,7 @@ common_headers = \
QLightDM/usersmodel.h

liblightdm_qt5_3includedir=$(includedir)/lightdm-qt5-3/QLightDM
liblightdm_qt6_3includedir=$(includedir)/lightdm-qt6-3/QLightDM

common_sources = \
greeter.cpp \
Expand All @@ -36,6 +45,9 @@ common_sources = \
liblightdm_qt5_3_la_SOURCES = \
$(common_sources) \
$(liblightdm_qt5_3include_HEADERS)
liblightdm_qt6_3_la_SOURCES = \
$(common_sources) \
$(liblightdm_qt6_3include_HEADERS)

pkgconfigdir = $(libdir)/pkgconfig

Expand All @@ -56,9 +68,20 @@ BUILT_SOURCES += $(common_sources:.cpp=_moc5.cpp)
pkgconfig_DATA += liblightdm-qt5-3.pc
endif

if COMPILE_LIBLIGHTDM_QT6
lib_LTLIBRARIES += liblightdm-qt6-3.la
liblightdm_qt6_3include_HEADERS = $(common_headers)
BUILT_SOURCES += $(common_sources:.cpp=_moc6.cpp)
pkgconfig_DATA += liblightdm-qt6-3.pc
endif

# Support pretty printing MOC
AM_V_MOC5 = $(am__v_MOC5_$(V))
am__v_MOC5_ = $(am__v_MOC5_$(AM_DEFAULT_VERBOSITY))
am__v_MOC5_0 = @echo " MOC5 " $@;
%_moc5.cpp: QLightDM/%.h
$(AM_V_MOC5) $(MOC5) $< -o $@

# qt6
%_moc6.cpp: QLightDM/%.h
$(MOC6) $< -o $@
6 changes: 3 additions & 3 deletions liblightdm-qt/greeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ QString Greeter::motd() const
return QString::fromUtf8(lightdm_get_motd());
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "greeter_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "greeter_moc6.cpp"
#else
#include "greeter_moc4.cpp"
#include "greeter_moc5.cpp"
#endif
11 changes: 11 additions & 0 deletions liblightdm-qt/liblightdm-qt6-3.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: liblightdm-qt6
Description: LightDM Qt6 client library
Version: @VERSION@
Requires: Qt6Core Qt6Gui Qt6DBus
Libs: -L${libdir} -llightdm-qt6-3
Cflags: -I${includedir}/lightdm-qt6-3
6 changes: 3 additions & 3 deletions liblightdm-qt/power.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ bool PowerInterface::restart()
return lightdm_restart (NULL);
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "power_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "power_moc6.cpp"
#else
#include "power_moc4.cpp"
#include "power_moc5.cpp"
#endif
6 changes: 3 additions & 3 deletions liblightdm-qt/sessionsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ QVariant SessionsModel::data(const QModelIndex &index, int role) const
return QVariant();
}

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "sessionsmodel_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "sessionsmodel_moc6.cpp"
#else
#include "sessionsmodel_moc4.cpp"
#include "sessionsmodel_moc5.cpp"
#endif
6 changes: 3 additions & 3 deletions liblightdm-qt/usersmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ QVariant UsersModel::data(const QModelIndex &index, int role) const
}


#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include "usersmodel_moc5.cpp"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include "usersmodel_moc6.cpp"
#else
#include "usersmodel_moc4.cpp"
#include "usersmodel_moc5.cpp"
#endif
68 changes: 68 additions & 0 deletions m4/qt-validate-moc.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Detect Qt5 and Qt6 moc executable
# partially borrowed from freeciv qt m4 scripts

dnl Qt5
AC_DEFUN([QT5_IF_QT5_MOC],
AS_IF([$1 -v >/dev/null 2>/dev/null &&
(test "`$1 -v 2<&1 | grep -o 'Qt [[[0-9]]]\+'`" = "Qt 5" ||
test "`$1 -v 2<&1 | grep -o 'moc [[[0-9]]]\+'`" = "moc 5" ||
test "`$1 -v 2<&1 | grep -o 'moc-qt[[[0-9]]]\+'`" = "moc-qt5")],
[$2]))

dnl Set MOCCMD to $1 if it is the Qt 5 "moc".
AC_DEFUN([QT5_TRY_MOC],
[QT5_IF_QT5_MOC([$1], [MOCCMD="$1"])])

dnl If a usable moc command is found set $1
AC_DEFUN([QT5_VALIDATE_MOC], [
AC_MSG_CHECKING([the Qt 5 moc command])

dnl Try to find a Qt 5 'moc'
AS_IF([test "x$MOCCMD" = "x"],
[for mocpath in "moc" "qtchooser -run-tool=moc -qt=5" "moc-qt5"
do
if test "x$MOCCMD" = "x" ; then
QT5_TRY_MOC([$mocpath])
fi
done
AS_IF([test "x$MOCCMD" = "x"],
[AC_MSG_RESULT([not found]); AC_SUBST($1,"")],
[AC_MSG_RESULT([$MOCCMD]); AC_SUBST($1,"$MOCCMD")])
MOCCMD=""],
[AC_MSG_ERROR(["MOCCMD should not be set"])])])


dnl Qt6
AC_DEFUN([QT6_IF_QT6_MOC],
AS_IF([$1 -v >/dev/null 2>/dev/null &&
(test "`$1 -v 2<&1 | grep -o 'Qt [[[0-9]]]\+'`" = "Qt 6" ||
test "`$1 -v 2<&1 | grep -o 'moc [[[0-9]]]\+'`" = "moc 6" ||
test "`$1 -v 2<&1 | grep -o 'moc-qt[[[0-9]]]\+'`" = "moc-qt6")],
[$2]))

dnl Set MOCCMD to $1 if it is the Qt 6 "moc".
AC_DEFUN([QT6_TRY_MOC],
[QT6_IF_QT6_MOC([$1], [MOCCMD="$1"])])

dnl If a usable moc command is found set $1
AC_DEFUN([QT6_VALIDATE_MOC], [
AC_MSG_CHECKING([the Qt 6 moc command])

dnl Try to find a Qt 6 'moc'
AS_IF([test "x$MOCCMD" = "x"],
[for mocpath in "moc" "qtchooser -run-tool=moc -qt=6" "moc-qt6" \
"/usr/lib/qt6/moc" "/usr/lib/qt6/libexec/moc" \
"/usr/lib64/qt6/moc" "/usr/lib64/qt6/libexec/moc" \
"$prefix/lib/qt6/moc" "$prefix/lib/qt6/libexec/moc" \
"$libexecdir/moc" "$libexecdir/qt6/moc" \
"$libdir/qt6/moc" "$libdir/qt6/libexec/moc"
do
if test "x$MOCCMD" = "x" ; then
QT6_TRY_MOC([$mocpath])
fi
done
AS_IF([test "x$MOCCMD" = "x"],
[AC_MSG_RESULT([not found]); AC_SUBST($1,"")],
[AC_MSG_RESULT([$MOCCMD]); AC_SUBST($1,"$MOCCMD")])
MOCCMD=""],
[AC_MSG_ERROR(["MOCCMD should not be set"])])])
37 changes: 37 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,42 @@ TESTS += \
test-power-qt5
endif

if COMPILE_LIBLIGHTDM_QT6
TESTS += \
test-autologin-timeout-qt6 \
test-autologin-guest-timeout-qt6 \
test-autologin-session-timeout-qt6 \
test-cancel-authentication-qt6 \
test-login-qt6 \
test-login-manual-qt6 \
test-login-manual-previous-session-qt6 \
test-login-no-password-qt6 \
test-login-long-username-qt6 \
test-login-long-password-qt6 \
test-login-two-factor-qt6 \
test-login-new-authtok-qt6 \
test-login-info-prompt-qt6 \
test-login-multi-info-prompt-qt6 \
test-login-previous-session-qt6 \
test-login-wrong-password-qt6 \
test-login-invalid-user-qt6 \
test-login-invalid-session-qt6 \
test-login-logout-qt6 \
test-login-pick-session-qt6 \
test-login-remember-session-qt6 \
test-login-manual-remember-session-qt6 \
test-login-guest-qt6 \
test-login-guest-pick-session-qt6 \
test-login-guest-disabled-qt6 \
test-login-guest-no-setup-script-qt6 \
test-login-guest-fail-setup-script-qt6 \
test-login-guest-logout-qt6 \
test-login-remote-session-qt6 \
test-sessions-qt6 \
test-users-qt6 \
test-power-qt6
endif

EXTRA_DIST = \
$(TESTS) \
data/remote-sessions/test-remote.desktop \
Expand All @@ -345,6 +381,7 @@ EXTRA_DIST = \
data/greeters/test-mir-greeter.desktop \
data/greeters/test-python-greeter.desktop \
data/greeters/test-qt5-greeter.desktop \
data/greeters/test-qt6-greeter.desktop \
data/greeters/test-wayland-greeter.desktop \
data/keys.conf \
data/sessions/alternative.desktop \
Expand Down
4 changes: 4 additions & 0 deletions tests/data/greeters/test-qt6-greeter.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Desktop Entry]
Name=Test Qt6 Greeter
Comment=LightDM test Qt6 greeter
Exec=test-qt6-greeter
22 changes: 20 additions & 2 deletions tests/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if COMPILE_LIBLIGHTDM_QT5
noinst_PROGRAMS += test-qt5-greeter
endif

if COMPILE_LIBLIGHTDM_QT6
noinst_PROGRAMS += test-qt6-greeter
endif

dbus_env_CFLAGS = \
$(WARN_CFLAGS) \
$(GLIB_CFLAGS) \
Expand Down Expand Up @@ -139,23 +143,32 @@ test_script_hook_LDADD = \

test-qt5-greeter_moc5.cpp: test-qt-greeter.h
$(am__v_MOC5_$(V)) $(MOC5) $< -o $@
test-qt6-greeter_moc6.cpp: test-qt-greeter.h
$(MOC6) $< -o $@
common_qt_sources = test-qt-greeter.cpp test-qt-greeter.h status.c status.h
test_qt5_greeter_SOURCES = $(common_qt_sources)
test_qt6_greeter_SOURCES = $(common_qt_sources)
nodist_test_qt5_greeter_SOURCES = test-qt5-greeter_moc5.cpp
nodist_test_qt6_greeter_SOURCES = test-qt6-greeter_moc6.cpp
common_qt_cflags = \
$(WARN_CXXFLAGS) \
$(GLIB_CFLAGS) \
$(GIO_UNIX_CFLAGS) \
$(XCB_CFLAGS)
test_qt5_greeter_CFLAGS = $(common_qt_cflags)
test_qt6_greeter_CFLAGS = $(common_qt_cflags)
common_qt_cxxflags = \
-fPIC \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
-I$(top_srcdir)/liblightdm-qt \
$(GLIB_CFLAGS)
test_qt5_greeter_CXXFLAGS = \
$(common_qt_cxxflags) \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(4, 0, 0)" \
$(LIBLIGHTDM_QT5_CFLAGS)
test_qt6_greeter_CXXFLAGS = \
$(common_qt_cxxflags) \
-DQT_DISABLE_DEPRECATED_BEFORE="QT_VERSION_CHECK(5, 0, 0)" \
$(LIBLIGHTDM_QT6_CFLAGS)
common_qt_ldadd = \
-L$(top_builddir)/liblightdm-gobject \
-llightdm-gobject-1 \
Expand All @@ -167,6 +180,10 @@ test_qt5_greeter_LDADD = \
$(common_qt_ldadd) \
-llightdm-qt5-3 \
$(LIBLIGHTDM_QT5_LIBS)
test_qt6_greeter_LDADD = \
$(common_qt_ldadd) \
-llightdm-qt6-3 \
$(LIBLIGHTDM_QT6_LIBS)

test_session_SOURCES = test-session.c status.c status.h
test_session_CFLAGS = \
Expand Down Expand Up @@ -212,7 +229,8 @@ vnc_client_LDADD = \
$(GIO_UNIX_LIBS)

CLEANFILES = \
test-qt5-greeter_moc5.cpp
test-qt5-greeter_moc5.cpp \
test-qt6-greeter_moc6.cpp

# Support pretty printing MOC
AM_V_MOC5 = $(am__v_MOC5_$(V))
Expand Down
Loading