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