home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / make_ppm.bat < prev    next >
Encoding:
DOS Batch File  |  2004-01-10  |  9.7 KB  |  311 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S %0 %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
  11. goto endofperl
  12. @rem ';
  13. #!/usr/bin/perl
  14. #line 15
  15.  
  16. use strict;
  17. # use warnings;
  18. use Getopt::Long qw(:config no_ignore_case auto_version auto_help);
  19. use PPM::Make;
  20. use Pod::Usage;
  21. $main::VERSION = $PPM::Make::VERSION;
  22. my %opts = ();
  23. my @files = ();
  24. my %progs = ();
  25. GetOptions(\%opts,
  26.            'zip|z',
  27.            'force|f',
  28.            'ignore|i',
  29.            'cpan',
  30.            'no_cfg',
  31.            'no_case',
  32.            'binary|b:s',
  33.            'arch_sub|n',
  34.            'script|s:s',
  35.            'exec|e:s',
  36.            'os|o:s',
  37.            'arch|a:s',
  38.            'remove|r',
  39.            'as|A!',
  40.            'vs|V',
  41.            'vsr',
  42.            'vsp',
  43.            'add|x:s' => \@files,
  44.            'program|p:s' => \%progs,
  45.            'ppd:s',
  46.            'ar:s',
  47.            'host:s',
  48.            'user:s',
  49.            'passwd:s',
  50.           ) or pod2usage(2);
  51.  
  52. my $dist = shift;
  53. my %upload = ();
  54.  
  55. for (qw(binary script exec add program ppd ar host user passwd)) {
  56.   die "Please supply an argument to '$_'"
  57.      if ( defined $opts{$_} and $opts{$_} eq "");
  58. }
  59.  
  60. for (qw(ppd ar host user passwd)) {
  61.   $upload{$_} = delete $opts{$_};
  62. }
  63. $opts{upload} = \%upload if defined $upload{ppd};
  64. $opts{dist} = $dist if $dist;
  65.  
  66. my $ppm = PPM::Make->new(%opts);
  67. $ppm->make_ppm();
  68.  
  69. __END__
  70.  
  71. =head1 NAME
  72.  
  73. make_ppm - make a PPM distribution
  74.  
  75. =head1 SYNOPSIS
  76.  
  77.    make_ppm [options] [Module | Distribution]
  78.  
  79. Options:
  80.  
  81.  [-z | --zip]              : make a zip distribution
  82.  [-f | --force]            : force remaking a distribution
  83.  [-i | --ignore]           : ignore any failing test results
  84.  [-b | --binary] location  : specify the binary location
  85.  [-n | --arch_sub]         : use \$Config{archname} as a subdirectory
  86.  [-s | --script] script    : specify a script in the <INSTALL> field
  87.  [-x | --add] file         : add specified extra files to the archive
  88.  [-e | --exec] exec        : specify the executable to run the <INSTALL> script
  89.  [-x | --add] file         : add file to the archive
  90.  [-o | --os] os            : use os for the <OS> field
  91.  [-a | --arch] arch        : use arch for the <ARCHITECTURE> field
  92.  [-v | --version]          : print version information and exit
  93.  [-h | --help]             : print this help screen
  94.  [-r | --remove]           : remove the build directory after installation
  95.  [-p | --program]  b=a     : specify "a" to be used for the "b" program
  96.  [-A | --as]               : add Perl version number to ARCHITECTURE (>= 5.8)
  97.  [-V | --ppmv]             : add version string to ppd and archive filenames
  98.  [ --ppd ]  location       : copy the ppd to the specified location
  99.  [ --ar ]   location       : copy the archive file to the specified location
  100.  [ --host]  host           : use the specified host for copying the ppm files
  101.  [ --user]  user           : username to use when transferring ppm files
  102.  [ --passwd] password      : password associated with user
  103.  [ --cpan ]                : make a CPAN distribution
  104.  [ --no_case ]             : for module searches, ignore case
  105.  [ --no_cfg ]              : do not read a .ppmcfg configuration file
  106.  [ --vsr]                  : add version string to the archive filename
  107.  [ --vsp]                  : add version string to the ppd filename
  108.  
  109. Additional Arguments:
  110.  
  111.    Module       : specify a module to fetch (requires CPAN.pm)
  112.    Distribution : specify a distribution to fetch
  113.  
  114. With no arguments, make_ppm will build a distribution
  115. inside the current directory. 
  116.  
  117. =head1 DESCRIPTION
  118.  
  119. C<make_ppm> is an interface to the C<PPM::Make> module,
  120. and is used to build a PPM (Perl Package Manager) distribution
  121. from a CPAN source distribution. See L<PPM::Make> for a
  122. discussion.
  123.  
  124. Apart from the options described below, without any arguments 
  125. C<make_ppm> will assume it is inside an unpacked source
  126. distribution and make the corresponding PPM distribution.
  127. If it is given an argument of what looks like a module
  128. name (eg, I<Net::FTP>), it will use C<CPAN.pm> to look up the 
  129. corresponding distribution and fetch and build it. Otherwise, 
  130. additional arguments (eg, F<package.tar.gz>, or
  131. I<http://someplace.org/package.tar.gz>) will be interpreted
  132. as distributions to fetch and build.
  133.  
  134. Options can be read from a configuration file
  135. (see L<PPM::Make>) and/or given as options to I<make_ppm>,
  136. unless the I<no_cfg> option is given.
  137. In case of duplicates, the options to I<make_ppm> take
  138. precedence. Available options include:
  139.  
  140. =over
  141.  
  142. =item [-z | --zip]
  143.  
  144. By default, C<make_ppm> will build a C<.tar.gz> distribution
  145. if possible. This option forces a C<.zip> distribution to be made.
  146.  
  147. =item [-f | --force]
  148.  
  149. By default, if C<make_ppm> detects a F<blib/> directory,
  150. it will assume the distribution has already been made, and
  151. will not remake it. This option forces remaking the distribution.
  152.  
  153. =item [-i | --ignore]
  154.  
  155. By default, C<make_ppm>, if it is building the distribution,
  156. will die if all tests do not pass. Turning on this option
  157. instructs C<make_ppm> to ignore any test failures.
  158.  
  159. =item [-b | --binary] location
  160.  
  161. I<location> is used as the value for the C<BINARY_LOCATION>
  162. attribute passed to C<perl Makefile.PL>, and is used in
  163. setting the I<HREF> attribute of the I<CODEBASE> field
  164. in the ppd file.
  165.  
  166. =item [-n | --arch_sub]
  167.  
  168. This option will insert the value of C<$Config{archname}>
  169. (or the value of the I<-a> option, if given)
  170. as a relative subdirectory in the I<HREF> attribute of the 
  171. I<CODEBASE> field in the ppd file.
  172.  
  173. =item  [-o | --os] os
  174.  
  175. If this option is specified, the value, if present, will be used 
  176. instead of the default for the I<NAME> attribute of the I<OS> field 
  177. of the ppd file. If no value is supplied, the I<OS> field will not 
  178. be included in the ppd file.
  179.  
  180. =item [-a | --arch] arch
  181.  
  182. If this option is specified, the value, if present, will be used instead 
  183. of the default for the I<NAME> attribute of the I<ARCHITECTURE> field of 
  184. the ppd file. If no value is specified, the  I<ARCHITECTURE> field 
  185. will not be included in the ppd file.
  186.  
  187. =item  [-s | --script] script
  188.  
  189. This will be used in the I<PPM_INSTALL_SCRIPT>
  190. attribute passed to C<perl Makefile.PL>, and arises in
  191. setting the value of the I<INSTALL> field in the ppd file.
  192. If this begins with I<http://> or I<ftp://>, so that the
  193. script is assumed external, this will be
  194. used as the I<HREF> attribute for I<INSTALL>.
  195.  
  196. =item [-e | -- exec] exec
  197.  
  198. This will be used in the I<PPM_INSTALL_EXEC>
  199. attribute passed to C<perl Makefile.PL>, and arises in
  200. setting the I<EXEC> attribute of the I<INSTALL> field
  201. in the ppd file.
  202.  
  203. =item  [-x | --add] file
  204.  
  205. This option, which can be specified multiple times, can
  206. be used to add additional files outside of the the F<blib>
  207. directory to the archive.
  208.  
  209. =item [-r | --remove]
  210.  
  211. If specified, the directory used to build the ppm distribution
  212. given on the command line will be removed after a successful install.
  213.  
  214. =item [-p | --prog] program=/path/to/program
  215.  
  216. This option specifies that C</path/to/program> should be used
  217. for C<program>, rather than the one PPM::Make finds. This option
  218. can be specified multiple times, with
  219. C<program> being one of C<tar>, C<gzip>, C<zip>, C<unzip>, or C<make>.
  220.  
  221. =item ppd $path_to_ppd_files
  222.  
  223. If given, this will copy the ppd file to the location specified,
  224. and must be given as an absolute pathname. If I<host> is specified,
  225. this copy will be done via ftp, otherwise a local copy is made.
  226.  
  227. =item ar $path_to_archive_files
  228.  
  229. This is the location where the archive file should be placed.
  230. This may either be an absolute pathname or a relative one,
  231. in which case it is interpreted to be relative to that
  232. specified by I<ppd>. If this is not given, but I<ppd>
  233. is specified, this will default to the value of I<ppd>.
  234.  
  235. =item host $hostname
  236.  
  237. If specified, an ftp transfer to the specified host is
  238. done, with I<ppd> and I<ar> as described above.
  239.  
  240. =item user $username
  241.  
  242. This specifies the user name to login as when transferring
  243. via ftp.
  244.  
  245. =item passwd $passwd
  246.  
  247. This is the associated password to use for I<user>
  248.  
  249. =item [-A | --as]
  250.  
  251. Beginning with Perl-5.8, Activestate adds the Perl version number to
  252. the NAME of the ARCHITECTURE tag in the ppd file. This option,
  253. which is enabled by default, will make a ppd file compatible with this
  254. practice. Specify C<--noas> to disable this option.
  255.  
  256. =item [-V | --vs]
  257.  
  258. This option will add a version string (based on the VERSION reported
  259. in the ppd file) to the ppd and archive filenames.
  260.  
  261. =item [--vsr]
  262.  
  263. This option, if enabled, will add a version string 
  264. (based on the VERSION reported in the ppd file) to the 
  265. archive filename.
  266.  
  267. =item [--vsp]
  268.  
  269. This option, if enabled, will add a version string 
  270. (based on the VERSION reported in the ppd file) to the 
  271. ppd filename.
  272.  
  273. =item [--cpan]
  274.  
  275. If specified, a distribution will be made using C<make dist>
  276. which will include the I<ppd> and I<archive> file.
  277.  
  278. =item [--no_case]
  279.  
  280. If specified, module searches will be performed in a case-insensitive
  281. manner.
  282.  
  283. =item [--no_cfg]
  284.  
  285. If specified, do not attempt to read a F<.ppmcfg> configuration
  286. file.
  287.  
  288. =item [--help]
  289.  
  290. This prints out a short help screen and exits.
  291.  
  292. =item [--version]
  293.  
  294. This prints out some version information and exits.
  295.  
  296. =back
  297.  
  298. =head1 COPYRIGHT
  299.  
  300. This program is copyright, 2002, by Randy Kobes <randy@theoryx5.uwinnipeg.ca>.
  301. It is distributed under the same terms as Perl itself.
  302.  
  303. =head1 SEE ALSO
  304.  
  305. L<PPM::Make>, and L<PPM>.
  306.  
  307. =cut
  308.  
  309. __END__
  310. :endofperl
  311.