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