[LON-CAPA-cvs] cvs: modules /matthew/systemperl prepare_systemperl.pl

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 09 May 2003 16:42:22 -0000


matthew		Fri May  9 12:42:22 2003 EDT

  Added files:                 
    /modules/matthew/systemperl	prepare_systemperl.pl 
  Log:
  prepare_systemperl.pl 
    retrieves perl modules from CPAN
    extracts, compiles, and installs other libraries (gd) for the systemperl rpm
    compiles and installs the perl modules from CPAN for the systemperl rpm
  Notes:
    Directories are hard-coded.
    The script is mildly interactive - it waits for your prompting to proceed
      on each of the 3 steps listed above.  This gives you a chance to abort
      if you think you saw errors in the previous step.
    The gd-*.tar.gz file must reside in $basedir
    The hparser_patch file must reside in $basedir
    The script must be run as root (CPAN seems to barf otherwise)
    gd and GD are compiled with the default formats (jpeg, freetype,
      AND xpm).  There is a reason for this but I don't remember it right now.
  
  

Index: modules/matthew/systemperl/prepare_systemperl.pl
+++ modules/matthew/systemperl/prepare_systemperl.pl
#!/usr/bin/perl -w 
#
# $Id: prepare_systemperl.pl,v 1.1 2003/05/09 16:42:22 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
#
# LON-CAPA is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# LON-CAPA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with LON-CAPA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# /home/httpd/html/adm/gpl.txt
#
use strict;
use CPAN;

my $basedir = "/home/matthew/systemperl/systemperl-3.6-rh7/";
my $builddir = $basedir."/modules";
my $targetdir = $basedir."/root/usr";

my %CPAN_config = (
                   build_cache => 1000,
                   build_dir => $builddir,
                   );

#
# These installation strings must be able to be run one after another
my $local_install  = "perl ./Makefile.PL; make; make install;";
my $default_local_install = 
    "perl ./Makefile.PL < /dev/null; make; make install;";
my $sysperl_install = 
    "perl ./Makefile.PL PREFIX=$targetdir; make; make install;";
my $default_sysperl_install = 
    "perl ./Makefile.PL PREFIX=$targetdir < /dev/null; make; make install;";

