]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Update README and prereq installer for Evergreen trunk:
[working/Evergreen.git] / Open-ILS / src / extras / Makefile.install
1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
3 #
4 # Makefile to install prerequisites for OpenSRF and Evergreen
5 #
6 # Currently supports Debian (etch/lenny), Ubuntu (hardy/lucid), and Fedora (13).
7 # Working towards support of CentOS 5 / RHEL 5.
8 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
9 #
10 # usage:
11 #       make -f Makefile.install debian-etch
12 #       - or -
13 #       make -f Makefile.install debian-lenny
14 #       - or -
15 #       make -f Makefile.install ubuntu-hardy
16 #       - or -
17 #       make -f Makefile.install ubuntu-lucid
18 #       - or -
19 #       make -f Makefile.install fedora-13
20 #       - or -
21 #       make -f Makefile.install centos
22 #       - or -
23 #       make -f Makefile.install rhel
24 #
25 # Notes:
26 #
27 #       This makefile has been tested much more with Debian and Ubuntu than
28 #       Fedora, CentOS, or RHEL.
29 #
30 # ---------------------------------------------------------------------
31  
32 # Make any assumptions about the shell being used explicit
33 SHELL=/bin/bash 
34
35 LIBJS=js-1.7.0
36 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
37 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
38 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
39 # used for installing libjs lib and header files
40 JS_INSTALL_PREFIX=/usr/
41
42 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
43 # the open-ils.org site now for ease of direct linking
44 LIBDBI=libdbi-0.8.3
45 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
46 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
47
48 # We need a recent version of Yaz
49 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
50 YAZ=yaz-3.0.47
51 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
52
53 # Business::OnlinePayment is not packaged on CentOS/RHEL
54 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
55 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
56
57 APT_TOOL=aptitude -yq
58
59 # 64 or 32 bit os?
60 LBITS=$(shell getconf LONG_BIT)
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         libgd-graph3d-perl\
87         liblog-log4perl-perl\
88         libmarc-record-perl\
89         libncurses5-dev\
90         libnet-server-perl\
91         libole-storage-lite-perl\
92         libpq-dev\
93         libreadline5-dev\
94         libspreadsheet-writeexcel-perl\
95         libssh2-1-dev\
96         libtext-aspell-perl\
97         libtext-csv-perl\
98         libuniversal-require-perl\
99         libunix-syslog-perl
100
101 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
102 EXTRA_DEBS = \
103         libmarc-charset-perl \
104         libmarc-xml-perl \
105         libnet-z3950-zoom-perl \
106         libyaz-dev \
107         yaz
108
109 # Ubuntu Hardy and Debian Etch require libencode-perl 
110 # to get a version of Encode > 2.12 - see bug 525069.
111 # Note that the Debian version of libencode-perl comes
112 # from etch-backports.
113 EXTRA_ENCODE = \
114         libencode-perl
115
116 CENTOS = \
117         aspell \
118         aspell-devel \
119         aspell-en \
120         gd-devel \
121         libssh2-devel \
122         openssl-devel \
123         perl-Business-CreditCard \
124         perl-Business-OnlinePayment \
125         perl-Class-Data-Inheritable \
126         perl-DateTime-Format-Builder \
127         perl-DateTime-Format-Strptime \
128         perl-Ima-DBI \
129         perl-DBD-Pg \
130         perl-GD-Graph3d \
131         perl-IO-stringy \
132         perl-Spreadsheet-WriteExcel \
133         perl-Text-Aspell \
134         perl-Text-CSV
135
136 CENTOS_PERL = \
137         Class::DBI::Frozen::301 \
138         Encode \
139         DBIx::ContextualFetch \
140         Getopt::Long \
141         Net::SSH2 \
142         Net::uFTP \
143         Net::XMPP \
144         Net::Z3950::ZOOM
145
146 FEDORA_13_RPMS = \
147         aspell \
148         aspell-en \
149         js-devel \
150         libdbi \
151         libdbi-dbd-pgsql \
152         libdbi-devel \
153         libssh2-devel \
154         libyaz \
155         libyaz-devel \
156         mod_ssl \
157         ncurses-devel \
158         ncurses-libs \
159         perl-Business-CreditCard \
160         perl-Email-Send \
161         perl-GDGraph3d \
162         perl-MARC-Record \
163         perl-Net-SSH2 \
164         perl-OLE-Storage_Lite \
165         perl-Spreadsheet-WriteExcel \
166         perl-Text-Aspell \
167         perl-Text-CSV \
168         perl-Text-CSV_XS \
169         perl-XML-Writer \
170         postgresql-devel \
171         readline-devel \
172         tcp_wrappers-devel \
173         yaz
174
175 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
176 # Should be fixed in 3.22
177 FEDORA_13_CPAN = \
178         Business::OnlinePayment \
179         Business::OnlinePayment::AuthorizeNet \
180         Class::DBI::Frozen::301
181
182 PGSQL_84_RPMS = \
183         postgresql-8.4* \
184         postgresql-contrib-8.4* \
185         postgresql-devel-8.4* \
186         postgresql-plpe*-8.4* \
187         postgresql-server-8.4*
188
189 PGSQL_CLIENT_DEBS_81 = \
190         postgresql-client-8.1
191
192 PGSQL_SERVER_DEBS_81 = \
193         postgresql-8.1 \
194         postgresql-contrib-8.1 \
195         postgresql-plperl-8.1 \
196         postgresql-server-dev-8.1
197
198 PGSQL_CLIENT_DEBS_82 = \
199         postgresql-client
200
201 PGSQL_SERVER_DEBS_82 = \
202         postgresql \
203         postgresql-contrib-8.2 \
204         postgresql-plperl-8.2 \
205         postgresql-server-dev-8.2
206
207 PGSQL_CLIENT_DEBS_83 = \
208         postgresql-client
209
210 PGSQL_SERVER_DEBS_83 = \
211         postgresql \
212         postgresql-contrib-8.3 \
213         postgresql-plperl-8.3 \
214         postgresql-server-dev-8.3
215
216 PGSQL_CLIENT_DEBS_84 = \
217         postgresql-client
218
219 PGSQL_SERVER_DEBS_84 = \
220         postgresql \
221         postgresql-contrib-8.4 \
222         postgresql-plperl-8.4 \
223         postgresql-server-dev-8.4
224
225 DEB_APACHE_MODS = \
226     expires\
227     include\
228     proxy\
229     proxy_http\
230     rewrite
231
232 DEB_APACHE_DISMODS = \
233     deflate
234
235 # Chronically unpackaged CPAN modules
236 CPAN_MODULES = \
237     Business::CreditCard::Object \
238     Business::EDI \
239     Net::uFTP \
240     Net::Z3950::Simple2ZOOM \
241     UUID::Tiny \
242     SRU
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     MARC::Charset \
251     MARC::File::XML \
252     Net::Z3950::ZOOM
253
254 # ----------------------------------------------------------------------------
255
256 all: 
257         @echo "please specify an OS" && exit 0
258
259 # these should be the same for any distro
260 install: install_cpan install_js_sm install_libdbi 
261
262 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
263 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
264
265 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
266
267 debian-etch: etch generic_debian
268 debian-lenny: lenny generic_debian
269 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
270 lenny: install_pgsql_client_debs_83 install_extra_debs
271 generic_debian:  install_debs install debian_sys_config install_cpan_safe
272
273 ubuntu-hardy: hardy generic_ubuntu
274 ubuntu-lucid: lucid generic_ubuntu
275 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
276 lucid: install_pgsql_client_debs_84 install_extra_debs
277 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
278
279 # - COMMON TARGETS ---------------------------------------------------------
280
281 # Install the CPAN modules
282 install_cpan: 
283         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
284
285 # Install the CPAN modules for MARC functionality
286 install_cpan_marc: 
287         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
288
289 # Install the Safe Perl module
290 # Is this really unpackaged everywhere except for Fedora?
291 install_cpan_safe: 
292         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
293
294 # Install the CPAN modules for Fedora 13
295 install_cpan_fedora: 
296         for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
297
298 # Install a known working version of YAZ
299 install_yaz:    
300         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
301         tar xzf $(YAZ).tar.gz
302         cd $(YAZ) && ./configure && make && make install && ldconfig
303
304 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
305 install_js_sm: install_libjs install_spidermonkey
306
307 install_libjs: 
308         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
309         tar -zxf $(LIBJS).tar.gz
310         cd js/src/ && make -f Makefile.ref
311         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
312         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
313         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
314         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
315         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
316
317 install_spidermonkey:
318         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
319         tar -zxf $(LIBJS_PERL).tar.gz
320         if [ ! -z $(FEDORA_64) ]; then \
321                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
322                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
323         fi;
324         cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
325
326
327 # Install libdbi and the postgres drivers
328 install_libdbi:
329         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
330         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
331         tar -zxf $(LIBDBI).tar.gz
332         tar -zxf $(LIBDBI_DRIVERS).tar.gz
333         cd $(LIBDBI) && ./configure --disable-docs && make all install
334         cd $(LIBDBI_DRIVERS) && ./configure  \
335                 --disable-docs --with-pgsql --enable-libdbi && make all install  
336
337
338 clean:
339         make -C $(LIBDBI) clean
340         make -C $(LIBDBI_DRIVERS) clean
341         make -C $(LIBJS_PERL) clean
342         make -f Makefile.ref -C js/src/ clean
343
344
345 # ------------------------------------------------------------------
346 # - DEBIAN ---------------------------------------------------------
347
348 debian_sys_config: 
349         # link the apache modules in
350         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
351         # keep the bad apache modules away
352         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
353         # refresh the dynamic library cache
354         ldconfig
355
356 # Install the debian-specific dependencies
357 install_debs:
358         $(APT_TOOL) install $(DEBS)
359
360 install_pgsql_client_debs_84:
361         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
362
363 install_pgsql_server_debs_84:
364         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
365
366 install_pgsql_client_debs_83:
367         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
368
369 install_pgsql_server_debs_83:
370         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
371
372 install_pgsql_client_debs_82:
373         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
374
375 install_pgsql_server_debs_82:
376         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
377
378 # Etch requires an explicit version to avoid PostgreSQL 7.4
379 install_pgsql_client_debs_81:
380         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
381
382 # Etch requires an explicit version to avoid PostgreSQL 7.4
383 install_pgsql_server_debs_81:
384         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
385
386 # Install the debian-specific dependencies for more modern distros
387 install_extra_debs:
388         $(APT_TOOL) install $(EXTRA_DEBS)
389
390 # Install specific modules required by Ubuntu Hardy and
391 # Debian Etch - see bug 525069
392 install_extra_encode:
393         $(APT_TOOL) install $(EXTRA_ENCODE)
394
395 # ------------------------------------------------------------------
396
397 # FEDORA 13
398 install_fedora_13_rpms:
399         yum -y update
400         yum -y install $(FEDORA_13_RPMS)
401
402 install_fedora_13_pgsql_server:
403         yum -y install $(PGSQL_84_RPMS)
404
405 # CENTOS
406 install_centos_rpms:
407         yum -y install $(CENTOS)
408         yum -y update
409         if [ $(LBITS) -eq 64 ]; then \
410                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
411                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
412                 ldconfig ; \
413         fi;
414         if [ $(LBITS) -eq 32 ]; then \
415                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
416                 ldconfig ; \
417         fi;
418
419 install_centos_pgsql:
420         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
421         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
422         rpm -Uvh --force ./$(PGSQL_CENTOS)
423         yum update -y
424         yum -y install $(PGSQL_84_RPMS)
425
426 install_redhat_pgsql:
427         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
428         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
429         rpm -Uvh --force ./$(PGSQL_REDHAT)
430         yum update -y
431         yum -y install $(PGSQL_84_RPMS)
432
433 install_centos_perl:
434         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
435         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
436         echo "force install Scalar::Util" | perl -MCPAN -e shell        
437
438 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
439 # if it is not already there
440 create_ld_local:
441         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
442                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
443                 ldconfig; \
444         fi;
445
446 # vim:noet:sw=4:ts=4: