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