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