4 # autoautotools aware of CVS and rpm/deb.
5 # Copyright (C) 2002-2003 Jan Kratochvil <project-macros@jankratochvil.net>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; exactly version 2 of June 1991 is required
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 require 5.6.0; # at least 'use warnings;' but we need some 5.6.0+ modules anyway
23 use vars qw($VERSION);
24 $VERSION=do { my @r=(q$Revision$=~/\d+/g); sprintf "%d.".("%03d"x$#r),@r; };
30 for (split "\n",<<'HERE') {
31 use Carp qw(cluck confess);
32 use Getopt::Long; # &GetOptions, $Getopt::Long::*
33 use File::Basename; # &basename
34 use File::Grep qw(fgrep);
35 use File::HomeDir; # &home
36 use File::Remove qw(remove);
37 use File::NCopy qw(copy);
38 use File::chdir; # $CWD
39 use File::Touch; # &touch
40 use POSIX qw(WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG WIFSTOPPED WSTOPSIG);
42 eval "$_\n; 1;" or push @missing,(/^\s*use\s+([^ ;]+)/)[0];
44 die "You are missing some modules - install them by:\n"
45 ."\tperl -MCPAN -e 'install qw(".join(" ",@missing).")'\n"
46 ."If you see messages: Writing Makefile for <packagename> -- NOT OK\n"
47 ."you may did not have installed make(1) while configuring Perl CPAN.\n"
48 ."Install make(1) and type 'o conf init' in: perl -MCPAN -e shell\n"
57 Beware: '.basename($0).' is a tool only for maintainers!
60 --rpm Build RPM packages locally (needs /usr/src/(redhat|packages)/ access)
61 --rpmtest Build RPM like "rpm" but w/o gpg/pgp signing
62 --deb Build DEB packages locally
63 --debtest Build DEB like "deb" but w/o gpg/pgp signing
64 --dist Prepare all build files but do not run the final "./configure"
65 --copy Behave exactly like in default mode but copy all instead of symlinks
66 --clean Standard cleanup method
67 --fullclean Like clean but even the .cvsignore files are removed
68 -h|--help Print this help message.
69 '.($Options{"help"} || "");
72 sub checkcommandversion
74 my($class,$command,$version)=@_;
77 do { open F,$_ or confess "Open $_: $!"; } for ("$command --version|");
82 my $command_version=($command_out=~m#([\d.]+)#)[0];
83 confess "$command(1) version not found in its output" if !$command_version;
84 confess "'$command' version $version or higher required"
85 # Do not take 3rd+ numbers as it would not be a number
86 if ($command_version=~/^(\d+[.]\d+)/)[0]<$version;
95 open F,$filename or confess "Open \"$filename\": $!";
97 close F or confess "Close \"$filename\": $!"; # Do not &cluck as it may be pipe result
103 my($filename,@content)=@_;
106 open F,($filename=~/^[|]/ ? "" : ">").$filename or confess "rewrite \"$filename\": $!";
108 close F or confess "close \"$filename\": $!"; # Do not &cluck as it may be pipe result
118 my $nameref=\$_rpmeval_cache{$name};
119 $$nameref=_readfile('rpm --eval %'.$name.'|') if !defined $$nameref;
123 return @r if wantarray();
124 confess "Scalar return for ".scalar(@r)." values" if 1!=@r;
132 confess $cmd.": $code=".join(",",
133 (!WIFEXITED($code) ? () : ("EXITSTATUS(".WEXITSTATUS($code).")")),
134 (!WIFSIGNALED($code) ? () : ("TERMSIG(" .WTERMSIG($code) .")")),
135 (!WIFSTOPPED($code) ? () : ("STOPSIG(" .WSTOPSIG($code) .")")),
143 my $rc_sub=pop @args if ref $args[$#args];
144 $rc_sub||=sub { $_[0]==0; };
145 my $rc=system(@args);
146 _system_error $?,join(" ",@args) if !WIFEXITED($?) || !&{$rc_sub}(WEXITSTATUS($?));
149 # Assumed wildcard pattern expansion to exactly one item if !$nocheck
154 my $nocheck=shift @files if $files[0] eq "nocheck";
155 my $flag=shift @files if ref $files[0];
157 # expand pattern to properly match © resulting filenames count
158 @files=map({ glob $_; } @files);
159 @files==copy((!$flag ? () : $flag),@files,$dest) or $nocheck or confess "$!";
162 # Assumed wildcard pattern expansion to exactly one item if !$nocheck
167 my $nocheck=shift @files if $files[0] eq "nocheck";
168 my $flag=shift @files if ref $files[0];
169 # expand pattern to properly match &remove resulting filenames count
170 @files=map({ glob $_; } @files);
171 @files==remove((!$flag ? () : $flag),@files) or $nocheck or confess "$!";
174 # FIXME: File::NCopy exists but File::NMove doesn't
189 mkdir $_ or confess "$!";
197 my($specsrc)=map((-e $_ ? $_ : "$name.spec.in"),"$name.spec.m4.in");
198 my $spec=_readfile $specsrc;
200 my $configure_args=($spec=~/^[%]configure\b[ \t]*(.*)$/m)[0];
201 $configure_args=~s/--disable-gtk-doc\b/--enable-gtk-doc/g; # optional; gtk-doc reqd for 'make dist'
202 $class->run(%Options,
203 "ARGV"=>[qw(--copy)],
204 "configure_args"=>[split /\s+/,$configure_args],
206 _remove "nocheck",($Options{"ChangeLog"} || "ChangeLog"); # force its rebuild by Makefile/rcs2log
216 my $name=$Options{"name"};
217 _remove "nocheck",\1,
218 _rpmeval("_tmppath" )."/$name-*-root",
219 _rpmeval("_builddir")."/$name-*";
220 $class->_prepdist($name);
221 _system "make $name.spec";
222 my $spec=_readfile "$name.spec";
223 my $patch=($spec=~/^Patch\d*\s*:\s*(.*)$/m)[0];
226 _copy "$name-*.tar.gz",_rpmeval("_sourcedir");
230 for my $glob ("orig-$name-*.tar.{gz,Z,bz2}") {
232 confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs;
234 my($origbase,$ext)=($origs[0]=~/^orig-(.*)[.]tar[.](gz|Z|bz2)$/);
235 _copy $origs[0],_rpmeval("_sourcedir")."/".($origs[0]=~/^orig-(.*)$/)[0];
236 _system "tar x".($ext eq "bz2" ? "j" : "z")."f ".$origs[0];
237 _mkdir $origbase."-orig";
238 # FIXME: Copy also dot-prefixed files!
239 _move \1,$origbase."/*",$origbase."-orig/";
240 rmdir $origbase or confess "rmdir $origbase: $!";
242 for my $glob ("$name-*.tar.gz") {
244 confess "Invalid glob $glob: ".join(",",@ours) if 1!=@ours;
246 my($ourbase)=($ours[0]=~/^(.*)[.]tar[.]gz$/);
247 _system "tar xzf ".$ours[0];
248 # Use single-argument system() as we need shell redirection.
249 # FIXME: Use directory-independent _cleanfiles(), not root-directory '.cvsignore'.
250 # "-X -" does not work, it needs to be stat(2)able file.
251 _system "diff -ruP -X .cvsignore -I '".'[$]\(Id\|RCSfile\)\>.*[$]'."'"
252 ." $origbase-orig/ $ourbase/"
253 ." >"._rpmeval("_sourcedir")."/".$patch,
254 sub { $_[0]==0 || $_[0]==1; }; # diff(1) returns non-zero return code on any diffs.
255 _remove \1,$ourbase,$origbase."-orig";
257 _system(join(" ","rpmbuild",
259 "--rmsource", # _remove _rpmeval("_sourcedir")."/$name-*.tar.gz";
260 "--clean", # _remove _rpmeval("_builddir")."/$name-VERSION";
261 (!$args{"sign"} ? () : "--sign"),
264 _system "make dist-tarZ" if $Options{"dist-tarZ"};
265 _move _rpmeval("_srcrpmdir")."/$name-*.src.rpm",".";
266 _move _rpmeval("_rpmdir")."/"._rpmeval("_target_cpu")."/$name-*."._rpmeval("_target_cpu").".rpm",".";
267 _system "ls -l $name-*";
268 exit 0; # should never return
278 my $name=$Options{"name"};
279 $class->_prepdist($name);
280 _system "make distdir";
281 # Copy 'orig' archive after &_prepdist which would delete it.
284 for my $glob ("orig-$name-*.tar.{gz,Z,bz2}") {
287 confess "Invalid glob $glob: ".join(",",@origs) if 1!=@origs;
288 $origs[0]=~/^orig-([^-]+)-(.*)([.]tar[.][^.]+)$/;
289 my $deborig="$1_$2.orig$3";
291 _copy $origs[0],$deborig;
295 for my $glob ("$name-*") {
297 confess "Invalid glob $glob: ".join(",",@subdirs) if 1!=@subdirs;
299 rename $subdirs[0],$base or confess "$!";
300 _system(join(" ","cd ".$base.";dpkg-buildpackage",
302 ($args{"sign"} ? () : ("-us","-uc")),
305 _system "ls -l ${name}*_[0-9]*";
306 exit 0; # should never return
309 # WARNING: doesn't respect %Options change!
310 my @_cleanfiles_cache;
313 # maintainer-clean hack is not safe, please list all files for 'rm'.
314 # When the filename doesn't contain '/', it is applied to ALL directories.
315 # Please note that files exactly in root dir MUST have ./ in the front
316 # (to not to be considered as ALL-directories files).
318 if (!@_cleanfiles_cache) {
319 @_cleanfiles_cache=map({
320 local $_=$_; # Prevent: Modification of a read-only value attempted
321 s/\Q<name>\E/$Options{"name"}/ego;
323 # "*xyzzy" basename -> "*xyzzy",".*xyzzy" for proper cleaning
324 (!m#^((?:.*/)?)([*][^/]*)$# ? ($_) : ("$1$2","$1.$2"));
327 ".#*", # Possible attempt to put comments in qw() list
335 *.[oa] *.l[oa] *.l[oa]T
340 ./configure ./configure.scan
341 ./config.guess ./config.status ./config.sub ./config.log ./config.cache
342 ./config.h ./config.h.in
343 ./confdefs.h ./conftest* ./autoh[0-9]* ./confcache
347 ./stamp-h ./stamp-h.in ./stamp-h1
350 ./autom4te.cache ./autom4te-*.cache
354 ./libtool ./ltconfig ./ltmain.sh
356 ./<name>-[0-9]* ./<name>-*-[0-9]*
357 ./<name>.spec ./<name>.m4 ./<name>.spec.m4
358 ./debian/tmp ./debian/<name>
362 ./po/Makefile.in.in ./po/POTFILES* ./po/cat-id-tbl.c ./po/cat-id-tbl.tmp
363 ./po/*.gmo ./po/*.mo ./po/stamp-cat-id ./po/<name>.pot ./po/ChangeLog
364 ./po/Makevars ./po/Makevars.template ./po/Rules-quot ./po/*.sed ./po/*.sin ./po/*.header
366 map(("./$_"),($Options{"ChangeLog"} || "ChangeLog")),
367 map((!$_ ? () : do { my $dir=$_; map("$dir/$_",qw(
382 )); }),$Options{"gtk-doc-dir"}),
383 map((!$_ ? () : do { my $dir=$_; map("$dir/$_",qw(
389 )); }),$Options{"docbook-lite-dir"}),
390 map((!$_ ? () : @$_),$Options{"clean"}),
393 for (@_cleanfiles_cache) {
394 confess "dir-specific 'clean'-pattern must start with './': $_" if m#^(?!\Q./\E).*/#;
397 return @_cleanfiles_cache;
400 sub _cleanfilesfordir
405 if (m#^\Q$dir\E/([^/]+)$#) { # this-dir: "./this-dir/file-name.c"
408 elsif (m#^[^/]+$#) { # all-dirs: "file-name.c"; the same as "./*/file-name.c"
411 elsif (do { # all-subdirs: "./parent-of-this-dir/*/file-name.c"
413 ($_=$1) && $dir=~m#^\Q$`\E(?:/|$)#;
428 my @todo=(@startdirs);
429 while (defined(my $dir=shift @todo)) {
431 my $entries_filename="$dir/CVS/Entries";
432 open ENTRIES,$entries_filename or (cluck "open \"$entries_filename\": $!" and next);
439 next if !m#^D/([^/]+)/#;
442 close ENTRIES or cluck "close \"$entries_filename\": $!";
443 if (-e (my $entries_log_filename=$dir."/CVS/Entries.Log")) {
445 if (open ENTRIES_LOG,$entries_log_filename or cluck "open \"$entries_log_filename\": $!") {
447 while (<ENTRIES_LOG>) {
449 if (m#^A D/([^/]*)/#) {
452 elsif (m#^R D/([^/]*)/#) {
456 cluck "$entries_log_filename: Unrecognized line $.: $_";
459 close ENTRIES_LOG or cluck "close \"$entries_log_filename\": $!";
462 push @todo,map(("$dir/$_"),keys(%local));
471 return $patt if $patt!~/\Q[\E(.*?)\Q]\E/;
472 my($pre,$range,$post)=($`,$1,$'); # FIXME: local($`,$1,$') doesn't work - why?
473 1 while $range=~s#(.)-(.)# join("",map(chr,(ord($1)..ord($2))));
475 return map({ _expandclass("$pre$_$post"); } split("",$range));
480 my($class,%options)=@_;
482 local %Options=%options;
483 do { require $_ if -e; } for (home()."/.".$Options{"name"}.".autogen.pl");
484 do { $$_=1 if !defined($$_) && fgrep { /^\s*AUTOMAKE_OPTIONS\s*=[^#]*\bdist-tarZ\b/m; } "Makefile.am"; }
485 for (\$Options{"dist-tarZ"});
486 Getopt::Long::Configure('noignorecase','prefix_pattern=(--|-|\+|)');
487 local @ARGV=@{$Options{"ARGV"}};
488 print _help() and confess if !GetOptions(
489 "rpm" ,sub { $class->_rpmbuild("sign"=>1); },
490 "rpmtest" ,sub { $class->_rpmbuild("sign"=>0); },
491 "deb" ,sub { $class->_debbuild("sign"=>1); },
492 "debtest" ,sub { $class->_debbuild("sign"=>0); },
493 "cleanfilesfordir=s",sub { print "$_\n" for (_cleanfilesfordir $_[1]); exit 0; },
494 "dist" ,\$Options{"ARGV_dist"},
495 "copy!" ,\$Options{"ARGV_copy"},
496 "clean" ,\$Options{"ARGV_clean"},
497 "fullclean",\$Options{"ARGV_fullclean"},
498 "h|help" ,sub { print _help(); exit 0; },
499 $Options{"GetOptions_args"},
502 for my $subdir (map((!$_ ? () : @$_),$Options{"subdirs"})) {
504 _system "./autogen.pl",@{$Options{"ARGV"}},"--dist"; # use "--dist" just as fallback!
507 for my $dir (_cvsdirs(".")) {
508 my @cleanfilesfordir=_cleanfilesfordir $dir;
509 _writefile $dir."/.cvsignore",map("$_\n",@cleanfilesfordir) if !$Options{"ARGV_fullclean"};
510 _remove "nocheck",\1,map({ _expandclass("$dir/$_"); } grep({
511 $Options{"ARGV_fullclean"} or $_ ne ".cvsignore";
512 } @cleanfilesfordir));
514 return if $Options{"ARGV_clean"} || $Options{"ARGV_fullclean"};
516 $Options{"aclocal_args"}=[qw(-I macros),map((!$_ ? () : @$_),$Options{"aclocal_args"})];
518 do { $configure_name||=$_ if -f $_ } for ("configure.in");
519 do { $configure_name||=$_ if -f $_ } for ("configure.ac");
520 $configure_name or confess "Cannot find configure.{in,ac}";
521 my $configure_in=_readfile($configure_name);
522 do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_GNU_GETTEXT\b/m; }
523 for (\$Options{"want-gettextize"});
524 do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_GLIB_GNU_GETTEXT\b/m; }
525 for (\$Options{"want-glib-gettextize"});
526 do { $$_=1 if !defined($$_) && $configure_in=~/^\s*AM_PROG_LIBTOOL\b/m; }
527 for (\$Options{"want-libtoolize"});
528 do { $$_=1 if !defined($$_) && $configure_in=~/^\s*A[CM]_CONFIG_HEADER\b/m; }
529 for (\$Options{"want-autoheader"});
530 my @copy_arg=(!$Options{"ARGV_copy"} ? () : "--copy");
532 do { &$_ if $_; } for ($Options{"prep"});
533 touch "po/POTFILES.in" if -d "po";
534 if ($Options{"want-gettextize"}) {
535 # don't use multi-arg system() here as it would reject "</dev/null" redirection etc.
537 .'spawn gettextize --intl --no-changelog '.join(" ",@copy_arg).';'
538 .'expect -timeout -1 "Press Return to acknowledge" {send "\r";exp_continue;} eof;'
540 _system $_ and confess $_;
542 for ($configure_name,"Makefile.am") {
543 STDERR->printflush("gettextize recovery rename \"$_~\"->\"$_\"... ");
544 rename "$_~","$_" or confess "$!";
545 STDERR->printflush("ok\n");
547 if (!-e "po/Makevars") {
548 my $Makevars_template="po/Makevars.template";
549 my $makevars=_readfile $Makevars_template;
550 $makevars=~s/^(COPYRIGHT_HOLDER)\b.*$/"$1=".$Options{"COPYRIGHT_HOLDER"}/meg
551 or confess "COPYRIGHT_HOLDER not found in $Makevars_template";
552 _writefile "po/Makevars",$makevars;
554 # Prevent updating of contents during touch of any source file;
555 # change the .po contents only when some data get updated
556 for my $Makefile_in_in ("po/Makefile.in.in") {
557 my $file=_readfile $Makefile_in_in;
558 $file=~s%(\$\Q(MSGMERGE_UPDATE)\E) (\$\$\Q{lang}.po \E\$\Q(DOMAIN).pot\E)$%
559 $1.q< --backup=simple --suffix="~" >.$2.q<;>
560 .q< if test `diff -u $${lang}.po~ $${lang}.po>
562 .q< -e '1,/^@@.*@@$$/d'>
563 .q< -e '/^[+-]"POT-Creation-Date:/d'>
566 .q< | wc -l` -eq 0;then>
567 .q< touch --reference=$${lang}.po $${lang}.po~;>
568 .q< mv -f $${lang}.po~ $${lang}.po;>
570 .q< rm -f $${lang}.po~;>
573 unlink $Makefile_in_in or confess "$!";
574 _writefile $Makefile_in_in,$file;
577 if ($Options{"want-glib-gettextize"}) {
578 _system "glib-gettextize",@copy_arg;
579 # "po/ChangeLog" is somehow missing at this point
580 File::Touch->new("atime_only"=>1)->touch("po/ChangeLog");
582 _system "aclocal",map((!$_ ? () : @$_),$Options{"aclocal_args"});
583 _system qw(libtoolize),@copy_arg if $Options{"want-libtoolize"};
584 _system qw(autoheader) if $Options{"want-autoheader"};
585 # "ChangeLog" is reqd by automake(1)
586 # Don't remove it afterwards as it may still be needed during automatic automake Makefile rebuilds
587 File::Touch->new("atime_only"=>1)->touch("ChangeLog") if !$Options{"ChangeLog"};
588 _system qw(automake --add-missing),@copy_arg;
589 _system qw(autoconf);
590 _writefile "| patch configure",<<'CONFIGURE_SUBST_X_EOF';
591 --- configure-orig Wed Aug 20 12:10:37 2003
592 +++ configure Wed Aug 20 13:22:51 2003
593 @@ -21590,6 +21590,11 @@
595 if test x"$ac_file" != x-; then
597 + for f in $ac_file_inputs; do
598 + if test -x $f; then
605 CONFIGURE_SUBST_X_EOF
606 _remove "nocheck","./configure.orig"; # It is usually produced by 'CONFIGURE_SUBST_X'.
607 # Why it is left there after RedHat autoconf-2.53-8 ?
608 _remove "nocheck",\1,"autom4te-*.cache";
610 return if $Options{"ARGV_dist"};
612 # 'configure' defaults to CFLAGS '-g -O2' but our --enable-maintainer-mode
613 # should force '-ggdb3'
615 # shared/static switching cannot be based on maintainer-mode in configure
616 _system(qw(./configure --enable-maintainer-mode),
617 (!$Options{"want-libtoolize"} ? () : qw(--enable-shared --disable-static)),
618 map((!$_ ? () : @$_),$Options{"configure_args"}),
627 AutoGen - autoautotools aware of CVS and rpm/deb
635 "name"=>"fooproject",
636 "COPYRIGHT_HOLDER"=>'Joe <joe@com>',
643 Projects usually have their B<autogen.sh> script files to run B<autoconf>(1),
644 B<automake>(1) and similiar tools. This project has some additional features:
650 Clean the checkout directory without B<Makefile>s for 'make clean'.
654 Maintain B<.cvsignore> files containing the files being cleaned.
658 Single-command package building of B<.rpm>/B<.deb> out of CVS checkout.
662 Supports: B<gettext>, B<glib-gettext>, B<libtool>, B<autoconf>, B<automake>.
669 B<AutoGen> module itself parses its command-line arguments from B<"ARGV"> field
670 of the hash passed to B<&AutoGen->run>. Its initial double-dash ('B<-->')
671 prefixes can be omitted.
673 B<AutoGen> will build the sources for development purposes in the current
674 directory if no other packaging options were given.
680 Build B<.rpm> packages. Either you need access to directory B</usr/src/redhat/>
681 (or B</usr/src/packages/> etc.) or you should set B<%_usrsrc> (default
682 B</usr/src/>) elsewhere in your B<$HOME/.rpmmacros>:
683 %_usrsrc /home/joe/src
685 As the resulting package will be digitally signed you should also set signing
686 properties in your B<$HOME/.rpmmacros>:
688 %_gpg_name Joe <joe@com>
692 The same as B<--rpm> but the resulting package will not be I<GnuPG> digitally
693 signed. I<GnuPG> passphrase is requested in the middle of package building
694 which would be very discomfortable during project development.
698 Build B<.deb> packages.
702 The same as B<--deb> but the resulting package will not be I<GnuPG> digitally
703 signed. I<GnuPG> passphrase is requested in the middle of package building
704 which would be very discomfortable during project development.
708 Prepare all build files but do not run the final B<./configure>. The resulting
709 directory is similiar to the one produced by B<make dist> but DO NOT
714 Some distribution files are created just as symlinks to the system ones by
715 default. This option forces their copy such as B<make dist> does.
719 Clean all files not belonging to the CVS repository. You SHOULD backup your
720 directory first during B<AutoGen> bootstrap. Only B<.cvsignore> files are
721 left in our directory tree.
725 Similiar to B<--clean> option but even B<.cvsignore> files get deleted.
729 Print short help message describing these I<OPTIONS>.
736 B<&AutoGen->run> method is passed configuration hash by your B<autogen.pl>.
743 Project basename - it should contain no special characters.
748 Pass here B<\@ARGV> from the user.
753 Array specifying files to be cleaned during B<./autogen.pl clean> and put into
754 B<.cvsignore> files. You still should add these entries also to B<CLEANFILES>,
755 B<DISTCLEANFILES> or B<MAINTAINERCLEANFILES> variables of B<Makefile.am>s.
757 There are several formats of B<clean> field possible entries:
761 =item B<./path/to/file.c>
763 Full project-basedir relative path to the deleted file. Rule applies only to
764 the one specified directory. Although B<path/to/file.c> would be also possible
765 it is not recommended to have unified format with B<./only_basedir.c> entries
766 to delete file just in the root directory (as B<only_basedir.c> would delete
767 it in ALL subdirectories incl. the root one).
771 Delete B<basename_generated.c> found in any subdirectory of the project.
772 It has the same effect as B<./*/basename_generated.c> entry.
774 =item B<./subdir/*/name.c>
776 Delete B<name.c> in B<./subdir> and all of its subdirector descendants.
777 Entry B<subdir/*/name.c> would have the same effect.
784 B<CODE> reference run to prepare the sources being built in the current
785 directory (if no packaging options given). Check for needed B<autotools>
786 versions required to build B<configure> script by
787 B<AutoGen->checkcommandversion>. Other version checks belong to B<configure.ac>
790 Referenced B<CODE> must return true value.
795 Alternative name of B<ChangeLog>, defaults to "B<ChangeLog>". You should define
796 alternative name if patching existing package with its own B<ChangeLog>.
801 Optional directory name where B<gtkdocize>(1) generated files reside.
811 =item B<AutoGen->checkcommandversion>(B<$command>,B<$minimal_version>)
813 Functions runs B<$command --version> and checks the resulting version number
814 against given B<$minimal_version>. Currently only the first 2 version numbers
821 =head1 PATCHED PACKAGES
823 This section applies to projects where you patch foreign existing packages.
829 Use the following alternate B<autogen.pl> prolog if your branch does not belong
830 to the B<MAIN> CVS branch:
832 # 'macros' could got checked out empty by our '-r captive' tag.
833 if (!-f "./macros/AutoGen.pm") {
834 do { system $_ and die "$_: $!"; } for ("cvs co -A macros");
842 Put B<fooproject-1.2.3.tar.gz> archive to the project root directory
843 as B<orig-fooproject-1.2.3.tar.gz>.
847 Set B<$VERSION> in B<configure.ac> file with you vendor prefix such as
848 B<1.2.3joe1>. Set B<$VERSION_BASE> to B<1.2.3> and B<$VERSION_EXT> to B<joe1>.
849 B<AC_SUBST>() them both.
851 =item B<.spec> file changes
857 Change B<Version: @VERSION@> to B<Version: @VERSION_BASE@>.
861 Change (expected) line B<Release: 1> to B<Release: 1@VERSION_EXT@>.
865 Change B<Source: ...@VERSION@.tar.gz> to B<Source: ...@VERSION_BASE@.tar.gz>.
869 Add line B<Patch1: @PACKAGE@-@VERSION_BASE@-@VERSION_EXT@.patch>.
870 This patch file name is not mandatory.
874 Remember to call B<autotools> commands manually in the B<%build>
875 section if their source files were modified in your vendor branch.
879 =item B<debian>-specific changes
885 Include both B<debian/changelog.in> and B<debian/changelog> to B<Makefile.am>.
889 Use B<@VERSION_BASE@> in B<debian/changelog.in>.
897 Jan Kratochvil <B<project-macros@jankratochvil.net>>,
898 I<http://www.jankratochvil.net/>