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