my @Modules = ({ src => "Algorithm::Diff",
		 dirname=> "Algorithm-Diff-*",
                 compile => $sysperl_install },
	       { src=>"Crypt::DES",
		 dirname => "Crypt-DES-*",
		 compile => $sysperl_install },
	       { src=>"Crypt::IDEA",
		 dirname => "Crypt-IDEA-*",
		 compile => $sysperl_install },
	       { src=>"Digest::MD5",
		 dirname => "Digest-MD5-*",
		 compile => $sysperl_install },
	       { src=>"Event",
		 dirname => "Event-*",
		 compile => $sysperl_install },
	       { src=>"GD",
		 dirname => "GD-[2-9]*",
		 compile => $default_local_install.$default_sysperl_install },
	       { src=>"GD::Text",
		 dirname => "GDTextUtil-*",
		 compile => $local_install.$sysperl_install },
	       { src=>"GD::Barcode",
		 dirname => "GD-Barcode-*",
		 compile => $sysperl_install },
	       { src=>"GD::Graph",
		 dirname => "GDGraph-*",
		 compile => $sysperl_install },
	       { src=>"GD::Graph3d",
		 dirname => "GD-Graph3d-*",
		 compile => $sysperl_install },
	       { src=>"HTML::Parser",
		 dirname => "HTML-Parser-*",
		 compile => 'patch < ../../hparser_patch;'.$sysperl_install },
	       { src=>"HTML::Tagset",
		 dirname => "HTML-Tagset-*",
		 compile => $sysperl_install },
	       { src=>"HTML::Tree",
		 dirname => "HTML-Tree-*",
		 compile => $sysperl_install },
	       { src=>"IO::Stringy",
		 dirname => "IO-stringy-*",
		 compile => $sysperl_install },
	       { src=>"I18N::LangTags",
		 dirname => "I18N-LangTags-*",
		 compile => $local_install.$sysperl_install },
	       { src=>"Authen::Krb4",
		 dirname=>"Krb4-*",
		 compile=>'nonstandard' },
	       { src=>"Authen::Krb5",
		 dirname=>"Krb5-*",
		 compile=>'nonstandard' },
	       { src=>"Locale::Maketext",
		 dirname => "Locale-Maketext-*",
		 compile => $sysperl_install },
	       { src=>"LWP",
		 dirname => "libwww-perl-*",
		 compile => $default_local_install.$default_sysperl_install },
	       { src=>"Mail::Header",
		 dirname=>"MailTools-*",
		 compile=>$sysperl_install },
	       { src=>"Math::Cephes",
		 dirname=>"Math-Cephes-*",
		 compile=>$sysperl_install },
	       { src=>"Math::Random",
		 dirname=>"Math-Random-*",
		 compile=>$sysperl_install },
	       { src=>"Text::Balanced",
		 dirname=>"Text-Balanced-*",
		 compile=>$local_install.$sysperl_install },
	       { src=>"Parse::RecDescent",
		 dirname=>"Parse-RecDescent-*",
		 compile=>$local_install.$sysperl_install },
	       { src=>"Pod::POM",
		 dirname=>"Pod-POM-*",
		 compile=>$sysperl_install },
	       { src=>"Safe::Hole",
		 dirname=>"Safe-Hole-*",
		 compile=>$sysperl_install },
               { src=>"Spreadsheet::WriteExcel",
		 dirname=>"Spreadsheet-WriteExcel-*",
		 compile=>$sysperl_install },
	       { src=>"String::Similarity",
		 dirname=>"String-Similarity-*",
		 compile=>$sysperl_install },
	       { src=>"Text::Query",
		 dirname=>"Text-Query-*",
		 compile=>$sysperl_install },
	       { src=>"Text::Query::Advanced",
		 dirname=>"Text-Query-Advanced-*",
		 compile=>$sysperl_install },  
	       { src=>"Text::Query::Simple",
		 dirname=>"Text-Query-Simple-*",
		 compile=>$sysperl_install },
	       { src=>"Time::HiRes",
		 dirname=>"Time-HiRes-*",
		 compile=>$sysperl_install },
	       );

my @Libraries = (
                 { src=>$builddir.'/../gd-2.0.12.tar.gz',
                   dirname=>"gd-*",
                   compile=>'./configure --prefix='.$targetdir.'/;'.
                       'make;'.
                       'make install;'.
                       'rm config.status;'.
                       './configure --prefix=/usr/ ;'.
                       'make;'.
                       'make install;'}
                 );
print <<"END";
##
##  This script performs ABSOLUTELY NO ERROR CHECKING OR TESTS!
##  If I were you, I'd pay attention to the stream of text that it produces.
##  If you don't like this message, feel free to add some error checks.
##
##  You need to have configured CPAN before running this script.  Run
##
##               perl -MCPAN -e shell
##
##  to configure it.
##
##  Hit enter to begin the process by retrieving the CPAN modules
##
END
while (! <>) {};

foreach my $modinfo (@Modules) {
    my $Mod = CPAN::Shell->expandany( ($modinfo->{'src'}) );
    #
    # Set CPAN configuration options
    while (my ($param,$newvalue) = each(%CPAN_config)) {
        $CPAN::Config->{$param} = $newvalue;
        print "set $param = $newvalue\n";
    }
    $Mod->get();
}

print "\n\nReady to begin installing libraries - hit enter to proceed\n\n";
while (! <>) {};

foreach my $library (@Libraries) {
    # open up the library
    if (exists($library->{'src'})) {
        my $extract_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
            'tar zxf '.$library->{'src'}.';';
        system($extract_command);
    }
    my $compile_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
        $library->{'compile'};
    system($compile_command);
}

print "\n\nReady to begin compiling and installing modules -".
    " hit enter to proceed\n\n";
while (! <>) {};

foreach my $modinfo (@Modules) {
    next if ($modinfo->{'compile'} =~ /^(nonstandard|no|manual)$/);
    my $compile_commands = 'cd '.$builddir.'/'.$modinfo->{'dirname'}.';'.
        $modinfo->{'compile'};
    system($compile_commands);
}