[Libreoffice-commits] .: 2 commits - configure.in scp2/macros

Michael Meeks mmeeks at kemper.freedesktop.org
Tue Oct 12 14:35:54 PDT 2010


 configure.in            |   16 +++++++++++++++
 scp2/macros/macro.pl    |   51 +++++++++++++++++++++++++++---------------------
 scp2/macros/makefile.mk |    3 --
 3 files changed, 46 insertions(+), 24 deletions(-)

New commits:
commit d3e0961a0079c1ecbf614249f0681721d2fa826c
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Tue Oct 12 22:30:55 2010 +0100

    cleanup macro.pl - re-build if your config changes

diff --git a/scp2/macros/macro.pl b/scp2/macros/macro.pl
index 21c0b8e..20a7b29 100644
--- a/scp2/macros/macro.pl
+++ b/scp2/macros/macro.pl
@@ -25,9 +25,11 @@
 #
 #*************************************************************************
 
+my $outfile;
+my $destfile;
+my $config_stamp;
+my $lastcompletelangiso_var;
 my $completelangiso_var = $ENV{COMPLETELANGISO_VAR};
-my $lastcompletelangiso_var;;
-my $outfile = "";
 
 if ( !defined $completelangiso_var) {
     print STDERR "ERROR: No language defined!\n";
@@ -42,11 +44,11 @@ foreach $lang (split (/ /, $poorhelplocalizations_var)) {
   $poorhelplocalizations{$lang}++;
 }
 
-startup_check();
-if ( "$completelangiso_var" eq "$lastcompletelangiso_var" ) {
-    print STDERR "No new languages. Keeping old file\n";
+if (!args_require_build()) {
+    print STDERR "No new languages, or config. Keeping old file\n";
     exit 0;
 }
+print STDERR "re-building macros\n";
 
 my @completelangiso = split " +", $completelangiso_var;
 
@@ -75,6 +77,7 @@ write_FILE_ALL_LANG_LETTER();
 
 close OUTFILE;
 
+rename $outfile, $destfile;
 
 sub write_ALL_LANG
 {
@@ -256,25 +259,26 @@ sub write_FILE_ALL_LANG_LETTER
     print OUTFILE "\n\n";
 }
 
-sub startup_check
+sub args_require_build
 {
-    my $i;
-    for ( $i=0; $i <= $#ARGV; $i++) {
-        if ( "$ARGV[$i]" eq "-o" ) {
-            if ( defined $ARGV[ $i + 1] ) {
-                $outfile = $ARGV[ $i + 1];
-            } else {
-                usage();
-            }
-        }
+    while (@ARGV) {
+        $opt = shift @ARGV;
+        $destfile = shift @ARGV if ($opt eq '-o');
+        $config_stamp = shift @ARGV if ($opt eq '-c');
     }
-    usage() if $i<2;
-    usage() if "$outfile" eq "";
-    if ( -f "$outfile" ) {
-        # changed script - run allways
-        return if (stat($0))[9] > (stat("$outfile"))[9] ;
+    usage() if (!defined ($destfile) || !defined ($config_stamp));
+    $outfile = "$destfile.tmp";
+
+    if ( -f "$destfile" ) {
+        # changed script - run always
+        return 1 if (stat($0))[9] > (stat("$destfile"))[9] ;
 
-        open OLDFILE, "$outfile" or die "$0 - ERROR: $outfile exists but isn't readable.\n";
+        # changed set_soenv.stamp - run always
+        if (-f "$config_stamp") {
+            return 1 if (stat($config_stamp))[9] > (stat($destfile))[9];
+        }
+
+        open OLDFILE, "$destfile" or die "$0 - ERROR: $outfile exists but isn't readable.\n";
         while ( $line = <OLDFILE> ) {
             if ( $line =~ /^\/\/.*completelangiso:/ ) {
                 $lastcompletelangiso_var = $line;
@@ -285,12 +289,15 @@ sub startup_check
                 
         }
         close OLDFILE;
+
+        return 0 if ( "$completelangiso_var" eq "$lastcompletelangiso_var" );
     }
+    return 1;
 }
 
 sub usage
 {
     print STDERR "Generate language dependend macros use in *.scp files\n";
-    print STDERR "perl $0 -o outputfile\n";
+    print STDERR "perl $0 -o <outputfile> -c <config_stamp_file>\n";
     exit  1;
 }
diff --git a/scp2/macros/makefile.mk b/scp2/macros/makefile.mk
index d36f25e..790a273 100644
--- a/scp2/macros/makefile.mk
+++ b/scp2/macros/makefile.mk
@@ -45,5 +45,4 @@ ALLTAR : $(INCCOM)$/langmacros.inc
 .PHONY $(INCCOM)$/langmacros.inc:
     @echo ------------------------------
     @echo Making: $@  
-    @@-$(RENAME) $@ $@.tmp
-    $(COMMAND_ECHO)$(PERL) macro.pl $(VERBOSITY) -o $@.tmp && $(RENAME:s/+//) $@.tmp $@
+    $(COMMAND_ECHO)$(PERL) macro.pl $(VERBOSITY) -o $@ -c $(SOLARSRC)/set_soenv.stamp
commit a932b085a786f98f180fbd5e1eee95072b19cd5b
Author: Michael Meeks <michael.meeks at novell.com>
Date:   Tue Oct 12 21:23:00 2010 +0100

    add stamp file - updated when configuration changes

diff --git a/configure.in b/configure.in
index 9cd1a15..bffc999 100644
--- a/configure.in
+++ b/configure.in
@@ -7571,8 +7571,24 @@ AC_SUBST(BUILD_TYPE)
 # make sure config.guess is +x; we execute config.guess, so it has to be so; 
 chmod +x ./config.guess
 
+# Generate a configuration timestamp we can use for deps
+if test -f set_soenv; then
+   mv -f set_soenv set_soenv.last
+else
+   echo > set_soenv.last
+fi
+
 AC_OUTPUT([set_soenv Makefile])
 
+# touch the config timestamp file set_soenv.stamp
+if test ! -f set_soenv.stamp; then
+   echo > set_soenv.stamp
+elif diff set_soenv set_soenv.last >/dev/null 2>&1; then
+   echo "Configuration unchanged - avoiding scp2 stamp update"
+else
+   echo > set_soenv.stamp
+fi
+
 dnl Executing the set_soenv script to setup the environment variables.
 chmod a+x set_soenv
 if test -z "$enable_check_only"; then


More information about the Libreoffice-commits mailing list