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