Bug 382459

Summary: Exec line in kiod service file must not have any path prefix on Windows
Product: [Frameworks and Libraries] frameworks-kio Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: christophe, kdelibs-bugs, simonandric5
Priority: NOR    
Version: 5.36.0   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 5.43.0
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 380136    

Description Ralf Habacker 2017-07-18 08:59:22 UTC
The Exec line in kio/src/kiod/org.kde.kiod5.service.in
[D-BUS Service]
Name=org.kde.kiod5
Exec=@KDE_INSTALL_FULL_LIBEXECDIR@/kf5/kiod5

will not work on Windows (see bug 382458 for details)

Instead the prefix in the Exec line needs to be completly removed on windows e.g.

Exec=@SOME_PREFIX@kiod5

Also on Windows kiod5 need to be installed in bindir
Comment 1 Christophe Marin 2017-07-21 06:43:06 UTC
I don't think these are different issues. This probably has to be fixed somewhere in ECM  (same thing for bug 382460)
Comment 2 Ralf Habacker 2017-07-21 07:23:36 UTC
(In reply to Christophe Giboudeaux from comment #1)
> I don't think these are different issues. This probably has to be fixed
> somewhere in ECM  (same thing for bug 382460)

In kio the Exec line needs to be changed to something like

Exec=@NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_PATH@kiod5

ECM is responsible to setup these variable according to related platform e.g.

if(WIN32)
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_PATH)
else()
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_PATH ${KDE_INSTALL_FULL_LIBEXECDIR}/kf5/)
endif()
Comment 3 Ralf Habacker 2017-07-21 08:34:45 UTC
https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDEInstallDirs.cmake#n31 states

# ``LIBEXECDIR``
#     executables for internal use by programs and libraries (``BINDIR`` on
#     Windows, ``LIBDIR/libexec`` otherwise) [``LIBEXEC_INSTALL_DIR``]

and at https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDEInstallDirs.cmake#n440 there is defined LIBEXECDIR_KF5 

which indicates that the ECM part has been done and that LIBEXECDIR_KF5 need to be used inside kio.
Comment 4 Ralf Habacker 2017-07-21 08:53:06 UTC
(In reply to Ralf Habacker from comment #3)
> https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDEInstallDirs.
> cmake#n440 there is used

_define_non_cache(LIBEXECDIR_KF5 "${CMAKE_INSTALL_LIBEXECDIR}/kf5")

which is defined at https://cgit.kde.org/extra-cmake-modules.git/tree/kde-modules/KDEInstallDirs.cmake#n387 which indicates that for kf5 libexec also KDE_INSTALL_FULL_LIBEXECDIR_KF5 could be used on non windows. On windows this variable could not be used because it would have a non empty prefix; instead an empty string or KDE_INSTALL_LIBEXECDIR_KF5 (which should also be empty) should work

The conclusion is that in the services something like the following should be used

Exec=@NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_PATH@kiod5

and in the top level CMakeLists.txt something like 

if(WIN32)
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_KF5_PATH )
else()
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC__KF5_PATH ${KDE_INSTALL_FULL_LIBEXECDIR_KF5})
endif()

or

if(WIN32)
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC_KF5_PATH ${KDE_INSTALL_LIBEXECDIR_KF5})
else()
    set(NEW_VARIABLE_FOR CROSS_PLATTFORM_LIBEXEC__KF5_PATH ${KDE_INSTALL_FULL_LIBEXECDIR_KF5})
endif()




Exec=@SOME_PREFIX@kiod5
Comment 5 Christophe Marin 2017-07-21 21:26:40 UTC
@something@somedir without any separator is not intuitive. I'd really prefer having something to replace the configure_file macro instead.
Comment 6 Ralf Habacker 2017-07-23 12:47:22 UTC
(In reply to Christophe Giboudeaux from comment #5)
> @something@somedir without any separator is not intuitive. I'd really prefer
> having something to replace the configure_file macro instead.

You are thinking about something like https://build.opensuse.org/package/view_file/home:rhabacker:branches:windows:mingw:win32:KF536/mingw32-kwallet/0002-Win32-fix-for-installing-kwalletd-dbus-service.patch?expand=1 ?
Comment 7 Ralf Habacker 2017-12-20 09:53:31 UTC
review request https://phabricator.kde.org/D9383
Comment 8 Ralf Habacker 2018-01-07 18:16:17 UTC
Git commit 105cdd8fb3c433588f799c901dd32ceb99b2cf11 by Ralf Habacker.
Committed on 07/01/2018 at 18:15.
Pushed by habacker into branch 'master'.

Use cmake function 'kdbusaddons_generate_dbus_service_file' from kdbusaddons to generate dbus service file

Summary:
Related: bug 388059, bug 388060, bug 388062, bug 388063
FIXED-IN:5.43.0

Test Plan:
compiled against installed HEAD of kdbusaddons git master branch and inspected generated service files;
On Windows only the executable is used, which is expected

Reviewers: dfaure, kfunk, bcooksley

Reviewed By: dfaure

Subscribers: #frameworks

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D9669

M  +1    -2    src/ioslaves/http/kcookiejar/CMakeLists.txt
D  +0    -4    src/ioslaves/http/kcookiejar/org.kde.kcookiejar5.service.in
M  +1    -4    src/kiod/CMakeLists.txt
D  +0    -4    src/kiod/org.kde.kiod5.service.in
M  +1    -2    src/kioexec/CMakeLists.txt
D  +0    -3    src/kioexec/org.kde.kioexecd.service.in
M  +1    -2    src/kpasswdserver/CMakeLists.txt
D  +0    -4    src/kpasswdserver/org.kde.kpasswdserver.service.in
M  +1    -2    src/kssld/CMakeLists.txt
D  +0    -4    src/kssld/org.kde.kssld5.service.in

https://commits.kde.org/kio/105cdd8fb3c433588f799c901dd32ceb99b2cf11