Git commit 036f5092adc382e3cc0e4c5a4946b1dbcb10ec03 by Nate Graham, on behalf of Andrew Shark. Committed on 29/11/2023 at 17:32. Pushed by ngraham into branch 'master'.
Delete the kdesrc-build-setup This is duplicating the work of --generate-config. But it is mostly broken and creates redundant source of "options defaults", see #132 Can I be made the maintainer of this project? M +0 -1 CMakeLists.txt M +5 -20 README.md M +0 -1 doc/CMakeLists.txt M +1 -1 doc/README.md M +0 -1 doc/build-docs M +4 -13 doc/index.docbook D +0 -204 doc/man-kdesrc-build-setup.1.docbook M +0 -2 doc/man-kdesrc-build.1.docbook D +0 -615 kdesrc-build-setup M +1 -1 sample-kde-env-master.sh M +1 -1 sample-xsession.sh https://invent.kde.org/sdk/kdesrc-build/-/commit/036f5092adc382e3cc0e4c5a4946b1dbcb10ec03 diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e5869e2..789c34af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,7 +45,6 @@ if (KDESRC_BUILD_INSTALL_MODULES) endif() install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/kdesrc-build DESTINATION ${KDE_INSTALL_BINDIR}) -install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/kdesrc-build-setup DESTINATION ${KDE_INSTALL_BINDIR}) install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/kdesrc-run DESTINATION ${KDE_INSTALL_BINDIR}) install(PROGRAMS diff --git a/README.md b/README.md index 4b6fb180..6d938b1a 100644 --- a/README.md +++ b/README.md @@ -63,30 +63,15 @@ Later we will set up kdesrc-build to keep itself updated automatically. 2. Set up kdesrc-build: - Now that kdesrc-build is installed and works, you need to set up kdesrc-build - to work appropriately on your particular system. Do this by running the - provided set up script to generate the **configuration file** - (~/.config/kdesrc-buildrc): + to work appropriately on your particular system. ```shell $ cd ~/kde/src/kdesrc-build -$ ./kdesrc-build-setup -``` - -- Answer the questions given, but do not fret if you don't know what exactly - you want to build, it is easy to edit the configuration later or just to - re-run `kdesrc-build-setup` again. - -- This script will reference a standard configuration provided as part of the - kdesrc-build repository that you downloaded earlier. As kdesrc-build - self-updates, these changes will reflect for your configuration as well. - -- After a configuration has been generated, kdesrc-build is able to bootstrap - its environment on most distributions by running: -```shell $ ./kdesrc-build --initial-setup ``` - This will install the dependencies required by kdesrc-build as well as add - itself to your path for convenience. + +- This will install the distribution packages dependencies required by kdesrc-build, + generate a configuration file, and add itself to your path for convenience. 3. Download the KDE project and dependency data: @@ -171,7 +156,7 @@ successfully upgraded kdesrc-build. A sample configuration file is included for demonstration purposes. You could copy it to `~/.config/kdesrc-buildrc` and edit manually. However, -it is advised to use provided `kdesrc-build-setup` script instead. +it is advised to use provided `kdesrc-build --generate-config` script instead. ## HELP!!! diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index d22b60a1..603d4b35 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,7 +1,6 @@ ########### install files ############### kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kdesrc-build) kdoctools_create_manpage(man-kdesrc-build.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR}) -kdoctools_create_manpage(man-kdesrc-build-setup.1.docbook 1 INSTALL_DESTINATION ${MAN_INSTALL_DIR}) install(PROGRAMS kdesrc-build.desktop DESTINATION ${KDE_INSTALL_APPDIR}) diff --git a/doc/README.md b/doc/README.md index 984ab378..e6c60812 100644 --- a/doc/README.md +++ b/doc/README.md @@ -29,7 +29,7 @@ directory and generate multiple HTML files from the index.docbook. ### Man page There is also a man page, also authored in Docbook, at -`man-kdesrc-build-setup.1.docbook` and `man-kdesrc-build.1.docbook`. These will +`man-kdesrc-build.1.docbook`. It will be built and installed to the KDE-specific `MANPATH` if you build kdesrc-build with CMake. The content is mostly the same as in the normal DocBook docs but can be more convenient at the command line, especially if Internet access is diff --git a/doc/build-docs b/doc/build-docs index 78616993..954a9661 100755 --- a/doc/build-docs +++ b/doc/build-docs @@ -100,4 +100,3 @@ STYLE=kde-chunk-online.xsl # the official one, used in docs.kde.org website. # render_docbook usage: $1 = docbook_file, $2 = folder for rendered html files, $3 - stylesheet_file render_docbook "index.docbook" "preview_doc_html" "$STYLE" render_docbook "man-kdesrc-build.1.docbook" "preview_man_html" "$STYLE" -#render_docbook "man-kdesrc-build-setup.1.docbook" "preview_man_setup_html" "$STYLE" diff --git a/doc/index.docbook b/doc/index.docbook index fe8b8248..8fce177a 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -392,16 +392,11 @@ This file is located at <filename>~/.config/kdesrc-buildrc</filename> (<filename>$XDG_CONFIG_HOME/kdesrc-buildrc</filename>, if <envar>$XDG_CONFIG_HOME</envar> is set).</para> -<para>You can use a program included with &kdesrc-build;, called -<application>kdesrc-build-setup</application> in order to prepare a simple +<para>You can use <application>kdesrc-build --generate-config</application> in order to prepare a simple kdesrc-build configuration. You can then edit the <filename>~/.config/kdesrc-buildrc</filename> configuration file to make any changes you see fit.</para> -<para><application>kdesrc-build-setup</application> itself runs from a terminal -(instead of using a graphical interface), just like &kdesrc-build;, so you can -use it even if you have no graphical interface available yet.</para> - <sect4 id="setup-rcfile-manually"> <title>Manual setup of configuration file</title> @@ -413,9 +408,7 @@ its <link linkend="conf-options-table">table of configuration options</link>. </para> <para>&kdesrc-build; contains many recommended configuration files to support -&kde; Frameworks 5, &plasma; 5, and other &kde; applications. The -<application>kdesrc-build-setup</application> refers to these files in the -configuration file it generates, but you can also use them yourself. See +&kde; Frameworks 5, &plasma; 5, and other &kde; applications. See <xref linkend="kdesrc-buildrc-including"/> for information on how to use other configuration files from your own <filename>kdesrc-buildrc</filename>. </para> @@ -2019,8 +2012,7 @@ number, the "nicer" the program is.</para> <member>Default value</member><member>Depends on system</member> <member>Available since</member><member>20.07</member> </simplelist> -<para>This option is defined by &kdesrc-build; (when using the kdesrc-build-setup tool -or <command>kdesrc-build --generate-config</command>), set to be the number of +<para>This option is defined by &kdesrc-build; (when using <command>kdesrc-build --generate-config</command>), set to be the number of available CPUs (as indicated by the external application <application>nproc</application>). If &kdesrc-build; cannot detect the number of CPUs, this value is set to 4.</para> @@ -2038,8 +2030,7 @@ option's usage.</para> <member>Default value</member><member>Depends on system</member> <member>Available since</member><member>20.07</member> </simplelist> -<para>This option is defined by &kdesrc-build; (when using the kdesrc-build-setup tool -or <command>kdesrc-build --generate-config</command>), set to be the number of +<para>This option is defined by &kdesrc-build; (when using <command>kdesrc-build --generate-config</command>), set to be the number of CPUs that is deemed safe for heavyweight or other highly-intensive modules, such as <literal>qtwebengine</literal>, to avoid running out of memory during the build.</para> diff --git a/doc/man-kdesrc-build-setup.1.docbook b/doc/man-kdesrc-build-setup.1.docbook deleted file mode 100644 index da78e231..00000000 --- a/doc/man-kdesrc-build-setup.1.docbook +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE refentry PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [ -<!ENTITY % English "INCLUDE"> -]> - -<!-- - Man page for kdesrc-build-setup. - Copyright (c) 2011 Michael Pyne <mp...@kde.org> - - Permission is granted to copy, distribute and/or modify this document under - the terms of the GNU Free Documentation License, Version 1.2 or any later - version published by the Free Software Foundation; with no Invariant - Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the - license is included in COPYING.DOC. - --> - -<refentry lang="&language;"> -<refentryinfo> -<title>kdesrc-build-setup User's Manual</title> -<author> - <personname><firstname>Michael</firstname><surname>Pyne</surname></personname> - <email>mp...@kde.org</email> - <personblurb><para>Authored man page</para></personblurb> -</author> -<date>2012-05-05</date> -<releaseinfo>kdesrc-build-setup 16.05</releaseinfo> -</refentryinfo> - -<refmeta> -<refentrytitle><command>kdesrc-build-setup</command></refentrytitle> -<manvolnum>1</manvolnum> -<refmiscinfo class="version">0.02</refmiscinfo> -</refmeta> - -<refnamediv> - <refname><command>kdesrc-build-setup</command></refname> - <refpurpose>Creates a <filename>kdesrc-buildrc</filename> configuration - file for <command>kdesrc-build</command>(1).</refpurpose> -</refnamediv> - -<refsynopsisdiv id="_synopsis"> -<cmdsynopsis> -<command>kdesrc-build-setup</command> -</cmdsynopsis> -</refsynopsisdiv> - -<refsect1> -<title>DESCRIPTION</title> - -<para>The <command>kdesrc-build-setup</command> command is used to generate -a simple configuration file for <command>kdesrc-build</command>(1).</para> - -<para>It requires the <command>dialog</command>(1) script be available, and -Perl (just like <command>kdesrc-build</command>).</para> - -<para>No command line options are accepted. The operation of the program is -instead driven through dialog-style prompts to gather the data required to -generate the configuration file. The resultant file can be saved to a location -other than <filename>~/.config/kdesrc-buildrc</filename>. -</para> - -</refsect1> - -<refsect1> -<title>OPTIONS</title> - -<para>No command line options are supported for this command.</para> - -</refsect1> - -<refsect1> -<title>EXIT STATUS</title> - -<variablelist> - -<varlistentry> -<term> -<emphasis role="strong">0</emphasis> -</term> - -<listitem> -<para> - Success -</para> -</listitem> -</varlistentry> - -<varlistentry> -<term> -<emphasis role="strong">Anything else</emphasis> -</term> - -<listitem> -<para> - Either there was an I/O failure of some type (invalid permissions, disk - full, etc.), or the user canceled the program by pressing - &Esc; during a dialog. -</para> -</listitem> -</varlistentry> - -</variablelist> -</refsect1> - -<refsect1> -<title>ENVIRONMENT</title> - -<variablelist> - -<varlistentry> -<term> -<envar>HOME</envar> -</term> - -<listitem> -<para> - Used for tilde-expansion of file names, and is the default base for the - source, build, and installation directories. -</para> -</listitem> -</varlistentry> - -<varlistentry> -<term> - <command>dialog</command>(1) -</term> - -<listitem> -<para> - The <command>dialog</command>(1) program is required for the operation of - this script and may obey environment variables of its own. -</para> -</listitem> -</varlistentry> - -</variablelist> -</refsect1> - -<refsect1> -<title>FILES</title> - -<para><filename>~/.config/kdesrc-buildrc</filename> -(<filename>$XDG_CONFIG_HOME/kdesrc-buildrc</filename>, if -<envar>$XDG_CONFIG_HOME</envar> is set) - Default global configuration file, -generated by this script. If the file already exists, the existing file is -renamed to <filename>kdesrc-buildrc~</filename> as a backup before generating -the configuration.</para> - -<para>The file generated by this script can be saved to a different name -instead.</para> - -</refsect1> - -<refsect1> -<title>BUGS</title> - -<para>See <ulink url="https://bugs.kde.org/">https://bugs.kde.org/</ulink>. Be -sure to search against the <command>kdesrc-build</command> product.</para> - -</refsect1> - -<refsect1> -<title>SEE ALSO</title> - -<para><command>kdesrc-build</command>(1)</para> - -<para><filename>kdesrc-buildrc-sample</filename> file (if included with your -<application>kdesrc-build</application> distribution).</para> - -</refsect1> - -<refsect1> -<title>RESOURCES</title> - -<para>Main web site: <ulink -url="https://apps.kde.org/kdesrc_build/">https://apps.kde.org/kdesrc_build/</ulink></para> - -<para>Documentation: <ulink -url="https://docs.kde.org/?application=kdesrc-build">https://docs.kde.org/?application=kdesrc-build</ulink></para> - -</refsect1> - -<refsect1> -<title>COPYING</title> - -<para>Copyright (C) 2011, 2020-2022 Michael Pyne.</para> - -<para>This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2 of the License, or (at your option) any -later version.</para> - -<para>This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -details.</para> - -<para>You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., 51 -Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</para> - -</refsect1> - -</refentry> diff --git a/doc/man-kdesrc-build.1.docbook b/doc/man-kdesrc-build.1.docbook index 9356a082..803583f6 100644 --- a/doc/man-kdesrc-build.1.docbook +++ b/doc/man-kdesrc-build.1.docbook @@ -1353,8 +1353,6 @@ url="https://apps.kde.org/kdesrc_build/">https://apps.kde.org/kdesrc_build/</uli <para>Documentation: <ulink url="https://docs.kde.org/?application=kdesrc-build">https://docs.kde.org/?application=kdesrc-build</ulink></para> -<para>Setup script: <command>kdesrc-build-setup</command></para> - </refsect1> <refsect1> diff --git a/kdesrc-build-setup b/kdesrc-build-setup deleted file mode 100755 index d86eb2e6..00000000 --- a/kdesrc-build-setup +++ /dev/null @@ -1,615 +0,0 @@ -#!/usr/bin/env perl - -# Script to create a configuration file for kdesrc-build. -# -# Copyright © 2011, 2020-2022 Michael Pyne. <mp...@kde.org> -# Home page: https://apps.kde.org/kdesrc_build/ -# -# This program is free software; you can redistribute it and/or modify it under -# the terms of the GNU General Public License as published by the Free Software -# Foundation; either version 2 of the License, or (at your option) any later -# version. -# -# This program is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 51 -# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -use v5.28; -use strict; -use warnings; - -# On many container-based distros, even FindBin is missing to conserve space. -# But we can use File::Spec to do nearly the same. -my $RealBin; -my $modPath; - -# The File::Spec calls have to run when parsing (i.e. in BEGIN) to make the -# 'use lib' below work (which itself implicitly uses BEGIN { }) -BEGIN { - use File::Spec; - - # resolve symlinks - my $scriptPath = $0; - for (1..16) { - last unless -l $scriptPath; - $scriptPath = readlink $scriptPath; - } - die "Too many symlinks followed looking for script" if -l $scriptPath; - - my ($volume, $directories, $script) = File::Spec->splitpath($scriptPath); - - $RealBin = File::Spec->catpath($volume, $directories, ''); - die "Couldn't find base directory!" unless $RealBin; - - # Use modules in git repo if running from git dir, otherwise assume - # system install - $modPath = File::Spec->rel2abs('modules', $RealBin); - $modPath = ($RealBin =~ s,/bin/?$,/share/kdesrc-build/modules,r) - unless -d $modPath; - - die "Couldn't find modules for kdesrc-build-setup!" unless $modPath; -} - -use lib "$modPath"; # Make ksb:: modules available - -use ksb; -use ksb::FirstRun; - -use Cwd qw(abs_path); -use File::Basename; -use File::Copy; -use File::Path qw(make_path); -use File::Temp qw(tempfile); -use IO::Pipe; -use List::Util qw(max min first); - -our $VERSION = 0.10; # Not user-visible yet. - -my $OS = `uname`; # Check whether we're using Linux or FreeBSD - -sub clearScreen -{ - require POSIX; - my $termios = POSIX::Termios->new(); - $termios->getattr(1); # Get STDOUT attributes - - require Term::Cap; - my $terminal = Term::Cap->Tgetent({OSPEED => $termios->getospeed}); - - # Force the clear characters to be output immediately. - # Otherwise it might overlap with other output, like error messages. - local $| = 1; - - print $terminal->Tputs('cl', 0); - - return 0; -} - -sub runDialogExecutable (@args) -{ - # Allow for 3 more file descriptors (on top of the normally allowed 0, 1, - # 2) to survive the upcoming exec - # See "SYSTEM_FD_MAX" in perldoc:perlvar - $^F = 5; - - my $pipe = new IO::Pipe; - my $pid; - - if ($pid = fork()) { - # Parent - $pipe->reader(); - - my $output = <$pipe>; - - waitpid $pid, 0; - my $result = ($? >> 8); - $pipe->close(); - - # dialog uses -1 as an exit code, Perl gets just the standard 8 bits - # the rest of UNIX uses... - if ($? == -1) { - clearScreen(); - die "Failed to run dialog(1): $@"; - } - elsif ($result == 255) { - clearScreen(); - die "Canceled the dialog"; - } - return $output || $result; - } - elsif (defined $pid) { - # Child - $pipe->writer(); - my $outputFd = $pipe->fileno(); - - print "Using fd $outputFd"; - exec ('dialog', '--output-fd', $outputFd, - '--backtitle', 'kdesrc-build setup', - @args); - } - else { - die "Unable to fork? $!"; - } -} - -sub getUserInput -{ - my $prompt = shift; - my $default = shift; - - my @args = qw/--inputbox 8 50/; - splice @args, 1, 0, $prompt; - push @args, $default if $default; - - return runDialogExecutable(@args); -} - -sub getMenuOption -{ - my ($prompt, @opts) = @_; - @opts = @{$opts[0]} if ref $opts[0] eq 'ARRAY'; - - my @args = qw/--menu 20 70 18/; - splice @args, 1, 0, $prompt; - - return runDialogExecutable(@args, @opts); -} - -sub showInfo -{ - my $message = shift; - my @args = qw/--msgbox 22 64/; - splice @args, 1, 0, $message; - - return runDialogExecutable(@args); -} - -sub getYesNoAnswer -{ - my $prompt = shift; - my @args = qw/--yesno 8 55/; - splice @args, 1, 0, $prompt; - - return runDialogExecutable(@args) == 0; -} - -sub getDirectory -{ - my $dir = shift; - my @args = qw/--dselect 10 70/; - splice @args, 1, 0, $dir; - - return runDialogExecutable(@args); -} - -sub getListOptions -{ - my ($prompt, $opts, $enabled) = @_; - die "\$opts not a hash ref" unless (ref $opts eq 'ARRAY'); - die "\$enabled not a hash ref" unless (ref $enabled eq 'HASH'); - - my @args = qw/--checklist 20 70 18/; - splice @args, 1, 0, $prompt; - splice @args, 0, 0, '--output-separator', ','; - - while (my ($k, $v) = splice(@{$opts}, 0, 2)) { - push (@args, $k, $v, (exists ${$enabled}{$k} ? 'on' : 'off')); - } - - my $output = runDialogExecutable(@args); - - # Filter out empty results, remove quotes. - my @items = split (/,/, $output); - s/^"(.*)"$/$1/ foreach @items; - @items = grep { length $_ } @items; - return @items; -} - -# The 'dialog(1)' program is required, verify it exists before going -# further. -# We use the --help option since it doesn't send weird terminal characters to the screen -# and it's supported on dialog and Debian's dialog replacement called whiptail. -system('dialog', '--help') == 0 or do { - my $osError = "$!"; - - say "Unable to run the dialog(1) program, it is required for this setup script."; - if ($? == -1) { - say "\tThe program wouldn't even run, due to error: $osError"; - } - else { - say "\tProgram ran, but exited with error: ", $? >> 8; - } - - exit 1; -}; - -showInfo(<<EOF); -This program sets up a base kdesrc-build configuration to -use. - -It can be modified as you wish later. Before the form is -presented, you will be asked if you would like an -explanation of the kdesrc-build file layout. It is -recommended to read this if you are not already familiar -with building software. -EOF - -if (getYesNoAnswer('See the tutorial?')) { - showInfo(<<EOF); -kdesrc-build must download source code from the KDE -repositories. This source code is then compiled, in the -"build directory". Once complete, this compiled code is -installed to its final location, the "install directory". - -This program will only configure the install location, but -all directories are configurable. - -The space requirements vary with the amount of software you -choose to build, and whether you keep the build directories -to speed up later builds. You will probably need at least -20 GiB in total free space unless you take steps to -customize your install to use fewer modules. -EOF -} - -# If the user appears to be using a proxy, ask for it directly, otherwise -# prompt for one. -my $proxy = $ENV{http_proxy} // ''; - -my $installDir = getMenuOption('Where do you want to install the software?', - [ - home => "$ENV{HOME}/kde/usr (default)", - custom => "Custom location, chosen next screen", - ]); - -if ($installDir eq 'custom') { - $installDir = getDirectory('/usr/local/kde'); -} -else { - $installDir = "~/kde/usr"; -} - -my $sourceDir = getMenuOption('Where do you want the source code to be saved?', - [ - home => "$ENV{HOME}/kde/src (default)", - custom => "Custom location, chosen next screen", - ]); - -if ($sourceDir eq 'custom') { - $sourceDir = getDirectory('/usr/local/kde/src'); -} -else { - $sourceDir = "~/kde/src"; -} - -my $buildDir = getMenuOption('Where do you want temporary build files to be saved? (They might need lots of space)', - [ - home => "$ENV{HOME}/kde/build (default)", - custom => "Custom location, chosen next screen", - ]); - -if ($buildDir eq 'custom') { - $buildDir = getDirectory('/usr/local/kde/build'); -} -else { - $buildDir = "~/kde/build"; -} - -showInfo(<<EOF); -Should kdesrc-build automatically try to include needed KDE -dependencies in each build? - -Doing this makes it easier to just get a single application -built without worrying about the details. Most KDE software -under active development needs these dependencies. -IF IN ANY DOUBT, SELECT YES on the next screen. - -If you know exactly what you want to build or want to ensure -that only modules you have allowed in your configuration -file are built, then you should disable this option. - -You can always use the --include-dependencies or ---no-include-dependencies command line option to -kdesrc-build, and you can change this default at any time by -editing the file that this script will generate. -EOF - -my $includeDependencies = - getYesNoAnswer('Should kdesrc-build include KDE dependencies by default with each build?'); - -my @chosenModules = getListOptions( - "Which major module groups do you want to build?", - [ - qt5 => 'Qt 5 - Base support libraries (required if distro version is old)', - frameworks => 'KDE Frameworks 5 - Essential libraries/runtime (required)', - workspace => 'KDE Plasma 5 Desktop and workspace', - base => 'Assorted useful KF5-based applications', - pim => 'Personal Information Management software', - ], - { - frameworks => 1, - workspace => 1, - base => 1, - }, -); - -# According to XDG spec, if $XDG_CONFIG_HOME is not set, then we should default -# to ~/.config -my $xdgConfigHome = $ENV{XDG_CONFIG_HOME} // "$ENV{HOME}/.config"; -my $xdgConfigHomeShort = $xdgConfigHome =~ s/^$ENV{HOME}/~/r; # Replace $HOME with ~ -my $outputFile = "$xdgConfigHome/kdesrc-buildrc"; -my $outputFileShort = $outputFile =~ s/^$ENV{HOME}/~/r; # Replace $HOME with ~ -my $output; # Will be output filehandle. - -while (-e $outputFile) { - my $outputChoice = getMenuOption( - "$outputFileShort already exists, what do you want to do?", - [ - backup => 'Make a backup, then overwrite with the new configuration', - custom => 'Write the new configuration to a different file', - cancel => 'Cancel setup', - ], - ); - - if ($outputChoice eq 'cancel') { - showInfo('Setup canceled'); - exit 0; - } - - if ($outputChoice eq 'custom') { - $outputFile = getUserInput('Enter desired configuration file name.'); - $outputFile =~ s/^~/$ENV{HOME}/; - $outputFileShort = $outputFile =~ s/^$ENV{HOME}/~/r; - } - - if ($outputChoice eq 'backup') { - copy($outputFile, "$outputFile~") or do { - my $error = "$!"; - showInfo(<<EOF); -Failed to make backup of $outputFileShort, due to error $error. -Configuration will be written to a temporary file instead. -EOF - - ($output, $outputFile) = tempfile("kdesrc-buildrc-XXXX"); - $outputFileShort = $outputFile =~ s/^$ENV{HOME}/~/r; - }; - - last; - } -} - -# Filehandle could already be opened as a tempfile. -if (!$output) { - # Ensure the directory we need exists - my ($vol, $dir, $file) = File::Spec->splitpath($outputFile); - make_path($dir) unless -d $dir; - - open ($output, '>', $outputFile) or do { - my $error = "$!"; - showInfo (<<EOF); -Unable to open output file $outputFileShort for writing due to error $error. -EOF - die "$!"; - } -} - -print $output <<EOF; -# Autogenerated by kdesrc-build-setup. You may modify this file if desired. -global -EOF - -# Only set qtdir if we're building it ourselves. If user uses their own custom -# Qt they should already be setting PATH and in that case we need do nothing -# anyways. -if (grep /^qt5$/, @chosenModules) { - print $output <<EOF; - - # The path to your Qt installation (default is empty, assumes Qt provided - # by system) - qtdir ~/kde/qt5 -EOF -} - -my $num_cores; - -if ($OS == 'Linux') { - chomp($num_cores = `nproc`); -} elsif ($OS == 'FreeBSD') { - chomp($num_cores = `sysctl -n hw.ncpu`); -} -$num_cores ||= 4; - -my $num_cores_low = min(ksb::FirstRun::suggestedNumCoresForLowMemory(), $num_cores); - -$includeDependencies = $includeDependencies ? 'true' : 'false'; - -# -### Start generating the kdesrc-buildrc -# -print $output <<EOF; - - # Finds and includes *KDE*-based dependencies into the build. This makes - # it easier to ensure that you have all the modules needed, but the - # dependencies are not very fine-grained so this can result in quite a few - # modules being installed that you didn't need. - include-dependencies $includeDependencies - - # Install directory for KDE software - kdedir $installDir - - # Directory for downloaded source code - source-dir $sourceDir - - # Directory to build KDE into before installing - # relative to source-dir by default - build-dir $buildDir - - ## kdesrc-build sets 2 options which is used in options like make-options or set-env - # to help manage the number of compile jobs that happen during a build: - # - # 1. num-cores, which is just the number of detected CPU cores, and can be passed - # to tools like make (needed for parallel build) or ninja (completely optional). - # - # 2. num-cores-low-mem, which is set to largest value that appears safe for - # particularly heavyweight modules based on total memory, intended for - # modules like qtwebengine - num-cores $num_cores - num-cores-low-mem $num_cores_low - - # kdesrc-build can install a sample .xsession file for "Custom" - # (or "XSession") logins, - install-session-driver false - - # or add a environment variable-setting script to - # ~/.config/kde-env-master.sh - install-environment-driver true - - # Stop the build process on the first failure - stop-on-failure true - - # Use a flat folder layout under $sourceDir and $buildDir - # rather than nested directories - directory-layout flat - - # Use Ninja as cmake generator instead of gmake - cmake-generator Kate - Ninja - - # Build with LSP support for everything that supports it - compile-commands-linking true - compile-commands-export true -EOF - -if ($proxy) { - print $output <<EOF; - - # Proxy to use for HTTP downloads. - http-proxy $proxy - - # Prefer HTTPS instead of Git-native protocol for git modules that come - # from 'kde-projects' repositories. - # - # Note that any git:// repositories you use will need to be - # manually converted to https:// URLs if your network does not allow - # git:// protcol. - git-desired-protocol https -EOF -} - -# Assume we can refer to files present alongside kdesrc-build in the source -# directory -my $basedir = dirname(abs_path($0)); -my $baseDirShort = $basedir =~ s/^$ENV{HOME}/~/r; # Replace $HOME with ~ - -if (! -e "$basedir/kf5-frameworks-build-include") { - # Check if it's installed to a share/ prefix - $basedir = abs_path(dirname($0) . "/../share/kdesrc-build/"); - $baseDirShort = $basedir =~ s/^$ENV{HOME}/~/r; - - if (! -e "$basedir/kf5-frameworks-build-include") { - close $output; - showInfo("Unable to find kdesrc-build installation to build a configuration!"); - exit 1; - } -} - -print $output <<EOF; -end global - -# Common options that should be set for some KDE modules no matter how -# kdesrc-build finds them. Do not comment these out unless you know -# what you are doing. -include $basedir/kf5-common-options-build-include - -EOF - -my $do_incl = '#'; -$do_incl = '' if grep { $_ eq 'qt5' } @chosenModules; - -print $output <<EOF; -# Refers to the qt5 file included as part of kdesrc-build. The file -# is simply read-in at this point as if you'd typed it in yourself. -${do_incl}include $basedir/qt5-build-include - -# Support libraries that use Qt5 -${do_incl}include $basedir/custom-qt5-libs-build-include - -EOF - -$do_incl = '#'; -$do_incl = '' if grep { $_ eq 'frameworks' } @chosenModules; - -print $output <<EOF; -# Refers to the kf5-frameworks file included as part of kdesrc-build. The file -# is simply read-in at this point as if you'd typed it in yourself. -${do_incl}include $basedir/kf5-frameworks-build-include - -EOF - -$do_incl = '#'; -$do_incl = '' if grep { $_ eq 'workspace' } @chosenModules; - -print $output <<EOF; -# Refers to the kf5-workspace file included as part of kdesrc-build. The file -# is simply read-in at this point as if you'd typed it in yourself. -${do_incl}include $basedir/kf5-workspace-build-include - -EOF - -$do_incl = '#'; -$do_incl = '' if grep { $_ eq 'base' } @chosenModules; - -print $output <<EOF; -# Refers to the kf5-applications file included as part of kdesrc-build. The file -# is simply read-in at this point as if you'd typed it in yourself. -${do_incl}include $basedir/kf5-applications-build-include - -EOF - -$do_incl = '#'; -$do_incl = '' if grep { $_ eq 'pim' } @chosenModules; - -print $output <<EOF; -# Refers to the kf5-kdepim file included as part of kdesrc-build. The file -# is simply read-in at this point as if you'd typed it in yourself. -${do_incl}include $basedir/kf5-kdepim-build-include - -EOF - -close($output); - -showInfo("Generated configuration has been written to $outputFileShort"); - -if (!@chosenModules) { - showInfo(<<EOF); -You have not chosen any major module groups. You will have to -add modules and module-sets to your configuration after this. - -To help you with this, please consult the sample files in -$basedir -EOF -} - -# Say same thing in text mode just in case. -system('clear'); -say "Generated configuration has been written to $outputFileShort"; -say "Sample configuration files are available in $baseDirShort"; - -if ($outputFile ne "$xdgConfigHome/kdesrc-buildrc") { - say <<EOF; - -Do note, that your configuration file $outputFileShort will NOT BE USED, -unless you will do one of the following: -- Overwrite $xdgConfigHomeShort/kdesrc-buildrc with $outputFileShort -- Copy $outputFileShort to some directory and rename it to "kdesrc-buildrc", - then ALWAYS run kdesrc-build from that directory -- ALWAYS pass the "--rc-file $outputFileShort" option to kdesrc-build when - you run it -EOF -} - -exit 0; diff --git a/sample-kde-env-master.sh b/sample-kde-env-master.sh index 4f47ba1c..db0ee225 100644 --- a/sample-kde-env-master.sh +++ b/sample-kde-env-master.sh @@ -10,7 +10,7 @@ # See also the sample xsession setup script, which requires this file. # # Use by copying this script to $XDG_CONFIG_HOME/kde-env-master.sh (this will -# be done for you by kdesrc-build and/or kdesrc-build-setup, later). 99% of the +# be done for you by kdesrc-build later). 99% of the # time this means ~/.config/kde-env-master.sh # # NOTHING IN THIS FILE IS MODIFIABLE, OTHERWISE WARNINGS WILL BE GENERATED diff --git a/sample-xsession.sh b/sample-xsession.sh index c8a7268b..fe616139 100644 --- a/sample-xsession.sh +++ b/sample-xsession.sh @@ -3,7 +3,7 @@ # Written by Michael Jansen and Michael Pyne # # Use by copying this script to ~/.xsession (this will be done for you by -# kdesrc-build and/or kdesrc-build-setup, later). +# kdesrc-build later). # # From there, select "custom" session when logging in, in order to login using # this script.