|
|
|
|
@ -196,98 +196,6 @@ sub get_module_path_dir |
|
|
|
|
return %result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Returns a hash digest of the given options in the list. The return value is |
|
|
|
|
# base64-encoded at this time. |
|
|
|
|
# |
|
|
|
|
# Note: Don't be dumb and pass data that depends on execution state as the |
|
|
|
|
# returned hash is almost certainly not useful for whatever you're doing with |
|
|
|
|
# it. (i.e. passing a reference to a list is not helpful, pass the list itself) |
|
|
|
|
# |
|
|
|
|
# Parameters: List of scalar values to hash. |
|
|
|
|
# Return value: base64-encoded hash value. |
|
|
|
|
sub get_list_digest |
|
|
|
|
{ |
|
|
|
|
use Digest::MD5 "md5_base64"; # Included standard with Perl 5.8 |
|
|
|
|
|
|
|
|
|
return md5_base64(@_); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Subroutine to run CMake to create the build directory for a module. |
|
|
|
|
# CMake is not actually run if pretend mode is enabled. |
|
|
|
|
# |
|
|
|
|
# First parameter is the module to run cmake on. |
|
|
|
|
# Return value is the shell return value as returned by log_command(). i.e. |
|
|
|
|
# 0 for success, non-zero for failure. |
|
|
|
|
sub safe_run_cmake |
|
|
|
|
{ |
|
|
|
|
my $module = assert_isa(shift, 'ksb::Module'); |
|
|
|
|
my $srcdir = $module->fullpath('source'); |
|
|
|
|
my @commands = split_quoted_on_whitespace ($module->getOption('cmake-options')); |
|
|
|
|
|
|
|
|
|
# grep out empty fields |
|
|
|
|
@commands = grep {!/^\s*$/} @commands; |
|
|
|
|
|
|
|
|
|
# Add -DBUILD_foo=OFF options for the directories in do-not-compile. |
|
|
|
|
# This will only work if the CMakeLists.txt file uses macro_optional_add_subdirectory() |
|
|
|
|
my @masked_directories = split(' ', $module->getOption('do-not-compile')); |
|
|
|
|
push @commands, "-DBUILD_$_=OFF" foreach @masked_directories; |
|
|
|
|
|
|
|
|
|
# Get the user's CXXFLAGS, use them if specified and not already given |
|
|
|
|
# on the command line. |
|
|
|
|
my $cxxflags = $module->getOption('cxxflags'); |
|
|
|
|
if ($cxxflags and not grep { /^-DCMAKE_CXX_FLAGS(:\w+)?=/ } @commands) |
|
|
|
|
{ |
|
|
|
|
push @commands, "-DCMAKE_CXX_FLAGS:STRING=$cxxflags"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
my $prefix = $module->installationPath(); |
|
|
|
|
|
|
|
|
|
push @commands, "-DCMAKE_INSTALL_PREFIX=$prefix"; |
|
|
|
|
|
|
|
|
|
if ($module->getOption('run-tests') && |
|
|
|
|
!grep { /^\s*-DKDE4_BUILD_TESTS(:BOOL)?=(ON|TRUE|1)\s*$/ } (@commands) |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
whisper ("Enabling tests"); |
|
|
|
|
push @commands, "-DKDE4_BUILD_TESTS:BOOL=ON"; |
|
|
|
|
|
|
|
|
|
# Also enable phonon tests. |
|
|
|
|
if ($module =~ /^phonon$/) { |
|
|
|
|
push @commands, "-DPHONON_BUILD_TESTS:BOOL=ON"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ($module->getOption('run-tests') eq 'upload') |
|
|
|
|
{ |
|
|
|
|
whisper ("Enabling upload of test results"); |
|
|
|
|
push @commands, "-DBUILD_experimental:BOOL=ON"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
unshift @commands, 'cmake', $srcdir; # Add to beginning of list. |
|
|
|
|
|
|
|
|
|
my $old_options = |
|
|
|
|
$module->getPersistentOption('last-cmake-options') || ''; |
|
|
|
|
my $builddir = $module->fullpath('build'); |
|
|
|
|
|
|
|
|
|
if (($old_options ne get_list_digest(@commands)) || |
|
|
|
|
$module->getOption('reconfigure') || |
|
|
|
|
! -e "$builddir/CMakeCache.txt" # File should exist only on successful cmake run |
|
|
|
|
) |
|
|
|
|
{ |
|
|
|
|
info ("\tRunning g[cmake]..."); |
|
|
|
|
|
|
|
|
|
# Remove any stray CMakeCache.txt |
|
|
|
|
safe_unlink ("$srcdir/CMakeCache.txt") if -e "$srcdir/CMakeCache.txt"; |
|
|
|
|
safe_unlink ("$builddir/CMakeCache.txt") if -e "$builddir/CMakeCache.txt"; |
|
|
|
|
|
|
|
|
|
$module->setPersistentOption('last-cmake-options', get_list_digest(@commands)); |
|
|
|
|
return log_command($module, "cmake", \@commands); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Skip cmake run |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# 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. |
|
|
|
|
|