]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Force Class::DBI 0.96 install
[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), Ubuntu (gutsy), 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
12 #       - or -
13 #       make -f Makefile.install ubuntu
14 #       - or -
15 #       make -f Makefile.install centos
16 #       - or -
17 #       make -f Makefile.install rhel
18 #       - or -
19 #       make -f Makefile.install gentoo
20 #
21 # Notes:
22 #
23 #       This makefile has been tested much more with Debian than CentOS, Gentoo, or RHEL.
24 #
25 #       Gentoo (especially amd64) requires a good bit of masked package
26 #       mangling for some packages.  These are not documented here because
27 #       they will continue to evolve
28 #
29 # ---------------------------------------------------------------------
30  
31 # Make any assumptions about the shell being used explicit
32 SHELL=/bin/bash 
33
34 # XXX
35 # Gentoo needs explicit versions on many of these packages
36 # to simulate a "blessed" set of packages
37 # Also, I (think) Gentoo has a javascript::spidermonkey package that does
38 # not require fetching the sources externally ... needs testing/updating in here
39
40 LIBJS=js-1.7.0
41 LIBJS_PERL=JavaScript-SpiderMonkey-0.19
42 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
43 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
44 # used for installing libjs lib and header files
45 JS_INSTALL_PREFIX=/usr/
46
47
48 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
49 # the open-ils.org site now for ease of direct linking
50 LIBDBI=libdbi-0.8.3
51 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
52 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
53
54 # Some people are firewalled out of indexdata.dk
55 YAZ=yaz-3.0.36
56 YAZ_HOST=http://evergreen-ils.org/~denials/yaz
57
58 # ejabberd is not packaged on CentOS/RHEL, so we have to
59 # download the installable package from the source
60 EJABBERD_VER=2.0.1
61 EJABBERD_PKG=ejabberd-2.0.1_2-linux-x86-installer.bin
62 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
63
64 # libmemcache is not packaged on CentOS/RHEL
65 LIBMEMCACHE=libmemcache-1.4.0.rc2
66 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
67
68 # Business::OnlinePayment is not packaged on CentOS/RHEL
69 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
70 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
71
72
73 # XML::LibXSLT fails due to old libxslt
74 XSLT=libxslt-1.1.22
75 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
76
77 # libxslt depends on a newer version of libxml2:
78 XML2=libxml2-2.6.30.tar.gz
79 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
80
81 APT_TOOL=aptitude
82
83 # Debian dependencies
84 DEBS =  \
85         apache2-mpm-prefork\
86         apache2-prefork-dev\
87         aspell\
88         aspell-en\
89         autoconf\
90         automake\
91         build-essential\
92         ejabberd\
93         less\
94         libapache2-mod-perl2\
95         libbusiness-creditcard-perl\
96         libbusiness-onlinepayment-authorizenet-perl\
97         libbusiness-onlinepayment-perl\
98         libcache-memcached-perl\
99         libclass-dbi-abstractsearch-perl\
100         libclass-dbi-pg-perl\
101         libclass-dbi-sqlite-perl\
102         libdatetime-format-builder-perl\
103         libdatetime-format-mail-perl\
104         libdatetime-perl\
105         libdatetime-timezone-perl\
106         libemail-send-perl\
107         liberror-perl\
108         libexpat1-dev\
109         libfile-find-rule-perl\
110         libfreezethaw-perl\
111         libgd-graph3d-perl\
112         liblog-log4perl-perl\
113         libmarc-record-perl\
114         libmemcache-dev\
115         libmodule-build-perl\
116         libnet-jabber-perl\
117         libole-storage-lite-perl\
118         libperl-dev\
119         libpq-dev\
120         libreadline5-dev\
121         librpc-xml-perl\
122         libspreadsheet-writeexcel-perl\
123         libtemplate-perl\
124         libtest-pod-perl\
125         libtext-aspell-perl\
126         libtext-csv-perl\
127         libtext-csv-perl\
128         libtie-ixhash-perl\
129         libtool\
130         libuniversal-require-perl\
131         libunix-syslog-perl\
132         libwww-perl\
133         libxml2-dev\
134         libxml-libxml-perl\
135         libxml-libxslt-perl\
136         libxml-simple-perl\
137         libxslt1-dev\
138         memcached\
139         ntpdate\
140         psmisc\
141         python-dev\
142         python-setuptools
143
144 CENTOS = \
145         apr-util-devel \
146         aspell \
147         aspell-devel \
148         aspell-en \
149         autoconf \
150         automake \
151         gcc \
152         gd-devel \
153         gdbm-devel \
154         httpd-devel \
155         less \
156         libtool \
157         libxml2-devel \
158         libxslt-devel \
159         make \
160         mod_perl \
161         mod_ssl \
162         ncurses \
163         ncurses-devel \
164         ntp \
165         perl-DBD-Pg \
166         perl-DBI \
167         perl-XML-LibXML \
168         perl-XML-Simple \
169         perl-libwww-perl \
170         psmisc \
171         python-devel \
172         python-setuptools\
173         readline-devel \
174         wget
175
176 PGSQL_CENTOS = \
177         postgresql \
178         postgresql-contrib \
179         postgresql-devel \
180         postgresql-pl \
181         postgresql-server
182
183 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
184 CENTOS_PERL_FORCE = \
185         Scalar::Util
186
187 # Some of these packages have stupid bugs in their test suites
188 # that are simply too painful to workaround
189 CENTOS_PERL_NOTEST = \
190         Business::OnlinePayment::AuthorizeNet \
191         DateTime::Format::Strptime \
192         RPC::XML
193
194 # This is a developer's version, but B:OP:AuthorizeNet depends on it
195 CENTOS_PERL_VERSION = \
196         IVAN/Business-OnlinePayment-3.00_08.tar.gz
197
198 CENTOS_PERL_LOCAL = \
199         XML-LibXSLT
200
201 CENTOS_PERL = \
202         Business::CreditCard \
203         Cache::Memcached \
204         Class::DBI::AbstractSearch \
205         Class::DBI::Pg \
206         Class::DBI::SQLite \
207         DateTime \
208         DateTime::TimeZone \
209         DateTime::Format::Builder \
210         Error \
211         File::Find::Rule \
212         FreezeThaw \
213         GD::Graph3d \
214         Log::Log4perl \
215         MARC::Record \
216         Net::Jabber \
217         Net::Z3950::ZOOM \
218         Spreadsheet::WriteExcel \
219         Template \
220         Test::Pod \
221         Text::Aspell \
222         Text::CSV \
223         Tie::IxHash \
224         Unix::Syslog \
225         UNIVERSAL::require \
226         XML::LibXSLT
227
228 PGSQL_DEBIAN = \
229         postgresql-8.1\
230         postgresql-client-8.1\
231         postgresql-contrib-8.1\
232         postgresql-plperl-8.1\
233         postgresql-server-dev-8.1
234
235 PGSQL_UBUNTU = \
236         postgresql-8.2\
237         postgresql-client-8.2\
238         postgresql-contrib-8.2\
239         postgresql-plperl-8.2\
240         postgresql-server-dev-8.2
241
242 GENTOOS = \
243     vim\
244     ntp\
245     memcached\
246     libmemcache\
247     net-misc/telnet-bsd\
248     app-portage/gentoolkit\
249     gsasl\
250     ejabberd\
251     mod_perl\
252     yaz\
253     aspell-en\
254     net-fs/nfs-utils\
255     dev-libs/apr\
256     dev-db/libpq\
257     dev-db/postgresql\
258     dev-perl/Email-Send\
259     dev-perl/Cache-Memcached\
260     dev-perl/DateTime\
261     dev-perl/DateTime-TimeZone\
262     dev-perl/DBI\
263     dev-perl/DBD-Pg\
264     dev-perl/GD-Graph3d\
265     dev-perl/Log-Log4perl\
266     dev-perl/Text-Aspell\
267     dev-perl/Unix-Syslog\
268     dev-perl/XML-LibXML\
269     dev-perl/XML-LibXSLT\
270     dev-perl/XML-Simple\
271     dev-perl/Net-Jabber\
272     dev-perl/libwww-perl\
273     dev-perl/Template-Toolkit\
274     dev-perl/Error\
275     dev-perl/Text-CSV_XS\
276     dev-perl/Spreadsheet-WriteExcel\
277     dev-perl/Tie-IxHash\
278         dev-perl/FreezeThaw
279
280 GENTOO_RC = \
281     ejabberd\
282     memcached\
283     portmap
284
285 GENTOO_PERL = \
286     UNIVERSAL::require\
287     Class::DBI::AbstractSearch\
288     MARC::Record \
289     Net::Z3950::ZOOM \
290     Text::CSV
291
292 DEB_APACHE_MODS = \
293     expires\
294     include\
295     proxy\
296     proxy_http\
297     rewrite\
298     ssl
299  
300
301 # generic CPAN modules
302 CPAN_MODULES = \
303     DateTime::Format::ISO8601 \
304     RHANDOM/Net-Server-0.90.tar.gz \
305     MARC::Charset MARC::File::XML \
306     JSON::XS \
307     SRU \
308     Net::Z3950::ZOOM \
309         Business::CreditCard::Object \
310         XML::LibXML::XPathContext
311
312 # generic CPAN modules to force the install
313 CPAN_MODULES_FORCE = \
314     TMTM/Class-DBI-0.96.tar.gz
315
316 # ----------------------------------------------------------------------------
317
318 all: 
319         @echo "please specify an OS" && exit 0
320
321
322 # these should be the same for any distro
323 install: install_yaz install_cpan install_js_sm install_libdbi 
324
325 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
326
327 debian: install_pgsql_debian install_debs install debian_sys_config
328
329 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
330
331 rhel: centos
332
333 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
334
335
336 # - COMMON TARGETS ---------------------------------------------------------
337
338 # Install the CPAN modules
339 install_cpan: 
340         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
341         for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
342
343 # Install ejabberd from official project installer binary
344 install_ejabberd:    
345         if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
346         gunzip $(EJABBERD_PKG).gz
347         chmod u+x $(EJABBERD_PKG).gz
348         ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
349
350 # Install libmemcache from the official project source
351 install_libmemcache:
352         if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
353         tar xjf $(LIBMEMCACHE).tar.bz2
354         cd $(LIBMEMCACHE) && ./configure && make && make install
355
356 # Install a newer version of libxslt
357 install_libxslt:    
358         if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
359         tar xzf $(XSLT).tar.gz
360         cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
361
362 # Install a newer version of libxml2
363 install_libxml2:    
364         if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
365         tar xzf $(XML2).tar.gz
366         cd $(XML2) && ./configure && make && make install
367
368 # Install a known working version of YAZ
369 install_yaz:    
370         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
371         tar xzf $(YAZ).tar.gz
372         cd $(YAZ) && ./configure && make && make install
373
374 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
375 install_js_sm: 
376         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
377         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
378         tar -zxf $(LIBJS).tar.gz
379         tar -zxf $(LIBJS_PERL).tar.gz
380         cd js/src/ && make -f Makefile.ref
381         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
382         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
383         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
384         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
385         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
386         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
387
388
389 # Install libdbi and the postgres drivers
390 install_libdbi:
391         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
392         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
393         tar -zxf $(LIBDBI).tar.gz
394         tar -zxf $(LIBDBI_DRIVERS).tar.gz
395         cd $(LIBDBI) && ./configure --disable-docs && make all install
396         cd $(LIBDBI_DRIVERS) && ./configure  \
397                 --disable-docs --with-pgsql --enable-libdbi && make all install  
398
399
400 clean:
401         make -C $(LIBDBI) clean
402         make -C $(LIBDBI_DRIVERS) clean
403         make -C $(LIBJS_PERL) clean
404         make -C $(XML2) clean
405         make -C $(XSLT) clean
406         make -f Makefile.ref -C js/src/ clean
407
408
409 # ------------------------------------------------------------------
410 # - DEBIAN ---------------------------------------------------------
411
412 debian_sys_config: 
413         # link the apache modules in
414         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
415         
416         # adds a placeholder module so apxs will be happy
417         if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
418                 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
419                         >> /etc/apache2/httpd.conf; \
420         fi;
421
422 # Install the debian-specific dependencies
423 install_debs:
424         $(APT_TOOL) install $(DEBS)
425
426 install_pgsql_debian:
427         $(APT_TOOL) install $(PGSQL_DEBIAN)
428
429 install_pgsql_ubuntu:
430         $(APT_TOOL) install $(PGSQL_UBUNTU)
431
432 # ------------------------------------------------------------------
433 # - GENTOO ---------------------------------------------------------
434
435 install_gentoos:
436         emerge -n $(GENTOOS)
437
438 install_gentoo_rc:
439         for m in $(GENTOO_RC); do rc-update add $$m default; done;
440
441 install_gentoo_perl:
442         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
443
444 # ------------------------------------------------------------------
445     
446
447 # CENTOS
448 install_centos_rpms:
449         yum -y install $(CENTOS)
450
451 install_centos_pgsql:
452         yum -y install $(PGSQL_CENTOS)
453
454 install_centos_perl:
455         for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
456         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
457         for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
458         for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
459         for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
460
461 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
462 # if it is not already there
463 create_ld_local:
464         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
465                 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
466                 ldconfig; \
467         fi;
468
469 # vim:noet:sw=4:ts=4: