Here it goes, new diff for findkde4internals and kde4macros (and the full polkitqt file :D) some comments below
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 2. The helper has to be installed in libexec_install_dir, so we also make sure that it gets installed into the correct location. 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 :) > Do I understand correctly that the registering is part of a correct > installation of this stuff ? Then one could argue that the register part is > included in the install part. And the docs will say it anyway :-) > (having "install" in the name 1) makes it more obvious and 2) helps when > grepping for "install" in the source tree). > > Alex > -- ------------------- Dario Freddi KDE Developer GPG Key Signature: 511A9A3B
# - Try to find Polkit-qt # Once done this will define # # POLKITQT_FOUND - system has Polkit-qt # POLKITQT_INCLUDE_DIR - the Polkit-qt include directory # POLKITQT_LIBRARIES - Link these to use all Polkit-qt libs # POLKITQT_CORE_LIBRARY # POLKITQT_GUI_LIBRARY # POLKITQT_DEFINITIONS - Compiler switches required for using Polkit-qt # Copyright (c) 2008, Adrien Bustany, <mad...@mymadcat.com> # Copyright (c) 2009, Daniel Nicoletti, <dantti85...@yahoo.com.br> # Copyright (c) 2009, Dario Freddi, <drf54...@gmail.com> # Copyright (c) 2009, Michal Malek, <mich...@jabster.pl> # # Redistribution and use is allowed according to the terms of the GPLv2+ license. if (POLKITQT_INCLUDE_DIR AND POLKITQT_LIB) set(POLKITQT_FIND_QUIETLY TRUE) endif (POLKITQT_INCLUDE_DIR AND POLKITQT_LIB) if (NOT POLKITQT_MIN_VERSION) set(POLKITQT_MIN_VERSION "0.9.0") endif (NOT POLKITQT_MIN_VERSION) if (NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig) pkg_check_modules(PC_POLKITQT QUIET polkit-qt) set(POLKITQT_DEFINITIONS ${PC_POLKITQT_CFLAGS_OTHER}) endif (NOT WIN32) find_path( POLKITQT_INCLUDE_DIR NAMES PolicyKit/polkit-qt/auth.h HINTS ${PC_POLKITQT_INCLUDEDIR} ) find_library( POLKITQT_CORE_LIBRARY NAMES polkit-qt-core HINTS ${PC_POLKITQT_LIBDIR} ) find_library( POLKITQT_GUI_LIBRARY NAMES polkit-qt-gui HINTS ${PC_POLKITQT_LIBDIR} ) find_library( POLKITQT_LIBRARIES NAMES polkit-qt-gui polkit-qt-core HINTS ${PC_POLKITQT_LIBDIR} ) #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/) include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set POLKIQT_FOUND to TRUE if # all listed variables are TRUE find_package_handle_standard_args(PolkitQt DEFAULT_MSG POLKITQT_LIBRARIES POLKITQT_INCLUDE_DIR) mark_as_advanced(POLKITQT_INCLUDE_DIR POLKITQT_CORE_LIBRARY POLKITQT_GUI_LIBRARY POLKITQT_LIBRARIES) if (POLKITQT_FOUND) if (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION) message(STATUS "Found Polkit-Qt release < ${POLKITQT_MIN_VERSION}") message(STATUS "You need Polkit-Qt version ${POLKITQT_MIN_VERSION} or newer to compile this component") set(POLKITQT_FOUND FALSE) return() else (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION) if ( NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX ) message("WARNING: Installation prefix does not match PolicyKit install prefixes. You probably will need to move files installed " "in POLICY_FILES_INSTALL_DIR and by dbus_add_activation_system_service to the ${PC_POLKITQT_PREFIX} prefix") endif (NOT PC_POLKITQT_PREFIX STREQUAL CMAKE_INSTALL_PREFIX) endif (POLKITQT_VERSION VERSION_LESS POLKITQT_MIN_VERSION) endif (POLKITQT_FOUND) set(POLKITQT_POLICY_FILES_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/PolicyKit/policy/) mark_as_advanced(POLKITQT_INCLUDE_DIR POLKITQT_LIB) macro(dbus_add_activation_system_service _sources) pkg_search_module( DBUS dbus-1 ) foreach (_i ${_sources}) get_filename_component(_service_file ${_i} ABSOLUTE) string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i}) set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file}) configure_file(${_service_file} ${_target}) install(FILES ${_target} DESTINATION ${DBUS_PREFIX}/share/dbus-1/system-services ) endforeach (_i ${ARGN}) endmacro(dbus_add_activation_system_service _sources)
Index: cmake/modules/FindKDE4Internal.cmake =================================================================== --- cmake/modules/FindKDE4Internal.cmake (revisione 1020439) +++ cmake/modules/FindKDE4Internal.cmake (copia locale) @@ -204,7 +204,20 @@ # INSTALL_DESTINATION <installdest>, or to <installdest>/<subdir> if # SUBDIR <subdir> is specified. # +# KDE4_AUTH_INSTALL_ACTIONS( HELPER_ID ACTIONS_FILE ) +# This macro registers an action file 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 # +# KDE4_INSTALL_AUTH_HELPER_FILES( HELPER_ID HELPER_USER ) +# This macro adds the needed files for an helper for applications using KAuth. It accepts 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 +# in the right location. *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 +399,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 1020439) +++ 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, <neund...@kde.org> # Copyright (c) 2006, 2007, Laurent Montel, <mon...@kde.org> @@ -1217,7 +1219,58 @@ endif (NOT CMAKE_SKIP_RPATH) endmacro (KDE4_HANDLE_RPATH_FOR_LIBRARY) +# This macro adds an helper for applications using KAuth. It accepts the target name, the helper +# ID (the DBUS name), the user under which the helper will run on, and the sources of the helper. +# This macro takes care of compiling the helper, generate the needed files, and install them in +# in the right location, helper executable included +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) + install(TARGETS ${HELPER_TARGET} DESTINATION ${LIBEXEC_INSTALL_DIR}) + + 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 registers an action file 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 +macro(KDE4_AUTH_INSTALL_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() + +endmacro(KDE4_AUTH_INSTALL_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)
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Kde-buildsystem mailing list Kde-buildsystem@kde.org https://mail.kde.org/mailman/listinfo/kde-buildsystem