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