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