Kaydet (Commit) ca0c54d0 authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Michael Meeks

Make autogen.sh prefer to read an autogen.input file

For backward compatibility, an autogen.lastrun file will still be used if it
exists and autogen.input does not exist. The recommended workflow is now to
keep the configuration parametets in autogen.input which is never written by
autogen.sh.

Most (?) developers used to treat autogen.lastrun as a valuable parameter file
to be edited manually anyway, and not as an ad-hoc backup copy of command-line
parameters last used. The name autogen.input better reflects this usage.

Change-Id: I7e3c747fa95e9f2f0bc44036419aaab8f4ad01e7
Reviewed-on: https://gerrit.libreoffice.org/3111Reviewed-by: 's avatarMichael Meeks <michael.meeks@suse.com>
Tested-by: 's avatarMichael Meeks <michael.meeks@suse.com>
üst 35b75ed5
...@@ -33,16 +33,17 @@ $(BUILDDIR)/config_host.mk : \ ...@@ -33,16 +33,17 @@ $(BUILDDIR)/config_host.mk : \
$(SRCDIR)/Makefile.in \ $(SRCDIR)/Makefile.in \
$(SRCDIR)/instsetoo_native/util/openoffice.lst.in \ $(SRCDIR)/instsetoo_native/util/openoffice.lst.in \
$(SRCDIR)/configure.ac \ $(SRCDIR)/configure.ac \
$(BUILDDIR)/autogen.lastrun $(if $(wildcard $(BUILDDIR)/autogen.input),$(BUILDDIR)/autogen.input,$(if $(wildcard $(BUILDDIR)/autogen.lastrun),$(BUILDDIR)/autogen.lastrun))
$(SRCDIR)/autogen.sh $(SRCDIR)/autogen.sh
# dummy rule in case any of the above prerequisites are removed, so that a stale # dummy rule in case any of the above prerequisites are removed, so
# Makefile still triggers autogen.sh, or in case autogen.lastrun does not yet # that a stale Makefile still triggers autogen.sh, or in case
# exist # autogen.input does not exist, or autogen.lastrun does not yet exist
$(SRCDIR)/config_host.mk.in \ $(SRCDIR)/config_host.mk.in \
$(SRCDIR)/Makefile.in \ $(SRCDIR)/Makefile.in \
$(SRCDIR)/instsetoo_native/util/openoffice.lst.in \ $(SRCDIR)/instsetoo_native/util/openoffice.lst.in \
$(SRCDIR)/configure.ac \ $(SRCDIR)/configure.ac \
$(BUILDDIR)/autogen.input \
$(BUILDDIR)/autogen.lastrun: $(BUILDDIR)/autogen.lastrun:
@true @true
......
...@@ -21,7 +21,7 @@ sub clean() ...@@ -21,7 +21,7 @@ sub clean()
{ {
system ("rm -Rf autom4te.cache"); system ("rm -Rf autom4te.cache");
system ("rm -f missing install-sh mkinstalldirs libtool ltmain.sh"); system ("rm -f missing install-sh mkinstalldirs libtool ltmain.sh");
print "cleaned the build tree\n"; print "Cleaned the build tree\n";
} }
my $aclocal; my $aclocal;
...@@ -108,9 +108,18 @@ for my $arg (@ARGV) { ...@@ -108,9 +108,18 @@ for my $arg (@ARGV) {
} }
my @cmdline_args = (); my @cmdline_args = ();
if (!@ARGV) {
my $lastrun = "autogen.lastrun"; my $input = "autogen.input";
@cmdline_args = read_args ($lastrun) if (-f $lastrun); my $lastrun = "autogen.lastrun";
if (-f $input) {
warn "Ignoring command-line arguments, using $input.\n" if (@ARGV);
warn "Ignoring $lastrun, using $input.\n" if (-f $lastrun);
@cmdline_args = read_args ($input);
} elsif (-f $lastrun) {
warn "Ignoring command-line arguments, using $lastrun.\n" if (@ARGV);
print STDERR "Reading $lastrun. Please rename it to $input to avoid this message.\n";
@cmdline_args = read_args ($lastrun);
} else { } else {
@cmdline_args = @ARGV; @cmdline_args = @ARGV;
} }
...@@ -118,7 +127,7 @@ if (!@ARGV) { ...@@ -118,7 +127,7 @@ if (!@ARGV) {
my @args; my @args;
my $default_config = "$src_path/distro-configs/default.conf"; my $default_config = "$src_path/distro-configs/default.conf";
if (-f $default_config) { if (-f $default_config) {
print STDERR "Reading default config file: $default_config\n"; print STDERR "Reading default config file: $default_config.\n";
push @args, read_args ($default_config); push @args, read_args ($default_config);
} }
for my $arg (@cmdline_args) { for my $arg (@cmdline_args) {
...@@ -164,40 +173,35 @@ if ($src_path ne $build_path) ...@@ -164,40 +173,35 @@ if ($src_path ne $build_path)
system ("$aclocal $aclocal_flags") && die "Failed to run aclocal"; system ("$aclocal $aclocal_flags") && die "Failed to run aclocal";
unlink ("configure"); unlink ("configure");
system ("autoconf -I ${src_path}") && die "Failed to run autoconf"; system ("autoconf -I ${src_path}") && die "Failed to run autoconf";
die "failed to generate configure" if (! -f "configure"); die "Failed to generate the configure script" if (! -f "configure");
if (defined $ENV{NOCONFIGURE}) { if (defined $ENV{NOCONFIGURE}) {
print "Skipping configure process."; print "Skipping configure process.";
} else { } else {
# Save autogen.lastrun only if we did get some arguments on the command-line # Save autogen.lastrun only if we did get some arguments on the command-line
if (@ARGV) { if (! -f $input && @ARGV) {
if (scalar(@cmdline_args) > 0) { if (scalar(@cmdline_args) > 0) {
# if there's already an autogen.lastrun, make a backup first # if there's already an autogen.lastrun, make a backup first
if (-e "autogen.lastrun") { if (-e $lastrun) {
open (my $fh, "autogen.lastrun") || warn "can't open autogen.lastrun. \n"; open (my $fh, $lastrun) || warn "Can't open $lastrun.\n";
open (BAK, ">autogen.lastrun.bak") || warn "can't create backup file. \n"; open (BAK, ">$lastrun.bak") || warn "Can't create backup file $lastrun.bak.\n";
while (<$fh>) { while (<$fh>) {
print BAK; print BAK;
} }
close (BAK) && close ($fh); close (BAK) && close ($fh);
} }
# print "writing args to autogen.lastrun\n"; # print "Saving command-line args to $lastrun\n";
my $fh; my $fh;
open ($fh, ">autogen.lastrun") || die "can't open autogen.lastrun: $!"; open ($fh, ">autogen.lastrun") || die "Can't open autogen.lastrun: $!";
for my $arg (@cmdline_args) { for my $arg (@cmdline_args) {
print $fh "$arg\n"; print $fh "$arg\n";
} }
close ($fh); close ($fh);
} }
} }
elsif ( ! -e "autogen.lastrun")
{
open (my $fh, ">autogen.lastrun") || die "can't create autogen.lastrun";
close ($fh);
}
push @args, "--srcdir=$src_path"; push @args, "--srcdir=$src_path";
print "running ./configure with '" . join ("' '", @args), "'\n"; print "Running ./configure with '" . join ("' '", @args), "'\n";
system ("./configure", @args) && die "Error running configure"; system ("./configure", @args) && die "Error running configure";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment