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