Skip to content

Commit d7fa041

Browse files
committed
CMake: use gen-man.py to generate man file
1 parent fe57b28 commit d7fa041

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

CMakeLists.txt

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,27 +256,39 @@ endfunction(fastfetch_load_text)
256256

257257
find_package(Python)
258258
if(Python_FOUND)
259+
message(STATUS "Minifying 'help.json'")
259260
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
260261
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
261262
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
262263
if(DATATEXT_JSON_HELP STREQUAL "")
263264
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
264265
endif()
265266
else()
266-
message(STATUS "Python3 is not found, 'help.json' will not be minified")
267+
message(WARNING "Python3 is not found, 'help.json' will not be minified")
267268
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
268269
endif()
269270

270271
if(ENABLE_EMBEDDED_PCIIDS AND NOT EXISTS "fastfetch_pciids.c.inc")
271272
if(Python_FOUND)
273+
message(STATUS "Generating 'fastfetch_pciids.c.inc'")
272274
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-pciids.py"
273275
OUTPUT_FILE "fastfetch_pciids.c.inc")
274276
else()
275-
message(STATUS "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
277+
message(WARNING "Python3 is not found, 'fastfetch_pciids.c.inc' will not be generated")
276278
set(ENABLE_EMBEDDED_PCIIDS OFF)
277279
endif()
278280
endif()
279281

282+
if(Python_FOUND)
283+
message(STATUS "Generating 'fastfetch.1'")
284+
execute_process(COMMAND ${Python_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen-man.py"
285+
OUTPUT_FILE "fastfetch.1")
286+
else()
287+
message(WARNING "Python3 is not found, use basic 'fastfetch.1.in' instead")
288+
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
289+
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
290+
endif()
291+
280292
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)
281293
fastfetch_load_text(src/data/structure.txt DATATEXT_STRUCTURE)
282294
fastfetch_load_text(src/data/help_footer.txt DATATEXT_HELP_FOOTER)
@@ -289,9 +301,6 @@ if(APPLE)
289301
configure_file(src/util/apple/Info.plist.in Info.plist @ONLY)
290302
endif()
291303

292-
string(TIMESTAMP FASTFETCH_BUILD_DATE "%d %B %Y" UTC)
293-
configure_file(doc/fastfetch.1.in fastfetch.1 @ONLY)
294-
295304
####################
296305
# Ascii image data #
297306
####################

0 commit comments

Comments
 (0)