]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Bolster SendEmail Reactor's handling of UTF-8 content
[working/Evergreen.git] / Open-ILS / src / extras / Makefile.install
1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
3 # Author: Dan Scott <dscott@laurentian.ca>
4 #
5 # Makefile to install prerequisites for OpenSRF and Evergreen
6 #
7 # Currently supports Debian (lenny/squeeze), Ubuntu (hardy/lucid), and Fedora (13).
8 # Working towards support of CentOS 5 / RHEL 5.
9 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
10 #
11 # usage:
12 #       make -f Makefile.install debian-lenny
13 #       - or -
14 #       make -f Makefile.install debian-squeeze
15 #       - or -
16 #       make -f Makefile.install ubuntu-hardy
17 #       - or -
18 #       make -f Makefile.install ubuntu-lucid
19 #       - or -
20 #       make -f Makefile.install fedora14
21 #       - or -
22 #       make -f Makefile.install centos
23 #       - or -
24 #       make -f Makefile.install rhel
25 #
26 # Notes:
27 #
28 #       This makefile has been tested much more with Debian and Ubuntu than
29 #       Fedora, CentOS, or RHEL.
30 #
31 # ---------------------------------------------------------------------
32  
33 # Make any assumptions about the shell being used explicit
34 SHELL=/bin/bash 
35
36 LIBJS=js-1.7.0
37 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
38 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
39 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
40 # used for installing libjs lib and header files
41 JS_INSTALL_PREFIX=/usr/
42
43 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
44 # the open-ils.org site now for ease of direct linking
45 LIBDBI=libdbi-0.8.3
46 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
47 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
48
49 # We need a recent version of Yaz
50 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
51 YAZ=yaz-3.0.47
52 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
53
54 # Business::OnlinePayment is not packaged on CentOS/RHEL
55 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
56 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
57
58 APT_TOOL=aptitude -yq
59
60 # 64 or 32 bit os?
61 LBITS=$(shell getconf LONG_BIT)
62
63 # Fedora?
64 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
65
66 # Fedora 64-bit?
67 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
68
69 #RHEL/Centos PGSQL 
70 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
71 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
72 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm       
73
74 # Debian dependencies
75 DEBS =  \
76         apache2-prefork-dev\
77         aspell\
78         aspell-en\
79         libbusiness-creditcard-perl\
80         libbusiness-onlinepayment-authorizenet-perl\
81         libbusiness-onlinepayment-perl\
82         libdatetime-format-builder-perl\
83         libdatetime-format-iso8601-perl\
84         libdatetime-format-mail-perl\
85         libdatetime-perl\
86         libdatetime-timezone-perl\
87         libdatetime-set-perl\
88         libdbd-pg-perl\
89         libemail-send-perl\
90         libemail-simple-perl\
91         libgd-graph3d-perl\
92         liblog-log4perl-perl\
93         libmarc-record-perl\
94         libncurses5-dev\
95         libnet-server-perl\
96         libnet-ssh2-perl\
97         libnspr4-dev\
98         libole-storage-lite-perl\
99         libparent-perl \
100         libpq-dev\
101         libreadline5-dev\
102         libspreadsheet-writeexcel-perl\
103         libssh2-1-dev\
104         libtext-aspell-perl\
105         libtext-csv-perl\
106         libuniversal-require-perl\
107         libunix-syslog-perl
108
109 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
110 EXTRA_DEBS = \
111         libbusiness-isbn-perl\
112         libbusiness-isbn-data-perl\
113         libmarc-charset-perl \
114         libmarc-xml-perl \
115         libnet-z3950-zoom-perl \
116         libyaz-dev \
117         yaz
118
119 EXTRA_DEBS_SQUEEZE = \
120     libuuid-tiny-perl
121
122 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
123 # > 2.12 - see bug 525069.
124 EXTRA_ENCODE = \
125         libencode-perl
126
127 CENTOS = \
128         aspell \
129         aspell-devel \
130         aspell-en \
131         gd-devel \
132         libssh2-devel \
133         openssl-devel \
134         perl-Business-CreditCard \
135         perl-Business-ISBN \
136         perl-Business-ISBN-Data \
137         perl-Business-OnlinePayment \
138         perl-Class-Data-Inheritable \
139         perl-DateTime-Format-Builder \
140         perl-DateTime-Format-Strptime \
141         perl-Ima-DBI \
142         perl-DBD-Pg \
143         perl-GD-Graph3d \
144         perl-IO-stringy \
145         perl-Spreadsheet-WriteExcel \
146         perl-Text-Aspell \
147         perl-Text-CSV
148
149 CENTOS_PERL = \
150         Encode \
151         DBIx::ContextualFetch \
152         Getopt::Long \
153         Net::SSH2 \
154         Net::XMPP \
155         Net::Z3950::ZOOM
156
157 FEDORA_13_RPMS = \
158         aspell \
159         aspell-en \
160         js-devel \
161         libdbi \
162         libdbi-dbd-pgsql \
163         libdbi-devel \
164         libssh2-devel \
165         libyaz \
166         libyaz-devel \
167         mod_ssl \
168         ncurses-devel \
169         ncurses-libs \
170         perl-parent \
171         perl-Business-CreditCard \
172         perl-Business-ISBN \
173         perl-Business-ISBN-Data \
174         perl-DBD-Pg \
175         perl-Email-Send \
176         perl-Email-Simple \
177         perl-GDGraph3d \
178         perl-Net-SSH2 \
179         perl-OLE-Storage_Lite \
180         perl-Spreadsheet-WriteExcel \
181         perl-Text-Aspell \
182         perl-Text-CSV \
183         perl-Text-CSV_XS \
184         perl-XML-Writer \
185         postgresql-devel \
186         readline-devel \
187         tcp_wrappers-devel \
188         wget \
189         yaz
190
191 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
192 # Should be fixed in 3.22
193 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
194 FEDORA_13_CPAN = \
195         Business::OnlinePayment \
196         Business::OnlinePayment::AuthorizeNet \
197         MARC::Record \
198         UUID::Tiny
199
200 PGSQL_84_RPMS = \
201         postgresql-8.4* \
202         postgresql-contrib-8.4* \
203         postgresql-devel-8.4* \
204         postgresql-plpe*-8.4* \
205         postgresql-server-8.4*
206
207 PGSQL_CLIENT_DEBS_82 = \
208         postgresql-client
209
210 PGSQL_CLIENT_DEBS_83 = \
211         postgresql-client
212
213 PGSQL_CLIENT_DEBS_84 = \
214         postgresql-client-8.4
215
216 PGSQL_SERVER_DEBS_84 = \
217         postgresql-8.4 \
218         postgresql-contrib-8.4 \
219         postgresql-plperl-8.4 \
220         postgresql-server-dev-8.4
221
222 DEB_APACHE_MODS = \
223     expires\
224     include\
225     proxy\
226     proxy_http\
227     rewrite
228
229 DEB_APACHE_DISMODS = \
230     deflate
231
232 # Chronically unpackaged CPAN modules
233 CPAN_MODULES = \
234     Business::EDI \
235     Library::CallNumber::LC \
236     Net::Z3950::Simple2ZOOM \
237     SRU
238
239 # More chronically unpackaged CPAN modules (available in Squeeze though)
240 CPAN_MODULES_MORE = \
241     Business::CreditCard::Object \
242     MARC::Record \
243     Net::SSH2 \
244     UUID::Tiny
245
246 # Are we sure most distros don't come with an acceptable version of Safe.pm?
247 CPAN_MODULES_SAFE = \
248         Safe
249
250 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
251 CPAN_MODULES_MARC = \
252         Business::ISBN \
253         Business::ISBN::Data \
254     MARC::Charset \
255     MARC::File::XML \
256     Net::Z3950::ZOOM
257
258 CPAN_MODULES_FORCE = \
259         Class::DBI::Frozen::301
260
261 # ----------------------------------------------------------------------------
262
263 all: 
264         @echo "please specify an OS" && exit 0
265
266 # these should be the same for any distro
267 install: install_cpan install_js_sm install_libdbi install_cpan_force
268
269 centos: install_centos_pgsql centos_like
270 rhel: install_redhat_pgsql centos_like
271 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force
272
273 fedora13: install_fedora_13_rpms install_cpan install_cpan_fedora install_cpan_marc install_spidermonkey install_cpan_force
274 fedora14: fedora13
275
276 debian-lenny: lenny generic_debian install_cpan_more install_cpan_safe
277 debian-squeeze: squeeze generic_debian
278 lenny: install_pgsql_client_debs_83 install_extra_debs
279 squeeze: install_pgsql_client_debs_84  install_extra_debs_squeeze
280 generic_debian:  install_debs install debian_sys_config install_cpan_force
281
282 ubuntu-hardy: hardy generic_ubuntu
283 ubuntu-lucid: lucid generic_ubuntu
284 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
285 lucid: install_pgsql_client_debs_84 install_extra_debs
286 generic_ubuntu: install_debs install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force
287
288 # - COMMON TARGETS ---------------------------------------------------------
289
290 # Install the CPAN modules
291 install_cpan: 
292         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
293
294 install_cpan_more: 
295         for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
296
297 # Install the CPAN modules for MARC functionality
298 install_cpan_marc: 
299         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
300
301 install_cpan_force:
302         for m in $(CPAN_MODULES_FORCE); do \
303                 echo "force install $$m" | perl -MCPAN -e shell ;\
304         done
305
306 # Install the Safe Perl module
307 # Is this really unpackaged everywhere except for Fedora?
308 install_cpan_safe: 
309         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
310
311 # Install the CPAN modules for Fedora 13
312 install_cpan_fedora: 
313         for m in $(FEDORA_13_CPAN); do \
314                 echo "force install $$m" | perl -MCPAN -e shell;\
315         done
316
317 # Install a known working version of YAZ
318 install_yaz:    
319         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
320         tar xzf $(YAZ).tar.gz
321         cd $(YAZ) && ./configure && make && make install && ldconfig
322
323 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
324 install_js_sm: install_libjs install_spidermonkey
325
326 install_libjs: 
327         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
328         tar -zxf $(LIBJS).tar.gz
329         cd js/src/ && JS_THREADSAFE=true JS_DIST=/usr make -f Makefile.ref
330         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
331         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
332         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
333         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
334         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
335
336 install_spidermonkey:
337         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
338         tar -zxf $(LIBJS_PERL).tar.gz
339         if [ ! -z $(FEDORA_64) ]; then \
340                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
341         fi;
342         if [ ! -z $(FEDORA) ]; then \
343                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
344         fi;
345         cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
346
347
348 # Install libdbi and the postgres drivers
349 install_libdbi:
350         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
351         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
352         tar -zxf $(LIBDBI).tar.gz
353         tar -zxf $(LIBDBI_DRIVERS).tar.gz
354         cd $(LIBDBI) && ./configure --disable-docs && make all install
355         cd $(LIBDBI_DRIVERS) && ./configure  \
356                 --disable-docs --with-pgsql --enable-libdbi && make all install  
357
358 clean:
359         make -C $(LIBDBI) clean
360         make -C $(LIBDBI_DRIVERS) clean
361         make -C $(LIBJS_PERL) clean
362         make -f Makefile.ref -C js/src/ clean
363
364
365 # ------------------------------------------------------------------
366 # - DEBIAN ---------------------------------------------------------
367
368 debian_sys_config: 
369         # link the apache modules in
370         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
371         # keep the bad apache modules away
372         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
373         # refresh the dynamic library cache
374         ldconfig
375
376 # Install the debian-specific dependencies
377 install_debs:
378         $(APT_TOOL) install $(DEBS)
379
380 install_pgsql_client_debs_84:
381         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
382
383 install_pgsql_server_debs_84:
384         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
385
386 install_pgsql_client_debs_83:
387         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
388
389 install_pgsql_client_debs_82:
390         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
391
392 # Install the debian-specific dependencies for more modern distros
393 install_extra_debs_squeeze: install_extra_debs
394         $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
395
396 install_extra_debs:
397         $(APT_TOOL) install $(EXTRA_DEBS)
398
399 # Install specific modules required by Ubuntu Hardy - see bug 525069
400 install_extra_encode:
401         $(APT_TOOL) install $(EXTRA_ENCODE)
402
403 # ------------------------------------------------------------------
404
405 # FEDORA 13
406 install_fedora_13_rpms:
407         yum -y update
408         yum -y install $(FEDORA_13_RPMS)
409
410 install_fedora_13_pgsql_server:
411         yum -y install $(PGSQL_84_RPMS)
412
413 # CENTOS
414 install_centos_rpms:
415         yum -y install $(CENTOS)
416         yum -y update
417         if [ $(LBITS) -eq 64 ]; then \
418                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
419                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
420                 ldconfig ; \
421         fi;
422         if [ $(LBITS) -eq 32 ]; then \
423                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
424                 ldconfig ; \
425         fi;
426
427 install_centos_pgsql:
428         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
429         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
430         rpm -Uvh --force ./$(PGSQL_CENTOS)
431         yum update -y
432         yum -y install $(PGSQL_84_RPMS)
433
434 install_redhat_pgsql:
435         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
436         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
437         rpm -Uvh --force ./$(PGSQL_REDHAT)
438         yum update -y
439         yum -y install $(PGSQL_84_RPMS)
440
441 install_centos_perl:
442         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
443         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
444         echo "force install Scalar::Util" | perl -MCPAN -e shell        
445
446 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
447 # if it is not already there
448 create_ld_local:
449         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
450                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
451                 ldconfig; \
452         fi;
453
454 # vim:noet:sw=4:ts=4: