Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add imlib2 support for login screen customisation #1962

Merged
merged 14 commits into from
Sep 1, 2021
Merged
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 .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ FreeBSD_task:
freebsd_instance:
image_family: freebsd-12-2
prepare_script:
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr nasm fusefs-libs check
- pkg install -y $SSL git autoconf automake libtool pkgconf opus jpeg-turbo fdk-aac pixman libX11 libXfixes libXrandr nasm fusefs-libs check imlib2
- git submodule update --init --recursive
configure_script:
- ./bootstrap
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --localstatedir=/var --enable-strict-locations --with-pkgconfigdir=/usr/local/libdata/pkgconfig --enable-strict-locations --enable-ipv6 --enable-opus --enable-jpeg --enable-fdkaac --enable-painter --enable-pixman --enable-fuse
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./configure --localstatedir=/var --enable-strict-locations --with-pkgconfigdir=/usr/local/libdata/pkgconfig --enable-strict-locations --enable-ipv6 --enable-opus --enable-jpeg --enable-fdkaac --enable-painter --enable-pixman --enable-fuse --with-imlib2
build_script:
- make -j $(sysctl -n hw.ncpu || echo 4)
install_script:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ jobs:
--disable-pixman"
CONF_FLAGS_amd64_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame
--enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter
--enable-pixman"
--enable-pixman --with-imlib2"
CONF_FLAGS_i386_max: "--enable-ipv6 --enable-jpeg --enable-fuse --enable-mp3lame
--enable-fdkaac --enable-opus --enable-rfxcodec --enable-painter
--disable-pixman --host=i686-linux"
--disable-pixman --with-imlib2 --host=i686-linux"

PKG_CONFIG_PATH_i386: "/usr/lib/i386-linux-gnu/pkgconfig"
CFLAGS_i386: "-m32"
Expand Down
47 changes: 47 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ AC_ARG_ENABLE(rdpsndaudin, AS_HELP_STRING([--enable-rdpsndaudin],
[], [enable_rdpsndaudin=no])
AM_CONDITIONAL(XRDP_RDPSNDAUDIN, [test x$enable_rdpsndaudin = xyes])

AC_ARG_WITH(imlib2, AC_HELP_STRING([--with-imlib2=ARG], [imlib2 library to use for non-BMP backgrounds (ARG=yes/no/<abs-path>)]),,)

# Obsolete options
AC_ARG_ENABLE(xrdpdebug, AS_HELP_STRING([--enable-xrdpdebug],
[This option is no longer supported - use --enable-devel-all]))
Expand Down Expand Up @@ -216,6 +218,44 @@ AC_CHECK_HEADER([security/_pam_types.h],
AC_CHECK_HEADER([security/pam_constants.h],
[AC_DEFINE([HAVE_PAM_CONSTANTS_H], 1, [Using OpenPAM], [])])

# Find imlib2
case "$with_imlib2" in
'' | no) AC_MSG_NOTICE([imlib2 will not be supported])
use_imlib2=no
;;
yes)
PKG_CHECK_MODULES([IMLIB2], [imlib2 >= 1.4.10],
[use_imlib2=yes],
[AC_MSG_ERROR([please install libimlib2-dev or imlib2-devel])])
;;
/*) AC_MSG_CHECKING([for imlib2 in $with_imlib2])
if test -d $with_imlib2/lib; then
IMLIB2_LIBS="-L$with_imlib2/lib -lImlib2"
elif test -d $with_imlib2/lib64; then
IMLIB2_LIBS="-L$with_imlib2/lib64 -lImlib2"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can't find libImlib2 in $with_imlib2])
fi

if test -f $with_imlib2/include/Imlib2.h; then
IMLIB2_CFLAGS="-I $with_imlib2/include"
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Can't find $with_imlib2/include/Imlib2.h])
fi
AC_MSG_RESULT([yes])
AC_SUBST([IMLIB2_LIBS])
AC_SUBST([IMLIB2_CFLAGS])
use_imlib2=yes
;;
*) AC_MSG_ERROR([--with-imlib2 needs yes/no or absolute path])
esac

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-detection is generally very nice but autodetected libraries will not appear in xrdp -v. I want an easy way to tell users if your compiled xrdp supports png/jpg images on the login screen. ldd /usr/sbin/xrdp sounds a little bit guru's way.

If we introduce more auto-detection, we might need to invent a new way to show which libraries/features compiled with.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a really good point - I hadn't thought of that but it's a feature I use a lot when triaging problems. I'll remove the auto-detect.

if test x$use_imlib2 = xyes; then
AC_DEFINE([USE_IMLIB2],1, [Compile with imlib2 support])
fi

# Check only one auth mechanism is specified, and give it a name
auth_cnt=0
auth_mech="Builtin"
Expand Down Expand Up @@ -454,6 +494,7 @@ AC_CONFIG_FILES([
tests/Makefile
tests/common/Makefile
tests/memtest/Makefile
tests/xrdp/Makefile
tools/Makefile
tools/devel/Makefile
tools/devel/tcp_proxy/Makefile
Expand Down Expand Up @@ -485,6 +526,12 @@ echo " vsock $enable_vsock"
echo " auth mechanism $auth_mech"
echo " rdpsndaudin $enable_rdpsndaudin"
echo
if test x$use_imlib2 = xyes; then
echo " with imlib2 yes"
else
echo " with imlib2 no"
fi
echo
echo " development logging $devel_logging"
echo " development streamcheck $devel_streamcheck"
echo ""
Expand Down
2 changes: 2 additions & 0 deletions scripts/install_xrdp_build_dependencies_with_apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ in
libjpeg-dev \
libmp3lame-dev \
libfdk-aac-dev \
libimlib2-dev \
libopus-dev \
libpixman-1-dev"
;;
Expand All @@ -66,6 +67,7 @@ in
libgl1-mesa-dev:i386 \
libglu1-mesa-dev:i386 \
libjpeg-dev:i386 \
libimlib2-dev:i386 \
libmp3lame-dev:i386 \
libfdk-aac-dev:i386 \
libopus-dev:i386 \
Expand Down
3 changes: 2 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ EXTRA_DIST = \

SUBDIRS = \
common \
memtest
memtest \
xrdp
41 changes: 41 additions & 0 deletions tests/xrdp/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir)/xrdp \
-I$(top_srcdir)/libxrdp \
-I$(top_srcdir)/common \
$(IMLIB2_CFLAGS)

LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
$(top_srcdir)/tap-driver.sh

PACKAGE_STRING="XRDP daemon"

EXTRA_DIST = \
test_4bit.bmp \
test_8bit.bmp \
test_24bit.bmp \
test_not4_4bit.bmp \
test_not4_8bit.bmp \
test_not4_24bit.bmp \
test1.jpg \
test_alpha_blend.png

TESTS = test_xrdp
check_PROGRAMS = test_xrdp

test_xrdp_SOURCES = \
test_xrdp.h \
test_xrdp_main.c \
test_bitmap_load.c

test_xrdp_CFLAGS = \
-D IMAGEDIR=\"$(srcdir)\" \
@CHECK_CFLAGS@

test_xrdp_LDADD = \
$(top_builddir)/xrdp/xrdp_bitmap_load.o \
$(top_builddir)/xrdp/xrdp_bitmap_common.o \
$(top_builddir)/xrdp/funcs.o \
$(top_builddir)/common/libcommon.la \
$(IMLIB2_LIBS) \
@CHECK_LIBS@
Binary file added tests/xrdp/test1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/xrdp/test_24bit.bmp
Binary file not shown.
Binary file added tests/xrdp/test_4bit.bmp
Binary file not shown.
Binary file added tests/xrdp/test_8bit.bmp
Binary file not shown.
Binary file added tests/xrdp/test_alpha_blend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading