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