IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18315


Ignore:
Timestamp:
Jun 24, 2008, 3:30:10 PM (18 years ago)
Author:
Paul Price
Message:

Bash script must be u+x in order to source.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psconfig/psbuild

    r17403 r18315  
    1919for (; @ARGV > 0; ) {
    2020    if ($ARGV[0] eq "-version") {
    21         $version = $ARGV[1];
     21        $version = $ARGV[1];
    2222        shift; shift; next;
    2323    }
    2424    if ($ARGV[0] eq "-verbose") {
    25         $verbose = 1;
     25        $verbose = 1;
    2626        shift; next;
    2727    }
    2828    if ($ARGV[0] eq "-extlibs") {
    29         $extlibs = $ARGV[1];
     29        $extlibs = $ARGV[1];
    3030        shift; shift; next;
    3131    }
    3232    if ($ARGV[0] eq "-extperl") {
    33         $extperl = $ARGV[1];
     33        $extperl = $ARGV[1];
    3434        shift; shift; next;
    3535    }
    3636    if ($ARGV[0] eq "-clean") {
    37         $clean = 1;
     37        $clean = 1;
    3838        shift; next;
    3939    }
    4040    if ($ARGV[0] eq "-extcheck") {
    41         $extlibs = "check";
    42         $extperl = "check";
     41        $extlibs = "check";
     42        $extperl = "check";
    4343        shift; next;
    4444    }
    4545    if ($ARGV[0] eq "-extbuild") {
    46         $extlibs = "build";
    47         $extperl = "build";
     46        $extlibs = "build";
     47        $extperl = "build";
    4848        shift; next;
    4949    }
    5050    if ($ARGV[0] eq "-rebuild") {
    51         $rebuild = 1;
     51        $rebuild = 1;
    5252        shift; next;
    5353    }
    5454    if ($ARGV[0] eq "-optimize") {
    55         $optimize = 1;
     55        $optimize = 1;
    5656        shift; next;
    5757    }
    5858    if ($ARGV[0] eq "-dev") {
    59         $developer = 1;
     59        $developer = 1;
    6060        shift; next;
    6161    }
    6262    if ($ARGV[0] eq "-only") {
    63         $start = $ARGV[1];
    64         $stop = $ARGV[1];
     63        $start = $ARGV[1];
     64        $stop = $ARGV[1];
    6565        shift; shift; next;
    6666    }
    6767    if ($ARGV[0] eq "-start") {
    68         $start = $ARGV[1];
     68        $start = $ARGV[1];
    6969        shift; shift; next;
    7070    }
    7171    if ($ARGV[0] eq "-stop") {
    72         $stop = $ARGV[1];
     72        $stop = $ARGV[1];
    7373        shift; shift; next;
    7474    }
    7575    if ($ARGV[0] eq "-list") {
    76         &list_distributions ();
     76        &list_distributions ();
    7777    }
    7878    if ($ARGV[0] eq "-bootstrap") {
    79         &bootstrap ();
     79        &bootstrap ();
    8080    }
    8181    if ($ARGV[0] eq "-env") {
    82         &show_environment ();
     82        &show_environment ();
    8383    }
    8484    if ($ARGV[0] eq "-h")     { &usage (); }
     
    9090@ARGV = @tARGV;
    9191
    92 if ( @ARGV == 0) { 
     92if ( @ARGV == 0) {
    9393    @list = <$tagsets/*.dist>;
    9494    $distribution = $list[-1];
     
    111111
    112112sub show_environment {
    113    
     113
    114114    # use psconfig.csh to set needed build aliases
    115115
    116116    # set the psconfig version:
    117117    if ("$version" eq "") {
    118         $version = $ENV{'PSVERSION'};
     118        $version = $ENV{'PSVERSION'};
    119119    }
    120120    if ("$version" eq "") {
    121         $version = "default";
     121        $version = "default";
    122122    }
    123123
    124124    if (! -e psconfig.csh) {
    125         $psconfdir = $ENV{'PSCONFDIR'};
    126         if ($psconfdir eq "") { die "PSCONFDIR not found, run psbuild -bootstrap and follow instructions\n"; }
    127         vsystem ("cat psconfig.csh.in | sed 's|\@PSCONFDIR@|$psconfdir|' > psconfig.csh");
    128         vsystem ("cat psconfig.bash.in | sed 's|\@PSCONFDIR@|$psconfdir|' > psconfig.bash");
     125        $psconfdir = $ENV{'PSCONFDIR'};
     126        if ($psconfdir eq "") { die "PSCONFDIR not found, run psbuild -bootstrap and follow instructions\n"; }
     127        vsystem ("cat psconfig.csh.in | sed 's|\@PSCONFDIR@|$psconfdir|' > psconfig.csh");
     128        vsystem ("cat psconfig.bash.in | sed 's|\@PSCONFDIR@|$psconfdir|' > psconfig.bash");
    129129    }
    130130
     
    138138
    139139    # set build environment variables
    140     ps_setenv (1, "PATH",                 "--path");
    141     ps_setenv (1, "CPATH",                "--cpath");
    142     ps_setenv (1, "ARCH",                 "--arch");
     140    ps_setenv (1, "PATH",                 "--path");
     141    ps_setenv (1, "CPATH",                "--cpath");
     142    ps_setenv (1, "ARCH",                 "--arch");
    143143    ps_setenv (1, "LIBRARY_PATH",    "--library_path");
    144144    ps_setenv (1, "LD_LIBRARY_PATH", "--ld_library_path");
     
    151151
    152152sub build_distribution {
    153    
     153
    154154    # use psconfig.csh to set needed build aliases
    155155
    156     if ($extlibs eq "check") { 
    157         $status = vsystem ("pschecklibs");
    158         if ($status) { die "failed to find external libraries\n"; }
    159     }
    160     if ($extlibs eq "build") { 
    161         $status = vsystem ("pschecklibs -build");
    162         if ($status) { die "failed to build external libraries\n"; }
    163     }
    164 
    165     if ($extperl eq "check") { 
    166         $status = vsystem ("pschecklperl");
    167         if ($status) { die "failed to find external perl modules\n"; }
    168     }
    169     if ($extperl eq "build") { 
    170         $status = vsystem ("pscheckperl -build");
    171         if ($status) { die "failed to build external perl modules\n"; }
     156    if ($extlibs eq "check") {
     157        $status = vsystem ("pschecklibs");
     158        if ($status) { die "failed to find external libraries\n"; }
     159    }
     160    if ($extlibs eq "build") {
     161        $status = vsystem ("pschecklibs -build");
     162        if ($status) { die "failed to build external libraries\n"; }
     163    }
     164
     165    if ($extperl eq "check") {
     166        $status = vsystem ("pschecklperl");
     167        if ($status) { die "failed to find external perl modules\n"; }
     168    }
     169    if ($extperl eq "build") {
     170        $status = vsystem ("pscheckperl -build");
     171        if ($status) { die "failed to build external perl modules\n"; }
    172172    }
    173173
    174174    # set the psconfig version:
    175175    if ("$version" eq "") {
    176         $version = $ENV{'PSVERSION'};
     176        $version = $ENV{'PSVERSION'};
    177177    }
    178178    if ("$version" eq "") {
    179         $version = "default";
     179        $version = "default";
    180180    }
    181181
     
    189189
    190190    # set build environment variables
    191     ps_setenv (0, "PATH",                 "--path");
    192     ps_setenv (0, "CPATH",                "--cpath");
    193     ps_setenv (0, "ARCH",                 "--arch");
     191    ps_setenv (0, "PATH",                 "--path");
     192    ps_setenv (0, "CPATH",                "--cpath");
     193    ps_setenv (0, "ARCH",                 "--arch");
    194194    ps_setenv (0, "LIBRARY_PATH",    "--library_path");
    195195    ps_setenv (0, "LD_LIBRARY_PATH", "--ld_library_path");
     
    213213    $stop_now = 0;
    214214    for ($i = 0; !$stop_now && ($i < @cvsname); $i++) {
    215         if (($stop ne "") && ($stop eq $cvsname[$i])) { $stop_now = 1; }
    216         if (($start ne "") && ($start ne $cvsname[$i])) { next; }
    217         $start = "";
    218 
    219         ($do_tag, $do_build, $do_package, $do_update, $dev_build) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)(\S)|;
    220         if ($developer) { $do_build = $dev_build; }
    221         if ($do_build eq "N") { next; }
    222 
    223         $workdir = "../$cvsname[$i]";
    224 
    225         # XXX need to grab current value for cleanup
    226         print "\n ** psbuild: $cvsname[$i] ** \n";
    227         print "\033]0; ** psbuild: $cvsname[$i] ** \007";
    228 
    229         if (!-d $workdir || !-r $workdir || !-x $workdir) {
    230             print STDERR "WARNING: no directory for component $cvsname[$i], skipping\n";
    231             next;
    232         }
    233        
    234         chdir $workdir;
    235 
    236         # how do we build this component?
    237         # - autogen.sh : configure : make : make install
    238         # - configure : make : make install
    239         # - make : make install
    240         # - perl Build.PL : ./Build : ./Build install
    241  
    242         if (-e "Build.PL") {
    243             vsystem ("$psperlbuild");
    244             if ($?) { &failure($cvsname[$i], "failure in perl Build.PL"); }
    245 
    246             vsystem ("./Build");
    247             if ($?) { &failure($cvsname[$i], "failure in Build"); }
    248 
    249             vsystem ("./Build install");
    250             if ($?) { &failure($cvsname[$i], "failure in Build install"); }
    251            
    252             next;
    253         }
    254 
    255         if ($rebuild && $clean) {
    256             if (-e "configure") { unlink "Makefile"; }
    257             if ($developer && -e "configure.ac" && -e "autogen.sh") { unlink "configure"; }
    258         }
    259         $rebuild_this = $rebuild;
    260 
    261         # set a local variable for this loop on rebuild;
    262         if (! -e "Makefile") { $rebuild_this = 1; }
    263 
    264         #  run autogen
    265         $skip_configure = 0;
    266         if ($developer && $rebuild_this && ! -e "configure" && -e "autogen.sh") {
    267             $skip_configure = 1;
    268             vsystem ("$psautogen $psopts");
    269             if ($?) { &failure($cvsname[$i], "failure in psautogen"); }
    270         }
    271 
    272         if ($rebuild_this && -e "configure" && !$skip_configure) {
    273             vsystem ("$psconfigure $psopts");
    274             if ($?) { &failure($cvsname[$i], "failure in psconfigure"); }
    275         }
    276 
    277         if (! -e "Makefile") { &failure($cvsname[$i], "missing makefile: do you need to run the -dev developer build?"); }
    278 
    279         if ($clean) {
    280             vsystem ("make clean");
    281             if ($?) { &failure($cvsname[$i], "failure in make clean"); }
    282         }
    283 
    284         vsystem ("make");
    285         if ($?) { &failure($cvsname[$i], "failure in make"); }
    286 
    287         vsystem ("make install");
    288         if ($?) { &failure($cvsname[$i], "failure in make install"); }
    289 
    290         print "*** done with $cvsname[$i] ***\n";
     215        if (($stop ne "") && ($stop eq $cvsname[$i])) { $stop_now = 1; }
     216        if (($start ne "") && ($start ne $cvsname[$i])) { next; }
     217        $start = "";
     218
     219        ($do_tag, $do_build, $do_package, $do_update, $dev_build) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)(\S)|;
     220        if ($developer) { $do_build = $dev_build; }
     221        if ($do_build eq "N") { next; }
     222
     223        $workdir = "../$cvsname[$i]";
     224
     225        # XXX need to grab current value for cleanup
     226        print "\n ** psbuild: $cvsname[$i] ** \n";
     227        print "\033]0; ** psbuild: $cvsname[$i] ** \007";
     228
     229        if (!-d $workdir || !-r $workdir || !-x $workdir) {
     230            print STDERR "WARNING: no directory for component $cvsname[$i], skipping\n";
     231            next;
     232        }
     233
     234        chdir $workdir;
     235
     236        # how do we build this component?
     237        # - autogen.sh : configure : make : make install
     238        # - configure : make : make install
     239        # - make : make install
     240        # - perl Build.PL : ./Build : ./Build install
     241
     242        if (-e "Build.PL") {
     243            vsystem ("$psperlbuild");
     244            if ($?) { &failure($cvsname[$i], "failure in perl Build.PL"); }
     245
     246            vsystem ("./Build");
     247            if ($?) { &failure($cvsname[$i], "failure in Build"); }
     248
     249            vsystem ("./Build install");
     250            if ($?) { &failure($cvsname[$i], "failure in Build install"); }
     251
     252            next;
     253        }
     254
     255        if ($rebuild && $clean) {
     256            if (-e "configure") { unlink "Makefile"; }
     257            if ($developer && -e "configure.ac" && -e "autogen.sh") { unlink "configure"; }
     258        }
     259        $rebuild_this = $rebuild;
     260
     261        # set a local variable for this loop on rebuild;
     262        if (! -e "Makefile") { $rebuild_this = 1; }
     263
     264        #  run autogen
     265        $skip_configure = 0;
     266        if ($developer && $rebuild_this && ! -e "configure" && -e "autogen.sh") {
     267            $skip_configure = 1;
     268            vsystem ("$psautogen $psopts");
     269            if ($?) { &failure($cvsname[$i], "failure in psautogen"); }
     270        }
     271
     272        if ($rebuild_this && -e "configure" && !$skip_configure) {
     273            vsystem ("$psconfigure $psopts");
     274            if ($?) { &failure($cvsname[$i], "failure in psconfigure"); }
     275        }
     276
     277        if (! -e "Makefile") { &failure($cvsname[$i], "missing makefile: do you need to run the -dev developer build?"); }
     278
     279        if ($clean) {
     280            vsystem ("make clean");
     281            if ($?) { &failure($cvsname[$i], "failure in make clean"); }
     282        }
     283
     284        vsystem ("make");
     285        if ($?) { &failure($cvsname[$i], "failure in make"); }
     286
     287        vsystem ("make install");
     288        if ($?) { &failure($cvsname[$i], "failure in make install"); }
     289
     290        print "*** done with $cvsname[$i] ***\n";
    291291
    292292      success:
    293         chdir $homedir;
     293        chdir $homedir;
    294294    }
    295295    print "\033]0; ** psbuild: finished ** \007";
     
    306306    @list = <$tagsets/*.dist>;
    307307    foreach $line (@list) {
    308         chomp $line;
    309         ($dist) = $line =~ m|$tagsets/(\S*).dist|;
    310         print STDERR "$dist\n";
     308        chomp $line;
     309        ($dist) = $line =~ m|$tagsets/(\S*).dist|;
     310        print STDERR "$dist\n";
    311311    }
    312312    exit 2;
     
    326326    vsystem ("cp psconfig.csh $psconfdir/psconfig.csh");
    327327    vsystem ("cp psconfig.bash $psconfdir/psconfig.bash");
     328    vsystem ("chmod u+x $psconfdir/psconfig.bash");
    328329
    329330    print STDOUT "\n";
    330    
     331
    331332    print STDOUT "** if you use csh, tcsh or equivalent as your shell, add the following to your .cshrc\n";
    332333    print STDOUT "    if (-e $psconfdir/psconfig.csh) then\n";
     
    363364
    364365    foreach $line (@list) {
    365         chop $line;
    366         if ($line =~ m|^\s*$|) { next; }
    367         if ($line =~ m|^\s*\#|) { next; }
    368 
    369         ($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
    370        
    371         if ($cvsname eq "") { die "missing module name\n"; }
    372 
    373         ($do_tag, $do_build, $do_package, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
    374         if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
    375         if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
    376         if (($do_package ne "Y") && ($do_package ne "N")) { die "invalid tag option $do_package\n"; }
    377         if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
    378        
    379         if ($verbose) { print "tag: $do_tag, build: $do_build, package: $do_package, update: $do_update "; }
    380         if ($verbose) { print "module: $cvsname, branchtag: $branchtag, branchver: $branchver \n"; }
    381 
    382         push @mode, $mode;
    383         push @cvsname, $cvsname;
    384         push @branchtag, $branchtag;
    385         push @branchver, $branchver;
     366        chop $line;
     367        if ($line =~ m|^\s*$|) { next; }
     368        if ($line =~ m|^\s*\#|) { next; }
     369
     370        ($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
     371
     372        if ($cvsname eq "") { die "missing module name\n"; }
     373
     374        ($do_tag, $do_build, $do_package, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
     375        if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
     376        if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
     377        if (($do_package ne "Y") && ($do_package ne "N")) { die "invalid tag option $do_package\n"; }
     378        if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
     379
     380        if ($verbose) { print "tag: $do_tag, build: $do_build, package: $do_package, update: $do_update "; }
     381        if ($verbose) { print "module: $cvsname, branchtag: $branchtag, branchver: $branchver \n"; }
     382
     383        push @mode, $mode;
     384        push @cvsname, $cvsname;
     385        push @branchtag, $branchtag;
     386        push @branchver, $branchver;
    386387    }
    387388}
     
    426427    $ENV{$var} = $answer;
    427428    if ($verbose) {
    428         print STDERR "$var = $answer\n";
    429     }
    430 }
    431 
     429        print STDERR "$var = $answer\n";
     430    }
     431}
     432
Note: See TracChangeset for help on using the changeset viewer.