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