root/gs2-extensions/parallel-building/trunk/src/packages/CASCADE-MAKE/CPAN.sh @ 27467

Revision 27467, 3.3 KB (checked in by jmt12, 6 years ago)

An advanced cascade script that will loop through an (evergrowing) list of CPAN modules and build them using either MakeMaker? of ModuleBuild? as appropriate

  • Property svn:executable set to *
  • Property svn:mime-type set to application/x-shellscript
Line 
1#!/bin/bash
2
3progname=$0
4
5source ../cascade-make/lib/cascade-lib.bash GEXTPARALLELBUILDING ../.. $*
6source ../cascade-make/lib/cascade-lib-modulebuild.bash GEXTPARALLELBUILDING $*
7
8base=$GEXTPARALLELBUILDING
9prefix=$GEXTPARALLELBUILDING_INSTALLED
10perlversion=$PERL_VERSION
11perlinstall="${prefix}/lib/perl/${perlversion}"
12
13filenames="IPC-Run-0.90 Proc-Daemon-0.14 Sort-Key-1.32 Bit-Vector-7.2 version-0.9902 Perl-OSType-1.003 Module-Metadata-1.000014 Module-Build-0.4005 Test-Requires-0.06 Test-Fatal-0.010 Test-Simple-0.98 Module-Runtime-0.013 Try-Tiny-0.12 Module-Implementation-0.06 Params-Validate-1.07 Params-Util-1.07 DateTime-1.03 DateTime-Locale-0.45 List-MoreUtils-0.33.tar.gz Class-Singleton-1.4 Class-Load-0.20 Data-OptList-0.107 parent-0.225 DateTime-TimeZone-1.59"
14
15cd cpan
16# 1. Scan <ext>/packages/cpan for *.tar.gz files
17#for filename in *.tar.gz # gah - doesn't support prereqs
18for filename in filenames
19do
20  # 2. For each found
21  echo "Processing $filename"
22  IFS='-' read -a parts <<< "$filename"
23  partslen=${#parts[@]}
24  # deal with version first, so we can pop it off array
25  version=${parts[${#parts[@]}-1]}
26  # - remove .tar.gz and prepend -
27  #version="-${version:0:(${#version} - 7)}"
28  # - just prepend -
29  version="-${version}"
30  # - pop!
31  unset parts[${#parts[@]}-1]
32  # now construct the three other module strings we need
33  first="1"
34  package=""
35  modulecolons=""
36  modulefilesp=""
37  for i in "${parts[@]}"
38  do
39    if [ $first == "1" ]
40    then
41      package=$i
42      modulecolons=$i
43      modulefilesp=$i
44      first="0"
45    else
46      package="${package}-${i}"
47      modulecolons="${modulecolons}::${i}"
48      modulefilesp="${modulefilesp}/${i}"
49    fi
50  done
51  echo "Package: $package (aka $modulecolons or $modulefilesp)"
52  echo "Version: $version"
53  modulepath="${base}/packages/cpan/${package}${version}"
54  # a. Unpack if necessary
55  opt_run_untar $force_untar $auto_untar $package $version
56  # b. Determine the type of Perl build (ModuleBuild vs MakeMaker)
57  modulebuild="0"
58  if [ -f "${modulepath}/Build.PL" ]
59  then
60    modulebuild="1"
61  fi
62  echo "Using ModuleBuild to install? $modulebuild"
63  # c. Determine if we need to compile this file
64  if [ ! -f "${perlinstall}/${modulefilesp}.pm" ]
65  then
66    if [ $modulebuild == "1" ]
67    then
68      # d. Configure
69      opt_modulebuild_configure $force_config $auto_config $package $version $prefix $perlversion
70      # e. Compile
71      opt_modulebuild_make $compile   $package $version
72      opt_modulebuild_make $install   $package $version "install"
73    else
74      # d. Configure
75      opt_run_perl_configure $force_config $auto_config $package $version $prefix INSTALLSITEARCH="${perlinstall}" INSTALLSITELIB="${perlinstall}"
76      # e. Compile
77      opt_run_make $compile   $package $version
78      opt_run_make $install   $package $version "install"
79    fi
80  else
81    echo "${modulecolons} Perl module already compiled => no need to recompile"
82  fi
83  # f. Other Perl builder specific modes
84  if [ $modulebuild == "1" ]
85  then
86    opt_modulebuild_make $clean     $package $version "clean"
87    opt_modulebuild_make $distclean $package $version "distclean"
88  else
89    opt_run_make $clean     $package $version "clean"
90    opt_run_make $distclean $package $version "distclean"
91  fi
92  # g. Finally the general modes
93  opt_run_tarclean $tarclean $package $version
94done
95
96cd ..
97
Note: See TracBrowser for help on using the browser.