[kdesrc-build] /: Reduce importance of qtdir option, default to ''.

Michael Pyne null at kde.org
Tue Aug 22 23:38:04 UTC 2017


Git commit 02c616cbb08915fe2804c75259ddf449ab8c1792 by Michael Pyne.
Committed on 06/08/2017 at 03:33.
Pushed by mpyne into branch 'master'.

Reduce importance of qtdir option, default to ''.

The qtdir setting took on much less importance with Qt 5.  We've never
officially supported building Qt 5 with kdesrc-build, and qmake and
cmake both use qmake or similar Qt-provided config information to find
Qt, rather than using the unsupported QTDIR environment variable.

As a result, default the value to an empty string (interpreted as use of
system Qt) and stop adding it automatically to the environment variables
defined during the build.  If set, it will continue to be used for now.

This also helps the environment setup driver detect when it should look
for the system Qt5 qmake.

M  +2    -5    doc/index.docbook
M  +3    -3    kdesrc-build-setup
M  +2    -1    kdesrc-buildrc-kf5-sample
M  +2    -4    kdesrc-buildrc-sample
M  +1    -1    modules/ksb/Application.pm
M  +1    -1    modules/ksb/BuildContext.pm
M  +6    -0    modules/ksb/BuildSystem/Qt4.pm
M  +7    -15   modules/ksb/Module.pm

https://commits.kde.org/kdesrc-build/02c616cbb08915fe2804c75259ddf449ab8c1792

diff --git a/doc/index.docbook b/doc/index.docbook
index 85516c3..8ecf0cc 100644
--- a/doc/index.docbook
+++ b/doc/index.docbook
@@ -2450,11 +2450,8 @@ installs the module.
 <entry>qtdir</entry>
 <entry>Module setting overrides global</entry>
 <entry>Set this option to set the environment variable <envar>QTDIR</envar> while building.
-You cannot override this setting in a module option. If you do not specify
-this option, it defaults to
-<filename class="directory"><symbol>${source-dir}</symbol>/build/qt</filename>,
-which uses the qt module included in the &kde; source repository.
-You may use a tilde (~) to represent your home directory.
+If you do not specify this option, &kdesrc-build; will assume that &Qt; is
+provided by the operating system.
 </entry>
 </row>
 
diff --git a/kdesrc-build-setup b/kdesrc-build-setup
index 5c437a3..4797a19 100755
--- a/kdesrc-build-setup
+++ b/kdesrc-build-setup
@@ -324,9 +324,9 @@ print $output <<EOF;
     # once. 'kf5-qt5' is the latest KF5 and Qt5-based software.
     branch-group kf5-qt5
 
-    # The path to your Qt installation.
-    qtdir ~/qt5
-#   qtdir /usr # If system Qt
+    # The path to your Qt installation (default is empty, assumes Qt provided
+    # by system)
+#   qtdir ~/qt5
 
     # Install directory for KDE software
     kdedir $installDir
diff --git a/kdesrc-buildrc-kf5-sample b/kdesrc-buildrc-kf5-sample
index 08b7b97..aaa0619 100644
--- a/kdesrc-buildrc-kf5-sample
+++ b/kdesrc-buildrc-kf5-sample
@@ -7,7 +7,8 @@
 global
     branch-group kf5-qt5
     kdedir ~/kde-5 # Where to install KF5-based software
-    qtdir /usr     # Where to find Qt5
+    # Uncomment this and edit value to choose a different Qt5
+#    qtdir /usr     # Where to find Qt5
 
     # Where to download source code. By default the build directory and
     # logs will be kept under this directory as well.
diff --git a/kdesrc-buildrc-sample b/kdesrc-buildrc-sample
index 23cf108..85444f5 100644
--- a/kdesrc-buildrc-sample
+++ b/kdesrc-buildrc-sample
@@ -24,10 +24,8 @@ global
 #
 # This is the Qt installation to use for building/using KDE. The default is
 # to build Qt (see the qt module below). If you wish to use your system's
