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