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