[sdk/kdesrc-build] /: Eliminate distinction between `prefix` and `install-dir`

Andrew Shark null at kde.org
Sun Jan 14 01:50:28 GMT 2024


Git commit 9b8ccbfe26bc751f42df49b2dc15f4a1ea886480 by Andrew Shark.
Committed on 14/01/2024 at 02:38.
Pushed by ashark into branch 'master'.

Eliminate distinction between `prefix` and `install-dir`

We will not use `--prefix` cli option or `prefix` config option anymore, because it means same thing what `install-dir` was meant for.

- For those who used '$MODULE' or '${MODULE}' in the `prefix` config option, we now will make that substitution in `install-dir` config option.
- Add a warning message if the prefix config option still found in user config

Closes #141

M  +1    -1    data/build-include/qt5.ksb
M  +1    -1    data/build-include/qt6.ksb
M  +7    -17   doc/conf-options-table.docbook
M  +0    -18   doc/man-kdesrc-build.1.docbook
M  +3    -4    doc/supported-cmdline-params.docbook
M  +3    -0    modules/ksb/Application.pm
M  +0    -1    modules/ksb/BuildContext.pm
M  +4    -4    modules/ksb/BuildSystem/KDECMake.pm
M  +6    -6    modules/ksb/BuildSystem/Qt5.pm
M  +3    -5    modules/ksb/Cmdline.pm
M  +3    -9    modules/ksb/Module.pm

https://invent.kde.org/sdk/kdesrc-build/-/commit/9b8ccbfe26bc751f42df49b2dc15f4a1ea886480

diff --git a/data/build-include/qt5.ksb b/data/build-include/qt5.ksb
index f90f241d..7dee09f2 100644
--- a/data/build-include/qt5.ksb
+++ b/data/build-include/qt5.ksb
@@ -15,7 +15,7 @@ module-set qt5-set
     # ignore-modules qtwebengine
 
     # install path. This *MUST* match your qtdir setting in kdesrc-buildrc!
-    prefix ${qtdir}
+    install-dir ${qtdir}
 
     configure-flags -release -reduce-relocations -force-debug-info -separate-debug-info -skip qtdocgallery
 
diff --git a/data/build-include/qt6.ksb b/data/build-include/qt6.ksb
index 35cedc94..4259b401 100644
--- a/data/build-include/qt6.ksb
+++ b/data/build-include/qt6.ksb
@@ -10,7 +10,7 @@ module-set qt6-set
     branch     6.6
 
     # install path. This *MUST* match your qtdir setting in kdesrc-buildrc!
-    prefix ${qtdir}
+    install-dir ${qtdir}
 
     # These have been manually placed in dependency order based on the
     # .gitmodules file in https://code.qt.io/cgit/qt/qt5.git/tree/.gitmodules
diff --git a/doc/conf-options-table.docbook b/doc/conf-options-table.docbook
index e74858b1..86e35dbb 100644
--- a/doc/conf-options-table.docbook
+++ b/doc/conf-options-table.docbook
@@ -791,11 +791,17 @@ flag.</para>
 <member>Type</member><member>String</member>
 <member>Default value</member><member><filename class="directory">~/kde/usr</filename></member>
 </simplelist>
-<para>This option sets the directory that &kde; will be installed to after it
+<para>This option controls where to install the module after it
 is built. If you
 change this to a directory needing root access, you may want to read about the
 <link linkend="conf-make-install-prefix">make-install-prefix</link> option as
 well.</para>
+<para>
+Changing this option for specific module allows you to install it to a different directory than
+where the &kde; Platform libraries are installed, such as if you were using
+&kdesrc-build; only to build applications.</para>
+<para>You can use <varname>${MODULE}</varname> or <varname>$MODULE</varname>
+in the path to have them expanded to the module's name.</para>
 </entry>
 </row>
 
@@ -1001,22 +1007,6 @@ the auto-detection. In this case you can manually specify the correct build type
 </entry>
 </row>
 
-<row id="conf-prefix">
-<entry>prefix</entry>
-<entry>
-<simplelist type='horiz' columns='2'>
-<member>Type</member><member>String</member>
-</simplelist>
-<para>This option controls where to install the module (normally the
-<option><link linkend="conf-install-dir">install-dir</link></option> setting is used).
-Using this option allows you to install a module to a different directory than
-where the KDE Platform libraries are installed, such as if you were using
-&kdesrc-build; only to build applications.</para>
-<para>You can use <varname>${MODULE}</varname> or <varname>$MODULE</varname>
-in the path to have them expanded to the module's name.</para>
-</entry>
-</row>
-
 <row id="conf-purge-old-logs">
 <entry>purge-old-logs</entry>
 <entry>
diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook
index fd0cb45f..59279ee1 100644
--- a/doc/man-kdesrc-build.1.docbook
+++ b/doc/man-kdesrc-build.1.docbook
@@ -606,24 +606,6 @@ Edit the "~/.bashrc" (or other shell rc file) to add &kdesrc-build; to your $PAT
 </listitem>
 </varlistentry>
 
-<varlistentry>
-<term>
-<option>--prefix=<replaceable>foo</replaceable></option>
-</term>
-
-<listitem>
-<para>
-    Overrides the <option>install-dir</option> setting to be
-    <replaceable>foo</replaceable> for this run. In addition, implies
-    <option>--reconfigure</option>. It <emphasis>does not</emphasis> actually
-    perform the action you would think it does (overriding the
-    <option>prefix</option> option to change where modules are installed),
-    although by default modules are installed to the <option>install-dir</option>
-    setting if <option>prefix</option> is not set.
-</para>
-</listitem>
-</varlistentry>
-
 <varlistentry>
 <term>
 <option>--nice=<replaceable>foo</replaceable></option>
diff --git a/doc/supported-cmdline-params.docbook b/doc/supported-cmdline-params.docbook
index ab7923bc..71993bdc 100644
--- a/doc/supported-cmdline-params.docbook
+++ b/doc/supported-cmdline-params.docbook
@@ -526,11 +526,10 @@ linkend="cmdline-refresh-build">--refresh-build</link></parameter> is used.
 </para></listitem>
 </varlistentry>
 
-<varlistentry id="cmdline-prefix">
-<term><option>--prefix <replaceable>/path/to/kde</replaceable></option></term>
+<varlistentry id="cmdline-install-dir">
+<term><option>--install-dir <replaceable>path</replaceable></option></term>
 <listitem><para>
-This allows you to change the directory that &kde; will be installed to from
-the command line.  This option implies <link
+This allows you to change the directory where modules will be installed to. This option implies <link
 linkend="cmdline-reconfigure"><option>--reconfigure</option></link>,
 but using <link linkend="cmdline-refresh-build"><option>--refresh-build</option></link>
 may still be required.
diff --git a/modules/ksb/Application.pm b/modules/ksb/Application.pm
index 2a99c248..92c63258 100644
--- a/modules/ksb/Application.pm
+++ b/modules/ksb/Application.pm
@@ -960,6 +960,9 @@ sub _parseModuleOptions ($ctx, $fileReader, $module, $endRE=undef)
             if ($option eq "kdedir") {  # todo This message is temporary. Remove it after 09.04.2024.
                 error "r[Please edit your config. Replace \"b[kdedir]r[\" with \"b[install-dir]r[\".";
             }
+            if ($option eq "prefix") {  # todo This message is temporary. Remove it after 14.04.2024.
+                error "r[Please edit your config. Replace \"b[prefix]r[\" with \"b[install-dir]r[\".";
+            }
             die ksb::BuildException::Config->new($option, "Unrecognized option \"$option\" found at $current_file:$.");
         }
 
diff --git a/modules/ksb/BuildContext.pm b/modules/ksb/BuildContext.pm
index 932f3c64..cd074ef7 100644
--- a/modules/ksb/BuildContext.pm
+++ b/modules/ksb/BuildContext.pm
@@ -108,7 +108,6 @@ my %internalGlobalOptions = (
     "manual-update"        => "",
     "niceness"             => "10",
     "no-src"               => "",
-    "prefix"               => "", # Override installation prefix.
     "pretend"              => "",
     "reconfigure"          => "",
     "refresh-build"        => "",
diff --git a/modules/ksb/BuildSystem/KDECMake.pm b/modules/ksb/BuildSystem/KDECMake.pm
index 67bc51c2..be94fe58 100644
--- a/modules/ksb/BuildSystem/KDECMake.pm
+++ b/modules/ksb/BuildSystem/KDECMake.pm
@@ -542,13 +542,13 @@ sub _safe_run_cmake
         push @commands, "-DCMAKE_CXX_FLAGS:STRING=$cxxflags";
     }
 
-    my $prefix = $module->installationPath();
+    my $installdir = $module->installationPath();
 
-    push @commands, "-DCMAKE_INSTALL_PREFIX=$prefix";
+    push @commands, "-DCMAKE_INSTALL_PREFIX=$installdir";
 
-    # Add custom Qt to the prefix (but don't overwrite a user-set prefix)
+    # Add custom Qt to the prefix (but don't overwrite a user-set install-dir)
     my $qtdir = $module->getOption('qtdir');
