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