source: gs2-extensions/parallel-building/trunk/src/packages/CASCADE-MAKE/CPAN.sh

Last change on this file was 30282, checked in by jmt12, 9 years ago

Ensure the perl/cpan install directories exist before trying to copy into them - they may not in a fresh check-out

  • Property svn:executable set to *
File size: 3.1 KB
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
13if [ ! -d "${perlinstall}" ]
14then
15 mkdir -p "${perlinstall}"
16fi
17
18# You can use a list should you need to force precedence
19#filenames="IPC-Run-0.90 Proc-Daemon-0.14 Sort-Key-1.32 Bit-Vector-7.2"
20
21cd cpan
22# 1. Scan <ext>/packages/cpan for *.tar.gz files
23for filename in *.tar.gz # gah - doesn't support prereqs
24#for filename in $filenames
25do
26 # 2. For each found
27 echo "Processing $filename"
28 IFS='-' read -a parts <<< "$filename"
29 partslen=${#parts[@]}
30 # deal with version first, so we can pop it off array
31 version=${parts[${#parts[@]}-1]}
32 # - remove .tar.gz
33 version="${version:0:(${#version} - 7)}"
34 # - prepend -
35 version="-${version}"
36 # - pop!
37 unset parts[${#parts[@]}-1]
38 # now construct the three other module strings we need
39 first="1"
40 package=""
41 modulecolons=""
42 modulefilesp=""
43 for i in "${parts[@]}"
44 do
45 if [ $first == "1" ]
46 then
47 package=$i
48 modulecolons=$i
49 modulefilesp=$i
50 first="0"
51 else
52 package="${package}-${i}"
53 modulecolons="${modulecolons}::${i}"
54 modulefilesp="${modulefilesp}/${i}"
55 fi
56 done
57 echo "Package: $package (aka $modulecolons or $modulefilesp)"
58 echo "Version: $version"
59 modulepath="${base}/packages/cpan/${package}${version}"
60 # a. Unpack if necessary
61 opt_run_untar $force_untar $auto_untar $package $version
62 # b. Determine the type of Perl build (ModuleBuild vs MakeMaker)
63 modulebuild="0"
64 if [ -f "${modulepath}/Build.PL" ]
65 then
66 modulebuild="1"
67 fi
68 echo "Using ModuleBuild to install? $modulebuild"
69 # c. Determine if we need to compile this file
70 if [ ! -f "${perlinstall}/${modulefilesp}.pm" ]
71 then
72 if [ $modulebuild == "1" ]
73 then
74 # d. Configure
75 opt_modulebuild_configure $force_config $auto_config $package $version $prefix $perlversion
76 # e. Compile
77 opt_modulebuild_make $compile $package $version
78 opt_modulebuild_make $install $package $version "install"
79 else
80 # d. Configure
81 opt_run_perl_configure $force_config $auto_config $package $version $prefix INC="${perlinstall}" INSTALLDIRS=site INSTALLSITEARCH="${perlinstall}" INSTALLSITELIB="${perlinstall}"
82 # e. Compile
83 opt_run_make $compile $package $version
84 opt_run_make $install $package $version "install"
85 fi
86 else
87 echo "${modulecolons} Perl module already compiled => no need to recompile"
88 fi
89 # f. Other Perl builder specific modes
90 if [ $modulebuild == "1" ]
91 then
92 opt_modulebuild_make $clean $package $version "clean"
93 opt_modulebuild_make $distclean $package $version "distclean"
94 else
95 opt_run_make $clean $package $version "clean"
96 opt_run_make $distclean $package $version "distclean"
97 fi
98 # g. Finally the general modes
99 opt_run_tarclean $tarclean $package $version
100done
101
102cd ..
103
Note: See TracBrowser for help on using the repository browser.