[kde-doc-english] [kdesrc-build] /: build-systems: Mask default options for non-default build systems.
Michael Pyne
mpyne at kde.org
Sun Mar 30 04:17:52 UTC 2014
Git commit 9fb3fb04d170478c922c5d85bb996f8f4b7ed82c by Michael Pyne.
Committed on 30/03/2014 at 03:39.
Pushed by mpyne into branch 'master'.
build-systems: Mask default options for non-default build systems.
This is a first-step hack to have non-default build systems ignore
global options which are related to the build system in use (e.g.
compile or make flags, install/uninstall options, etc.).
This should fix bug 331654 (now that I understand it better) and improve
the situation for bug 332789 (which would be the long-term fix when
implemented).
BUG:331654
CCBUG:332789
FIXED-IN:1.16
M +11 -8 doc/index.docbook
M +31 -1 modules/ksb/BuildSystem.pm
http://commits.kde.org/kdesrc-build/9fb3fb04d170478c922c5d85bb996f8f4b7ed82c
diff --git a/doc/index.docbook b/doc/index.docbook
index 7705584..d15db62 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -1760,7 +1760,8 @@ operation of the &git; source control system.</para>
<row id="conf-cmake-options">
<entry>cmake-options</entry>
-<entry>Appends to global options (not applicable to qt)</entry>
+<entry>Appends to global options for the default buildsystem, overrides global
+for other buildsystems.</entry>
<entry><para>Use this option to specify what flags to pass to &cmake; when
creating the build system for the module. When this is used as a global option,
it is applied to all modules that this script builds. When used as a module
@@ -1794,7 +1795,8 @@ color codes to anything but a terminal (such as xterm, &konsole;, or the normal
<row id="conf-configure-flags">
<entry>configure-flags</entry>
-<entry>Module setting overrides global</entry>
+<entry>Appends to global options for the default buildsystem, overrides global
+for other buildsystems.</entry>
<entry><para>Use this option to specify what flags to pass to ./configure when
creating the build system for the module. When this is used as a global-option,
it is applied to all modules that this script builds. <emphasis>This option
@@ -1808,7 +1810,7 @@ only works for qt.</emphasis></para>
<row id="conf-custom-build-command">
<entry>custom-build-command</entry>
-<entry>Module setting overrides global</entry>
+<entry>Module setting overrides global (build system option)</entry>
<entry>
<para>This option can be set to run a different command (other than
<command>make</command>, for example) in order to perform the build
@@ -1826,7 +1828,8 @@ only works for qt.</emphasis></para>
<row id="conf-cxxflags">
<entry>cxxflags</entry>
-<entry>Appends to global option</entry>
+<entry>Appends to global options for the default buildsystem, overrides global
+for other buildsystems.</entry>
<entry><para>Use this option to specify what flags to use for building the
module. This option is
specified here instead of with <link
@@ -2154,7 +2157,7 @@ generated by the script.
<row id="conf-make-install-prefix">
<entry>make-install-prefix</entry>
-<entry>Module setting overrides global</entry>
+<entry>Module setting overrides global (build system option)</entry>
<entry>Set this variable to a space-separated list, which is interpreted as a
command and its options to precede the <userinput><command>make</command> <option>install</option></userinput> command used to install
modules. This is useful for installing packages with &sudo; for example, but
@@ -2163,7 +2166,7 @@ please be careful while dealing with root privileges.</entry>
<row id="conf-make-options">
<entry>make-options</entry>
-<entry>Module setting overrides global</entry>
+<entry>Module setting overrides global (build system option)</entry>
<entry>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="http://distcc.samba.org/"><application>distcc</application></ulink> or
@@ -2392,7 +2395,7 @@ linkend="kde-projects-module-sets">kde-projects</link> modules) until
<row id="conf-run-tests">
<entry>run-tests</entry>
-<entry>Module setting overrides global</entry>
+<entry>Module setting overrides global (build system option)</entry>
<entry>If set to <userinput>true</userinput>, then the module will be
built with support for running its test suite, and the test suite will be
executed as part of the build process. &kdesrc-build; will show a simple
@@ -2474,7 +2477,7 @@ url="http://download.kde.org/download.php">its mirrors</ulink>.</para>
<row id="conf-use-clean-install">
<entry>use-clean-install</entry>
-<entry>Module setting overrides global</entry>
+<entry>Module setting overrides global (build system option)</entry>
<entry><para>Set this option to <userinput>true</userinput> in order to
have &kdesrc-build; run <command>make uninstall</command> directly before
running <command>make install</command>.</para>
diff --git a/modules/ksb/BuildSystem.pm b/modules/ksb/BuildSystem.pm
index 91e8967..1ec0d4b 100644
--- a/modules/ksb/BuildSystem.pm
+++ b/modules/ksb/BuildSystem.pm
@@ -17,7 +17,37 @@ use List::Util qw(first);
sub new
{
my ($class, $module) = @_;
- return bless { module => $module }, $class;
+ my $self = bless { module => $module }, $class;
+
+ # This is simply the 'default' build system at this point, also used for
+ # KF5.
+ if ($class ne 'ksb::BuildSystem::KDE4') {
+ _maskGlobalBuildSystemOptions($self);
+ }
+
+ return $self;
+}
+
+# Removes or masks global build system-related options, so that they aren't
+# accidentally picked up for use with our non-default build system.
+# Module-specific options are left intact.
+sub _maskGlobalBuildSystemOptions
+{
+ my $self = shift;
+ my $module = $self->module();
+ my $ctx = $module->buildContext();
+ my @buildSystemOptions = qw(
+ cmake-options configure-flags custom-build-command cxxflags
+ make-install-prefix make-options run-tests use-clean-install
+ );
+
+ for my $opt (@buildSystemOptions) {
+ # If an option is present, and not set at module-level, it must be
+ # global. Can't use getOption() method due to recursion.
+ if ($ctx->{options}->{$opt} && !$module->{options}->{$opt}) {
+ $module->{options}->{$opt} = '';
+ }
+ }
}
sub module
More information about the kde-doc-english
mailing list