-    if ($qtdir && $qtdir ne $prefix &&
+    if ($qtdir && $qtdir ne $installdir &&
         !grep { /^\s*-DCMAKE_PREFIX_PATH/ } (@commands)
        )
     {
diff --git a/modules/ksb/BuildSystem/Qt5.pm b/modules/ksb/BuildSystem/Qt5.pm
index fdf4e695..658fe633 100644
--- a/modules/ksb/BuildSystem/Qt5.pm
+++ b/modules/ksb/BuildSystem/Qt5.pm
@@ -44,23 +44,23 @@ sub configureInternal
     my $cxxflags = $module->getOption('cxxflags');
     $module->buildContext()->queueEnvironmentVariable('CXXFLAGS', $cxxflags);
 
-    my $prefix = $module->getOption('prefix');
+    my $installdir = $module->getOption('install-dir');
     my $qtdir  = $module->getOption('qtdir');
 
-    if ($prefix && $qtdir && $prefix ne $qtdir) {
+    if ($installdir && $qtdir && $installdir ne $qtdir) {
         warning (<<EOF);
 b[y[*]
 b[y[*] Building the Qt module, but the install directory for Qt is not set to the
 b[y[*] Qt directory to use.
-b[y[*]   install directory ('prefix' option): b[$prefix]
+b[y[*]   install directory ('install-dir' option): b[$installdir]
 b[y[*]   Qt install to use ('qtdir'  option): b[$qtdir]
 b[y[*]
-b[y[*] Try setting b[qtdir] to the same setting as the Qt module's b[prefix].
+b[y[*] Try setting b[qtdir] to the same setting as the Qt module's b[install-dir].
 b[y[*]
 EOF
     }
 
-    $prefix ||= $qtdir; # Use qtdir for install if prefix not set
+    $installdir ||= $qtdir; # Use qtdir for install if install-dir not set
 
     # Some users have added -prefix manually to their flags, they
     # probably shouldn't anymore. :)
@@ -75,7 +75,7 @@ b[y[*]
 EOF
     }
 
-    push @commands, "-prefix", $prefix;
+    push @commands, "-prefix", $installdir;
     unshift @commands, $script;
 
     my $builddir = $module->fullpath('build');
diff --git a/modules/ksb/Cmdline.pm b/modules/ksb/Cmdline.pm
index daa04aa7..b7ab22bf 100644
--- a/modules/ksb/Cmdline.pm
+++ b/modules/ksb/Cmdline.pm
@@ -186,10 +186,9 @@ sub readCommandLineOptionsAndSelectors (@options)
             $opts->{run_mode} = 'install';
             $phases->phases('install');
         },
-        prefix => sub {
+        'install-dir' => sub {
             my ($optName, $arg) = @_;
-            $auxOptions{prefix} = $arg;
-            $foundOptions{'install-dir'} = $arg; #TODO: Still needed for compat?
+            $auxOptions{'install-dir'} = $arg;
             $foundOptions{reconfigure} = 1;
         },
         query => sub {
@@ -202,7 +201,7 @@ sub readCommandLineOptionsAndSelectors (@options)
             # Add useful aliases
             $arg = 'source-dir'  if $arg =~ /^src-?dir$/;
             $arg = 'build-dir'   if $arg =~ /^build-?dir$/;
-            $arg = 'install-dir' if $arg eq 'prefix';
+            $arg = 'install-dir' if $arg =~ /^install-?dir$/;
 
             $opts->{run_mode} = 'query';
             $auxOptions{query} = $arg;
@@ -455,7 +454,6 @@ sub _supportedOptions
         'no-metadata',
         'no-src|S',
         'no-tests',
-        'prefix=s',
         'pretend|dry-run|p',
         'print-modules',
         'query=s',
diff --git a/modules/ksb/Module.pm b/modules/ksb/Module.pm
index e1665e8c..6d831d29 100644
--- a/modules/ksb/Module.pm
+++ b/modules/ksb/Module.pm
@@ -1022,19 +1022,13 @@ sub destDir ($self)
 
 # Subroutine to return the installation path of a given module (the value
 # that is passed to the CMAKE_INSTALL_PREFIX CMake option).
-# It is based on the "prefix" and, if it is not set, the "install-dir" option.
-# The user may use '$MODULE' or '${MODULE}' in the "prefix" option to have
+# It is based on the "install-dir" option.
+# The user may use '$MODULE' or '${MODULE}' in the "install-dir" option to have
 # them replaced by the name of the module in question.
 sub installationPath
 {
     my $self = assert_isa(shift, 'ksb::Module');
-    my $path = $self->getOption('prefix');
-
-    if (!$path)
-    {
-        return $self->getOption('install-dir');
-    }
-
+    my $path = $self->getOption('install-dir');
     my $moduleName = $self->name();
     $path =~ s/(\$\{MODULE})|(\$MODULE\b)/$moduleName/g;
 


More information about the kde-doc-english mailing list