]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Merge branch 'master' of git+ssh://yeti.esilibrary.com/home/evergreen/evergreen-equin...
[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         libunix-syslog-perl
108
109 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
110 EXTRA_DEBS = \
111         libbusiness-isbn-perl\
112         libbusiness-isbn-data-perl\
113         libmarc-charset-perl \
114         libmarc-xml-perl \
115         libnet-z3950-zoom-perl \
116         libyaz-dev \
117         yaz
118
119 EXTRA_DEBS_SQUEEZE = \
120     libuuid-tiny-perl
121
122 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
123 # > 2.12 - see bug 525069.
124 EXTRA_ENCODE = \
125         libencode-perl
126
127 CENTOS = \
128         aspell \
129         aspell-devel \
130         aspell-en \
131         gd-devel \
132         libssh2-devel \
133         openssl-devel \
134         perl-Business-CreditCard \
135         perl-Business-ISBN \
136         perl-Business-ISBN-Data \
137         perl-Business-OnlinePayment \
138         perl-Class-Data-Inheritable \
139         perl-DateTime-Format-Builder \
140         perl-DateTime-Format-Strptime \
141         perl-Ima-DBI \
142         perl-DBD-Pg \
143         perl-GD-Graph3d \
144         perl-IO-stringy \
145         perl-Spreadsheet-WriteExcel \
146         perl-Text-Aspell \
147         perl-Text-CSV
148
149 CENTOS_PERL = \
150         Encode \
151         DBIx::ContextualFetch \
152         Getopt::Long \
153         Net::SSH2 \
154         Net::XMPP \
155         Net::Z3950::ZOOM
156
157 FEDORA_13_RPMS = \
158         aspell \
159         aspell-en \
160         libdbi \
161         libdbi-dbd-pgsql \
162         libdbi-devel \
163         libssh2-devel \
164         libyaz \
165         libyaz-devel \
166         mod_ssl \
167         ncurses-devel \
168         ncurses-libs \
169         perl-parent \
170         perl-Business-CreditCard \
171         perl-Business-ISBN \
172         perl-Business-ISBN-Data \
173         perl-DBD-Pg \
174         perl-Email-Send \
175         perl-Email-Simple \
176         perl-GDGraph3d \
177         perl-Net-SSH2 \
178         perl-OLE-Storage_Lite \
179         perl-Spreadsheet-WriteExcel \
180         perl-Text-Aspell \
181         perl-Text-CSV \
182         perl-Text-CSV_XS \
183         perl-XML-Writer \
184         postgresql-devel \
185         readline-devel \
186         tcp_wrappers-devel \
187         wget \
188         yaz
189
190 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
191 # Should be fixed in 3.22
192 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
193 FEDORA_13_CPAN = \
194         Business::OnlinePayment \
195         Business::OnlinePayment::AuthorizeNet \
196         MARC::Record \
197         UUID::Tiny
198
199 PGSQL_84_RPMS = \
200         postgresql-8.4* \
201         postgresql-contrib-8.4* \
202         postgresql-devel-8.4* \
203         postgresql-plpe*-8.4* \
204         postgresql-server-8.4*
205
206 PGSQL_CLIENT_DEBS_82 = \
207         postgresql-client
208
209 PGSQL_CLIENT_DEBS_83 = \
210         postgresql-client
211
212 PGSQL_CLIENT_DEBS_84 = \
213         postgresql-client-8.4
214
215 PGSQL_SERVER_DEBS_84 = \
216         postgresql-8.4 \
217         postgresql-contrib-8.4 \
218         postgresql-plperl-8.4 \
219         postgresql-server-dev-8.4
220
221 DEB_APACHE_MODS = \
222     expires\
223     include\
224     proxy\
225     proxy_http\
226     rewrite
227
228 DEB_APACHE_DISMODS = \
229     deflate
230
231 # Chronically unpackaged CPAN modules
232 CPAN_MODULES = \
233     Business::EDI \
234     Library::CallNumber::LC \
235     Net::Z3950::Simple2ZOOM \
236     SRU
237
238 # More chronically unpackaged CPAN modules (available in Squeeze though)
239 CPAN_MODULES_MORE = \
240     Business::CreditCard::Object \
241     MARC::Record \
242     Net::SSH2 \
243     UUID::Tiny
244
245 # Are we sure most distros don't come with an acceptable version of Safe.pm?
246 CPAN_MODULES_SAFE = \
247         Safe
248
249 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
250 CPAN_MODULES_MARC = \
251         Business::ISBN \
252         Business::ISBN::Data \
253     MARC::Charset \
254     MARC::File::XML \
255     Net::Z3950::ZOOM
256
257 CPAN_MODULES_FORCE = \
258         Class::DBI::Frozen::301
259
260 # ----------------------------------------------------------------------------
261
262 all: 
263         @echo "please specify an OS" && exit 0
264
265 # these should be the same for any distro
266 install: install_cpan install_js_sm install_libdbi install_cpan_force
267
268 centos: install_centos_pgsql centos_like
269 rhel: install_redhat_pgsql centos_like
270 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force
271
272 fedora13: install_fedora_13_rpms install_cpan install_cpan_fedora install_cpan_marc install_js_sm install_cpan_force
273 fedora14: fedora13
274
275 debian-lenny: lenny generic_debian install_cpan_more install_cpan_safe
276 debian-squeeze: squeeze generic_debian
277 lenny: install_pgsql_client_debs_83 install_extra_debs
278 squeeze: install_pgsql_client_debs_84  install_extra_debs_squeeze
279 generic_debian:  install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_force
280
281 ubuntu-hardy: hardy generic_ubuntu
282 ubuntu-lucid: lucid generic_ubuntu
283 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
284 lucid: install_pgsql_client_debs_84 install_extra_debs
285 generic_ubuntu: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force
286
287 # - COMMON TARGETS ---------------------------------------------------------
288
289 # Install the CPAN modules
290 install_cpan: 
291         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
292
293 install_cpan_more: 
294         for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
295
296 # Install the CPAN modules for MARC functionality
297 install_cpan_marc: 
298         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
299
300 install_cpan_force:
301         for m in $(CPAN_MODULES_FORCE); do \
302                 echo "force install $$m" | perl -MCPAN -e shell ;\
303         done
304
305 # Install the Safe Perl module
306 # Is this really unpackaged everywhere except for Fedora?
307 install_cpan_safe: 
308         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
309
310 # Install the CPAN modules for Fedora 13
311 install_cpan_fedora: 
312         for m in $(FEDORA_13_CPAN); do \
313                 echo "force install $$m" | perl -MCPAN -e shell;\
314         done
315
316 # Install a known working version of YAZ
317 install_yaz:    
318         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
319         tar xzf $(YAZ).tar.gz
320         cd $(YAZ) && ./configure && make && make install && ldconfig
321
322 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
323 install_js_sm: install_libjs install_spidermonkey
324
325 install_libjs: 
326         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
327         tar -zxf $(LIBJS).tar.gz
328         cd js/src/ && JS_DIST=/usr make -f Makefile.ref
329         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
330         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
331         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
332         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
333         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
334
335 install_spidermonkey:
336         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
337         tar -zxf $(LIBJS_PERL).tar.gz
338         if [ ! -z $(FEDORA_64) ]; then \
339                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
340         fi;
341         if [ ! -z $(FEDORA) ]; then \
342                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
343         fi;
344         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
345
346 # On Ubuntu and possibly Debian, the libdbi0 package prevents the 
347 # compiled-from-source version from being used and breaks the install.
348 # This package might get installed depending on the install-time choices
349 # for the distro. Test for its existence; if it's there, throw an error
350 # message and exit.
351 test_for_libdbi_pkg:
352                 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
353                                 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
354                                 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
355                                 echo "*** to successfully install Evergreen."; \
356                                 echo; \
357                                 echo "*** Note: this may break other applications on your system."; \
358                                 exit 0; \
359                 fi;
360
361 # Install libdbi and the postgres drivers
362 install_libdbi:
363         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
364         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
365         tar -zxf $(LIBDBI).tar.gz
366         tar -zxf $(LIBDBI_DRIVERS).tar.gz
367         cd $(LIBDBI) && ./configure --disable-docs && make all install
368         cd $(LIBDBI_DRIVERS) && ./configure  \
369                 --disable-docs --with-pgsql --enable-libdbi && make all install  
370
371 clean:
372         make -C $(LIBDBI) clean
373         make -C $(LIBDBI_DRIVERS) clean
374         make -C $(LIBJS_PERL) clean
375         make -f Makefile.ref -C js/src/ clean
376
377
378 # ------------------------------------------------------------------
379 # - DEBIAN ---------------------------------------------------------
380
381 debian_sys_config: 
382         # link the apache modules in
383         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
384         # keep the bad apache modules away
385         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
386         # refresh the dynamic library cache
387         ldconfig
388
389 # Install the debian-specific dependencies
390 install_debs:
391         $(APT_TOOL) install $(DEBS)
392
393 install_pgsql_client_debs_84:
394         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
395
396 install_pgsql_server_debs_84:
397         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
398
399 install_pgsql_client_debs_83:
400         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
401
402 install_pgsql_client_debs_82:
403         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
404
405 # Install the debian-specific dependencies for more modern distros
406 install_extra_debs_squeeze: install_extra_debs
407         $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
408
409 install_extra_debs:
410         $(APT_TOOL) install $(EXTRA_DEBS)
411
412 # Install specific modules required by Ubuntu Hardy - see bug 525069
413 install_extra_encode:
414         $(APT_TOOL) install $(EXTRA_ENCODE)
415
416 # ------------------------------------------------------------------
417
418 # FEDORA 13
419 install_fedora_13_rpms:
420         yum -y update
421         yum -y install $(FEDORA_13_RPMS)
422
423 install_fedora_13_pgsql_server:
424         yum -y install $(PGSQL_84_RPMS)
425
426 # CENTOS
427 install_centos_rpms:
428         yum -y install $(CENTOS)
429         yum -y update
430         if [ $(LBITS) -eq 64 ]; then \
431                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
432                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
433                 ldconfig ; \
434         fi;
435         if [ $(LBITS) -eq 32 ]; then \
436                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
437                 ldconfig ; \
438         fi;
439
440 install_centos_pgsql:
441         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
442         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
443         rpm -Uvh --force ./$(PGSQL_CENTOS)
444         yum update -y
445         yum -y install $(PGSQL_84_RPMS)
446
447 install_redhat_pgsql:
448         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
449         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
450         rpm -Uvh --force ./$(PGSQL_REDHAT)
451         yum update -y
452         yum -y install $(PGSQL_84_RPMS)
453
454 install_centos_perl:
455         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
456         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
457         echo "force install Scalar::Util" | perl -MCPAN -e shell        
458
459 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
460 # if it is not already there
461 create_ld_local:
462         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
463                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
464                 ldconfig; \
465         fi;
466
467 # vim:noet:sw=4:ts=4: