diff --git a/CMakeLists.txt b/CMakeLists.txt index 22cf21c..5bebbff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,95 +1,99 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.0) project(kdesrc-build) # Needed for the docs, but optional. If not found, we will simply # defer to native CMake handling. find_package(ECM 5.10.0 NO_MODULE) if (ECM_FOUND) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(KDEInstallDirs) include(KDECMakeSettings) include(FeatureSummary) include(ECMOptionalAddSubdirectory) find_package(KF5 5.10.0 COMPONENTS DocTools) if(KF5_DocTools_FOUND) ecm_optional_add_subdirectory(doc) else() message(WARNING "Found ECM, but not KF5::DocTools; documentation will not be built") endif() - # ECM sets DATA_INSTALL_DIR to PREFIX/share, the "/apps" is gone in KF5. - # To get a consistent install with and without ECM, override this: - set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/apps" CACHE PATH "The parent directory where applications can install their data") else() message(WARNING "Did not find extra-cmake-modules; documentation will not be built and install paths will be guessed based on CMake settings.") - set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/apps" CACHE PATH "The parent directory where applications can install their data") + # ECM sets DATA_INSTALL_DIR to PREFIX/share, try to match + set(DATA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH "The parent directory where applications can install their data") set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "The install dir for executables") endif() set(KDESRC_BUILD_INSTALL_MODULES TRUE CACHE BOOL "Controls whether to install the modules that make up the script. Leave enabled unless running straight from source") set(KDESRC_BUILD_MODULE_INSTALL_PREFIX "${DATA_INSTALL_DIR}/kdesrc-build/modules" CACHE PATH "Prefix to install the component Perl modules to. (This is only an option to allow for installing to vendor_perl or similar)") if (KDESRC_BUILD_INSTALL_MODULES) message(STATUS "Installing component modules to ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}") install(FILES modules/ksb/Application.pm modules/ksb/BuildContext.pm modules/ksb/BuildException.pm modules/ksb/BuildSystem.pm modules/ksb/Debug.pm modules/ksb/DependencyResolver.pm modules/ksb/IPC.pm modules/ksb/KDEXMLReader.pm modules/ksb/Module.pm modules/ksb/ModuleResolver.pm modules/ksb/ModuleSet.pm modules/ksb/OptionsBase.pm modules/ksb/PhaseList.pm modules/ksb/RecursiveFH.pm modules/ksb/StatusView.pm modules/ksb/Updater.pm modules/ksb/Util.pm modules/ksb/Version.pm modules/ksb/l10nSystem.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb) install(FILES modules/ksb/BuildSystem/Autotools.pm modules/ksb/BuildSystem/CMakeBootstrap.pm modules/ksb/BuildSystem/KDE4.pm modules/ksb/BuildSystem/QMake.pm modules/ksb/BuildSystem/Qt4.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/BuildSystem) install(FILES modules/ksb/Module/BranchGroupResolver.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/Module) install(FILES modules/ksb/ModuleSet/KDEProjects.pm modules/ksb/ModuleSet/Null.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/ModuleSet) install(FILES modules/ksb/IPC/Null.pm modules/ksb/IPC/Pipe.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/IPC) install(FILES modules/ksb/Updater/Bzr.pm modules/ksb/Updater/Git.pm modules/ksb/Updater/KDEProject.pm modules/ksb/Updater/KDEProjectMetadata.pm modules/ksb/Updater/Svn.pm DESTINATION ${KDESRC_BUILD_MODULE_INSTALL_PREFIX}/ksb/Updater) endif() install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/kdesrc-build DESTINATION ${BIN_INSTALL_DIR}) install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/kdesrc-build-setup DESTINATION ${BIN_INSTALL_DIR}) +install(PROGRAMS + ${CMAKE_SOURCE_DIR}/sample-kde-env-master.sh + ${CMAKE_SOURCE_DIR}/sample-kde-env-user.sh + ${CMAKE_SOURCE_DIR}/sample-xsession.sh + DESTINATION ${DATA_INSTALL_DIR}/kdesrc-build) + if (ECM_FOUND) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) endif() diff --git a/kdesrc-build b/kdesrc-build index ff25a2b..3265945 100755 --- a/kdesrc-build +++ b/kdesrc-build @@ -1,263 +1,263 @@ #!/usr/bin/env perl # Script to handle building KDE from source code. All of the configuration is # stored in the file ./kdesrc-buildrc (or ~/.kdesrc-buildrc, if that's not # present). # # Please also see the documentation that should be included with this program, # in the doc/ directory. # # Copyright © 2003 - 2016 Michael Pyne. # Home page: https://kdesrc-build.kde.org/ # # Copyright © 2005, 2006, 2008 - 2011 David Faure # Copyright © 2005 Thiago Macieira # Copyright © 2006 Stephan Kulow # Copyright © 2006, 2008 Dirk Mueller # ... and possibly others. Check the git source repository for specifics. # # 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 # Adding an option? Grep for 'defaultGlobalOptions' in ksb::BuildContext --mpyne use FindBin qw($RealBin); -use lib "$RealBin/../share/apps/kdesrc-build/modules"; +use lib "$RealBin/../share/kdesrc-build/modules"; use lib "$RealBin/modules"; # Force all symbols to be in this package. We can tell if we're being called # through require/eval/etc. by using the "caller" function. package main; use strict; use warnings; use Carp; use Data::Dumper; use File::Find; # For our lndir reimplementation. use File::Path qw(remove_tree); use ksb::Debug; use ksb::Util; use ksb::Version qw(scriptVersion); use ksb::Application; use 5.014; # Require Perl 5.14 # Make Perl 'plain die' exceptions use Carp::confess instead of their core # support. This is not supported by the Perl 5 authors but assuming it works # will be better than the alternative backtrace we get (which is to say, none) $SIG{__DIE__} = \&Carp::confess; my $SCRIPT_VERSION = scriptVersion(); ### Script-global functions. # These functions might be called at runtime via log_command, using # log_command's support for symbolic execution of a named subroutine. Because # of that, they have been left in the top-level script. # # Everything else should be in an appropriate class. # Subroutine to recursively symlink a directory into another location, in a # similar fashion to how the XFree/X.org lndir() program does it. This is # reimplemented here since some systems lndir doesn't seem to work right. # # Used from ksb::l10nSystem # # As a special exception to the GNU GPL, you may use and redistribute this # function however you would like (i.e. consider it public domain). # # The first parameter is the directory to symlink from. # The second parameter is the destination directory name. # # e.g. if you have $from/foo and $from/bar, lndir would create $to/foo and # $to/bar. # # All intervening directories will be created as needed. In addition, you # may safely run this function again if you only want to catch additional files # in the source directory. # # Note that this function will unconditionally output the files/directories # created, as it is meant to be a close match to lndir. # # RETURN VALUE: Boolean true (non-zero) if successful, Boolean false (0, "") # if unsuccessful. sub safe_lndir { my ($from, $to) = @_; # Create destination directory. if (not -e $to) { print "$to\n"; if (not pretending() and not super_mkdir($to)) { error ("Couldn't create directory r[$to]: b[r[$!]"); return 0; } } # Create closure callback subroutine. my $wanted = sub { my $dir = $File::Find::dir; my $file = $File::Find::fullname; $dir =~ s/$from/$to/; # Ignore the .svn directory and files. return if $dir =~ m,/\.svn,; # Create the directory. if (not -e $dir) { print "$dir\n"; if (not pretending()) { super_mkdir ($dir) or croak_runtime("Couldn't create directory $dir: $!"); } } # Symlink the file. Check if it's a regular file because File::Find # has no qualms about telling you you have a file called "foo/bar" # before pointing out that it was really a directory. if (-f $file and not -e "$dir/$_") { print "$dir/$_\n"; if (not pretending()) { symlink $File::Find::fullname, "$dir/$_" or croak_runtime("Couldn't create file $dir/$_: $!"); } } }; # Recursively descend from source dir using File::Find eval { find ({ 'wanted' => $wanted, 'follow_fast' => 1, 'follow_skip' => 2}, $from); }; if ($@) { error ("Unable to symlink $from to $to: $@"); return 0; } return 1; } # Subroutine to delete recursively, everything under the given directory, # unless we're in pretend mode. # # Used from ksb::BuildSystem to handle cleaning a build directory. # # i.e. the effect is similar to "rm -r $arg/* $arg/.*". # # This assumes we're called from a separate child process. Therefore the # normal logging routines are /not used/, since our output will be logged # by the parent kdesrc-build. # # The first parameter should be the absolute path to the directory to delete. # # Returns boolean true on success, boolean false on failure. sub prune_under_directory { my $dir = shift; my $errorRef; print "starting delete of $dir\n"; eval { remove_tree($dir, { keep_root => 1, error => \$errorRef }); }; if ($@ || @$errorRef) { error ("\tUnable to clean r[$dir]:\n\ty[b[$@]"); return 0; } return 1; } # Script starts. # Adding in a way to load all the functions without running the program to # enable some kind of automated QA testing. if (defined caller && caller eq 'test') { print "kdesrc-build being run from testing framework, BRING IT.\n"; print "kdesrc-build is version $SCRIPT_VERSION\n"; return 1; } my $app; our @atexit_subs; END { # Basically used to call the finish() handler but only when appropriate. foreach my $sub (@atexit_subs) { &$sub(); } } # Use some exception handling to avoid ucky error messages eval { $app = ksb::Application->new(@ARGV); # Hack for debugging current state. if (exists $ENV{KDESRC_BUILD_DUMP_CONTEXT}) { local $Data::Dumper::Indent = 1; local $Data::Dumper::Sortkeys = 1; # This method call dumps the first list with the variables named by the # second list. print Data::Dumper->Dump([$app->context()], [qw(ctx)]); } push @atexit_subs, sub { $app->finish(99) }; my $result = $app->runAllModulePhases(); @atexit_subs = (); # Clear exit handlers $app->finish($result); }; if (my $err = $@) { if (had_an_exception()) { print "kdesrc-build encountered an exceptional error condition:\n"; print " ========\n"; print " $err\n"; print " ========\n"; print "\tCan't continue, so stopping now.\n"; if ($err->{'exception_type'} eq 'Internal') { print "\nPlease submit a bug against kdesrc-build on https://bugs.kde.org/\n" } } else { # We encountered an error. print "Encountered an error in the execution of the script.\n"; print "The error reported was $err\n"; print "Please submit a bug against kdesrc-build on https://bugs.kde.org/\n"; } exit 99; } # vim: set et sw=4 ts=4 fdm=marker: