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