X-Git-Url: http://git.jankratochvil.net/?p=macros.git;a=blobdiff_plain;f=AutoGen.pm;h=4bbb8fd142dd9e7360a00a174af2e1685d77ad7e;hp=3294492ab7f3a0a08600def70be1eaff3201af54;hb=df3336d8450e4fb390c525b995377cf21448a8c3;hpb=a9661c9cf600fad523f3ecf5427e29e24cd2ea2e diff --git a/AutoGen.pm b/AutoGen.pm index 3294492..4bbb8fd 100644 --- a/AutoGen.pm +++ b/AutoGen.pm @@ -38,8 +38,9 @@ BEGIN { use File::chdir; # $CWD use File::Touch; # &touch use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG); + use File::Glob qw(:glob); # &bsd_glob, &GLOB_* HERE - eval "$_\n; 1;" or push @missing,(/^\s*use\s+([^\s;]+)/)[0]; + eval "$_\n; 1;" or push @missing,(/^\s*use\s+([^ ;]+)/)[0]; } die "You are missing some modules - install them by:\n" ."\tperl -MCPAN -e 'install qw(".join(" ",@missing).")'\n" @@ -120,6 +121,9 @@ my(@files)=@_; my $nocheck=shift @files if $files[0] eq "nocheck"; my $dest=pop @files; + # expand pattern to properly match © resulting filenames count + @files=map({ bsd_glob $_,&GLOB_ERR|&GLOB_NOSORT; } @files); + confess "$!" if $File::Glob::GLOB_ERROR; @files==copy @files,$dest or $nocheck or confess "$!"; } @@ -130,6 +134,9 @@ my(@files)=@_; my $nocheck=shift @files if $files[0] eq "nocheck"; my $flag=shift @files if ref $files[0]; + # expand pattern to properly match © resulting filenames count + @files=map({ bsd_glob $_,&GLOB_ERR|&GLOB_NOSORT; } @files); + confess "$!" if $File::Glob::GLOB_ERROR; @files==remove((!$flag ? () : $flag),@files) or $nocheck or confess "$!"; } @@ -159,7 +166,7 @@ my($class,%args)=@_; $spec=~s/\\\n/ /gs; $class->run(%Options, "ARGV"=>["--copy"], - "configure_args"=>[split /\s+/,($spec=~/^%configure\s+(.*)$/m)[0]], + "configure_args"=>[split /\s+/,($spec=~/^[%]configure\b[ \t]*(.*)$/m)[0]], ); _remove "ChangeLog"; # force its rebuild by Makefile/rcs2log _system "make dist $name.spec"; @@ -219,7 +226,7 @@ sub _cleanfiles ./stamp-h ./stamp-h.in ./stamp-h1 ./install-sh ./aclocal.m4 - ./autom4te-*.cache + ./autom4te.cache ./autom4te-*.cache ./m4 ./missing ./mkinstalldirs @@ -333,8 +340,10 @@ sub _expandclass my($patt)=@_; return $patt if $patt!~/\Q[\E(.*?)\Q]\E/; - my($pre,$post)=($`,$'); # FIXME: local($`,$') doesn't work - why? - return map({ _expandclass("$pre$_$post"); } split("",$1)); + my($pre,$range,$post)=($`,$1,$'); # FIXME: local($`,$1,$') doesn't work - why? + 1 while $range=~s#(.)-(.)# join("",map(chr,(ord($1)..ord($2)))); + #ge; + return map({ _expandclass("$pre$_$post"); } split("",$range)); } sub run @@ -376,6 +385,8 @@ my($class,%options)=@_; my $configure_in=_readfile("configure.in"); do { $$_=1 if !defined($$_) && $configure_in=~/^AM_GNU_GETTEXT\b/m; } for (\$Options{"want-gettextize"}); + do { $$_=1 if !defined($$_) && $configure_in=~/^AM_GLIB_GNU_GETTEXT\b/m; } + for (\$Options{"want-glib-gettextize"}); do { $$_=1 if !defined($$_) && $configure_in=~/^AM_PROG_LIBTOOL\b/m; } for (\$Options{"want-libtoolize"}); do { $$_=1 if !defined($$_) && $configure_in=~/^A[CM]_CONFIG_HEADER\b/m; } @@ -427,6 +438,11 @@ my($class,%options)=@_; _writefile $Makefile_in_in,$file; } } + if ($Options{"want-glib-gettextize"}) { + _system "glib-gettextize",@copy_arg; + # "po/ChangeLog" is somehow missing at this point + File::Touch->new("atime_only"=>1)->touch("po/ChangeLog"); + } _system "aclocal",map((!$_ ? () : @$_),$Options{"aclocal_args"}); _system qw(libtoolize),@copy_arg if $Options{"want-libtoolize"}; _system qw(autoheader) if $Options{"want-autoheader"}; @@ -445,7 +461,7 @@ my($class,%options)=@_; $ENV{"CFLAGS"}||=""; # shared/static switching cannot be based on maintainer-mode in configure _system(qw(./configure --enable-maintainer-mode), - ($Options{"want-libtoolize"} && qw(--enable-shared --disable-static)), + (!$Options{"want-libtoolize"} ? () : qw(--enable-shared --disable-static)), map((!$_ ? () : @$_),$Options{"configure_args"}), ); }