Skip to content

Commit

Permalink
Require gperf at build-time
Browse files Browse the repository at this point in the history
Rather than allowing the build to continue without gperf, we should
fail with an error so that the colour behaviour does not change in a
backward incompatible manner. The old colour behaviour should continue
to work going forward.

This resolves #1868.
  • Loading branch information
brndnmtthws committed Apr 28, 2024
1 parent 777b9a8 commit 10045ab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 37 deletions.
4 changes: 4 additions & 0 deletions cmake/Conky.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ endif(NOT APP_UNAME)

find_program(APP_GPERF gperf)

if(NOT APP_GPERF)
message(FATAL_ERROR "Unable to find program 'gperf' (required at build-time as of Conky v1.20.2)")
endif(NOT APP_GPERF)

if(NOT RELEASE)
find_program(APP_GIT git)

Expand Down
25 changes: 10 additions & 15 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,16 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)
endif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)

# Generate colour-names.hh with gperf
if(APP_GPERF)
execute_process(
INPUT_FILE "${CMAKE_SOURCE_DIR}/data/color-names.yml"
OUTPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf"
COMMAND sh "${CMAKE_SOURCE_DIR}/bin/format-colors.sh"
)
execute_process(
INPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf"
OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh"
COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E
)
else(APP_GPERF)
message(WARNING "'gperf' program not found, using stub colour-names.hh; colors names will not be parsed")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/colour-names-stub.hh" "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh" COPYONLY)
endif(APP_GPERF)
execute_process(
INPUT_FILE "${CMAKE_SOURCE_DIR}/data/color-names.yml"
OUTPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf"
COMMAND sh "${CMAKE_SOURCE_DIR}/bin/format-colors.sh"
)
execute_process(
INPUT_FILE "${CMAKE_BINARY_DIR}/data/color-names.gperf"
OUTPUT_FILE "${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh"
COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E
)

set(conky_sources
${conky_sources}
Expand Down
22 changes: 0 additions & 22 deletions src/colour-names-stub.hh

This file was deleted.

0 comments on commit 10045ab

Please sign in to comment.