]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Merge branch 'opac-tt-poc' of git+ssh://yeti.esilibrary.com/home/evergreen/evergreen...
[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 (lenny/squeeze), Ubuntu (hardy/lucid), and Fedora (13).
8 # Working towards support of CentOS 5 / RHEL 5.
9 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
10 #
11 # usage:
12 #       make -f Makefile.install debian-lenny
13 #       - or -
14 #       make -f Makefile.install debian-squeeze
15 #       - or -
16 #       make -f Makefile.install ubuntu-hardy
17 #       - or -
18 #       make -f Makefile.install ubuntu-lucid
19 #       - or -
20 #       make -f Makefile.install fedora14
21 #       - or -
22 #       make -f Makefile.install centos
23 #       - or -
24 #       make -f Makefile.install rhel
25 #
26 # Notes:
27 #
28 #       This makefile has been tested much more with Debian and Ubuntu than
29 #       Fedora, CentOS, or RHEL.
30 #
31 # ---------------------------------------------------------------------
32  
33 # Make any assumptions about the shell being used explicit
34 SHELL=/bin/bash 
35
36 LIBJS=js-1.7.0
37 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
38 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
39 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
40 # used for installing libjs lib and header files
41 JS_INSTALL_PREFIX=/usr/
42
43 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
44 # the open-ils.org site now for ease of direct linking
45 LIBDBI=libdbi-0.8.3
46 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
47 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
48
49 # We need a recent version of Yaz
50 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
51 YAZ=yaz-3.0.47
52 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
53
54 # Business::OnlinePayment is not packaged on CentOS/RHEL
55 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
56 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
57
58 APT_TOOL=aptitude -yq
59
60 # 64 or 32 bit os?
61 LBITS=$(shell getconf LONG_BIT)
62
63 # Fedora?
64 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
65
66 # Fedora 64-bit?
67 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
68
69 #RHEL/Centos PGSQL 
70 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
71 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
72 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm       
73
74 # Debian dependencies
75 DEBS =  \
76         apache2-prefork-dev\
77         aspell\
78         aspell-en\
79         libbusiness-creditcard-perl\
80         libbusiness-onlinepayment-authorizenet-perl\
81         libbusiness-onlinepayment-perl\
82         libdatetime-format-builder-perl\
83         libdatetime-format-iso8601-perl\
84         libdatetime-format-mail-perl\
85         libdatetime-perl\
86         libdatetime-timezone-perl\
87         libdatetime-set-perl\
88         libdbd-pg-perl\
89         libemail-send-perl\
90         libemail-simple-perl\
91         libgd-graph3d-perl\
92         liblog-log4perl-perl\
93         libmarc-record-perl\
94         libncurses5-dev\
95         libnet-server-perl\
96         libnet-ssh2-perl\
97         libnspr4-dev\
98         libole-storage-lite-perl\
99         libparent-perl \
100         libpq-dev\
101         libreadline5-dev\
102         libspreadsheet-writeexcel-perl\
103         libssh2-1-dev\
104         libtext-aspell-perl\
105         libtext-csv-perl\
106         libuniversal-require-perl\
107         libnet-ip-perl\
108         libunix-syslog-perl
109
110 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
111 EXTRA_DEBS = \
112         libbusiness-isbn-perl\
113         libbusiness-isbn-data-perl\
114         libmarc-charset-perl \
115         libmarc-xml-perl \
116         libnet-z3950-zoom-perl \
117         libyaz-dev \
118         yaz
119
120 EXTRA_DEBS_SQUEEZE = \
121     libuuid-tiny-perl
122
123 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
124 # > 2.12 - see bug 525069.
125 EXTRA_ENCODE = \
126         libencode-perl
127
128 CENTOS = \
129         aspell \
130         aspell-devel \
131         aspell-en \
132         gd-devel \
133         libssh2-devel \
134         openssl-devel \
135         perl-Business-CreditCard \
136         perl-Business-ISBN \
137         perl-Business-ISBN-Data \
138         perl-Business-OnlinePayment \
139         perl-Class-Data-Inheritable \
140         perl-DateTime-Format-Builder \
141         perl-DateTime-Format-Strptime \
142         perl-Ima-DBI \
143         perl-DBD-Pg \
144         perl-GD-Graph3d \
145         perl-IO-stringy \
146         perl-Spreadsheet-WriteExcel \
147         perl-Text-Aspell \
148         perl-Text-CSV
149
150 CENTOS_PERL = \
151         Encode \
152         DBIx::ContextualFetch \
153         Getopt::Long \
154         Net::SSH2 \
155         Net::XMPP \
156         Net::Z3950::ZOOM
157
158 FEDORA_13_RPMS = \
159         aspell \
160         aspell-en \
161         libdbi \
162         libdbi-dbd-pgsql \
163         libdbi-devel \
164         libssh2-devel \
165         libyaz \
166         libyaz-devel \
167         mod_ssl \
168         ncurses-devel \
169         ncurses-libs \
170         perl-parent \
171         perl-Business-CreditCard \
172         perl-Business-ISBN \
173         perl-Business-ISBN-Data \
174         perl-DBD-Pg \
175         perl-Email-Send \
176         perl-Email-Simple \
177         perl-GDGraph3d \
178         perl-Net-IP \
179         perl-Net-SSH2 \
180         perl-OLE-Storage_Lite \
181         perl-Spreadsheet-WriteExcel \
182         perl-Text-Aspell \
183         perl-Text-CSV \
184         perl-Text-CSV_XS \
185         perl-XML-Writer \
186         postgresql-devel \
187         readline-devel \
188         tcp_wrappers-devel \
189         wget \
190         yaz
191
192 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
193 # Should be fixed in 3.22
194 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
195 FEDORA_13_CPAN = \
196         Business::OnlinePayment \
197         Business::OnlinePayment::AuthorizeNet \
198         MARC::Record \
199         UUID::Tiny
200
201 PGSQL_84_RPMS = \
202         postgresql-8.4* \
203         postgresql-contrib-8.4* \
204         postgresql-devel-8.4* \
205         postgresql-plpe*-8.4* \
206         postgresql-server-8.4*
207
208 PGSQL_CLIENT_DEBS_82 = \
209         postgresql-client
210
211 PGSQL_CLIENT_DEBS_83 = \
212         postgresql-client
213
214 PGSQL_CLIENT_DEBS_84 = \
215         postgresql-client-8.4
216
217 PGSQL_SERVER_DEBS_84 = \
218         postgresql-8.4 \
219         postgresql-contrib-8.4 \
220         postgresql-plperl-8.4 \
221         postgresql-server-dev-8.4
222
223 DEB_APACHE_MODS = \
224     expires\
225     include\
226     proxy\
227     proxy_http\
228     rewrite
229
230 DEB_APACHE_DISMODS = \
231     deflate
232
233 # Chronically unpackaged CPAN modules
234 CPAN_MODULES = \
235     Business::EDI \
236     Library::CallNumber::LC \
237     Net::Z3950::Simple2ZOOM \
238     SRU
239
240 # More chronically unpackaged CPAN modules (available in Squeeze though)
241 CPAN_MODULES_MORE = \
242     Business::CreditCard::Object \
243     MARC::Record \
244     Net::SSH2 \
245     UUID::Tiny
246
247 # Are we sure most distros don't come with an acceptable version of Safe.pm?
248 CPAN_MODULES_SAFE = \
249         Safe
250
251 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
252 CPAN_MODULES_MARC = \
253         Business::ISBN \
254         Business::ISBN::Data \
255     MARC::Charset \
256     MARC::File::XML \
257     Net::Z3950::ZOOM
258
259 CPAN_MODULES_FORCE = \
260         Class::DBI::Frozen::301
261
262 # ----------------------------------------------------------------------------
263
264 all: 
265         @echo "please specify an OS" && exit 0
266
267 # these should be the same for any distro
268 install: install_cpan install_js_sm install_libdbi install_cpan_force
269
270 centos: install_centos_pgsql centos_like
271 rhel: install_redhat_pgsql centos_like
272 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force
273
274 fedora13: install_fedora_13_rpms install_cpan install_cpan_fedora install_cpan_marc install_js_sm install_cpan_force
275 fedora14: fedora13
276
277 debian-lenny: lenny generic_debian install_cpan_more install_cpan_safe
278 debian-squeeze: squeeze generic_debian
279 lenny: install_pgsql_client_debs_83 install_extra_debs
280 squeeze: install_pgsql_client_debs_84  install_extra_debs_squeeze
281 generic_debian:  install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_force
282
283 ubuntu-hardy: hardy generic_ubuntu
284 ubuntu-lucid: lucid generic_ubuntu
285 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
286 lucid: install_pgsql_client_debs_84 install_extra_debs
287 generic_ubuntu: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force
288
289 # - COMMON TARGETS ---------------------------------------------------------
290
291 # Install the CPAN modules
292 install_cpan: 
293         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
294
295 install_cpan_more: 
296         for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
297
298 # Install the CPAN modules for MARC functionality
299 install_cpan_marc: 
300         for m in $(CPAN_MODULES_MARC); 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 13
313 install_cpan_fedora: 
314         for m in $(FEDORA_13_CPAN); do \
315                 echo "force install $$m" | perl -MCPAN -e shell;\
316         done
317
318 # Install a known working version of YAZ
319 install_yaz:    
320         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
321         tar xzf $(YAZ).tar.gz
322         cd $(YAZ) && ./configure && make && make install && ldconfig
323
324 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
325 install_js_sm: install_libjs install_spidermonkey
326
327 install_libjs: 
328         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
329         tar -zxf $(LIBJS).tar.gz
330         cd js/src/ && JS_DIST=/usr make -f Makefile.ref
331         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
332         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
333         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
334         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
335         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
336
337 install_spidermonkey:
338         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
339         tar -zxf $(LIBJS_PERL).tar.gz
340         if [ ! -z $(FEDORA_64) ]; then \
341                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
342         fi;
343         if [ ! -z $(FEDORA) ]; then \
344                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
345         fi;
346         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
347
348 # On Ubuntu and possibly Debian, the libdbi0 package prevents the 
349 # compiled-from-source version from being used and breaks the install.
350 # This package might get installed depending on the install-time choices
351 # for the distro. Test for its existence; if it's there, throw an error
352 # message and exit.
353 test_for_libdbi_pkg:
354                 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
355                                 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
356                                 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
357                                 echo "*** to successfully install Evergreen."; \
358                                 echo; \
359                                 echo "*** Note: this may break other applications on your system."; \
360                                 exit 0; \
361                 fi;
362
363 # Install libdbi and the postgres drivers
364 install_libdbi:
365         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
366         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
367         tar -zxf $(LIBDBI).tar.gz
368         tar -zxf $(LIBDBI_DRIVERS).tar.gz
369         cd $(LIBDBI) && ./configure --disable-docs && make all install
370         cd $(LIBDBI_DRIVERS) && ./configure  \
371                 --disable-docs --with-pgsql --enable-libdbi && make all install  
372
373 clean:
374         make -C $(LIBDBI) clean
375         make -C $(LIBDBI_DRIVERS) clean
376         make -C $(LIBJS_PERL) clean
377         make -f Makefile.ref -C js/src/ clean
378
379
380 # ------------------------------------------------------------------
381 # - DEBIAN ---------------------------------------------------------
382
383 debian_sys_config: 
384         # link the apache modules in
385         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
386         # keep the bad apache modules away
387         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
388         # refresh the dynamic library cache
389         ldconfig
390
391 # Install the debian-specific dependencies
392 install_debs:
393         $(APT_TOOL) install $(DEBS)
394
395 install_pgsql_client_debs_84:
396         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
397
398 install_pgsql_server_debs_84:
399         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
400
401 install_pgsql_client_debs_83:
402         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
403
404 install_pgsql_client_debs_82:
405         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
406
407 # Install the debian-specific dependencies for more modern distros
408 install_extra_debs_squeeze: install_extra_debs
409         $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
410
411 install_extra_debs:
412         $(APT_TOOL) install $(EXTRA_DEBS)
413
414 # Install specific modules required by Ubuntu Hardy - see bug 525069
415 install_extra_encode:
416         $(APT_TOOL) install $(EXTRA_ENCODE)
417
418 # ------------------------------------------------------------------
419
420 # FEDORA 13
421 install_fedora_13_rpms:
422         yum -y update
423         yum -y install $(FEDORA_13_RPMS)
424
425 install_fedora_13_pgsql_server:
426         yum -y install $(PGSQL_84_RPMS)
427
428 # CENTOS
429 install_centos_rpms:
430         yum -y install $(CENTOS)
431         yum -y update
432         if [ $(LBITS) -eq 64 ]; then \
433                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
434                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
435                 ldconfig ; \
436         fi;
437         if [ $(LBITS) -eq 32 ]; then \
438                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
439                 ldconfig ; \
440         fi;
441
442 install_centos_pgsql:
443         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
444         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
445         rpm -Uvh --force ./$(PGSQL_CENTOS)
446         yum update -y
447         yum -y install $(PGSQL_84_RPMS)
448
449 install_redhat_pgsql:
450         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
451         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
452         rpm -Uvh --force ./$(PGSQL_REDHAT)
453         yum update -y
454         yum -y install $(PGSQL_84_RPMS)
455
456 install_centos_perl:
457         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
458         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
459         echo "force install Scalar::Util" | perl -MCPAN -e shell        
460
461 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
462 # if it is not already there
463 create_ld_local:
464         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
465                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
466                 ldconfig; \
467         fi;
468
469 # vim:noet:sw=4:ts=4: