From 1ddc58b84ae7c5b7733c1c31bfa4b6619d84a04a Mon Sep 17 00:00:00 2001 From: Andrei Alexeyev Date: Wed, 14 Dec 2022 08:06:32 +0100 Subject: [PATCH] build: featurize docs; always install licenses --- doc/meson.build | 52 ++++++++++++++++++++++------------------------- meson.build | 24 ++++++++-------------- meson_options.txt | 6 +++--- 3 files changed, 36 insertions(+), 46 deletions(-) diff --git a/doc/meson.build b/doc/meson.build index 43b5b715fd..8012ce7a90 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -1,27 +1,33 @@ -if install_docs - rst2html_variants = [] +if angle_enabled + bindist_deps += custom_target('LICENSE.ANGLE', + command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'], + input : 'LICENSE.ANGLE', + output : 'LICENSE.txt', + install : true, + install_dir : angle_install_path + ) +endif - # This is *completely* ridiculous, but apparently this thing has THAT many faces. - basenames = ['rst2html5', 'rst2html', 'rst2html4'] - suffixes = ['', '-3', '3', '-docutils'] +rst2html_variants = [] - foreach basename : basenames - foreach suffix : suffixes - variant = '@0@@1@'.format(basename, suffix) - rst2html_variants += [variant, '@0@.py'.format(variant)] - endforeach - endforeach +# This is *completely* ridiculous, but apparently this thing has THAT many faces. +basenames = ['rst2html5', 'rst2html', 'rst2html4'] +suffixes = ['', '-3', '3', '-docutils'] - rst2html5 = find_program( - rst2html_variants, - required : false - ) +foreach basename : basenames + foreach suffix : suffixes + variant = '@0@@1@'.format(basename, suffix) + rst2html_variants += [variant, '@0@.py'.format(variant)] + endforeach +endforeach - if not rst2html5.found() - error('rst2html5 from docutils is required to build documentation. Please install it, or disable the `docs` option if you don\'t want it.') - endif +rst2html5 = find_program( + rst2html_variants, + required : get_option('docs') +) +if rst2html5.found() rst_to_html = generator(rst2html5, arguments : [ '--no-datestamp', @@ -67,14 +73,4 @@ if install_docs depend_files : files('taisei.css') ) endforeach - - if angle_enabled - bindist_deps += custom_target('LICENSE.ANGLE', - command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'], - input : 'LICENSE.ANGLE', - output : 'LICENSE.txt', - install : true, - install_dir : angle_install_path - ) - endif endif diff --git a/meson.build b/meson.build index f462250a9b..eab068a684 100644 --- a/meson.build +++ b/meson.build @@ -405,22 +405,16 @@ config.set('TAISEI_BUILDCONF_LOG_FATAL_MSGBOX', ( )) config.set('TAISEI_BUILDCONF_DEBUG_OPENGL', get_option('debug_opengl')) -install_docs = get_option('docs') and host_machine.system() != 'emscripten' - if host_machine.system() == 'windows' - if install_docs - custom_target('COPYING.txt', - command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'], - input : 'COPYING', - output : 'COPYING.txt', - install : true, - install_dir : doc_path - ) - endif + custom_target('COPYING.txt', + command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'], + input : 'COPYING', + output : 'COPYING.txt', + install : true, + install_dir : doc_path + ) else - if install_docs - install_data('COPYING', install_dir : doc_path) - endif + install_data('COPYING', install_dir : doc_path) endif if angle_enabled @@ -439,7 +433,7 @@ if angle_enabled endif # Where to install the libs (prefix-relative) - # Also used in docs/meson.build to install the license + # Also used in doc/meson.build to install the license angle_install_path = join_paths(lib_path, angle_dir) # Where the game should look (either absolute or SDL_GetBasePath()-relative, depending on configuration) diff --git a/meson_options.txt b/meson_options.txt index 0315a7e5c9..49b979fa35 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -108,9 +108,9 @@ option( option( 'docs', - type : 'boolean', - value : true, - description : 'Build and install documentation' + type : 'feature', + deprecated : {'true' : 'enabled', 'false' : 'disabled'}, + description : 'Build and install documentation (requires docutils)' ) option(