From c32d54f244b0a18e0dcfcfceae140499e2dc3bbe Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 22 Sep 2017 16:51:22 +0300 Subject: [PATCH] Revert "Goodbye autogen.lastrun" Welcome back autogen.lastrun. I just don't have the energy to convince tinderbox maintainers to fix their scripts. Oh well. This reverts commit 7496c83374f68148c62ac23a6e4c4c314d67273d. --- Makefile.in | 1 + autogen.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 03184af18d44..62924dc2aae0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -46,6 +46,7 @@ $(BUILDDIR)/config_host.mk : $(wildcard \ $(SRCDIR)/configure.ac \ $(SRCDIR)/config_host/*.h.in \ $(BUILDDIR)/autogen.input \ + $(BUILDDIR)/autogen.lastrun \ $(BUILDDIR)/autogen.sh \ ) \ $(shell . $(SRCDIR)/bin/get_config_variables JAVA_HOME && \ diff --git a/autogen.sh b/autogen.sh index 02d160bdca92..a4bab811a36b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,15 @@ : # +# This script checks various configure parameters and uses three files: +# * autogen.input (ro) +# * autogen.lastrun (rw) +# * autogen.lastrun.bak (rw) +# # If _no_ parameters: -# Read args from autogen.input +# Read args from autogen.input or autogen.lastrun +# Else +# Backup autogen.lastrun as autogen.lastrun.bak +# Write autogen.lastrun with new commandline args # # Run configure with checked args # @@ -178,7 +186,7 @@ unlink ("configure"); system ("autoconf -I ${src_path}") && die "Failed to run autoconf"; die "Failed to generate the configure script" if (! -f "configure"); -# Handle help arguments first +# Handle help arguments first, so we don't clobber autogen.lastrun for my $arg (@ARGV) { if ($arg =~ /^(--help|-h|-\?)$/) { print STDOUT "autogen.sh - libreoffice configuration helper\n"; @@ -193,10 +201,24 @@ for my $arg (@ARGV) { my @cmdline_args = (); my $input = "autogen.input"; +my $lastrun = "autogen.lastrun"; if (!@ARGV) { if (-f $input) { + if (-f $lastrun) { + print STDERR < 0) { + # if there's already an autogen.lastrun, make a backup first + if (-e $lastrun) { + open (my $fh, $lastrun) || warn "Can't open $lastrun.\n"; + open (BAK, ">$lastrun.bak") || warn "Can't create backup file $lastrun.bak.\n"; + while (<$fh>) { + print BAK; + } + close (BAK) && close ($fh); + } + # print "Saving command-line args to $lastrun\n"; + my $fh; + open ($fh, ">autogen.lastrun") || die "Can't open autogen.lastrun: $!"; + for my $arg (@cmdline_args) { + print $fh "$arg\n"; + } + close ($fh); + } + } push @args, "--srcdir=$src_path"; push @args, "--enable-option-checking=$option_checking";