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