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