[kdesrc-build/feature-meson-support] /: meson: Fix build system integration bugs, add docs.

Michael Pyne null at kde.org
Wed May 1 03:07:18 BST 2019


Git commit cd7af4eed524b78a7b5228ce799ae84968acc4b2 by Michael Pyne.
Committed on 01/05/2019 at 02:04.
Pushed by mpyne into branch 'feature-meson-support'.

meson: Fix build system integration bugs, add docs.

This should account for the open issues on !8 and also documents the
ninja-options that is introduced to address @ouwerkerk's recommendation.

Test suite passes and I continue to be able to build 2048.cpp. I've also
validated that ninja-options is passed to ninja when building 2048.cpp,
though this was a manual verification.

M  +43   -2    doc/index.docbook
M  +1    -0    modules/ksb/Application.pm
M  +2    -1    modules/ksb/BuildSystem.pm
M  +10   -1    modules/ksb/BuildSystem/Meson.pm
M  +3    -2    vim/syntax/kdesrc-buildrc.vim

https://invent.kde.org/kde/kdesrc-build/commit/cd7af4eed524b78a7b5228ce799ae84968acc4b2

diff --git a/doc/index.docbook b/doc/index.docbook
index 881d861..c280ad5 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2438,10 +2438,15 @@ please be careful while dealing with root privileges.</entry>
 <row id="conf-make-options">
 <entry>make-options</entry>
 <entry>Module setting overrides global (build system option)</entry>
-<entry>Set this variable in order to pass command line options to the
+<entry><para>Set this variable in order to pass command line options to the
 <command>make</command> command. This is useful for programs such as <ulink
 url="https://github.com/distcc/distcc"><application>distcc</application></ulink> or
-systems with more than one processor core.
+systems with more than one processor core.</para>
+<para>Note that not all supported build systems use <command>make</command>. For
+build systems that use <command>ninja</command> for build (such as the
+<link linkend="conf-override-build-system"><application>Meson</application>
+build system</link>), see the <link linkend="conf-ninja-options">ninja-options</link>
+setting.</para>
 </entry>
 </row>
 
@@ -2499,6 +2504,36 @@ number, the "nicer" the program is. The default is 10.
 </entry>
 </row>
 
+<row id="conf-ninja-options">
+<entry>ninja-options</entry>
+<entry>Module setting overrides global (build system option)</entry>
+<entry><para>Set this variable in order to pass command line options to the
+
+<command>ninja</command> build command. This can be useful to enable <quote>verbose</quote> output
+or to manually reduce the number of parallel build jobs that <command>ninja</command> would
+use.</para>
+
+<note><para>Note that this setting only controls ninja when used by &kdesrc-build;.
+The &Qt; <quote>webengine</quote> module uses <command>ninja</command> indirectly, but
+only officially supports being built by <command>make</command>.
+In this situation, you can set <literal>NINJAFLAGS</literal> as a way to have
+<command>make</command> pass the appropriate flags when it later calls
+<command>ninja</command>, by using
+<link linkend="conf-make-options">make-options</link>.</para>
+
+<informalexample>
+<programlisting>
+options <replaceable>qtwebengine</replaceable>
+    # Restrict make and ninja to using no more than 6 separate compile jobs even
+    # when more CPU is available, to avoid running out of memory
+    <option><link linkend="conf-make-options">make-options</link></option> -j<replaceable>6</replaceable> NINJAFLAGS=-j<replaceable>6</replaceable>
+end options
+</programlisting>
+</informalexample>
+</note>
+</entry>
+</row>
+
 <row id="conf-no-svn">
 <entry>no-svn</entry>
 <entry>Module setting overrides global</entry>
@@ -2554,6 +2589,12 @@ the auto-detection. In this case you can manually specify the correct build type
         <listitem><para>This is the standard configuration tool used for most Free and
             open-source software not in any of the other categories.</para></listitem>
     </varlistentry>
+    <varlistentry>
+        <term>meson</term>
+        <listitem><para>This is a <ulink url="https://mesonbuild.com">relatively new
+            tool</ulink> gaining popularity as a replacement for the autotools and may
+            be required for some non-&kde; modules.</para></listitem>
+    </varlistentry>
 </variablelist>
 
 </entry>
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 1ae55df..1a3d579 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -2531,6 +2531,7 @@ sub _checkForEssentialBuildPrograms
         my %requiredPackages = (
             qmake => 'Qt',
             cmake => 'CMake',
+            meson => 'Meson',
         );
 
         my $preferredPath = absPathToExecutable($prog, @preferred_paths);
diff --git a/modules/ksb/BuildSystem.pm b/modules/ksb/BuildSystem.pm
index 2053f3b..d67a79e 100644
--- a/modules/ksb/BuildSystem.pm
+++ b/modules/ksb/BuildSystem.pm
@@ -134,12 +134,13 @@ sub buildCommands
 sub buildInternal
 {
     my $self = shift;
+    my $optionsName = shift // 'make-options';
 
     return $self->safe_make({
         target => undef,
         message => 'Compiling...',
         'make-options' => [
-            split(' ', $self->module()->getOption('make-options')),
+            split(' ', $self->module()->getOption($optionsName)),
         ],
         logbase => 'build',
         subdirs => [
diff --git a/modules/ksb/BuildSystem/Meson.pm b/modules/ksb/BuildSystem/Meson.pm
index e80d494..3a93a25 100644
--- a/modules/ksb/BuildSystem/Meson.pm
+++ b/modules/ksb/BuildSystem/Meson.pm
@@ -18,6 +18,7 @@ sub name
     return 'meson';
 }
 
+# Override
 # Return value style: boolean
 sub configureInternal
 {
@@ -41,6 +42,14 @@ sub configureInternal
         ]) == 0;
 }
 
+# Override
+sub buildInternal
+{
+    my $self = shift;
+
+    return $self->SUPER::buildInternal('ninja-options');
+}
+
 # Override
 sub buildCommands
 {
@@ -50,7 +59,7 @@ sub buildCommands
 # Override
 sub requiredPrograms
 {
-    return 'meson';
+    return ('meson', 'ninja');
 }
 
 # Override
diff --git a/vim/syntax/kdesrc-buildrc.vim b/vim/syntax/kdesrc-buildrc.vim
index 6cd4808..b55fdcc 100644
--- a/vim/syntax/kdesrc-buildrc.vim
+++ b/vim/syntax/kdesrc-buildrc.vim
@@ -1,9 +1,9 @@
 " Vim syntax file
 " Language: kdesrc-build configuration file
 " Maintainer: Michael Pyne <mpyne at kde.org>
-" Latest Revision: 23 July 2017
+" Latest Revision: 30 April 2019
 
-" Copyright (c) 2014-2017 Michael Pyne <mpyne at kde.org>
+" Copyright (c) 2014-2019 Michael Pyne <mpyne at kde.org>
 " Redistribution and use in source and binary forms, with or without
 " modification, are permitted provided that the following conditions
 " are met:
@@ -39,6 +39,7 @@ syn keyword ksbrcOption contained skipwhite nextgroup=ksbrcStringValue
             \ binpath branch build-dir checkout-only cmake-options configure-flags
             \ custom-build-command cxxflags dest-dir do-not-compile kdedir
             \ libpath log-dir make-install-prefix make-options module-base-path
+            \ ninja-options
             \ override-build-system override-url prefix qtdir repository
             \ revision source-dir svn-server tag remove-after-install
             \ qmake-options git-user


More information about the kde-doc-english mailing list