[27467] | 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 |
|
---|
[30282] | 8 | base="${GEXTPARALLELBUILDING}"
|
---|
| 9 | prefix="${GEXTPARALLELBUILDING_INSTALLED}"
|
---|
| 10 | perlversion="${PERL_VERSION}"
|
---|
[27467] | 11 | perlinstall="${prefix}/lib/perl/${perlversion}"
|
---|
| 12 |
|
---|
[30282] | 13 | if [ ! -d "${perlinstall}" ]
|
---|
| 14 | then
|
---|
| 15 | mkdir -p "${perlinstall}"
|
---|
| 16 | fi
|
---|
| 17 |
|
---|
[27488] | 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"
|
---|
[27467] | 20 |
|
---|
| 21 | cd cpan
|
---|
| 22 | # 1. Scan <ext>/packages/cpan for *.tar.gz files
|
---|
[27488] | 23 | for filename in *.tar.gz # gah - doesn't support prereqs
|
---|
| 24 | #for filename in $filenames
|
---|
[27467] | 25 | do
|
---|
| 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]}
|
---|
[27488] | 32 | # - remove .tar.gz
|
---|
| 33 | version="${version:0:(${#version} - 7)}"
|
---|
| 34 | # - prepend -
|
---|
[27467] | 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
|
---|
[27488] | 81 | opt_run_perl_configure $force_config $auto_config $package $version $prefix INC="${perlinstall}" INSTALLDIRS=site INSTALLSITEARCH="${perlinstall}" INSTALLSITELIB="${perlinstall}"
|
---|
[27467] | 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
|
---|
| 100 | done
|
---|
| 101 |
|
---|
| 102 | cd ..
|
---|
| 103 |
|
---|