Skip to content

Commit

Permalink
build: featurize docs; always install licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed Dec 16, 2022
1 parent c3a94d7 commit 1ddc58b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 46 deletions.
52 changes: 24 additions & 28 deletions 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',
Expand Down Expand Up @@ -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
24 changes: 9 additions & 15 deletions meson.build
Expand Up @@ -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
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions meson_options.txt
Expand Up @@ -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(
Expand Down

0 comments on commit 1ddc58b

Please sign in to comment.