root/main/trunk/greenstone2/perllib/cpan/compile-zerossl.sh @ 32456

Revision 32456, 6.2 KB (checked in by ak19, 9 months ago)

First version of compile-zerossl.sh to build the Crypt::LE perl package. Still needs the other folders moved to the correct position, but it took a while for the automated script to work the same as manually doing this on the commandline. The key was to export PERL5LIB, not simply set it.

  • Property svn:executable set to *
Line 
1# A basic cascade-make to install the Crypt::LE perl package required for ZeroSSL, used to get an https certificate on Mac
2
3if [ "x$GSDL3SRCHOME" = "x" ] ; then
4    echo "GSDL3SRCHOME not set, sourcing gs3-setup.sh"
5    echo ""
6    cd ../../..
7    source ./gs3-setup.sh
8    cd $GSDLHOME/perllib/cpan
9fi
10
11CPAN_DIR=$GSDLHOME/perllib/cpan
12OLD_PERL5LIB=$PERL5LIB
13# dependencies are not found if PERL5LIB is simply set to cpan. PERL5LIB Needs to specifically be exported
14export PERL5LIB=$CPAN_DIR
15
16echo "**** PERL5LIB is $PERL5LIB"
17
18
19WGET_FLAGS=--no-check-certificate
20TMPDIR=$CPAN_DIR/tmp
21
22OLD_C_INCLUDE_PATH=$C_INCLUDE_PATH
23
24# if clean was passed in
25if [ "x$1" = "xclean" ] ; then
26    cd $CPAN_DIR
27    rm -rf Crypt/OpenSSL Log JSON/MaybeXS.pm Log Time Module JSON/PP.pm JSON/PP Crypt/LE Crypt/LE.pm
28    mv JSON/PP.old JSON/PP
29    mv JSON/PP.pm_old JSON/PP.pm
30    rm -rf $TMPDIR
31    echo "Done cleaning"
32    exit 0
33fi
34
35
36
37mkdir -p $TMPDIR
38
39
40
41
42# We'll download, unpack and compile stuff into TMPDIR
43cd $TMPDIR
44
45
46# First run through the dependencies and then finally Crypt::LE itself
47
48# 1 https://metacpan.org/pod/Crypt::OpenSSL::Bignum
49if [ ! -d "$CPAN_DIR/Crypt/OpenSSL/Bignum" ]; then
50    CRYPT_OPENSSL_BIGNUM=Crypt-OpenSSL-Bignum
51    CRYPT_OPENSSL_BIGNUM_VER=$CRYPT_OPENSSL_BIGNUM-0.09
52    echo "+ Installing $CRYPT_OPENSSL_BIGNUM"
53    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/K/KM/KMX/$CRYPT_OPENSSL_BIGNUM_VER.tar.gz
54    tar -xvzf $CRYPT_OPENSSL_BIGNUM_VER.tar.gz
55   
56    export C_INCLUDE_PATH=$GSDL3SRCHOME/bin/darwin/openssl/include
57    cd $CRYPT_OPENSSL_BIGNUM_VER
58    perl Makefile.PL PREFIX=$TMPDIR/$CRYPT_OPENSSL_BIGNUM
59    make
60    make install
61    cp -r $TMPDIR/$CRYPT_OPENSSL_BIGNUM/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/Crypt/OpenSSL $CPAN_DIR/Crypt/.
62   
63    C_INCLUDE_PATH=
64    cd $TMPDIR
65else
66    echo "*** $CPAN_DIR/Crypt/OpenSSL/Bignum already exists, not installing"
67fi
68
69
70# 2a https://metacpan.org/pod/JSON::PP
71# which is the minimum dependency for JSON::MaybeXS
72
73if [ ! -f "$CPAN_DIR/JSON/PP.pm_old" ]; then
74    mv $CPAN_DIR/JSON/PP $CPAN_DIR/JSON/PP.old
75    mv $CPAN_DIR/JSON/PP.pm $CPAN_DIR/JSON/PP.pm_old
76
77    JSON_PP=JSON-PP
78    JSON_PP_VER=$JSON_PP-2.97001
79    echo "+ Installing $JSON_PP"
80    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/$JSON_PP_VER.tar.gz
81    tar -xvzf $JSON_PP_VER.tar.gz
82
83    cd $JSON_PP_VER
84    perl Makefile.PL PREFIX=$TMPDIR/$JSON_PP
85    make
86    make install
87    cp -r $TMPDIR/$JSON_PP/lib/perl5/site_perl/JSON/* JSON $CPAN_DIR/JSON/.
88
89    cd $TMPDIR
90else
91    echo "*** The new $CPAN_DIR/JSON/PP.pm already exists, not installing"
92fi
93
94
95# 2 https://metacpan.org/pod/JSON::MaybeXS
96
97if [ ! -f "$CPAN_DIR/JSON/MaybeXS.pm" ]; then
98    JSON_MAYBEXS=JSON-MaybeXS
99    JSON_MAYBEXS_VER=$JSON_MAYBEXS-1.004000
100    echo "+ Installing $JSON_MAYBEXS"
101    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/H/HA/HAARG/$JSON_MAYBEXS_VER.tar.gz
102    tar -xvzf $JSON_MAYBEXS_VER.tar.gz
103
104    cd $JSON_MAYBEXS_VER
105    perl Makefile.PL PREFIX=$TMPDIR/$JSON_MAYBEXS
106    make
107    make install
108    cp $TMPDIR/$JSON_MAYBEXS/lib/perl5/site_perl/JSON/MaybeXS.pm $CPAN_DIR/JSON/.
109
110    cd $TMPDIR
111else
112    echo "*** $CPAN_DIR/JSON/MaybeXS.pm already exists, not installing"
113fi
114
115
116# 3 https://metacpan.org/pod/Log::Log4perl
117
118if [ ! -d "$CPAN_DIR/Log/Log4perl" ]; then
119    LOG4PERL=Log-Log4perl
120    LOG4PERL_VER=$LOG4PERL-1.49
121    echo "+ Installing $LOG4PERL"
122    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/M/MS/MSCHILLI/$LOG4PERL_VER.tar.gz
123    tar -xvzf $LOG4PERL_VER.tar.gz
124
125    cd $LOG4PERL_VER
126    perl Makefile.PL PREFIX=$TMPDIR/$LOG4PERL
127    make
128    make install
129    cp -r $TMPDIR/$LOG4PERL/lib/perl5/site_perl/Log $CPAN_DIR/.
130
131    cd $TMPDIR
132else
133    echo "*** $CPAN_DIR/Log/Log4Perl already exists, not installing"
134fi
135
136# 4 https://metacpan.org/pod/HTTP::Tiny
137
138if [ ! -f "$CPAN_DIR/HTTP/Tiny.pm" ]; then
139    HTTP_TINY=HTTP-Tiny
140    HTTP_TINY_VER=$HTTP_TINY-0.076
141    echo "+ Installing $HTTP_TINY"
142    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/D/DA/DAGOLDEN/$HTTP_TINY_VER.tar.gz
143    tar -xvzf $HTTP_TINY_VER.tar.gz
144
145    cd $HTTP_TINY_VER
146    perl Makefile.PL PREFIX=$TMPDIR/$HTTP_TINY
147    make
148    make install
149
150    cp -r $TMPDIR/$HTTP_TINY/lib/perl5/site_perl/HTTP/* $CPAN_DIR/HTTP/.
151
152    cd $TMPDIR
153else
154    echo "*** $CPAN_DIR/$HTTP_TINY already exists, not installing"
155fi
156
157
158# 5 https://metacpan.org/pod/Module::Load
159
160if [ ! -d "$CPAN_DIR/Module" ]; then
161    MODULE_LOAD=Module-Load
162    MODULE_LOAD_VER=$MODULE_LOAD-0.32
163    echo "+ Installing $MODULE_LOAD"
164    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/B/BI/BINGOS/$MODULE_LOAD_VER.tar.gz
165    tar -xvzf $MODULE_LOAD_VER.tar.gz
166
167    cd $MODULE_LOAD_VER
168    perl Makefile.PL PREFIX=$TMPDIR/$MODULE_LOAD
169    make
170    make install
171    cp -r $TMPDIR/$MODULE_LOAD/lib/perl5/site_perl/Module $CPAN_DIR/.
172
173    cd $TMPDIR
174else
175    echo "*** $CPAN_DIR/$MODULE_LOAD already exists, not installing"
176fi
177
178
179# 6 https://metacpan.org/pod/Time::Piece
180
181if [ ! -f "$CPAN_DIR/Time/Piece.pm" ]; then
182    TIME_PIECE=Time-Piece
183    TIME_PIECE_VER=$TIME_PIECE-1.33
184    echo "+ Installing $TIME_PIECE"
185    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/E/ES/ESAYM/$TIME_PIECE_VER.tar.gz
186    tar -xvzf $TIME_PIECE_VER.tar.gz
187
188    cd $TIME_PIECE_VER
189    perl Makefile.PL PREFIX=$TMPDIR/$TIME_PIECE
190    make
191    make install
192
193    cp -r $TMPDIR/$TIME_PIECE/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/Time $CPAN_DIR/.
194
195    cd $TMPDIR
196else
197    echo "*** $CPAN_DIR/$TIME_PIECE already exists, not installing"
198fi
199
200
201
202# FINALLY, compile up Crypt::LE
203# https://metacpan.org/pod/Crypt::LE
204
205if [ ! -d "$CPAN_DIR/Crypt/LE" ]; then
206    CRYPT_LE=Crypt-LE
207    CRYPT_LE_VER=$CRYPT_LE-0.31
208    echo "+ FINALLY, Installing $CRYPT_LE"
209    wget $WGET_FLAGS https://cpan.metacpan.org/authors/id/L/LE/LEADER/$CRYPT_LE_VER.tar.gz
210    tar -xvzf $CRYPT_LE_VER.tar.gz
211
212    cd $CRYPT_LE_VER
213    perl Makefile.PL PREFIX=$TMPDIR/$CRYPT_LE
214    make
215    make install
216
217    cp -r $TMPDIR/$CRYPT_LE/lib/perl5/site_perl/Crypt/* $CPAN_DIR/Crypt/.
218    # the most important step: we need the le.pl binary
219    cp -r $TMPDIR/$CRYPT_LE/bin $CPAN_DIR/Crypt/LE/.
220
221    cd $CPAN_DIR
222else
223    echo "*** $CPAN_DIR/$CRYPT_LE already exists, not installing"
224fi
225
226
227# DONE
228# restore env vars
229C_INCLUDE_PATH=$OLD_C_INCLUDE_PATH
230PERL5LIB=$OLD_PERL5LIB
Note: See TracBrowser for help on using the browser.