IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 20, 2007, 11:50:12 AM (19 years ago)
Author:
eugene
Message:

adding perl install script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psconfig/ckperlmods

    r11938 r11940  
    11#!/usr/bin/env perl
    22
     3$version = "";
     4$check = 0;
     5@tARGV = ();
     6for (; @ARGV > 0; ) {
     7    if ($ARGV[0] eq "-version") {
     8        $version = $ARGV[1];
     9        shift; shift; next;
     10    }
     11    if ($ARGV[0] eq "-check") {
     12        $check = 1;
     13        shift; next;
     14    }
     15    if ($ARGV[0] eq "-h")     { &usage (); }
     16    if ($ARGV[0] eq "-help")  { &usage (); }
     17    if ($ARGV[0] eq "--help") { &usage (); }
     18    @tARGV = (@tARGV, $ARGV[0]);
     19    shift;
     20}
     21@ARGV = @tARGV;
     22if ( @ARGV != 0) { &usage (); }
     23
     24# load the perl module list
    325$file = "tagsets/ipp-extperl.dst";
    4 
    526open (FILE, $file) || die "ERROR: can't open perl module list: $file\n";
    627@list = <FILE>;
     
    1536}
    1637
    17 $prefix = `csh psconfig.sh --prefix $version`;
    18 $perl5lib = `csh psconfig.sh --perl5lib $version`;
    19 $homedir = `pwd`;
     38print "version: $version\n";
     39
     40$prefix = `csh -f psconfig.sh --prefix $version`; chomp $prefix;
     41$perl5lib = `csh -f psconfig.sh --perl5lib $version`; chomp $perl5lib;
     42$homedir = `pwd`; chomp $homedir;
     43
     44print "prefix: $prefix\n";
    2045
    2146foreach $line (@list) {
     
    2449    if ($line =~ m|^\s*\#|) { next; }
    2550
    26     ($N, $module, $tarball) = split (" ", $line);
     51    ($N, $module, $tarball, $prompts) = split (" ", $line);
    2752   
    2853    if (eval "use $module; 1") {
     
    3156    }
    3257
    33     # print "$module: missing\n";
     58    print "$module: missing\n";
     59    if ($check) { next; }
     60
    3461    # try to build the module from ../../extperl/Module.*.tar.gz
    3562    chdir "../../extperl";
    3663
    3764    print "extract $module from $tarball\n";
    38     system ("tar xvzf $tarball");
     65    vsystem ("tar xvzf $tarball");
    3966   
    4067    ($tardir) = $tarball =~ m|(\S*).tar.gz|;
     
    4269
    4370    chdir $tardir;
    44     # system ("perl Makefile.PL LIB=$perl5lib");
    45     system ("perl Makefile.PL PREFIX=$prefix");
    46     system ("make");
    47     system ("make install");
    4871
    49     # system ("ls $tarball");
     72    # vsystem ("perl Makefile.PL LIB=$perl5lib");
     73    if ($prompts) {
     74        @answers = split (",", $prompts);
     75        open (PIPE, "|perl Makefile.PL PREFIX=$prefix LIB=$perl5lib");
     76        foreach $answer (@answers) {
     77            print PIPE "$answer\n";
     78        }
     79        close (PIPE);
     80    } else {
     81        vsystem ("perl Makefile.PL PREFIX=$prefix LIB=$perl5lib");
     82    }
     83   
     84    vsystem ("make < /dev/null");
     85    vsystem ("make install");
    5086
    5187    chdir $homedir;
    5288}
     89
     90sub usage {
     91    print STDERR "USAGE: ckperlmods [-version] [-check]\n";
     92    exit 2;
     93}
     94
     95sub vsystem {
     96    print STDERR "@_\n";
     97    $status = system ("@_");
     98    $status;
     99}
Note: See TracChangeset for help on using the changeset viewer.