]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
LP#1162907: install RPC::XML as Evergreen dependency
[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 (squeeze), Ubuntu (10.04), Ubuntu (12.04) and
8 # Fedora (16 and 17).
9 #
10 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
11 #
12 # usage:
13 #       make -f Makefile.install debian-squeeze
14 #       - or -
15 #       make -f Makefile.install ubuntu-lucid
16 #       - or -
17 #       make -f Makefile.install ubuntu-precise
18 #       - or -
19 #       make -f Makefile.install fedora
20 #
21 # ---------------------------------------------------------------------
22  
23 # Make any assumptions about the shell being used explicit
24 SHELL=/bin/bash 
25
26 LIBJS=js-1.7.0
27 LIBJS_PERL=JavaScript-SpiderMonkey-0.21
28 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
29 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
30 # used for installing libjs lib and header files
31 JS_INSTALL_PREFIX=/usr/
32
33 LIBNET_Z3950_SIMPLESERVER=Net-Z3950-SimpleServer-1.15
34 LIBNET_Z3950_SIMPLESERVER_URL=http://ftp.indexdata.dk/pub/simpleserver/$(LIBNET_Z3950_SIMPLESERVER)
35
36 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
37 # the open-ils.org site now for ease of direct linking
38 LIBDBI=libdbi-0.8.3
39 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
40 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
41
42 # We need a recent version of Yaz
43 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
44 YAZ=yaz-4.2.32
45 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
46
47 APT_TOOL=aptitude -yq
48 APT_SAFE_TOOL=aptitude -P
49 APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq
50
51 # Fedora?
52 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
53
54 # Fedora 64-bit?
55 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
56
57 # Debian dependencies
58 DEBS =  \
59         apache2-prefork-dev\
60         aspell\
61         aspell-en\
62         libbusiness-creditcard-perl\
63         libbusiness-onlinepayment-authorizenet-perl\
64         libbusiness-onlinepayment-perl\
65         libdatetime-format-builder-perl\
66         libdatetime-format-iso8601-perl\
67         libdatetime-format-mail-perl\
68         libdatetime-perl\
69         libdatetime-timezone-perl\
70         libdatetime-set-perl\
71         libdbd-pg-perl\
72         libemail-send-perl\
73         libemail-simple-perl\
74         libgd-graph3d-perl\
75         liblog-log4perl-perl\
76         libmarc-record-perl\
77         libncurses5-dev\
78         libnet-ldap-perl \
79         libnet-server-perl\
80         libnet-ssh2-perl\
81         libnspr4-dev\
82         libole-storage-lite-perl\
83         libspreadsheet-writeexcel-perl\
84         libssh2-1-dev\
85         libtext-aspell-perl\
86         libtext-csv-perl\
87         libuniversal-require-perl\
88         libnet-ip-perl\
89         liblocale-maketext-lexicon-perl\
90         libunix-syslog-perl
91
92 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
93 EXTRA_DEBS = \
94         libbusiness-isbn-perl\
95         libbusiness-isbn-data-perl\
96         libmarc-charset-perl \
97         libmarc-xml-perl \
98         libnet-z3950-zoom-perl \
99         libyaz-dev \
100         yaz
101
102 EXTRA_DEBS_SQUEEZE = \
103     libparent-perl \
104     libuuid-tiny-perl
105
106 EXTRA_DEBS_LUCID = \
107     libparent-perl
108
109 EXTRA_DEBS_PRECISE = \
110     libdbi-dev \
111     libdbd-pgsql \
112     libmarc-record-perl \
113     libbusiness-edi-perl \
114     liblibrary-callnumber-lc-perl \
115     libsru-perl \
116     libnet-z3950-simple2zoom-perl \
117     libuuid-tiny-perl \
118     libnet-https-any-perl \
119     librpc-xml-perl
120
121 FEDORA_RPMS = \
122         aspell \
123         aspell-en \
124         libdbi \
125         libdbi-dbd-pgsql \
126         libdbi-devel \
127         libssh2-devel \
128         libyaz \
129         libyaz-devel \
130         mingw32-nsiswrapper \
131         mod_ssl \
132         ncurses-devel \
133         ncurses-libs \
134         perl-parent \
135         perl-Business-CreditCard \
136         perl-Business-ISBN \
137         perl-Business-ISBN-Data \
138         perl-CPAN \
139         perl-DBD-Pg \
140         perl-Email-Send \
141         perl-Email-Simple \
142         perl-GDGraph3d \
143         perl-JSON-XS \
144         perl-LDAP \
145         perl-Library-CallNumber-LC \
146         perl-Locale-Codes \
147         perl-MARC-Charset \
148         perl-MARC-Record \
149         perl-Net-IP \
150         perl-Net-SSH2 \
151         perl-OLE-Storage_Lite \
152         perl-RPC-XML \
153         perl-Spreadsheet-WriteExcel \
154         perl-Text-Aspell \
155         perl-Text-CSV \
156         perl-Text-CSV_XS \
157         perl-XML-Writer \
158         postgresql-devel \
159         readline-devel \
160         tcp_wrappers-devel \
161         wget \
162         yaz
163
164 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
165 # Should be fixed in 3.22
166 # MARC::Record 2.0.1+ is required but only 2.0.0 is packaged
167 FEDORA_CPAN = \
168         Business::OnlinePayment \
169         Business::OnlinePayment::AuthorizeNet \
170         Business::OnlinePayment::PayPal \
171         MARC::File::XML \
172         UUID::Tiny
173
174 PGSQL_90_RPMS = \
175         postgresql90 \
176         postgresql90-contrib \
177         postgresql90-devel \
178         postgresql90-libs \
179         postgresql90-plperl \
180         postgresql90-server
181
182 PGSQL_FEDORA_RPMS = \
183         postgresql \
184         postgresql-contrib \
185         postgresql-libs \
186         postgresql-plperl \
187         postgresql-server
188
189 PGSQL_CLIENT_DEBS_90 = \
190         libpq5 \
191         libpq-dev \
192         postgresql-client-9.0
193
194 PGSQL_CLIENT_DEBS_91 = \
195         libpq5 \
196         libpq-dev \
197         postgresql-client-9.1
198
199 PGSQL_SERVER_DEBS_90 = \
200         postgresql-9.0 \
201         postgresql-contrib-9.0 \
202         postgresql-plperl-9.0 \
203         postgresql-server-dev-9.0
204
205 PGSQL_SERVER_DEBS_91 = \
206         postgresql-9.1 \
207         postgresql-contrib-9.1 \
208         postgresql-plperl-9.1 \
209         postgresql-server-dev-9.1
210
211 DEB_APACHE_MODS = \
212     expires\
213     include\
214     proxy\
215     proxy_http\
216     rewrite
217
218 DEB_APACHE_DISMODS = \
219     deflate
220
221 # Chronically unpackaged CPAN modules
222 CPAN_MODULES = \
223         Business::OnlinePayment::PayPal \
224         Library::CallNumber::LC \
225         Net::Z3950::Simple2ZOOM \
226         Template::Plugin::POSIX \
227         SRU \
228         Rose::URI
229
230 # More chronically unpackaged CPAN modules (available in Squeeze though)
231 CPAN_MODULES_MORE = \
232     Business::CreditCard::Object \
233     MARC::Record \
234     Net::SSH2 \
235     UUID::Tiny
236
237 # Are we sure most distros don't come with an acceptable version of Safe.pm?
238 CPAN_MODULES_SAFE = \
239         Safe
240
241 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
242 CPAN_MODULES_MARC = \
243         Business::ISBN \
244         Business::ISBN::Data \
245         MARC::Charset \
246         MARC::File::XML \
247         Net::Z3950::ZOOM
248
249 CPAN_MODULES_MARC_RECORD = \
250         MARC::Record
251
252 CPAN_MODULES_FORCE = \
253         Class::DBI::Frozen::301
254
255 # Debian Squeeze needs the following additional CPAN modules.
256 CPAN_MODULES_SQUEEZE = \
257         RPC::XML
258
259 # Lucid Lynx needs the following additional CPAN modules.
260 CPAN_MODULES_LUCID = \
261     Rose::URI \
262     RPC::XML
263
264 # Precise Pangolin needs the following CPAN modules. All others are
265 # available as debs.
266 CPAN_MODULES_PRECISE = \
267     Business::CreditCard::Object \
268     Business::OnlinePayment::PayPal \
269     Template::Plugin::POSIX \
270     Rose::URI
271
272 # ----------------------------------------------------------------------------
273
274 all: 
275         @echo "please specify an OS" && exit 0
276
277 # these should be the same for any distro
278 install: install_cpan install_js_sm install_cpan_force
279
280 fedora: install_fedora_rpms install_cpan_fedora install_cpan_marc install
281
282 debian-squeeze: squeeze generic_debian
283 squeeze: install_pgsql_client_backport_debs_91  install_extra_debs_squeeze install_cpan_squeeze
284 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
285
286 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
287 ubuntu-lucid: lucid generic_ubuntu
288 lucid: install_pgsql_client_debs_90 install_extra_debs_lucid \
289        install_cpan_marc_record install_yaz install_cpan_more \
290        install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
291        install_libdbi
292
293 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
294 ubuntu-precise: precise generic_ubuntu
295 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
296          install_cpan_precise install_js_sm install_cpan_force
297
298 # We don't do the "install" target on generic_ubuntu because newer
299 # Ubuntu releases, like newer Debian releases, include packages for
300 # many of those prerequisites.
301 generic_ubuntu: install_debs debian_sys_config
302
303 # - COMMON TARGETS ---------------------------------------------------------
304
305 # Install the CPAN modules
306 install_cpan: install_net_z3950_simpleserver
307         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
308
309 install_cpan_more: 
310         for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
311
312 # Install the CPAN modules for MARC functionality
313 install_cpan_marc: install_cpan_marc_record
314         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
315
316 install_cpan_marc_record:
317         for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
318
319 install_cpan_force:
320         for m in $(CPAN_MODULES_FORCE); do \
321                 echo "force install $$m" | perl -MCPAN -e shell ;\
322         done
323
324 # Install the Safe Perl module
325 # Is this really unpackaged everywhere except for Fedora?
326 install_cpan_safe: 
327         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
328
329 # Install the CPAN modules for Fedora
330 install_cpan_fedora: 
331         for m in $(FEDORA_CPAN); do \
332                 echo "force install $$m" | perl -MCPAN -e shell;\
333         done
334
335 # Install the CPAN modules needed for Squeeze
336 install_cpan_squeeze:
337         for m in $(CPAN_MODULES_SQUEEZE); do perl -MCPAN -e "install \"$$m\";"; done
338
339 # Install the CPAN modules needed for Lucid
340 install_cpan_lucid:
341         for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
342
343 # Install the CPAN modules needed for Precise
344 install_cpan_precise:
345         for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
346
347 # Install a known working version of YAZ
348 install_yaz:    
349         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
350         tar xzf $(YAZ).tar.gz
351         cd $(YAZ) && ./configure && make && make install && ldconfig
352
353 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
354 install_js_sm: install_libjs install_spidermonkey
355
356 install_libjs: 
357         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
358         tar -zxf $(LIBJS).tar.gz
359         cd js/src/ && JS_DIST=/usr make -f Makefile.ref
360         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
361         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
362         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
363         if [ ! -z $(FEDORA_64) ]; then \
364                 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
365                 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
366         else \
367                 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
368                 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
369         fi;
370         ldconfig
371
372 install_spidermonkey:
373         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
374         tar -zxf $(LIBJS_PERL).tar.gz
375         if [ ! -z $(FEDORA_64) ]; then \
376                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
377         fi;
378         if [ ! -z $(FEDORA) ]; then \
379                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
380         fi;
381         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
382
383 install_net_z3950_simpleserver:
384         if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
385         tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
386         cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
387
388 # On Ubuntu and possibly Debian, the libdbi0 package prevents the 
389 # compiled-from-source version from being used and breaks the install.
390 # This package might get installed depending on the install-time choices
391 # for the distro. Test for its existence; if it's there, throw an error
392 # message and exit.
393 test_for_libdbi_pkg:
394                 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
395                                 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
396                                 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
397                                 echo "*** to successfully install Evergreen."; \
398                                 echo; \
399                                 echo "*** Note: this may break other applications on your system."; \
400                                 exit 0; \
401                 fi;
402
403 # Install libdbi and the postgres drivers
404 install_libdbi:
405         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
406         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
407         tar -zxf $(LIBDBI).tar.gz
408         tar -zxf $(LIBDBI_DRIVERS).tar.gz
409         cd $(LIBDBI) && ./configure --disable-docs && make all install
410         cd $(LIBDBI_DRIVERS) && ./configure  \
411                 --disable-docs --with-pgsql --enable-libdbi && make all install  
412
413 clean:
414         make -C $(LIBDBI) clean
415         make -C $(LIBDBI_DRIVERS) clean
416         make -C $(LIBJS_PERL) clean
417         make -f Makefile.ref -C js/src/ clean
418
419
420 # ------------------------------------------------------------------
421 # - DEBIAN ---------------------------------------------------------
422
423 debian_sys_config: 
424         # link the apache modules in
425         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
426         # keep the bad apache modules away
427         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
428         # refresh the dynamic library cache
429         ldconfig
430
431 # Install the debian-specific dependencies
432 install_debs:
433         $(APT_TOOL) install $(DEBS)
434
435 install_pgsql_client_debs_90:
436         @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
437                 then \
438                 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
439                 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
440                 "conflict with the 9.0 versions - so remove them, install the pinned" \
441                 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
442                 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
443                 "databases that might currently exist on this machine." && \
444                 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
445         fi
446         $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
447         $(APT_TOOL) install apache2-prefork-dev
448
449 install_pgsql_server_debs_90:
450         $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
451
452 install_pgsql_client_backport_debs_91:
453         @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
454                 then \
455                 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
456                 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
457                 "conflict with the 9.0 versions - so remove them, install the pinned" \
458                 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
459                 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
460                 "databases that might currently exist on this machine." && \
461                 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
462         fi
463         $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
464         $(APT_TOOL) install apache2-prefork-dev
465
466 install_pgsql_client_debs_91:
467         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
468
469 install_pgsql_server_debs_91:
470         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
471
472 install_pgsql_server_backport_debs_91:
473         $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
474
475 # Install the debian-specific dependencies for more modern distros
476 install_extra_debs_squeeze: install_extra_debs
477         $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
478
479 # Install dependencies for Ubuntu 10.04:
480 install_extra_debs_lucid: install_extra_debs
481         $(APT_TOOL) install $(EXTRA_DEBS_LUCID)
482
483 # Install dependencies for Ubuntu 12.04:
484 install_extra_debs_precise: install_extra_debs
485         $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
486
487 install_extra_debs:
488         $(APT_TOOL) install $(EXTRA_DEBS)
489
490 # ------------------------------------------------------------------
491
492 # FEDORA
493 install_fedora_rpms:
494         yum -y update
495         yum -y install $(FEDORA_RPMS)
496
497 install_fedora_pgsql_server:
498         yum -y install $(PGSQL_FEDORA_RPMS)
499
500 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
501 # if it is not already there
502 create_ld_local:
503         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
504                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
505                 ldconfig; \
506         fi;
507
508 # vim:noet:sw=4:ts=4: