From 97d8dfc961c70d25372e0f7536fc730466daca96 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Tue, 13 Apr 2004 01:41:17 +0000 Subject: [PATCH] * Added TODO entry regarding home dir expansion. * Automatically add $QTDIR/bin and $KDEDIR/bin to PATH. * Automatically add $QTDIR/lib and $KDEDIR/lib to PATH. svn path=/trunk/kdenonbeta/kdecvs-build/; revision=303200 --- TODO | 4 +--- kdecvs-build | 58 ++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 73a8880..741b29f 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,8 @@ * Add CVSROOT changing support. -* Add .cvsrc creation support. * Add .cvspass creation/appending support. * Allow checkout of any level subdirectory. * Add $KDEDIR/bin:$QTDIR/bin to $PATH automatically. * Add $KDEDIR/lib to $LD_LIBRARY_PATH automatically. * Ensure LD_LIBRARY_PATH is correct for one/multi dir cases. * Refactor code if necessary. -* Allow --help and --version command line arguments even if the program - is already running. +* Expand ~ in environment setting code. diff --git a/kdecvs-build b/kdecvs-build index 56b534b..b7fcfba 100755 --- a/kdecvs-build +++ b/kdecvs-build @@ -30,7 +30,7 @@ my %global_opts = ( "kdedir" => "", "cxxflags" => "", "libpath" => "", - "do-not-compile" => "", + "do-not-compile" => "", "binpath" => "", "no-cvs" => "", "refresh-build" => "", @@ -41,7 +41,7 @@ my %global_opts = ( "make-output-file" => "output", "manual-build" => "", "pretend" => "", - "use-unsermake" => "", + "use-unsermake" => "", ); my %package_opts; # Holds module-specific options. @@ -824,6 +824,7 @@ EOF { print "Unable to make directory $kdecvs!\n$!\n"; @build_list = (); # Clear out the build list, since we can't build. + @install_list = (); # Can't install either. return 0; } } @@ -970,6 +971,42 @@ sub setup_build_system return 1; } +# Subroutine to setup the environment for a module. First parameter is the name of +# the module to set the environment for +sub update_module_environment +{ + my $dir = shift; + my $kdecvs = get_option ('global', 'cvs-root'); + my $kdedir = get_option ($dir, 'kdedir'); + my $qtdir = get_option ($dir, 'qtdir'); + my $path = join(':', get_option ($dir, 'binpath'), "$qtdir/bin", "$kdedir/bin"); + my $libdir = join(':', get_option ($dir, 'libpath'), "$qtdir/lib", "$kdedir/lib"); + + # Set up the children's environment. We use setenv since it + # won't set an environment variable to nothing. (e.g, setting + # QTDIR to a blank string might confuse Qt or KDE. + + # Remove leading and trailing colons, just in case. + for ($path, $libdir) + { + s/^:*//; + s/:*$//; + } + + setenv ('LD_LIBRARY_PATH', $libdir); + setenv ('PATH', $path); + setenv ('KDEDIR', $kdedir); + setenv ('QTDIR', $qtdir); + + # Everyone loves unsermake. It's a pity that not every module will compile with it. + # Benjamin Meyer has an excellent article about speeding up distributed builds using + # unsermake. You should notice a much faster build even with only one CPU, however. + if (get_option ($dir, "use-unsermake")) + { + setenv ("UNSERMAKE", "$kdecvs/kdenonbeta/unsermake/unsermake"); + } +} + # Subroutine to handle the build process. # First parameter is a reference of a list containing the packages # we are to build. @@ -1010,19 +1047,8 @@ sub handle_build { next if get_option ($dir, 'manual-build'); - # Set up the children's environment. We use setenv since it - # won't set an environment variable to nothing. (e.g, setting - # QTDIR to a blank string might confuse Qt or KDE. - setenv ('LD_LIBRARY_PATH', get_option ($dir, "libpath")); - setenv ('PATH', get_option ($dir, "binpath")); - setenv ('KDEDIR', get_option ($dir, "kdedir")); - setenv ('QTDIR', get_option ($dir, "qtdir")); - - if (get_option ($dir, "use-unsermake")) - { - setenv ("UNSERMAKE", "$kdecvs/kdenonbeta/unsermake/unsermake"); - } - + update_module_environment ($dir); + # Ensure that the build system is ready. if (not setup_build_system($dir)) { @@ -1163,3 +1189,5 @@ $time = localtime; print "Script finished processing at $time\n"; finish(); + +# vim: set et sw=4 ts=4: