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