diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-16 15:48:41 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-16 15:48:41 +0000 |
| commit | cbe6f9d6aa13e450da99ee6405e78faa4a6a5f75 (patch) | |
| tree | 646deb33acd7701f43bb1dd74beabf639ab9e9ee /cmake | |
| parent | 034e6ce52b7d1a5437c23d168af4ea26cfaee725 (diff) | |
build(man): generate and package .so alias pages
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Manual.cmake | 26 | ||||
| -rw-r--r-- | cmake/ManualAliases.cmake | 34 | ||||
| -rw-r--r-- | cmake/Release.cmake | 13 |
3 files changed, 73 insertions, 0 deletions
diff --git a/cmake/Manual.cmake b/cmake/Manual.cmake index 17a8e77..14187c0 100644 --- a/cmake/Manual.cmake +++ b/cmake/Manual.cmake @@ -1,3 +1,4 @@ +include("${CMAKE_CURRENT_LIST_DIR}/ManualAliases.cmake") if(WIN32) set(cpsc_manual_format html5) else() @@ -37,4 +38,29 @@ foreach(source IN LISTS cpsc_manual_sources) ) list(APPEND cpsc_manual_outputs "${output}") endforeach() +if(WIN32) + foreach(pair IN LISTS CPSC_MANUAL_ALIASES) + string(REPLACE ":" ";" alias_parts "${pair}") + list(GET alias_parts 0 alias_name) + list(GET alias_parts 1 target_name) + set(alias_target "${CMAKE_CURRENT_BINARY_DIR}/doc/language/keyword/${target_name}.html") + set(alias_output "${CMAKE_CURRENT_BINARY_DIR}/doc/language/keyword/${alias_name}.html") + add_custom_command( + OUTPUT "${alias_output}" + COMMAND "${CMAKE_COMMAND}" -E copy "${alias_target}" "${alias_output}" + DEPENDS "${alias_target}" + COMMENT "Generating language/keyword/${alias_name}.html (alias)" + VERBATIM + ) + list(APPEND cpsc_manual_outputs "${alias_output}") + endforeach() +else() + foreach(pair IN LISTS CPSC_MANUAL_ALIASES) + string(REPLACE ":" ";" alias_parts "${pair}") + list(GET alias_parts 0 alias_name) + list(GET alias_parts 1 target_name) + file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/doc/language/keyword/${alias_name}.7" ".so man7/${target_name}.7\n") + list(APPEND cpsc_manual_outputs "${CMAKE_CURRENT_BINARY_DIR}/doc/language/keyword/${alias_name}.7") + endforeach() +endif() add_custom_target(doc DEPENDS ${cpsc_manual_outputs}) diff --git a/cmake/ManualAliases.cmake b/cmake/ManualAliases.cmake new file mode 100644 index 0000000..e9418d8 --- /dev/null +++ b/cmake/ManualAliases.cmake @@ -0,0 +1,34 @@ +# Alias pages have no .md source; pandoc builds the target, then the alias +# reuses its output (copy on Windows, .so stub on man pages). +# The NAME lines in the primary .md sources are the human-readable +# counterpart and must be kept in sync with this map. +set(CPSC_MANUAL_ALIASES + "cpsc-keyword-then:cpsc-keyword-if" + "cpsc-keyword-else:cpsc-keyword-if" + "cpsc-keyword-endif:cpsc-keyword-if" + "cpsc-keyword-catch:cpsc-keyword-try" + "cpsc-keyword-endtry:cpsc-keyword-try" + "cpsc-keyword-throw:cpsc-keyword-try" + "cpsc-keyword-endwhile:cpsc-keyword-while" + "cpsc-keyword-until:cpsc-keyword-repeat" + "cpsc-keyword-to:cpsc-keyword-for" + "cpsc-keyword-step:cpsc-keyword-for" + "cpsc-keyword-next:cpsc-keyword-for" + "cpsc-keyword-otherwise:cpsc-keyword-case" + "cpsc-keyword-endcase:cpsc-keyword-case" + "cpsc-keyword-endfunction:cpsc-keyword-function" + "cpsc-keyword-endprocedure:cpsc-keyword-procedure" + "cpsc-keyword-read:cpsc-keyword-openfile" + "cpsc-keyword-write:cpsc-keyword-openfile" + "cpsc-keyword-append:cpsc-keyword-openfile" + "cpsc-keyword-array:cpsc-keyword-declare" + "cpsc-keyword-integer:cpsc-keyword-declare" + "cpsc-keyword-real:cpsc-keyword-declare" + "cpsc-keyword-boolean:cpsc-keyword-declare" + "cpsc-keyword-char:cpsc-keyword-declare" + "cpsc-keyword-string:cpsc-keyword-declare" + "cpsc-keyword-endtype:cpsc-keyword-type" + "cpsc-keyword-public:cpsc-keyword-class" + "cpsc-keyword-private:cpsc-keyword-class" + "cpsc-keyword-endclass:cpsc-keyword-class" +) diff --git a/cmake/Release.cmake b/cmake/Release.cmake index dfb6586..7ff1d2c 100644 --- a/cmake/Release.cmake +++ b/cmake/Release.cmake @@ -1,5 +1,6 @@ # Read HEAD at packaging time so subsequent commits do not require reconfiguration. include("${CPSC_SOURCE_DIR}/cmake/FindDependency.cmake") +include("${CPSC_SOURCE_DIR}/cmake/ManualAliases.cmake") cpsc_find_dependency(PROGRAM GIT_EXECUTABLE NAMES git REQUIRED) find_package(Git REQUIRED) execute_process( @@ -52,6 +53,18 @@ foreach(source IN LISTS cpsc_language_sources) file(COPY "${CPSC_BINARY_DIR}/doc/language/${relative}" DESTINATION "${cpsc_package_dir}/doc/language/${directory}") endforeach() +foreach(pair IN LISTS CPSC_MANUAL_ALIASES) + string(REPLACE ":" ";" alias_parts "${pair}") + list(GET alias_parts 0 alias_name) + set(relative "keyword/${alias_name}.${cpsc_language_extension}") + get_filename_component(directory "${relative}" DIRECTORY) + if(NOT EXISTS "${CPSC_BINARY_DIR}/doc/language/${relative}") + message(FATAL_ERROR "Language manual alias is missing: ${relative}") + endif() + file(MAKE_DIRECTORY "${cpsc_package_dir}/doc/language/${directory}") + file(COPY "${CPSC_BINARY_DIR}/doc/language/${relative}" + DESTINATION "${cpsc_package_dir}/doc/language/${directory}") +endforeach() execute_process( COMMAND "${CMAKE_COMMAND}" -E tar "${cpsc_tar_flags}" "${cpsc_archive}" "--format=${cpsc_archive_format}" "${cpsc_package_name}" |
