]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Stop requiring unneeded/absent RPC::XML::Function
[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         libparent-perl \
84         libreadline5-dev\
85         libspreadsheet-writeexcel-perl\
86         libssh2-1-dev\
87         libtext-aspell-perl\
88         libtext-csv-perl\
89         libuniversal-require-perl\
90         libnet-ip-perl\
91         liblocale-maketext-lexicon-perl\
92         libunix-syslog-perl
93
94 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
95 EXTRA_DEBS = \
96         libbusiness-isbn-perl\
97         libbusiness-isbn-data-perl\
98         libmarc-charset-perl \
99         libmarc-xml-perl \
100         libnet-z3950-zoom-perl \
101         libyaz-dev \
102         yaz
103
104 EXTRA_DEBS_SQUEEZE = \
105     libuuid-tiny-perl
106
107 EXTRA_DEBS_PRECISE = \
108     libdbi-dev \
109     libdbd-pgsql \
110     libmarc-record-perl \
111     libbusiness-edi-perl \
112     liblibrary-callnumber-lc-perl \
113     libsru-perl \
114     libnet-z3950-simple2zoom-perl \
115     libuuid-tiny-perl \
116     libnet-https-any-perl
117
118 FEDORA_RPMS = \
119         aspell \
120         aspell-en \
121         libdbi \
122         libdbi-dbd-pgsql \
123         libdbi-devel \
124         libssh2-devel \
125         libyaz \
126         libyaz-devel \
127         mingw32-nsiswrapper \
128         mod_ssl \
129         ncurses-devel \
130         ncurses-libs \
131         perl-parent \
132         perl-Business-CreditCard \
133         perl-Business-ISBN \
134         perl-Business-ISBN-Data \
135         perl-CPAN \
136         perl-DBD-Pg \
137         perl-Email-Send \
138         perl-Email-Simple \
139         perl-GDGraph3d \
140         perl-JSON-XS \
141         perl-LDAP \
142         perl-Library-CallNumber-LC \
143         perl-Locale-Codes \
144         perl-MARC-Charset \
145         perl-MARC-Record \
146         perl-Net-IP \
147         perl-Net-SSH2 \
148         perl-OLE-Storage_Lite \
149         perl-Spreadsheet-WriteExcel \
150         perl-Text-Aspell \
151         perl-Text-CSV \
152         perl-Text-CSV_XS \
153         perl-XML-Writer \
154         postgresql-devel \
155         readline-devel \
156         tcp_wrappers-devel \
157         wget \
158         yaz
159
160 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
161 # Should be fixed in 3.22
162 # MARC::Record 2.0.1+ is required but only 2.0.0 is packaged
163 FEDORA_CPAN = \
164         Business::OnlinePayment \
165         Business::OnlinePayment::AuthorizeNet \
166         Business::OnlinePayment::PayPal \
167         MARC::File::XML \
168         UUID::Tiny
169
170 PGSQL_90_RPMS = \
171         postgresql90 \
172         postgresql90-contrib \
173         postgresql90-devel \
174         postgresql90-libs \
175         postgresql90-plperl \
176         postgresql90-server
177
178 PGSQL_FEDORA_RPMS = \
179         postgresql \
180         postgresql-contrib \
181         postgresql-libs \
182         postgresql-plperl \
183         postgresql-server
184
185 PGSQL_CLIENT_DEBS_90 = \
186         libpq5 \
187         libpq-dev \
188         postgresql-client-9.0
189
190 PGSQL_CLIENT_DEBS_91 = \
191         libpq5 \
192         libpq-dev \
193         postgresql-client-9.1
194
195 PGSQL_SERVER_DEBS_90 = \
196         postgresql-9.0 \
197         postgresql-contrib-9.0 \
198         postgresql-plperl-9.0 \
199         postgresql-server-dev-9.0
200
201 PGSQL_SERVER_DEBS_91 = \
202         postgresql-9.1 \
203         postgresql-contrib-9.1 \
204         postgresql-plperl-9.1 \
205         postgresql-server-dev-9.1
206
207 DEB_APACHE_MODS = \
208     expires\
209     include\
210     proxy\
211     proxy_http\
212     rewrite
213
214 DEB_APACHE_DISMODS = \
215     deflate
216
217 # Chronically unpackaged CPAN modules
218 CPAN_MODULES = \
219         Business::OnlinePayment::PayPal \
220         Library::CallNumber::LC \
221         Net::Z3950::Simple2ZOOM \
222         Template::Plugin::POSIX \
223         SRU \
224         Rose::URI
225
226 # More chronically unpackaged CPAN modules (available in Squeeze though)
227 CPAN_MODULES_MORE = \
228     Business::CreditCard::Object \
229     MARC::Record \
230     Net::SSH2 \
231     UUID::Tiny
232
233 # Are we sure most distros don't come with an acceptable version of Safe.pm?
234 CPAN_MODULES_SAFE = \
235         Safe
236
237 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
238 CPAN_MODULES_MARC = \
239         Business::ISBN \
240         Business::ISBN::Data \
241         MARC::Charset \
242         MARC::File::XML \
243         Net::Z3950::ZOOM
244
245 CPAN_MODULES_MARC_RECORD = \
246         MARC::Record
247
248 CPAN_MODULES_FORCE = \
249         Class::DBI::Frozen::301
250
251 # Lucid Lynx needs the following additional CPAN modules.
252 CPAN_MODULES_LUCID = \
253     Rose::URI
254
255 # Precise Pangolin needs the following CPAN modules. All others are
256 # available as debs.
257 CPAN_MODULES_PRECISE = \
258     Business::CreditCard::Object \
259     Business::OnlinePayment::PayPal \
260     Template::Plugin::POSIX \
261     Rose::URI
262
263 # ----------------------------------------------------------------------------
264
265 all: 
266         @echo "please specify an OS" && exit 0
267
268 # these should be the same for any distro
269 install: install_cpan install_js_sm install_cpan_force
270
271 fedora: install_fedora_rpms install_cpan_fedora install_cpan_marc install
272
273 debian-squeeze: squeeze generic_debian
274 squeeze: install_pgsql_client_backport_debs_91  install_extra_debs_squeeze
275 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
276
277 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
278 ubuntu-lucid: lucid generic_ubuntu
279 lucid: install_pgsql_client_debs_90 install_extra_debs \
280        install_cpan_marc_record install_yaz install_cpan_more \
281        install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
282        install_libdbi
283
284 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
285 ubuntu-precise: precise generic_ubuntu
286 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
287          install_cpan_precise install_js_sm install_cpan_force
288
289 # We don't do the "install" target on generic_ubuntu because newer
290 # Ubuntu releases, like newer Debian releases, include packages for
291 # many of those prerequisites.
292 generic_ubuntu: install_debs debian_sys_config
293
294 # - COMMON TARGETS ---------------------------------------------------------
295
296 # Install the CPAN modules
297 install_cpan: install_net_z3950_simpleserver
298         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
299
300 install_cpan_more: 
301         for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
302
303 # Install the CPAN modules for MARC functionality
304 install_cpan_marc: install_cpan_marc_record
305         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
306
307 install_cpan_marc_record:
308         for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
309
310 install_cpan_force:
311         for m in $(CPAN_MODULES_FORCE); do \
312                 echo "force install $$m" | perl -MCPAN -e shell ;\
313         done
314
315 # Install the Safe Perl module
316 # Is this really unpackaged everywhere except for Fedora?
317 install_cpan_safe: 
318         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
319
320 # Install the CPAN modules for Fedora
321 install_cpan_fedora: 
322         for m in $(FEDORA_CPAN); do \
323                 echo "force install $$m" | perl -MCPAN -e shell;\
324         done
325
326 # Install the CPAN modules needed for Lucid
327 install_cpan_lucid:
328         for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
329
330 # Install the CPAN modules needed for Precise
331 install_cpan_precise:
332         for m in $(CPAN_MODULES_PRECISE); 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/ && JS_DIST=/usr 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         if [ ! -z $(FEDORA_64) ]; then \
351                 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
352                 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
353         else \
354                 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
355                 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
356         fi;
357         ldconfig
358
359 install_spidermonkey:
360         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
361         tar -zxf $(LIBJS_PERL).tar.gz
362         if [ ! -z $(FEDORA_64) ]; then \
363                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
364         fi;
365         if [ ! -z $(FEDORA) ]; then \
366                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
367         fi;
368         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
369
370 install_net_z3950_simpleserver:
371         if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
372         tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
373         cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
374
375 # On Ubuntu and possibly Debian, the libdbi0 package prevents the 
376 # compiled-from-source version from being used and breaks the install.
377 # This package might get installed depending on the install-time choices
378 # for the distro. Test for its existence; if it's there, throw an error
379 # message and exit.
380 test_for_libdbi_pkg:
381                 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
382                                 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
383                                 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
384                                 echo "*** to successfully install Evergreen."; \
385                                 echo; \
386                                 echo "*** Note: this may break other applications on your system."; \
387                                 exit 0; \
388                 fi;
389
390 # Install libdbi and the postgres drivers
391 install_libdbi:
392         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
393         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
394         tar -zxf $(LIBDBI).tar.gz
395         tar -zxf $(LIBDBI_DRIVERS).tar.gz
396         cd $(LIBDBI) && ./configure --disable-docs && make all install
397         cd $(LIBDBI_DRIVERS) && ./configure  \
398                 --disable-docs --with-pgsql --enable-libdbi && make all install  
399
400 clean:
401         make -C $(LIBDBI) clean
402         make -C $(LIBDBI_DRIVERS) clean
403         make -C $(LIBJS_PERL) clean
404         make -f Makefile.ref -C js/src/ clean
405
406
407 # ------------------------------------------------------------------
408 # - DEBIAN ---------------------------------------------------------
409
410 debian_sys_config: 
411         # link the apache modules in
412         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
413         # keep the bad apache modules away
414         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
415         # refresh the dynamic library cache
416         ldconfig
417
418 # Install the debian-specific dependencies
419 install_debs:
420         $(APT_TOOL) install $(DEBS)
421
422 install_pgsql_client_debs_90:
423         @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
424                 then \
425                 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
426                 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
427                 "conflict with the 9.0 versions - so remove them, install the pinned" \
428                 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
429                 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
430                 "databases that might currently exist on this machine." && \
431                 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
432         fi
433         $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
434         $(APT_TOOL) install apache2-prefork-dev
435
436 install_pgsql_server_debs_90:
437         $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
438
439 install_pgsql_client_backport_debs_91:
440         @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
441                 then \
442                 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
443                 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
444                 "conflict with the 9.0 versions - so remove them, install the pinned" \
445                 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
446                 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
447                 "databases that might currently exist on this machine." && \
448                 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
449         fi
450         $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
451         $(APT_TOOL) install apache2-prefork-dev
452
453 install_pgsql_client_debs_91:
454         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
455
456 install_pgsql_server_debs_91:
457         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
458
459 install_pgsql_server_backport_debs_91:
460         $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
461
462 # Install the debian-specific dependencies for more modern distros
463 install_extra_debs_squeeze: install_extra_debs
464         $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
465
466 # Install dependencies for Ubuntu 12.04:
467 install_extra_debs_precise: install_extra_debs
468         $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
469
470 install_extra_debs:
471         $(APT_TOOL) install $(EXTRA_DEBS)
472
473 # ------------------------------------------------------------------
474
475 # FEDORA
476 install_fedora_rpms:
477         yum -y update
478         yum -y install $(FEDORA_RPMS)
479
480 install_fedora_pgsql_server:
481         yum -y install $(PGSQL_FEDORA_RPMS)
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: