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 install files to the build #64

Merged
merged 3 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src
SUBDIRS = src instfiles
EXTRA_DIST = bootstrap.sh
13 changes: 12 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ PA_LIBDIR=`$PKG_CONFIG --variable=libdir libpulse`
PA_MODDIR=`$PKG_CONFIG --variable=modlibexecdir libpulse`
PA_PREFIX=`$PKG_CONFIG --variable=prefix libpulse`

# Default system-wide autostart directory from XDG autostart specification
m4_define([XDG_AUTOSTART_DIR], /etc/xdg/autostart)

AC_SUBST([PA_MAJOR], [pa_major])
AC_SUBST([PA_MINOR], [pa_minor])
AC_SUBST([PA_MAJORMINOR], [pa_major].[pa_minor])
Expand Down Expand Up @@ -68,6 +71,13 @@ AC_ARG_WITH(
[modlibexecdir=$withval], [modlibexecdir="${PA_MODDIR}"])
AC_SUBST(modlibexecdir)

AC_ARG_WITH(
[xdgautostart-dir],
[AS_HELP_STRING([--with-xdgautostart-dir],
Directory to install the desktop file (defaults to XDG_AUTOSTART_DIR))],
[xdgautostartdir=$withval], [xdgautostartdir=XDG_AUTOSTART_DIR])
AC_SUBST(xdgautostartdir)

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h unistd.h])

Expand All @@ -80,5 +90,6 @@ AC_TYPE_UINT32_T
AC_CHECK_FUNCS([memset socket])

AC_CONFIG_FILES([Makefile
src/Makefile])
src/Makefile
instfiles/Makefile])
AC_OUTPUT
29 changes: 29 additions & 0 deletions instfiles/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
EXTRA_DIST = \
load_pa_modules.sh \
pulseaudio-xrdp.desktop.in

#
# substitute directories in service file
#
CLEANFILES= \
pulseaudio-xrdp.desktop

SUBST_VARS = sed \
-e 's|@pkglibexecdir[@]|$(pkglibexecdir)|g'

subst_verbose = $(subst_verbose_@AM_V@)
subst_verbose_ = $(subst_verbose_@AM_DEFAULT_V@)
subst_verbose_0 = @echo " SUBST $@";

SUFFIXES = .in
.in:
$(subst_verbose)$(SUBST_VARS) $< > $@

#
# files for all platforms
#
xdgautostart_DATA = \
pulseaudio-xrdp.desktop

pkglibexec_SCRIPTS = \
load_pa_modules.sh
32 changes: 32 additions & 0 deletions instfiles/load_pa_modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

PACTL=/usr/bin/pactl
Copy link
Member

Choose a reason for hiding this comment

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

Happy if we can avoid this hardcoded path of pactl.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point - this will be broken on FreeBSD of course.

I'll assume it's in the PATH. It's not a privileged script, and if the pa utils aren't in the PATH for the desktop, the user will have other problems anyway.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll look into this a bit further - my FreeBSD testing was OK, so something's happening here I'm not expecting

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it - under FreeBSD, the PULSE_SCRIPT environment variable is loading the xrdp drivers. The load_pa_modules.sh fails, but that doesn't matter.

Removing the PULSE_SCRIPT definition is causing some problems. I'll get this working on FreeBSD, re-test on a couple of Linuxes and then post an updated script for re-review.


if [ -n "$XRDP_SESSION" -a -n "$XRDP_SOCKET_PATH" ]; then
# These values are not present on xrdp versions before v0.9.8
if [ -z "$XRDP_PULSE_SINK_SOCKET" -o \
-z "$XRDP_PULSE_SOURCE_SOCKET" ]; then
displaynum=${DISPLAY##*:}
displaynum=${displaynum%.*}
XRDP_PULSE_SINK_SOCKET=xrdp_chansrv_audio_out_socket_$displaynum
XRDP_PULSE_SOURCE_SOCKET=xrdp_chansrv_audio_in_socket_$displaynum
fi

# Don't check for the presence of the sockets, as if the modules
# are loaded they won't be there

# Unload modules
$PACTL unload-module module-xrdp-sink >/dev/null 2>&1
$PACTL unload-module module-xrdp-source >/dev/null 2>&1

# Reload modules
$PACTL load-module module-xrdp-sink \
xrdp_socket_path=$XRDP_SOCKET_PATH \
xrdp_pulse_sink_socket=$XRDP_PULSE_SINK_SOCKET && \
\
$PACTL load-module module-xrdp-source \
xrdp_socket_path=$XRDP_SOCKET_PATH \
xrdp_pulse_source_socket=$XRDP_PULSE_SOURCE_SOCKET
fi

exit $?
9 changes: 9 additions & 0 deletions instfiles/pulseaudio-xrdp.desktop.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Version=1.0
Name=PulseAudio xrdp modules
Comment=Load PulseAudio Modules for xrdp
Exec=@pkglibexecdir@/load_pa_modules.sh
Terminal=false
Type=Application
Categories=
GenericName=