From: John Marshall Date: Mon, 11 Jun 2018 09:12:24 +0000 (+0100) Subject: meson build: only build docs if we can run required objects in build environment X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~11^2~123 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d606119915b13b7d8eecedf1ba0775fbb1bdcc50;p=babl.git meson build: only build docs if we can run required objects in build environment --- diff --git a/docs/meson.build b/docs/meson.build index 03a38c9..11d517e 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -17,12 +17,16 @@ babl_css = configure_file(input : 'babl.css', output : 'babl.css', configuration : configuration_data()) +index_html_tmp_env = [ + 'BABL_PATH='+ join_paths(meson.build_root(), 'extensions'), +] + index_html_tmp = custom_target('index.html.tmp', input : [ babl_html_dump, ], output: [ 'index.html.tmp', ], command: [ env_bin, - 'BABL_PATH='+ join_paths(meson.build_root(), 'extensions'), + index_html_tmp_env, babl_html_dump ], capture: true, diff --git a/meson.build b/meson.build index eb999b3..142a203 100644 --- a/meson.build +++ b/meson.build @@ -145,6 +145,8 @@ build_platform_win32 = (build_os.startswith('mingw') or build_os.startswith('cygwin') or build_os.startswith('windows')) +# Only run cross compile objects if we have exe wrapper +cc_can_run = not meson.is_cross_build() or meson.has_exe_wrapper() ################################################################################ # Compiler arguments @@ -307,13 +309,26 @@ endif ################################################################################ # Build utilities -env_bin = find_program('env', required: true, native: true) +env_bin = find_program('env', required: false, native: true) git_bin = find_program('git', required: false, native: true) rsvg_convert_bin = find_program('rsvg-convert', required: false, native: true) test_bin = find_program('test', required: false, native: true) w3m_bin = find_program('w3m', required: false, native: true) +################################################################################ +# Build flags + +build_docs = false + +if get_option('with-docs') + if cc_can_run and env_bin.found() and not build_platform_win32 + build_docs = true + else + warning('Unable to generate docs in this environment') + endif +endif + ################################################################################ # Configuration files @@ -350,12 +365,11 @@ subdir('babl') subdir('extensions') subdir('tests') subdir('tools') -if get_option('with-docs') +if build_docs subdir('docs') endif - -if w3m_bin.found() +if w3m_bin.found() and build_docs custom_target('README', input : [ join_paths('docs', 'index.html'), ] , output: [ 'README' ] ,