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