]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
First stab at Fedora 13 support in prerequisite installer
[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         libssh2-devel \
167         libyaz \
168         libyaz-devel \
169         ncurses-devel \
170         ncurses-libs \
171         perl-Business-CreditCard \
172         perl-Class-DBI-Pg \
173         perl-Email-Send \
174         perl-GDGraph3d \
175         perl-MARC-Record \
176         perl-Net-SSH2 \
177         perl-OLE-Storage_Lite \
178         perl-Spreadsheet-WriteExcel \
179         perl-Text-Aspell \
180         perl-Text-CSV \
181         perl-Text-CSV_XS \
182         perl-XML-Writer \
183         postgresql-devel \
184         readline-devel \
185         tcp_wrappers-devel \
186         yaz
187
188 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
189 # Should be fixed in 3.22
190 FEDORA_13_CPAN = \
191         Business::OnlinePayment \
192         Business::OnlinePayment::AuthorizeNet
193
194 PGSQL_84_RPMS = \
195         postgresql-8.4* \
196         postgresql-contrib-8.4* \
197         postgresql-devel-8.4* \
198         postgresql-plp*-8.4* \
199         postgresql-server-8.4*
200
201 PGSQL_CLIENT_DEBS_81 = \
202         postgresql-client-8.1
203
204 PGSQL_SERVER_DEBS_81 = \
205         postgresql-8.1 \
206         postgresql-contrib-8.1 \
207         postgresql-plperl-8.1 \
208         postgresql-server-dev-8.1
209
210 PGSQL_CLIENT_DEBS_82 = \
211         postgresql-client
212
213 PGSQL_SERVER_DEBS_82 = \
214         postgresql \
215         postgresql-contrib-8.2 \
216         postgresql-plperl-8.2 \
217         postgresql-server-dev-8.2
218
219 PGSQL_CLIENT_DEBS_83 = \
220         postgresql-client
221
222 PGSQL_SERVER_DEBS_83 = \
223         postgresql \
224         postgresql-contrib-8.3 \
225         postgresql-plperl-8.3 \
226         postgresql-server-dev-8.3
227
228 PGSQL_CLIENT_DEBS_84 = \
229         postgresql-client
230
231 PGSQL_SERVER_DEBS_84 = \
232         postgresql \
233         postgresql-contrib-8.4 \
234         postgresql-plperl-8.4 \
235         postgresql-server-dev-8.4
236
237 GENTOOS = \
238     yaz\
239     aspell-en\
240     dev-db/libpq\
241     dev-db/postgresql\
242     dev-perl/Email-Send\
243     dev-perl/DateTime\
244     dev-perl/DateTime-TimeZone\
245     dev-perl/DBD-Pg\
246     dev-perl/GD-Graph3d\
247     dev-perl/Text-Aspell\
248     dev-perl/Template-Toolkit\
249     dev-perl/Text-CSV_XS\
250     dev-perl/Spreadsheet-WriteExcel
251
252 GENTOO_PERL = \
253     MARC::Record \
254     Net::Z3950::ZOOM \
255     Text::CSV
256
257 DEB_APACHE_MODS = \
258     expires\
259     include\
260     proxy\
261     proxy_http\
262     rewrite
263
264 DEB_APACHE_DISMODS = \
265     deflate
266
267 # Chronically unpackaged CPAN modules
268 CPAN_MODULES = \
269     Business::CreditCard::Object \
270     Business::EDI \
271     Net::uFTP \
272     Net::Z3950::Simple2ZOOM \
273     UUID::Tiny \
274     SRU
275
276 # Are we sure most distros don't come with an acceptable version of Safe.pm?
277 CPAN_MODULES_SAFE = \
278         Safe
279
280 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
281 CPAN_MODULES_MARC = \
282     MARC::Charset \
283     MARC::File::XML \
284     Net::Z3950::ZOOM
285
286 # ----------------------------------------------------------------------------
287
288 all: 
289         @echo "please specify an OS" && exit 0
290
291 # these should be the same for any distro
292 install: install_cpan install_js_sm install_libdbi 
293
294 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
295 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
296
297 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
298
299 debian-etch: etch generic_debian
300 debian-lenny: lenny generic_debian
301 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
302 lenny: install_pgsql_client_debs_83 install_extra_debs
303 generic_debian:  install_debs install debian_sys_config install_cpan_safe
304
305 gentoo: install_gentoos install_gentoo_perl install
306
307 ubuntu-hardy: hardy generic_ubuntu
308 ubuntu-karmic: karmic generic_ubuntu
309 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
310 karmic: install_pgsql_client_debs_84 install_extra_debs
311 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
312
313 # - COMMON TARGETS ---------------------------------------------------------
314
315 # Install the CPAN modules
316 install_cpan: 
317         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
318
319 # Install the CPAN modules for MARC functionality
320 install_cpan_marc: 
321         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
322
323 # Install the Safe Perl module
324 # Is this really unpackaged everywhere except for Fedora?
325 install_cpan_safe: 
326         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
327
328 # Install the CPAN modules for Fedora 13
329 install_cpan_fedora: 
330         for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
331
332 # Install a known working version of YAZ
333 install_yaz:    
334         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
335         tar xzf $(YAZ).tar.gz
336         cd $(YAZ) && ./configure && make && make install && ldconfig
337
338 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
339 install_js_sm: install_libjs install_spidermonkey
340
341 install_libjs: 
342         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
343         tar -zxf $(LIBJS).tar.gz
344         cd js/src/ && make -f Makefile.ref
345         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
346         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
347         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
348         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
349         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
350
351 install_spidermonkey:
352         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
353         tar -zxf $(LIBJS_PERL).tar.gz
354         if [ ! -z $(FEDORA_64) ]; then \
355                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
356                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
357         fi;
358         cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
359
360
361 # Install libdbi and the postgres drivers
362 install_libdbi:
363         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
364         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
365         tar -zxf $(LIBDBI).tar.gz
366         tar -zxf $(LIBDBI_DRIVERS).tar.gz
367         cd $(LIBDBI) && ./configure --disable-docs && make all install
368         cd $(LIBDBI_DRIVERS) && ./configure  \
369                 --disable-docs --with-pgsql --enable-libdbi && make all install  
370
371
372 clean:
373         make -C $(LIBDBI) clean
374         make -C $(LIBDBI_DRIVERS) clean
375         make -C $(LIBJS_PERL) clean
376         make -f Makefile.ref -C js/src/ clean
377
378
379 # ------------------------------------------------------------------
380 # - DEBIAN ---------------------------------------------------------
381
382 debian_sys_config: 
383         # link the apache modules in
384         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
385         # keep the bad apache modules away
386         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
387         # refresh the dynamic library cache
388         ldconfig
389
390 # Install the debian-specific dependencies
391 install_debs:
392         $(APT_TOOL) install $(DEBS)
393
394 install_pgsql_client_debs_84:
395         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
396
397 install_pgsql_server_debs_84:
398         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
399
400 install_pgsql_client_debs_83:
401         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
402
403 install_pgsql_server_debs_83:
404         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
405
406 install_pgsql_client_debs_82:
407         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
408
409 install_pgsql_server_debs_82:
410         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
411
412 # Etch requires an explicit version to avoid PostgreSQL 7.4
413 install_pgsql_client_debs_81:
414         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
415
416 # Etch requires an explicit version to avoid PostgreSQL 7.4
417 install_pgsql_server_debs_81:
418         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
419
420 # Install the debian-specific dependencies for more modern distros
421 install_extra_debs:
422         $(APT_TOOL) install $(EXTRA_DEBS)
423
424 # Install specific modules required by Ubuntu Hardy and
425 # Debian Etch - see bug 525069
426 install_extra_encode:
427         $(APT_TOOL) install $(EXTRA_ENCODE)
428
429 # ------------------------------------------------------------------
430 # - GENTOO ---------------------------------------------------------
431
432 install_gentoos:
433         emerge -n $(GENTOOS)
434
435 install_gentoo_perl:
436         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
437
438 # ------------------------------------------------------------------
439
440 # FEDORA 13
441 install_fedora_13_rpms:
442         yum -y update
443         yum -y install $(FEDORA_13_RPMS)
444
445 # CENTOS
446 install_centos_rpms:
447         yum -y install $(CENTOS)
448         yum -y update
449         if [ $(LBITS) -eq 64 ]; then \
450                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
451                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
452                 ldconfig ; \
453         fi;
454         if [ $(LBITS) -eq 32 ]; then \
455                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
456                 ldconfig ; \
457         fi;
458
459 install_centos_pgsql:
460         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
461         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
462         rpm -Uvh --force ./$(PGSQL_CENTOS)
463         yum update -y
464         yum -y install $(PGSQL_84_RPMS)
465
466 install_redhat_pgsql:
467         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
468         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
469         rpm -Uvh --force ./$(PGSQL_REDHAT)
470         yum update -y
471         yum -y install $(PGSQL_84_RPMS)
472
473 install_centos_perl:
474         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
475         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
476         echo "force install Scalar::Util" | perl -MCPAN -e shell        
477
478 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
479 # if it is not already there
480 create_ld_local:
481         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
482                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
483                 ldconfig; \
484         fi;
485
486 # vim:noet:sw=4:ts=4: