X-Git-Url: http://git.jankratochvil.net/?p=macros.git;a=blobdiff_plain;f=AutoGen.pm;h=8519a75d7c84d5a8cb5f8f1e30ba312404f26c9c;hp=aa4bb647bc1fbfac7c81eb70bb6da10d265cb2a5;hb=19e00dcd0398730dff10b24fe7258f7b5b79f4ec;hpb=6cf1604c42c41f1b95fae2d07e3b4725a1f99f90 diff --git a/AutoGen.pm b/AutoGen.pm index aa4bb64..8519a75 100644 --- a/AutoGen.pm +++ b/AutoGen.pm @@ -214,20 +214,20 @@ my($class,%args)=@_; $class->_prepdist($name); _system "make $name.spec"; my $spec=_readfile "$name.spec"; - my $patch=($spec=~/^Patch\d*:\s*(.*)$/m)[0]; + my $patch=($spec=~/^Patch\d*\s*:\s*(.*)$/m)[0]; _system "make dist"; if (!$patch) { _copy "$name-*.tar.gz",_rpmeval("_sourcedir"); } else { my @origs; - for my $glob ("orig-$name-*.tar.{gz,Z}") { + for my $glob ("orig-$name-*.tar.{gz,Z,bz2}") { @origs=glob $glob; confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs; } - my $base=($origs[0]=~/^orig-(.*)[.]tar[.](?:gz|Z)$/)[0]; + my($base,$ext)=($origs[0]=~/^orig-(.*)[.]tar[.](gz|Z|bz2)$/); _copy $origs[0],_rpmeval("_sourcedir")."/".($origs[0]=~/^orig-(.*)$/)[0]; - _system "tar xzf ".$origs[0]; + _system "tar x".($ext eq "bz2" ? "j" : "z")."f ".$origs[0]; _mkdir $base."-orig"; # FIXME: Copy also dot-prefixed files! _move \1,$base."/*",$base."-orig/"; @@ -336,7 +336,7 @@ sub _cleanfiles ./mkinstalldirs ./libtool ./ltconfig ./ltmain.sh ./ABOUT-NLS - ./-[0-9]* ./-devel-[0-9]* + ./-[0-9]* ./-*-[0-9]* ./.spec ./.m4 ./.spec.m4 ./debian/tmp ./debian/ ./*_[0-9]* @@ -496,14 +496,18 @@ my($class,%options)=@_; return if $Options{"ARGV_clean"} || $Options{"ARGV_fullclean"}; $Options{"aclocal_args"}=[qw(-I macros),map((!$_ ? () : @$_),$Options{"aclocal_args"})]; - my $configure_in=_readfile("configure.in"); - do { $$_=1 if !defined($$_) && $configure_in=~/^AM_GNU_GETTEXT\b/m; } + my $configure_name; + do { $configure_name||=$_ if -f $_ } for ("configure.in"); + do { $configure_name||=$_ if -f $_ } for ("configure.ac"); + $configure_name or confess "Cannot find configure.{in,ac}"; + my $configure_in=_readfile($configure_name); + do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_GNU_GETTEXT\b/m; } for (\$Options{"want-gettextize"}); - do { $$_=1 if !defined($$_) && $configure_in=~/^AM_GLIB_GNU_GETTEXT\b/m; } + do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_GLIB_GNU_GETTEXT\b/m; } for (\$Options{"want-glib-gettextize"}); - do { $$_=1 if !defined($$_) && $configure_in=~/^AM_PROG_LIBTOOL\b/m; } + do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_PROG_LIBTOOL\b/m; } for (\$Options{"want-libtoolize"}); - do { $$_=1 if !defined($$_) && $configure_in=~/^A[CM]_CONFIG_HEADER\b/m; } + do { $$_=1 if !defined($$_) && $configure_in=~/^\s*A[CM]_CONFIG_HEADER\b/m; } for (\$Options{"want-autoheader"}); my @copy_arg=(!$Options{"ARGV_copy"} ? () : "--copy"); @@ -517,7 +521,7 @@ my($class,%options)=@_; ."'") { _system $_ and confess $_; } - for ("configure.in","Makefile.am") { + for ($configure_name,"Makefile.am") { STDERR->printflush("gettextize recovery rename \"$_~\"->\"$_\"... "); rename "$_~","$_" or confess "$!"; STDERR->printflush("ok\n");