2
# Copyright (C) 2006 Thomas Zander <zander@kde.org>
2
# Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
3
3
$COMMAND = "unsercmake";
4
$VERSION = "$COMMAND 0.14";
4
$VERSION = "$COMMAND 0.32";
5
5
# This script allows you to build a target library including dependency checking, but it
6
6
# limits the dependency checking to the current dir and its subdirs meaning a lot of
7
7
# unwanted steps are skipped.
8
# This script assumes the presence of cmake 2.4.3 or greater and the Makefiles it created.
219
218
if(defined $just_print) {
221
foreach $h (@actualTargets) {
222
if($h=~/(\b$lib\_automoc)/) {
223
system ("make $jobs $verbose $1");
222
228
my $rc = system ("make $jobs $verbose $lib/fast");
223
229
if(!(defined $keep_going) && $rc != 0) {
226
if($doInstall == 1 && $rc == 0) {
228
&install("$builddir/$locations{$lib}/cmake_install.cmake", 1);
231
233
elsif(! defined $quiet) {
232
234
print "Skipping lib: $lib (in $dir)\n";
456
my $inputFile=shift(@_);
457
my $limitToLibs=shift(@_);
460
open FILE, "$inputFile";
461
foreach $line (<FILE>) {
462
if($limitToLibs == 0 && $line=~/^INCLUDE\(\"(.*)\"\)/) {
465
elsif($line=~/^FILE\(INSTALL DESTINATION \"(.*)\" TYPE (SHARED_LIBRARY|EXECUTABLE|FILE|MODULE)(.+?)FILES \"(.*)\"\)$/) {
470
if($limitToLibs==1 && !($type eq "SHARED_LIBRARY" || $type eq "MODULE")) {
475
if($type eq "FILE" && $options=~/RENAME \"(.*)\"/) {
478
#print " a: '$dest', b: $type, c: '$options', d: '$filename'\n";
481
if($filename=~/\.so$/) { # cmake may be lying to us in this case about the source path
482
my @sourceInfo = stat "$input";
483
if (@sourceInfo == 0) {
484
# in this case cmake moved the .so to the [build]/lib/ dir. Which sucks as we don't know what the build dir is!
485
my $testPath = $input;
487
$testPath=~/(.*)\/.*/; # aka 'cd ..'
489
if ($testPath eq "") { last; }
490
if (-f "$testPath/lib/$filename") {
492
$input = "$testPath/lib/$filename";
499
my @destInfo = stat "$dest/$filename";
501
#print "dest not exist\n";
505
my @sourceInfo = stat "$input";
506
if(@destInfo[7] != @sourceInfo[7]) { # filesize
507
#print "different size\n";
510
elsif(abs(@destInfo[9] - @sourceInfo[9]) > 2) { # mtime
511
#print "different date\n";
516
system("install -d $dest"); # create dir
520
if($type eq "SHARED_LIBRARY") {
521
if($options=~/VERSION ([\d\.]+)/) { # do symlinks since its got versions.
524
$options=~/SOVERSION ([\d\.]+)/;
528
system "install -d $dest" || die "Can not create dir '$dest'";
529
unlink "$dest/$filename$ver";
530
system "cp", "--preserve=timestamps,mode", "$input", "$dest/$filename$ver";
531
if($type eq "EXECUTABLE") {
532
chmod 0755, "$dest/$filename";
534
#print " cp $input $dest/$filename$ver\n";
536
if(!-l "$dest/$filename$sover") {
537
unlink("$dest/$filename$sover"); #if its a normal file
538
symlink "$filename$ver", "$dest/$filename$sover";
540
if(!-l "$dest/$filename") {
541
unlink("$dest/$filename"); #if its a normal file
542
symlink "$filename$sover", "$dest/$filename";
545
if($limitToLibs == 1) {
548
print " $dest/$filename$ver\n";
554
foreach $subdir (@subdirs) {
555
&install($subdir, $limitToLibs);