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