Skip to content

Commit

Permalink
Cleanup build flags, global namespace and includes
Browse files Browse the repository at this point in the history
- Separated displays so they don't have to be all built even when the
  features are disabled.
- Removed weird linker magic for display init and replaced it with
  straightforward (and faster) template functions that behave the same.
  - Replaced disabled_display_output classes with log messages.
- Add explicit errors when feature dependent headers get included where
  they shouldn't.
- Use gperf to build perfect hash for color names instead of custom X11
  lookup. This should make it easier to add more color names to the list
  with no extra cost.
- Made alignment use a specific bit layout which greatly simplifies
  code.
- Switch BUILD_MOUSE_EVENTS dependency from OWN_WINDOW to BUILD_X11.
- Other minor improvements to some existing code which shouldn't affect
  behavior.
- Add documentation links to sample configs.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
  • Loading branch information
Caellian committed Apr 19, 2024
1 parent d815f9a commit 60843da
Show file tree
Hide file tree
Showing 50 changed files with 4,786 additions and 2,418 deletions.
44 changes: 44 additions & 0 deletions 3rdparty/toluapp/cmake_install.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Install script for directory: /data/code/FOSS/conky/3rdparty/toluapp

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()

# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "0")
endif()

# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()

# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif()

71 changes: 71 additions & 0 deletions CPackConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. The list of available CPACK_xxx variables and their associated
# documentation may be obtained using
# cpack --help-variable-list
#
# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME)
# and some are specific to a generator
# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables
# usually begin with CPACK_<GENNAME>_xxxx.


set(CPACK_BUILD_SOURCE_DIRS "/data/code/FOSS/conky;/data/code/FOSS/conky")
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
set(CPACK_COMPONENTS_ALL "")
set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE")
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Brenden Matthews")
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake")
set(CPACK_GENERATOR "TGZ;STGZ;DEB")
set(CPACK_INNOSETUP_ARCHITECTURE "x64")
set(CPACK_INSTALL_CMAKE_PROJECTS "/data/code/FOSS/conky;conky;ALL;/")
set(CPACK_INSTALL_PREFIX "/usr/local")
set(CPACK_MODULE_PATH "/data/code/FOSS/conky/cmake")
set(CPACK_NSIS_DISPLAY_NAME "conky")
set(CPACK_NSIS_INSTALLER_ICON_CODE "")
set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
set(CPACK_NSIS_PACKAGE_NAME "conky")
set(CPACK_NSIS_UNINSTALL_NAME "Uninstall")
set(CPACK_OBJCOPY_EXECUTABLE "/usr/bin/objcopy")
set(CPACK_OBJDUMP_EXECUTABLE "/usr/bin/objdump")
set(CPACK_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackConfig.cmake")
set(CPACK_PACKAGE_CONTACT "brenden@diddyinc.com")
set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
set(CPACK_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake")
set(CPACK_PACKAGE_FILE_NAME "conky-1.20.1_pre-Linux-")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "conky")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "conky")
set(CPACK_PACKAGE_NAME "conky")
set(CPACK_PACKAGE_RELOCATABLE "true")
set(CPACK_PACKAGE_VENDOR "Humanity")
set(CPACK_PACKAGE_VERSION "1.20.1")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "20")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_READELF_EXECUTABLE "/usr/bin/readelf")
set(CPACK_RESOURCE_FILE_LICENSE "/usr/share/cmake/Templates/CPack.GenericLicense.txt")
set(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt")
set(CPACK_SET_DESTDIR "OFF")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$")
set(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackSourceConfig.cmake")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "conky-1.20.1_pre-src")
set(CPACK_STRIP_FILES "true")
set(CPACK_SYSTEM_NAME "Linux")
set(CPACK_THREADS "1")
set(CPACK_TOPLEVEL_TAG "Linux")
set(CPACK_WIX_SIZEOF_VOID_P "8")

if(NOT CPACK_PROPERTIES_FILE)
set(CPACK_PROPERTIES_FILE "/data/code/FOSS/conky/CPackProperties.cmake")
endif()

if(EXISTS ${CPACK_PROPERTIES_FILE})
include(${CPACK_PROPERTIES_FILE})
endif()
76 changes: 76 additions & 0 deletions CPackSourceConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# This file will be configured to contain variables for CPack. These variables
# should be set in the CMake list file of the project before CPack module is
# included. The list of available CPACK_xxx variables and their associated
# documentation may be obtained using
# cpack --help-variable-list
#
# Some variables are common to all generators (e.g. CPACK_PACKAGE_NAME)
# and some are specific to a generator
# (e.g. CPACK_NSIS_EXTRA_INSTALL_COMMANDS). The generator specific variables
# usually begin with CPACK_<GENNAME>_xxxx.


set(CPACK_BUILD_SOURCE_DIRS "/data/code/FOSS/conky;/data/code/FOSS/conky")
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
set(CPACK_COMPONENTS_ALL "")
set(CPACK_COMPONENT_UNSPECIFIED_HIDDEN "TRUE")
set(CPACK_COMPONENT_UNSPECIFIED_REQUIRED "TRUE")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Brenden Matthews")
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_DEFAULT_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake")
set(CPACK_GENERATOR "TBZ2")
set(CPACK_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$")
set(CPACK_INNOSETUP_ARCHITECTURE "x64")
set(CPACK_INSTALLED_DIRECTORIES "/data/code/FOSS/conky;/")
set(CPACK_INSTALL_CMAKE_PROJECTS "")
set(CPACK_INSTALL_PREFIX "/usr/local")
set(CPACK_MODULE_PATH "/data/code/FOSS/conky/cmake")
set(CPACK_NSIS_DISPLAY_NAME "conky")
set(CPACK_NSIS_INSTALLER_ICON_CODE "")
set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
set(CPACK_NSIS_PACKAGE_NAME "conky")
set(CPACK_NSIS_UNINSTALL_NAME "Uninstall")
set(CPACK_OBJCOPY_EXECUTABLE "/usr/bin/objcopy")
set(CPACK_OBJDUMP_EXECUTABLE "/usr/bin/objdump")
set(CPACK_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackConfig.cmake")
set(CPACK_PACKAGE_CONTACT "brenden@diddyinc.com")
set(CPACK_PACKAGE_DEFAULT_LOCATION "/")
set(CPACK_PACKAGE_DESCRIPTION_FILE "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "conky built using CMake")
set(CPACK_PACKAGE_FILE_NAME "conky-1.20.1_pre-src")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "conky")
set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "conky")
set(CPACK_PACKAGE_NAME "conky")
set(CPACK_PACKAGE_RELOCATABLE "true")
set(CPACK_PACKAGE_VENDOR "Humanity")
set(CPACK_PACKAGE_VERSION "1.20.1")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "20")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(CPACK_READELF_EXECUTABLE "/usr/bin/readelf")
set(CPACK_RESOURCE_FILE_LICENSE "/usr/share/cmake/Templates/CPack.GenericLicense.txt")
set(CPACK_RESOURCE_FILE_README "/usr/share/cmake/Templates/CPack.GenericDescription.txt")
set(CPACK_RESOURCE_FILE_WELCOME "/usr/share/cmake/Templates/CPack.GenericWelcome.txt")
set(CPACK_RPM_PACKAGE_SOURCES "ON")
set(CPACK_SET_DESTDIR "OFF")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_IGNORE_FILES "~$;\\.git.*$;\\..*\\.swp$;build.*$")
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "/data/code/FOSS/conky;/")
set(CPACK_SOURCE_OUTPUT_CONFIG_FILE "/data/code/FOSS/conky/CPackSourceConfig.cmake")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "conky-1.20.1_pre-src")
set(CPACK_SOURCE_TOPLEVEL_TAG "Linux-Source")
set(CPACK_STRIP_FILES "")
set(CPACK_SYSTEM_NAME "Linux")
set(CPACK_THREADS "1")
set(CPACK_TOPLEVEL_TAG "Linux-Source")
set(CPACK_WIX_SIZEOF_VOID_P "8")

if(NOT CPACK_PROPERTIES_FILE)
set(CPACK_PROPERTIES_FILE "/data/code/FOSS/conky/CPackProperties.cmake")
endif()

if(EXISTS ${CPACK_PROPERTIES_FILE})
include(${CPACK_PROPERTIES_FILE})
endif()
8 changes: 8 additions & 0 deletions build.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef __BUILD_H
#define __BUILD_H

/* Conky build info */

#define BUILD_ARCH "Linux x86_64"

#endif /* __BUILD_H */
8 changes: 4 additions & 4 deletions cmake/ConkyBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ dependent_option(BUILD_XSHAPE "Enable Xshape support" true
"BUILD_X11" false
"Xshape support requires X11")
dependent_option(BUILD_XINPUT "Build Xinput 2 support" true
"BUILD_X11;BUILD_MOUSE_EVENTS" false
"Xinput 2 support requires X11 and BUILD_MOUSE_EVENTS enabled")
"BUILD_X11" false
"Xinput 2 support requires X11")

# if we build with any GUI support
if(BUILD_X11)
Expand All @@ -206,8 +206,8 @@ if(BUILD_WAYLAND)
endif(BUILD_WAYLAND)

dependent_option(BUILD_MOUSE_EVENTS "Enable mouse event support" true
"BUILD_WAYLAND OR OWN_WINDOW" false
"Mouse event support requires Wayland or OWN_WINDOW enabled")
"BUILD_WAYLAND OR BUILD_X11" false
"Mouse event support requires Wayland or X11 enabled")

# Lua library options
option(BUILD_LUA_CAIRO "Build cairo bindings for Lua" false)
Expand Down
87 changes: 87 additions & 0 deletions cmake_install.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Install script for directory: /data/code/FOSS/conky

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "RelWithDebInfo")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()

# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "0")
endif()

# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()

# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for the subdirectory.
include("/data/code/FOSS/conky/lua/cmake_install.cmake")
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for the subdirectory.
include("/data/code/FOSS/conky/data/cmake_install.cmake")
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for the subdirectory.
include("/data/code/FOSS/conky/doc/cmake_install.cmake")
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for the subdirectory.
include("/data/code/FOSS/conky/3rdparty/toluapp/cmake_install.cmake")
endif()

if(NOT CMAKE_INSTALL_LOCAL_ONLY)
# Include the install script for the subdirectory.
include("/data/code/FOSS/conky/src/cmake_install.cmake")
endif()

if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT)
file(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/share/doc/conky-1.20.1_pre" TYPE FILE FILES
"/data/code/FOSS/conky/extras/convert.lua"
"/data/code/FOSS/conky/data/conky_no_x11.conf"
"/data/code/FOSS/conky/data/conky.conf"
)
endif()

if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()

string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/data/code/FOSS/conky/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
46 changes: 46 additions & 0 deletions cmake_uninstall.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
#Conky, a system monitor, based on torsmo
#
#Please see COPYING for details
#
#Copyright(c) 2005 - 2024 Brenden Matthews, et.al.(see AUTHORS)All rights
#reserved.
#
#This program is free software : you can redistribute it and / or \
modify it under
#the terms of the GNU General Public License as published by the Free Software
#Foundation, either version 3 of the License, or (at your option) any later
#version.
#
#This program is distributed in the hope that it will be useful, but WITHOUT
#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
#FOR A PARTICULAR PURPOSE.See the GNU General Public License for more
#details.You should have received a copy of the GNU General Public License
#along with this program.If not, see < http: // www.gnu.org/licenses/>.
#

if (NOT EXISTS ${CMAKE_BINARY_DIR} / install_manifest.txt)
message(
FATAL_ERROR
"Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt")
endif()

file(READ "${CMAKE_BINARY_DIR}/install_manifest.txt" files) string(
REGEX REPLACE
"\n"
";" files "${files}") foreach (file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}") if (
IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS
"$ENV{DESTDIR}${file}")
exec_program(
${CMAKE_COMMAND} ARGS
"-E remove \"$ENV{DESTDIR}${file}\"" OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval) if (NOT
"${rm_retval}" STREQUAL 0)
message(FATAL_ERROR
"Problem when removing $ENV{DESTDIR}${file}")
endif() else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS
"$ENV{DESTDIR}${file}")
message(STATUS
"File $ENV{DESTDIR}${file} does not exist.")
endif() endforeach()
Loading

0 comments on commit 60843da

Please sign in to comment.