Diff updated. This one should be a good commit candidate, all concerns should 
have gone away.

In data domenica 06 settembre 2009 14:40:40, Alexander Neundorf ha scritto:
: > On Sunday 06 September 2009, Dario Freddi wrote:
> > Here it goes, new diff for findkde4internals and kde4macros
> 
> There is some inconsistency in the naming:
> KDE4_AUTH_INSTALL_ACTIONS()
> vs.
> KDE4_INSTALL_AUTH_HELPER_FILES()
> 
> How about KDE4_INSTALL_AUTH_ACTIONS() ?
> 
> From the documentation:
> 
> # This macro registers an action file for applications using KAuth.
> 
> Please explain this in more detail in the docs. It is not clear
> that "register" means to install the files at "make install" time to some
> location. Register with what ?
> It might also mention how the generated file will be named and where it
>  will be installed.
> 
> ...
> #   This macro adds the needed files for an helper for
> 
> I think it would be more clear if you use "helper executable" instead of
> just "helper" in all places where appropriate.
> 
> > (and the full polkitqt file :D) some comments below
> 
> We're almost there :-) Three issues left.
> 
> --------8<--------------8<-------
> #It really looks like find_path is not working, this one at least makes
>  things work
> set(POLKITQT_INCLUDE_DIR ${PC_POLKITQT_INCLUDEDIR}/PolicyKit/polkit-qt
>     ${PC_POLKITQT_INCLUDEDIR}/PolicyKit/)
> --------8<--------------8<-------
> 
> I mean, you knew I would have an issue with this, right ?
> So, in which directory is auth.h on your system ?
> Which value does PC_POLKITQT_INCLUDEDIR have on your system ?
> 
> I think the call should look like this:
> 
> find_path( POLKITQT_INCLUDE_DIR
>     NAMES polkit-qt/auth.h
>     PATH_SUFFIXES PolicyKit
>     HINTS ${PC_POLKITQT_INCLUDEDIR}
>     )
> 
> (the PATH_SUFFIXES appends the given subdir to each of the search dirs,
>  e.g. instead for /usr/include/plokit-qt/auth.h it will look
> in /usr/include/PolicyKit/plokit-qt/auth.h)
> 
> The second one:
> macro(dbus_add_activation_system_service _sources)
> 
> This should most probably go into FindDBus.cmake (which is right now in
> kdebase/workspace/cmake/modules/ )
> Or here's another one:
> http://www.opensync.org/browser/branches/3rd-party-cmake-modules/modules/Fi
> ndLibDbus.cmake?rev=3679 or here:
> http://anonsvn.wireshark.org/viewvc/trunk/cmake/modules/FindDBUS.cmake?view
> =markup&pathrev=19672
> 
> and please find out where that other dbus-related macro comes from which
>  you mentioned.
> 
> 3rd issue:
> please mark the result variables from the find_xxx() calls as ADVANCED (no
> blocker)
> 
> > In data sabato 05 settembre 2009 21:53:36, Alexander Neundorf ha scritto:
> > [snip]
> >
> > > Yes, please.
> > > This would add another macro which creates an executable, but without
> > > providing real benefit. I mean, every KDE developer should know
> > >
> > > kde4_add_executable()
> > > target_link_libraries()
> > > install(TARGETS)
> > >
> > > So there's nothing new here.
> > > Now to help with getting that stuff installed correctly we can provide
> > > a macro which helps with that. Which means there is 1 new thing to
> > > learn but the other code stays understandable for everybody else who
> > > don't know about KAuth.
> >
> > Done, but with a modification. The function (ah, tested and function
> > works nice, btw) also accepts the helper target and installs it. This for
> > a variety of reasons:
> >
> > 1. The macro has to know the target name since one of the configured
> > files needs it
> 
> This one is ok.
> 
> > 2. The helper has to be installed in libexec_install_dir, so we also make
> > sure that it gets installed into the correct location.
> 
> Also all other files have to be installed to the correct locations, that's
>  not different for this one.
> Please remove the install(TARGETS) from the function.
> We had long discussions about similar things in the past here on the list.
>  I don't want this to be hidden in a macro/function.
> 
> > The cmake code client-side would then be:
> >
> > kde4_add_executable(kcmremotewidgetshelper
> > private/remotewidgetshelper.cpp)
> > target_link_libraries(kcmremotewidgetshelper kdecore)
> >
> > kde4_install_auth_helper_files(kcmremotewidgetshelper
> > org.kde.kcontrol.kcmremotewidgets root)
> >
> > kde4_auth_install_actions(org.kde.kcontrol.kcmremotewidgets
> > kcm_remotewidgets.actions)
> >
> > I hope this makes up as a good compromise
> >
> > > Adding KDE4_ADD_AUTH_HELPER_EXECUTABLE() would also be 1 new thing to
> > > learn and it doesn't show that it will also install and link to
> > > kdecore. So the name would have to be something like
> > > KDE4_ADD_AUTH_HELPER_EXECUTABLE_LINK_TO_KDECORE_AND_INSTALL()
> > > I guess we don't want that ;-)
> >
> > Hehe, right :D
> >
> > > > > Macro KDE4_AUTH_REGISTER_ACTIONS:
> > > > >
> > > > > Maybe an "install" in the name of the macro would be a good idea,
> > > > > since it installs stuff.
> > > >
> > > > Uhm, you are right. KDE4_AUTH_INSTALL_ACTIONS? But it seems confusing
> > > > to me. REGISTER_AND_INSTALL is making it too long IMHO. Any other
> > > > suggestions?
> > >
> > > I don't have a problem with long names.
> > >
> > > Or just KDE4_INSTALL_AUTH_ACTIONS() ?
> >
> > Done this way :)
> 
> Sure ?
> It's still KDE4_AUTH_INSTALL_ACTIONS() in the patch.
> I would also suggest to turn it into a function() instead of a macro() (but
> that's no blocker).
> Do you know whether this macro also works correctly with DESTDIR set on
> Apple ? (also no blocker)
> 
> Alex
> 

-- 
-------------------

Dario Freddi
KDE Developer
GPG Key Signature: 511A9A3B
Index: cmake/modules/FindKDE4Internal.cmake
===================================================================
--- cmake/modules/FindKDE4Internal.cmake	(revisione 1020477)
+++ cmake/modules/FindKDE4Internal.cmake	(copia locale)
@@ -204,7 +204,25 @@
 #   INSTALL_DESTINATION <installdest>, or to <installdest>/<subdir> if
 #   SUBDIR <subdir> is specified.
 #
+#  KDE4_INSTALL_AUTH_ACTIONS( HELPER_ID ACTIONS_FILE )
+#   This macro generates an action file, depending on the backend used, for applications using KAuth.
+#   It accepts the helper id (the DBUS name) and a file containing the actions (check kdelibs/kdecore/auth/example
+#   for file format). The macro will take care of generating the file according to the backend specified, 
+#   and to install it in the right location. This (at the moment) means that on Linux (PolicyKit) a .policy
+#   file will be generated and installed into the policykit action directory (usually /usr/share/PolicyKit/policy/),
+#   and on Mac (Authorization Services) will be added to the system action registry using the native MacOS API during
+#   the install phase
 #
+#  KDE4_INSTALL_AUTH_HELPER_FILES( HELPER_TARGET HELPER_ID HELPER_USER )
+#   This macro adds the needed files for an helper executable meant to be used by applications using KAuth.
+#   It accepts the helper target, the helper ID (the DBUS name) and the user under which the helper will run on.
+#   This macro takes care of generate the needed files, and install them in the right location. This boils down
+#   to a DBus policy to let the helper register on the system bus, and a service file for letting the helper
+#   being automatically activated by the system bus.
+#   *WARNING* You have to install the helper in ${LIBEXEC_INSTALL_DIR} to make sure everything will work.
+#
+#
+#
 #  A note on the possible values for CMAKE_BUILD_TYPE and how KDE handles
 #  the flags for those buildtypes. FindKDE4Internal supports the values
 #  Debug, Release, RelWithDebInfo, Profile and Debugfull:
@@ -386,24 +404,26 @@
    set(EXECUTABLE_OUTPUT_PATH ${kdelibs_BINARY_DIR}/bin )
 
    if (WIN32)
-      set(LIBRARY_OUTPUT_PATH            ${EXECUTABLE_OUTPUT_PATH} )
+      set(LIBRARY_OUTPUT_PATH               ${EXECUTABLE_OUTPUT_PATH} )
       # CMAKE_CFG_INTDIR is the output subdirectory created e.g. by XCode and MSVC
-      set(KDE4_KCFGC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
+      set(KDE4_KCFGC_EXECUTABLE             ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler )
 
-      set(KDE4_MEINPROC_EXECUTABLE       ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 )
-      set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
+      set(KDE4_MEINPROC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4 )
+      set(KDE4_KAUTH_POLICY_GEN_EXECUTABLE  ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kauth-policy-gen )
+      set(KDE4_MAKEKDEWIDGETS_EXECUTABLE    ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets )
    else (WIN32)
-      set(LIBRARY_OUTPUT_PATH            ${CMAKE_BINARY_DIR}/lib )
-      set(KDE4_KCFGC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler${CMAKE_EXECUTABLE_SUFFIX}.shell )
-
-      set(KDE4_MEINPROC_EXECUTABLE       ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4${CMAKE_EXECUTABLE_SUFFIX}.shell )
-      set(KDE4_MAKEKDEWIDGETS_EXECUTABLE ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets${CMAKE_EXECUTABLE_SUFFIX}.shell )
+      set(LIBRARY_OUTPUT_PATH               ${CMAKE_BINARY_DIR}/lib )
+      set(KDE4_KCFGC_EXECUTABLE             ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kconfig_compiler${CMAKE_EXECUTABLE_SUFFIX}.shell )
+      set(KDE4_KAUTH_POLICY_GEN_EXECUTABLE  ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/kauth-policy-gen${CMAKE_EXECUTABLE_SUFFIX}.shell )
+      set(KDE4_MEINPROC_EXECUTABLE          ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/meinproc4${CMAKE_EXECUTABLE_SUFFIX}.shell )
+      set(KDE4_MAKEKDEWIDGETS_EXECUTABLE    ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/makekdewidgets${CMAKE_EXECUTABLE_SUFFIX}.shell )
    endif (WIN32)
 
    set(KDE4_LIB_DIR ${LIBRARY_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
 
    # when building kdelibs, make the kcfg rules depend on the binaries...
    set( _KDE4_KCONFIG_COMPILER_DEP kconfig_compiler)
+   set( _KDE4_KAUTH_POLICY_GEN_EXECUTABLE_DEP kauth-policy-gen)
    set( _KDE4_MAKEKDEWIDGETS_DEP makekdewidgets)
    set( _KDE4_MEINPROC_EXECUTABLE_DEP meinproc4)
 
Index: cmake/modules/KDE4Macros.cmake
===================================================================
--- cmake/modules/KDE4Macros.cmake	(revisione 1020477)
+++ cmake/modules/KDE4Macros.cmake	(copia locale)
@@ -22,6 +22,8 @@
 # KDE4_ADD_APP_ICON
 # KDE4_CREATE_MANPAGE
 # KDE4_CREATE_BASIC_CMAKE_VERSION_FILE (function)
+# KDE4_INSTALL_AUTH_HELPER_FILES
+# KDE4_AUTH_INSTALL_ACTIONS
 
 # Copyright (c) 2006-2009 Alexander Neundorf, <[email protected]>
 # Copyright (c) 2006, 2007, Laurent Montel, <[email protected]>
@@ -1217,7 +1219,62 @@
    endif (NOT CMAKE_SKIP_RPATH)
 endmacro (KDE4_HANDLE_RPATH_FOR_LIBRARY)
 
+# This macro adds the needed files for an helper executable meant to be used by applications using KAuth.
+# It accepts the helper target, the helper ID (the DBUS name) and the user under which the helper will run on.
+# This macro takes care of generate the needed files, and install them in the right location. This boils down
+# to a DBus policy to let the helper register on the system bus, and a service file for letting the helper
+# being automatically activated by the system bus.
+# *WARNING* You have to install the helper in ${LIBEXEC_INSTALL_DIR} to make sure everything will work.
+function(KDE4_INSTALL_AUTH_HELPER_FILES HELPER_TARGET HELPER_ID HELPER_USER)
+    
+  if (_kdeBootStrapping)
+    set(_stubFilesDir  ${CMAKE_SOURCE_DIR}/kdecore/auth/backends/dbus/ )
+  else (_kdeBootStrapping)
+    set(_stubFilesDir  ${KDE4_DATA_INSTALL_DIR}/kauth/ )
+  endif (_kdeBootStrapping)
 
+  configure_file(${_stubFilesDir}/dbus_policy.stub
+                 ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf)
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.conf 
+          DESTINATION ${SYSCONF_INSTALL_DIR}/dbus-1/system.d/)
+       
+  configure_file(${_stubFilesDir}/dbus_service.stub
+                 ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service)
+  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.service 
+          DESTINATION ${DBUS_SYSTEM_SERVICES_INSTALL_DIR})
+endfunction(KDE4_INSTALL_AUTH_HELPER_FILES)
+
+# This macro generates an action file, depending on the backend used, for applications using KAuth.
+# It accepts the helper id (the DBUS name) and a file containing the actions (check kdelibs/kdecore/auth/example
+# for file format). The macro will take care of generating the file according to the backend specified, 
+# and to install it in the right location. This (at the moment) means that on Linux (PolicyKit) a .policy
+# file will be generated and installed into the policykit action directory (usually /usr/share/PolicyKit/policy/),
+# and on Mac (Authorization Services) will be added to the system action registry using the native MacOS API during
+# the install phase
+function(KDE4_INSTALL_AUTH_ACTIONS HELPER_ID ACTIONS_FILE)
+
+  if(APPLE)
+    install(CODE "execute_process(COMMAND ${KDE4_KAUTH_POLICY_GEN_EXECUTABLE} ${ACTIONS_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})")
+  elseif(UNIX)
+    set(_output ${CMAKE_CURRENT_BINARY_DIR}/${HELPER_ID}.policy)
+    get_filename_component(_input ${ACTIONS_FILE} ABSOLUTE)
+    
+    add_custom_command(OUTPUT ${_output} 
+                       COMMAND ${KDE4_KAUTH_POLICY_GEN_EXECUTABLE} ${_input} > ${_output} 
+                       MAIN_DEPENDENCY ${_input}
+                       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                       COMMENT "Generating ${HELPER_ID}.policy"
+                       DEPENDS ${_KDE4_KAUTH_POLICY_GEN_EXECUTABLE_DEP})
+    add_custom_target("actions for ${HELPER_ID}" ALL DEPENDS ${_output})
+
+    if (POLKITQT_FOUND)
+      install(FILES ${_output} DESTINATION ${POLKITQT_POLICY_FILES_INSTALL_DIR})
+    endif (POLKITQT_FOUND)
+  endif()
+
+endfunction(KDE4_INSTALL_AUTH_ACTIONS)
+
+
 macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename)
    message(FATAL_ERROR "_KDE4_EXPORT_LIBRARY_DEPENDENCIES() was an internal macro and has been removed again. Just remove the code which calls it, there is no substitute.")
 endmacro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES)

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to