Skip to content

Commit

Permalink
Merge pull request #21 from dkondor/backports
Browse files Browse the repository at this point in the history
Backport some fixes
  • Loading branch information
dkondor authored Sep 21, 2024
2 parents 364fb2b + a89b3da commit 9df9af7
Show file tree
Hide file tree
Showing 77 changed files with 322 additions and 4,440 deletions.
109 changes: 21 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include ("${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/GNUInstallDirs.cmake")
########### project ###############

project ("cairo-dock-plugins")
set (VERSION "3.5.0")
set (VERSION "3.5.1")

add_definitions (-std=gnu99 -Wall -Werror-implicit-function-declaration) # -Wextra -Wwrite-strings -Wuninitialized -Werror-implicit-function-declaration -Wstrict-prototypes -Wreturn-type -Wparentheses -Warray-bounds)
if (NOT DEFINED CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -197,30 +197,15 @@ endif()
## Indicator
enable_if_not_defined (enable-indicator-support)
if (enable-indicator-support)
set (INDICATOR_APPLET_MODULE indicator3-0.4)
set (INDICATOR_APPLET_MODULE ayatana-indicator3-0.4)
pkg_check_modules (INDICATOR_APPLET ${INDICATOR_APPLET_MODULE})
if (INDICATOR_APPLET_FOUND)
set (INDICATOR_NEW_VERSION TRUE) # oneiric and newer
else()
set (INDICATOR_APPLET_MODULE indicator3)
pkg_check_modules (INDICATOR_APPLET ${INDICATOR_APPLET_MODULE})
endif()
endif()

## libido
enable_if_not_defined (enable-libido-support)
if (enable-libido-support)
set (IDO_MODULE libido3-0.1)
set (IDO_MODULE libayatana-ido3-0.4)
pkg_check_modules (IDO ${IDO_MODULE})
if (IDO_FOUND)
STRING (REGEX REPLACE "\\..*" "" IDO_MAJOR "${IDO_VERSION}")
STRING (REGEX REPLACE "[0-9]*\\.([^ ]+)" "\\1" IDO_MINOR "${IDO_VERSION}") # 0.1.7 => 1.7
STRING (REGEX REPLACE "\\.[0-9]*" "" IDO_MINOR "${IDO_MINOR}")
if (${IDO_MAJOR} GREATER 13
OR ${IDO_MAJOR} EQUAL 13 AND ${IDO_MINOR} GREATER 9)
set (INDICATOR_NG 1)
endif()
endif()
endif()

## Extract versions of DBusMenu
Expand Down Expand Up @@ -262,21 +247,16 @@ if (INDICATOR_APPLET_FOUND)
set (INDICATOR_MESSAGES_HAS_LOZENGE 0)
endif()

if (INDICATOR_NEW_VERSION) # oneiric and newer
execute_process(
COMMAND pkg-config --variable=iconsdir indicator3-0.4
OUTPUT_VARIABLE INDICATORICONSDIR)
execute_process(
COMMAND pkg-config --variable=indicatordir indicator3-0.4
OUTPUT_VARIABLE INDICATORDIR)
STRING (REGEX REPLACE "\n" "" INDICATORDIR ${INDICATORDIR})
set (with_indicator3 yes)
message (STATUS " Indicators: with Indicator3 support")
else()
execute_process(
COMMAND pkg-config --variable=iconsdir indicator3
OUTPUT_VARIABLE INDICATORICONSDIR)
endif()
execute_process(
COMMAND pkg-config --variable=iconsdir ayatana-indicator3-0.4
OUTPUT_VARIABLE INDICATORICONSDIR)
execute_process(
COMMAND pkg-config --variable=indicatordir ayatana-indicator3-0.4
OUTPUT_VARIABLE INDICATORDIR)
STRING (REGEX REPLACE "\n" "" INDICATORDIR ${INDICATORDIR})
set (with_indicator3 yes)
message (STATUS " Indicators: with Indicator3 support")

STRING (REGEX REPLACE "\n" "" INDICATORICONSDIR "${INDICATORICONSDIR}") # la commande rajoute un retour chariot ...
if (with_indicator3)
add_subdirectory (Indicator-applet3)
Expand All @@ -289,30 +269,10 @@ if (INDICATOR_APPLET_FOUND)
endif()

if (NOT DBUSMENU_FOUND OR NOT DBUSMENU_GTK_FOUND OR NOT INDICATOR_APPLET_FOUND)
message (WARNING "These modules are required to compile Indicators applet (MeMenu, Messaging-Menu, Sound-Control, Status-Notifier and Global-Menu): ${INDICATOR_APPLET_MODULE}(-0.4), ${IDO_MODULE}, ${DBUSMENU_MODULE}(-0.4), ${DBUSMENU_GTK_MODULE}(-0.4)")
message (WARNING "These modules are required to compile Indicators applet (Messaging-Menu, Sound-Control, Status-Notifier and Global-Menu): ${INDICATOR_APPLET_MODULE}(-0.4), ${IDO_MODULE}, ${DBUSMENU_MODULE}(-0.4), ${DBUSMENU_GTK_MODULE}(-0.4)")
set (MODULES_MISSING "${MODULES_MISSING} ${INDICATOR_APPLET_MODULE}(-0.4) (${IDO_MODULE}) ${DBUSMENU_MODULE}(-0.4) ${DBUSMENU_GTK_MODULE}(-0.4)")
endif()

############# INDICATOR-NAME #################
message (STATUS "> Indicator Names:")
set (INDICATOR_OLD_NAMES 0)
if (force_old_indicator_names)
set (INDICATOR_OLD_NAMES 1)
message (STATUS " Indicators: use old Ayatana Dbus names (forced)")
#~ elseif ("${DISTRO_ID}" STREQUAL "Ubuntu")
#~ STRING (REGEX REPLACE "\\..*" "" DISTRO_RELEASE_MAJOR ${DISTRO_RELEASE})
#~ # message (STATUS "DISTRO_RELEASE_MAJOR: ${DISTRO_RELEASE_MAJOR}")
#~ if (${DISTRO_RELEASE_MAJOR} LESS 11) # from 11.04, new names are used.
#~ set (INDICATOR_OLD_NAMES 1)
#~ message (STATUS " Indicators: use old Ayatana Dbus names")
#~ endif()
elseif (INDICATOR_APPLET_FOUND)
if (NOT (${INDICATOR_MAJOR} GREATER 0 OR ${INDICATOR_MINOR} GREATER 3 OR (${INDICATOR_MINOR} EQUAL 3 AND ${INDICATOR_NANO} GREATER 20)))
set (INDICATOR_OLD_NAMES 1) # maverick or older
message (STATUS " Indicators: use old Ayatana Dbus names")
endif()
endif()

############# UPOWER #####################
message (STATUS "> UPower:")
enable_if_not_defined (enable-upower-support)
Expand Down Expand Up @@ -417,10 +377,7 @@ if (enable-alsa-mixer)
set (alsa_mixerdatadir "${pluginsdatadir}/AlsaMixer")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/alsaMixer/data/AlsaMixer.conf.in ${CMAKE_CURRENT_BINARY_DIR}/alsaMixer/data/AlsaMixer.conf)
if (with_indicator3)
set (INDICATOR_SOUNDMENU_WITH_IND3 TRUE) # If it's supported, it's maybe better to use it
set (with_soundmenu yes)
elseif (with_indicator AND IDO_FOUND
AND "${INDICATOR_OLD_NAMES}" STREQUAL "0")
set (INDICATOR_SOUNDMENU_WITH_IND3 TRUE)
set (with_soundmenu yes)
endif()
add_subdirectory ("alsaMixer")
Expand Down Expand Up @@ -545,7 +502,7 @@ if (enable-ruby-interface)
message (STATUS " * Ruby:")
# find_package(Ruby) found libs of ruby-dev but we only need a directory where we can install ruby libs.
find_program (RUBY_EXECUTABLE ruby)
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['rubylibdir']"
EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendordir']"
OUTPUT_VARIABLE RUBY_LIB_DIR)
message (STATUS " Ruby library dir: ${RUBY_LIB_DIR}")
if ("${RUBY_LIB_DIR}" STREQUAL "" OR "${RUBY_LIB_DIR}" STREQUAL "nil")
Expand All @@ -554,10 +511,6 @@ if (enable-ruby-interface)
set (PROGRAMS_MISSING "${PROGRAMS_MISSING} ruby")
set (with_ruby no)
else()
# /usr/lib/ruby/1.8 or /usr/lib/ruby/1.9.1
string (REGEX REPLACE "lib/ruby/[0-9].[0-9]?.+" "" RUBY_LIB_DIR_INSTALL "${RUBY_LIB_DIR}")
string (REGEX REPLACE "${RUBY_LIB_DIR_INSTALL}" "" RUBY_LIB_DIR_INSTALL "${RUBY_LIB_DIR}")
set (RUBY_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${RUBY_LIB_DIR_INSTALL}")
message (STATUS " will be installed in: ${RUBY_LIB_DIR}")
set (RUBY_FOUND "TRUE")
set (with_ruby yes)
Expand All @@ -569,9 +522,9 @@ enable_if_not_defined (enable-mono-interface)
if (enable-mono-interface)
message (STATUS " * Mono:")
#find_package (Mono)
find_program (GMCS_EXECUTABLE gmcs)
find_program (GMCS_EXECUTABLE mcs)
if (NOT GMCS_EXECUTABLE OR NOT EXISTS ${GMCS_EXECUTABLE})
message (STATUS "Could not find Mono compiler gmcs, won't build Mono interface.")
message (STATUS "Could not find Mono compiler mcs, won't build Mono interface.")
else()
pkg_check_modules (MONO_PACKAGE dbus-sharp-2.0 dbus-sharp-glib-2.0 glib-sharp-2.0)
if (NOT MONO_PACKAGE_FOUND)
Expand Down Expand Up @@ -737,7 +690,7 @@ add_subdirectory (Folders)

############# GLOBAL-MENU #################
set (with_global_menu no) # unstable
if (enable-global-menu AND "${INDICATOR_OLD_NAMES}" STREQUAL "0" AND DBUSMENU_FOUND AND DBUSMENU_GTK_FOUND) # currently only supported with new name of the indicator module and with newer version of dbusmenu
if (enable-global-menu AND DBUSMENU_FOUND AND DBUSMENU_GTK_FOUND) # currently only supported with new name of the indicator module and with newer version of dbusmenu
message (STATUS "> Global-Menu:")
set (GETTEXT_GLOBAL_MENU ${GETTEXT_PLUGINS})
set (VERSION_GLOBAL_MENU "0.1.3")
Expand Down Expand Up @@ -978,9 +931,8 @@ set (with_mail no)
# find the compilation flags
enable_if_not_defined (enable-mail)
if (enable-mail)
find_program (LIBETPAN_CONFIG_EXECUTABLE libetpan-config)
execute_process(
COMMAND ${LIBETPAN_CONFIG_EXECUTABLE} --cflags
COMMAND pkg-config libetpan --cflags
OUTPUT_VARIABLE MAIL_PACKAGE_CFLAGS)
if (NOT "${MAIL_PACKAGE_CFLAGS}" STREQUAL "" AND NOT "${MAIL_PACKAGE_CFLAGS}" STREQUAL "\n") # if there is a problem with the previous, we don't want to have a lot of errors
STRING (REGEX REPLACE "\n" "" TMP_VARIABLE "${MAIL_PACKAGE_CFLAGS}") # to not skip the last option
Expand All @@ -993,7 +945,7 @@ if (enable-mail)
endif()
# find the link flags
execute_process(
COMMAND ${LIBETPAN_CONFIG_EXECUTABLE} --libs
COMMAND pkg-config libetpan --libs
OUTPUT_VARIABLE MAIL_PACKAGE_LIBS)
if (NOT "${MAIL_PACKAGE_LIBS}" STREQUAL "")
STRING (REGEX REPLACE "\n" "" MAIL_PACKAGE_LIBS "${MAIL_PACKAGE_LIBS}")
Expand Down Expand Up @@ -1030,21 +982,6 @@ if (enable-mail)
endif()
endif()

############# MEMENU #################
set (with_me_menu no)
if (INDICATOR_NEW_VERSION AND NOT enable-memenu)
message (STATUS "> MeMenu: this applet has been automatically merged with Messaging-Menu") # oneiric or newer
elseif (with_indicator AND IDO_FOUND)
message (STATUS "> MeMenu:")
set (GETTEXT_MEMENU ${GETTEXT_PLUGINS})
set (VERSION_MEMENU "1.0.6")
set (PACKAGE_MEMENU "cd-MeMenu")
set (memenudatadir "${pluginsdatadir}/MeMenu")
set (with_me_menu yes)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/MeMenu/data/MeMenu.conf.in ${CMAKE_CURRENT_BINARY_DIR}/MeMenu/data/MeMenu.conf)
add_subdirectory (MeMenu)
endif()

############# MESSAGING_MENU #################
set (with_messaging_menu no)
if (with_indicator)
Expand Down Expand Up @@ -1292,7 +1229,6 @@ else()
elseif (DEFINED force_indicator_applicationadded_have_hint)
set (INDICATOR_APPLICATIONADDED_HAS_HINT 0)
endif()
message (STATUS " Used old DBus name = ${INDICATOR_OLD_NAMES}")
message (STATUS " ApplicationAdded signal has 'Hint' = ${INDICATOR_APPLICATIONADDED_HAS_HINT}")
message (STATUS " ApplicationAdded signal has 'Title' = ${INDICATOR_APPLICATIONADDED_HAS_TITLE}")
set (GETTEXT_STATUS_NOTIFIER ${GETTEXT_PLUGINS})
Expand Down Expand Up @@ -1508,9 +1444,6 @@ message (STATUS " - with Impulse applet: ${with_impulse}")
message (STATUS " - with Indicator-Generic applet: ${with_indicator_generic}")
message (STATUS " - with Keyboard-indicator applet: ${with_keyboard_indicator}")
message (STATUS " - with Mail applet: ${with_mail}")
if (NOT INDICATOR_NEW_VERSION OR enable-memenu) # oneiric or newer
message (STATUS " - with Me-Menu applet applet: ${with_me_menu}")
endif()
message (STATUS " - with Messaging-Menu applet: ${with_messaging_menu}")
message (STATUS " - with Recent-Events applet: ${with_recent_events}")
message (STATUS " - with Sound Effects applet: ${with_sound_effects}")
Expand Down
2 changes: 1 addition & 1 deletion Dbus/demos/demo_bash/demo_bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

# This is a part of the external demo applet for Cairo-Dock
# Copyright : (C) 2010-2011 by Nochka85, Fabounet and atttbe
Expand Down
2 changes: 1 addition & 1 deletion Dbus/demos/demo_python/demo_python
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3

# This is a part of the external demo applet for Cairo-Dock
# Copyright : (C) 2010-2011 by Fabounet
Expand Down
46 changes: 30 additions & 16 deletions Dbus/interfaces/bash/BashInstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,52 @@

IF ("@PYTHON2_FOUND@" STREQUAL "TRUE")
IF("@ROOT_PREFIX@" STREQUAL "")
EXEC_PROGRAM("@PYTHON2_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
set (ROOT1 "$ENV{DESTDIR}")
IF ("${ROOT1}" STREQUAL "")
set (ROOT1 "/")
ENDIF()
execute_process(COMMAND "@PYTHON2_EXECUTABLE@"
"setup.py" "install"
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--root=`test -z \"\$DESTDIR\" && echo / || echo \$DESTDIR`"
"@DEBIAN_INSTALL_LAYOUT@")
"--prefix=@CMAKE_INSTALL_PREFIX@"
"--root=${ROOT1}"
@DEBIAN_INSTALL_LAYOUT@
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ELSEIF("@python_no_deb_layout@" STREQUAL "")
EXEC_PROGRAM("@PYTHON2_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
execute_process(COMMAND "@PYTHON2_EXECUTABLE@"
"setup.py" "install"
"--root=@ROOT_PREFIX@"
"@DEBIAN_INSTALL_LAYOUT@")
@DEBIAN_INSTALL_LAYOUT@
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ELSE()
EXEC_PROGRAM("@PYTHON2_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
execute_process(COMMAND "@PYTHON2_EXECUTABLE@"
"setup.py" "install"
"--root=@ROOT_PREFIX@")
"--root=@ROOT_PREFIX@"
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ENDIF()
ENDIF()

IF ("@PYTHON3_FOUND@" STREQUAL "TRUE")
IF("@ROOT_PREFIX@" STREQUAL "")
EXEC_PROGRAM("@PYTHON3_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
set (ROOT1 "$ENV{DESTDIR}")
IF ("${ROOT1}" STREQUAL "")
set (ROOT1 "/")
ENDIF()
execute_process(COMMAND "@PYTHON3_EXECUTABLE@"
"setup.py" "install"
"--prefix=${CMAKE_INSTALL_PREFIX}"
"--root=`test -z \"\$DESTDIR\" && echo / || echo \$DESTDIR`"
"@DEBIAN_INSTALL_LAYOUT@")
"--prefix=@CMAKE_INSTALL_PREFIX@"
"--root=${ROOT1}"
@DEBIAN_INSTALL_LAYOUT@
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ELSEIF("@python_no_deb_layout@" STREQUAL "")
EXEC_PROGRAM("@PYTHON3_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
execute_process(COMMAND "@PYTHON3_EXECUTABLE@"
"setup.py" "install"
"--root=@ROOT_PREFIX@"
"@DEBIAN_INSTALL_LAYOUT@")
@DEBIAN_INSTALL_LAYOUT@
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ELSE()
EXEC_PROGRAM("@PYTHON3_EXECUTABLE@" "${CMAKE_CURRENT_BINARY_DIR}" ARGS
execute_process(COMMAND "@PYTHON3_EXECUTABLE@"
"setup.py" "install"
"--root=@ROOT_PREFIX@")
"--root=@ROOT_PREFIX@"
WORKING_DIRECTORY "@CMAKE_CURRENT_BINARY_DIR@")
ENDIF()
ENDIF()
6 changes: 3 additions & 3 deletions Dbus/interfaces/bash/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ if (NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
endif()

if (PYTHON2_FOUND)
exec_program("${PYTHON2_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}" ARGS "setup.py" "-q" "build")
execute_process(COMMAND "${PYTHON2_EXECUTABLE}" "setup.py" "-q" "build" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if (PYTHON3_FOUND)
exec_program("${PYTHON3_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}" ARGS "setup.py" "-q" "build") # if both are present, the build sub-folder will not have the same name, so we can build now and then install during the 'make install'.
execute_process(COMMAND "${PYTHON3_EXECUTABLE}" "setup.py" "-q" "build" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # if both are present, the build sub-folder will not have the same name, so we can build now and then install during the 'make install'.
endif()

########### install files ###############
# Run a custom script with 'make install'
add_custom_target(bash_pyc ALL)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BashInstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BashInstall.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BashInstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BashInstall.cmake @ONLY)
set_target_properties(bash_pyc PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/BashInstall.cmake)

# and the bash functions goes into the data dir of the applet (didn't find a better place).
Expand Down
2 changes: 1 addition & 1 deletion Dbus/interfaces/bash/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# GNU General Public License for more details.
# http://www.gnu.org/licenses/licenses.html#GPL

from distutils.core import setup
from setuptools import setup
setup(name='CDBashApplet',
version='1.0',
license='GPL-3',
Expand Down
6 changes: 3 additions & 3 deletions Dbus/interfaces/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ endif()

########### byte-compile the python scripts to .pyc ###############
if (PYTHON2_FOUND)
exec_program("${PYTHON2_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}" ARGS "setup.py" "-q" "build")
execute_process(COMMAND "${PYTHON2_EXECUTABLE}" "setup.py" "-q" "build" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if (PYTHON3_FOUND)
exec_program("${PYTHON3_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}" ARGS "setup.py" "-q" "build") # if both are present, the build sub-folder will not have the same name, so we can build now and then install during the 'make install', which allows us to not build as root.
execute_process(COMMAND "${PYTHON3_EXECUTABLE}" "setup.py" "-q" "build" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") # if both are present, the build sub-folder will not have the same name, so we can build now and then install during the 'make install', which allows us to not build as root.
endif()

########### install files ###############
# Run a custom script with 'make install'
add_custom_target(python_pyc ALL)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PythonInstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PythonInstall.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/PythonInstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/PythonInstall.cmake @ONLY)
set_target_properties(python_pyc PROPERTIES POST_INSTALL_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/PythonInstall.cmake)
Loading

0 comments on commit 9df9af7

Please sign in to comment.