build: featurize docs; always install licenses

This commit is contained in:
Andrei Alexeyev 2022-12-14 08:06:32 +01:00
parent c3a94d7f5b
commit 1ddc58b84a
No known key found for this signature in database
GPG key ID: 72D26128040B9690
3 changed files with 38 additions and 48 deletions

View file

@ -1,27 +1,33 @@
if install_docs
rst2html_variants = []
# This is *completely* ridiculous, but apparently this thing has THAT many faces.
basenames = ['rst2html5', 'rst2html', 'rst2html4']
suffixes = ['', '-3', '3', '-docutils']
foreach basename : basenames
foreach suffix : suffixes
variant = '@0@@1@'.format(basename, suffix)
rst2html_variants += [variant, '@0@.py'.format(variant)]
endforeach
endforeach
rst2html5 = find_program(
rst2html_variants,
required : false
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
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
rst2html_variants = []
# This is *completely* ridiculous, but apparently this thing has THAT many faces.
basenames = ['rst2html5', 'rst2html', 'rst2html4']
suffixes = ['', '-3', '3', '-docutils']
foreach basename : basenames
foreach suffix : suffixes
variant = '@0@@1@'.format(basename, suffix)
rst2html_variants += [variant, '@0@.py'.format(variant)]
endforeach
endforeach
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

View file

@ -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)

View file

@ -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(