-# installed Qt (assuming it is recent enough!) then you can set this to the
-# path to your Qt installation. To find the path to your system's Qt, run
-# "qmake -v". Qt will be installed to the path reported (do not include /lib)
-	qtdir ~/qt4  # Default to installing Qt
+# installed Qt (assuming it is recent enough!) then you can leave this unset.
+#	qtdir ~/qt4  # Default to installing Qt
 
 # By default, each source code module is checked out from its latest
 # development version ('master' for git, 'trunk' for subversion).
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 44cfbb0..3e4f9e9 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -2260,7 +2260,7 @@ sub _installTemplatedFile
                 \s*%>     # remaining whitespace and closing bracket
               }
               {
-                  $ctx->getOption($1, 'module') ||
+                  $ctx->getOption($1, 'module') //
                       croak_runtime("Invalid variable $1")
               }gxe;
               # Replace all matching expressions, use extended regexp w/
diff --git a/modules/ksb/BuildContext.pm b/modules/ksb/BuildContext.pm
index 3e2c3aa..7634043 100644
--- a/modules/ksb/BuildContext.pm
+++ b/modules/ksb/BuildContext.pm
@@ -112,7 +112,7 @@ our %defaultGlobalOptions = (
     "override-build-system"=> "",
     "override-url"         => "",
     "persistent-data-file" => "",
-    "qtdir"                => "$ENV{HOME}/qt4",
+    "qtdir"                => "",
     "remove-after-install" => "none", # { none, builddir, all }
     "source-dir"           => "$ENV{HOME}/kdesrc",
     "svn-server"           => "svn://anonsvn.kde.org/home/kde",
diff --git a/modules/ksb/BuildSystem/Qt4.pm b/modules/ksb/BuildSystem/Qt4.pm
index 5bc5e89..fe3984a 100644
--- a/modules/ksb/BuildSystem/Qt4.pm
+++ b/modules/ksb/BuildSystem/Qt4.pm
@@ -49,6 +49,12 @@ sub configureInternal
 
     my $prefix = $module->getOption('qtdir');
 
+    if (!$prefix)
+    {
+        error ("\tThe b[qtdir] option must be set to determine where to install r[b[$module]");
+        return 0;
+    }
+
     # Some users have added -prefix manually to their flags, they
     # probably shouldn't anymore. :)
 
diff --git a/modules/ksb/Module.pm b/modules/ksb/Module.pm
index ce3975b..d6aa249 100644
--- a/modules/ksb/Module.pm
+++ b/modules/ksb/Module.pm
@@ -647,31 +647,23 @@ sub setupEnvironment
     my $self = assert_isa(shift, 'ksb::Module');
     my $ctx = $self->buildContext();
     my $kdedir = $self->getOption('kdedir');
-    my $qtdir = $self->getOption('qtdir');
     my $prefix = $self->installationPath();
 
-    # Add global set-envs
+    # Add global set-envs and context
     $self->buildContext()->applyUserEnvironment();
 
-    # Add some standard directories for pkg-config support.  Include env settings.
-    my @pkg_config_dirs = ("$kdedir/lib/pkgconfig", "$qtdir/lib/pkgconfig");
+    my @pkg_config_dirs = ("$kdedir/lib/pkgconfig");
     $ctx->prependEnvironmentValue('PKG_CONFIG_PATH', @pkg_config_dirs);
 
-    # Likewise, add standard directories that should be in LD_LIBRARY_PATH.
-    my @ld_dirs = ("$kdedir/lib", "$qtdir/lib", $self->getOption('libpath'));
+    my @ld_dirs = ("$kdedir/lib", $self->getOption('libpath'));
     $ctx->prependEnvironmentValue('LD_LIBRARY_PATH', @ld_dirs);
 
-    my $buildSystem = $self->buildSystem();
-    $buildSystem->prepareModuleBuildEnvironment($ctx, $self, $prefix);
-
-    my @path = ("$kdedir/bin", "$qtdir/bin", $self->getOption('binpath'));
+    my @path = ("$kdedir/bin", $self->getOption('binpath'));
     $ctx->prependEnvironmentValue('PATH', @path);
 
-    # Set up the children's environment.  We use queueEnvironmentVariable since
-    # it won't set an environment variable to nothing.  (e.g, setting QTDIR to
-    # a blank string might confuse Qt or KDE.
-
-    $ctx->queueEnvironmentVariable('QTDIR', $qtdir);
+    # Build system's environment injection
+    my $buildSystem = $self->buildSystem();
+    $buildSystem->prepareModuleBuildEnvironment($ctx, $self, $prefix);
 
     # Read in user environment defines
     $self->applyUserEnvironment() unless $self == $ctx;



More information about the kde-doc-english mailing list