]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Apply RHEL5 prerequisite installer patch by Lee Dickens <ldickens@esilibrary.com>
[working/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/karmic), and Gentoo.
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-karmic
18 #       - or -
19 #       make -f Makefile.install centos
20 #       - or -
21 #       make -f Makefile.install rhel
22 #       - or -
23 #       make -f Makefile.install gentoo
24 #
25 # Notes:
26 #
27 #       This makefile has been tested much more with Debian and Ubuntu than
28 #       CentOS, Gentoo, or RHEL.
29 #
30 #       Gentoo (especially amd64) requires a good bit of masked package
31 #       mangling for some packages.  These are not documented here because
32 #       they will continue to evolve
33 #
34 # ---------------------------------------------------------------------
35  
36 # Make any assumptions about the shell being used explicit
37 SHELL=/bin/bash 
38
39 # XXX
40 # Gentoo needs explicit versions on many of these packages
41 # to simulate a "blessed" set of packages
42 #
43 # Also, I (think) Gentoo has a javascript::spidermonkey package that does
44 # not require fetching the sources externally ... needs testing/updating in here
45 #
46 # Intrepid has libmozjs-dev and spidermonkey-bin - might work
47
48 LIBJS=js-1.7.0
49 LIBJS_PERL=JavaScript-SpiderMonkey-0.19
50 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
51 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
52 # used for installing libjs lib and header files
53 JS_INSTALL_PREFIX=/usr/
54
55
56 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
57 # the open-ils.org site now for ease of direct linking
58 LIBDBI=libdbi-0.8.3
59 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
60 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
61
62 # We need a recent version of Yaz
63 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
64 YAZ=yaz-3.0.47
65 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
66
67 # Business::OnlinePayment is not packaged on CentOS/RHEL
68 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
69 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
70
71 APT_TOOL=aptitude -yq
72
73 # 64 or 32 bit os?
74 LBITS=$(shell getconf LONG_BIT)
75
76 #RHEL/Centos PGSQL 
77 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
78 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
79 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm       
80
81 # Debian dependencies
82 DEBS =  \
83         apache2-prefork-dev\
84         aspell\
85         aspell-en\
86         libbusiness-creditcard-perl\
87         libbusiness-onlinepayment-authorizenet-perl\
88         libbusiness-onlinepayment-perl\
89         libclass-dbi-pg-perl\
90         libdatetime-format-builder-perl\
91         libdatetime-format-iso8601-perl\
92         libdatetime-format-mail-perl\
93         libdatetime-perl\
94         libdatetime-timezone-perl\
95         libdatetime-set-perl\
96         libemail-send-perl\
97         libgd-graph3d-perl\
98         liblog-log4perl-perl\
99         libmarc-record-perl\
100         libncurses5-dev\
101         libnet-server-perl\
102         libole-storage-lite-perl\
103         libpq-dev\
104         libreadline5-dev\
105         libspreadsheet-writeexcel-perl\
106         libssh2-1-dev\
107         libtext-aspell-perl\
108         libtext-csv-perl\
109         libtext-csv-perl\
110         libuniversal-require-perl\
111         libunix-syslog-perl
112
113 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
114 EXTRA_DEBS = \
115         libmarc-charset-perl \
116         libmarc-xml-perl \
117         libnet-z3950-zoom-perl \
118         libyaz-dev \
119         yaz
120
121 # Ubuntu Hardy and Debian Etch require libencode-perl 
122 # to get a version of Encode > 2.12 - see bug 525069.
123 # Note that the Debian version of libencode-perl comes
124 # from etch-backports.
125 EXTRA_ENCODE = \
126         libencode-perl
127
128 CENTOS = \
129         aspell \
130         aspell-devel \
131         aspell-en \
132         gd-devel \
133         libssh2-devel \
134         openssl-devel \
135         perl-Business-CreditCard \
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 PGSQL_84_RPMS = \
149         postgresql-8.4* \
150         postgresql-contrib-8.4* \
151         postgresql-devel-8.4* \
152         postgresql-plp*-8.4* \
153         postgresql-server-8.4*
154
155 CENTOS_PERL = \
156         Class::DBI \
157         Class::DBI::Pg \
158         Encode \
159         DBIx::ContextualFetch \
160         Getopt::Long \
161         Net::SSH2 \
162         Net::uFTP \
163         Net::XMPP \
164         Net::Z3950::ZOOM
165
166 PGSQL_CLIENT_DEBS_81 = \
167         postgresql-client-8.1
168
169 PGSQL_SERVER_DEBS_81 = \
170         postgresql-8.1 \
171         postgresql-contrib-8.1 \
172         postgresql-plperl-8.1 \
173         postgresql-server-dev-8.1
174
175 PGSQL_CLIENT_DEBS_82 = \
176         postgresql-client
177
178 PGSQL_SERVER_DEBS_82 = \
179         postgresql \
180         postgresql-contrib-8.2 \
181         postgresql-plperl-8.2 \
182         postgresql-server-dev-8.2
183
184 PGSQL_CLIENT_DEBS_83 = \
185         postgresql-client
186
187 PGSQL_SERVER_DEBS_83 = \
188         postgresql \
189         postgresql-contrib-8.3 \
190         postgresql-plperl-8.3 \
191         postgresql-server-dev-8.3
192
193 PGSQL_CLIENT_DEBS_84 = \
194         postgresql-client
195
196 PGSQL_SERVER_DEBS_84 = \
197         postgresql \
198         postgresql-contrib-8.4 \
199         postgresql-plperl-8.4 \
200         postgresql-server-dev-8.4
201
202 GENTOOS = \
203     yaz\
204     aspell-en\
205     dev-db/libpq\
206     dev-db/postgresql\
207     dev-perl/Email-Send\
208     dev-perl/DateTime\
209     dev-perl/DateTime-TimeZone\
210     dev-perl/DBD-Pg\
211     dev-perl/GD-Graph3d\
212     dev-perl/Text-Aspell\
213     dev-perl/Template-Toolkit\
214     dev-perl/Text-CSV_XS\
215     dev-perl/Spreadsheet-WriteExcel
216
217 GENTOO_PERL = \
218     MARC::Record \
219     Net::Z3950::ZOOM \
220     Text::CSV
221
222 DEB_APACHE_MODS = \
223     expires\
224     include\
225     proxy\
226     proxy_http\
227     rewrite
228
229 DEB_APACHE_DISMODS = \
230     deflate
231
232 # Chronically unpackaged CPAN modules
233 CPAN_MODULES = \
234     Business::CreditCard::Object \
235     Business::EDI \
236     Net::uFTP \
237     Net::Z3950::Simple2ZOOM \
238     UUID::Tiny \
239     SRU \
240     Safe
241
242 # Intrepid and Lenny have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
243 CPAN_MODULES_MARC = \
244     MARC::Charset \
245     MARC::File::XML \
246     Net::Z3950::ZOOM
247
248 # ----------------------------------------------------------------------------
249
250 all: 
251         @echo "please specify an OS" && exit 0
252
253 # these should be the same for any distro
254 install: install_cpan install_js_sm install_libdbi 
255
256 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local
257 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local
258
259 debian-etch: etch generic_debian
260 debian-lenny: lenny generic_debian
261 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
262 lenny: install_pgsql_client_debs_83 install_extra_debs
263 generic_debian:  install_debs install debian_sys_config
264
265 gentoo: install_gentoos install_gentoo_perl install
266
267 ubuntu-hardy: hardy generic_ubuntu
268 ubuntu-karmic: karmic generic_ubuntu
269 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
270 karmic: install_pgsql_client_debs_84 install_extra_debs
271 generic_ubuntu: install_debs install debian_sys_config
272
273 # - COMMON TARGETS ---------------------------------------------------------
274
275 # Install the CPAN modules
276 install_cpan: 
277         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
278
279 # Install the CPAN modules for MARC functionality
280 install_cpan_marc: 
281         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
282
283 # Install a known working version of YAZ
284 install_yaz:    
285         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
286         tar xzf $(YAZ).tar.gz
287         cd $(YAZ) && ./configure && make && make install && ldconfig
288
289 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
290 install_js_sm: 
291         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
292         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
293         tar -zxf $(LIBJS).tar.gz
294         tar -zxf $(LIBJS_PERL).tar.gz
295         cd js/src/ && make -f Makefile.ref
296         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
297         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
298         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
299         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
300         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
301         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
302
303
304 # Install libdbi and the postgres drivers
305 install_libdbi:
306         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
307         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
308         tar -zxf $(LIBDBI).tar.gz
309         tar -zxf $(LIBDBI_DRIVERS).tar.gz
310         cd $(LIBDBI) && ./configure --disable-docs && make all install
311         cd $(LIBDBI_DRIVERS) && ./configure  \
312                 --disable-docs --with-pgsql --enable-libdbi && make all install  
313
314
315 clean:
316         make -C $(LIBDBI) clean
317         make -C $(LIBDBI_DRIVERS) clean
318         make -C $(LIBJS_PERL) clean
319         make -f Makefile.ref -C js/src/ clean
320
321
322 # ------------------------------------------------------------------
323 # - DEBIAN ---------------------------------------------------------
324
325 debian_sys_config: 
326         # link the apache modules in
327         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
328         # keep the bad apache modules away
329         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
330         # refresh the dynamic library cache
331         ldconfig
332
333 # Install the debian-specific dependencies
334 install_debs:
335         $(APT_TOOL) install $(DEBS)
336
337 install_pgsql_client_debs_84:
338         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
339
340 install_pgsql_server_debs_84:
341         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
342
343 install_pgsql_client_debs_83:
344         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
345
346 install_pgsql_server_debs_83:
347         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
348
349 install_pgsql_client_debs_82:
350         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
351
352 install_pgsql_server_debs_82:
353         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
354
355 # Etch requires an explicit version to avoid PostgreSQL 7.4
356 install_pgsql_client_debs_81:
357         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
358
359 # Etch requires an explicit version to avoid PostgreSQL 7.4
360 install_pgsql_server_debs_81:
361         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
362
363 # Install the debian-specific dependencies for more modern distros
364 install_extra_debs:
365         $(APT_TOOL) install $(EXTRA_DEBS)
366
367 # Install specific modules required by Ubuntu Hardy and
368 # Debian Etch - see bug 525069
369 install_extra_encode:
370         $(APT_TOOL) install $(EXTRA_ENCODE)
371
372 # ------------------------------------------------------------------
373 # - GENTOO ---------------------------------------------------------
374
375 install_gentoos:
376         emerge -n $(GENTOOS)
377
378 install_gentoo_perl:
379         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
380
381 # ------------------------------------------------------------------
382     
383
384 # CENTOS
385 install_centos_rpms:
386         yum -y install $(CENTOS)
387         yum -y update
388         if [ $(LBITS) -eq 64 ]; then \
389                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
390                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
391                 ldconfig ; \
392         fi;
393         if [ $(LBITS) -eq 32 ]; then \
394                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
395                 ldconfig ; \
396         fi;
397
398 install_centos_pgsql:
399         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
400         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
401         rpm -Uvh --force ./$(PGSQL_CENTOS)
402         yum update -y
403         yum -y install $(PGSQL_84_RPMS)
404
405 install_redhat_pgsql:
406         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
407         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
408         rpm -Uvh --force ./$(PGSQL_REDHAT)
409         yum update -y
410         yum -y install $(PGSQL_84_RPMS)
411
412 install_centos_perl:
413         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
414         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
415         echo "force install Scalar::Util" | perl -MCPAN -e shell        
416
417 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
418 # if it is not already there
419 create_ld_local:
420         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
421                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
422                 ldconfig; \
423         fi;
424
425 # vim:noet:sw=4:ts=4: