]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Use a locally hosted yaz package to avoid strange firewalls
[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         syslog-ng
144
145 CENTOS = \
146         apr-util-devel \
147         aspell \
148         aspell-devel \
149         aspell-en \
150         autoconf \
151         automake \
152         gcc \
153         gd-devel \
154         gdbm-devel \
155         httpd-devel \
156         less \
157         libtool \
158         libxml2-devel \
159         libxslt-devel \
160         make \
161         mod_perl \
162         mod_ssl \
163         ncurses \
164         ncurses-devel \
165         ntp \
166         perl-DBD-Pg \
167         perl-DBI \
168         perl-XML-LibXML \
169         perl-XML-Simple \
170         perl-libwww-perl \
171         psmisc \
172         python-devel \
173         python-setuptools\
174         readline-devel \
175         wget
176
177 PGSQL_CENTOS = \
178         postgresql \
179         postgresql-contrib \
180         postgresql-devel \
181         postgresql-pl \
182         postgresql-server
183
184 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
185 CENTOS_PERL_FORCE = \
186         Scalar::Util
187
188 # Some of these packages have stupid bugs in their test suites
189 # that are simply too painful to workaround
190 CENTOS_PERL_NOTEST = \
191         Business::OnlinePayment::AuthorizeNet \
192         DateTime::Format::Strptime \
193         RPC::XML
194
195 # This is a developer's version, but B:OP:AuthorizeNet depends on it
196 CENTOS_PERL_VERSION = \
197         IVAN/Business-OnlinePayment-3.00_08.tar.gz
198
199 CENTOS_PERL_LOCAL = \
200         XML-LibXSLT
201
202 CENTOS_PERL = \
203         Business::CreditCard \
204         Cache::Memcached \
205         Class::DBI::AbstractSearch \
206         Class::DBI::Pg \
207         Class::DBI::SQLite \
208         DateTime \
209         DateTime::TimeZone \
210         DateTime::Format::Builder \
211         Error \
212         File::Find::Rule \
213         FreezeThaw \
214         GD::Graph3d \
215         Log::Log4perl \
216         MARC::Record \
217         Net::Jabber \
218         Net::Z3950::ZOOM \
219         Spreadsheet::WriteExcel \
220         Template \
221         Test::Pod \
222         Text::Aspell \
223         Text::CSV \
224         Tie::IxHash \
225         Unix::Syslog \
226         UNIVERSAL::require \
227         XML::LibXSLT
228
229 PGSQL_DEBIAN = \
230         postgresql-8.1\
231         postgresql-client-8.1\
232         postgresql-contrib-8.1\
233         postgresql-plperl-8.1\
234         postgresql-server-dev-8.1
235
236 PGSQL_UBUNTU = \
237         postgresql-8.2\
238         postgresql-client-8.2\
239         postgresql-contrib-8.2\
240         postgresql-plperl-8.2\
241         postgresql-server-dev-8.2
242
243 GENTOOS = \
244     vim\
245     ntp\
246     memcached\
247     libmemcache\
248     net-misc/telnet-bsd\
249     app-portage/gentoolkit\
250     gsasl\
251     ejabberd\
252     mod_perl\
253     yaz\
254     aspell-en\
255     net-fs/nfs-utils\
256     dev-libs/apr\
257     dev-db/libpq\
258     dev-db/postgresql\
259     dev-perl/Email-Send\
260     dev-perl/Cache-Memcached\
261     dev-perl/DateTime\
262     dev-perl/DateTime-TimeZone\
263     dev-perl/DBI\
264     dev-perl/DBD-Pg\
265     dev-perl/GD-Graph3d\
266     dev-perl/Log-Log4perl\
267     dev-perl/Text-Aspell\
268     dev-perl/Unix-Syslog\
269     dev-perl/XML-LibXML\
270     dev-perl/XML-LibXSLT\
271     dev-perl/XML-Simple\
272     dev-perl/Net-Jabber\
273     dev-perl/libwww-perl\
274     dev-perl/Template-Toolkit\
275     dev-perl/Error\
276     dev-perl/Text-CSV_XS\
277     dev-perl/Spreadsheet-WriteExcel\
278     dev-perl/Tie-IxHash\
279         dev-perl/FreezeThaw
280
281 GENTOO_RC = \
282     ejabberd\
283     memcached\
284     portmap
285
286 GENTOO_PERL = \
287     UNIVERSAL::require\
288     Class::DBI::AbstractSearch\
289     MARC::Record \
290     Net::Z3950::ZOOM \
291     Text::CSV
292
293 DEB_APACHE_MODS = \
294     expires\
295     include\
296     proxy\
297     proxy_http\
298     rewrite\
299     ssl
300  
301
302 # generic CPAN modules
303 CPAN_MODULES = \
304     DateTime::Format::ISO8601 \
305     TMTM/Class-DBI-0.96.tar.gz \
306     RHANDOM/Net-Server-0.90.tar.gz \
307     MARC::Charset MARC::File::XML \
308     JSON::XS \
309     SRU \
310     Net::Z3950::ZOOM \
311         Business::CreditCard::Object \
312         XML::LibXML::XPathContext
313
314
315 # ----------------------------------------------------------------------------
316
317 all: 
318         @echo "please specify an OS" && exit 0
319
320
321 # these should be the same for any distro
322 install: install_yaz install_cpan install_js_sm install_libdbi 
323
324 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
325
326 debian: install_pgsql_debian install_debs install debian_sys_config
327
328 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
329
330 rhel: centos
331
332 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
333
334
335 # - COMMON TARGETS ---------------------------------------------------------
336
337 # Install the CPAN modules
338 install_cpan: 
339         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
340
341 # Install ejabberd from official project installer binary
342 install_ejabberd:    
343         if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
344         gunzip $(EJABBERD_PKG).gz
345         chmod u+x $(EJABBERD_PKG).gz
346         ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
347
348 # Install libmemcache from the official project source
349 install_libmemcache:
350         if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
351         tar xjf $(LIBMEMCACHE).tar.bz2
352         cd $(LIBMEMCACHE) && ./configure && make && make install
353
354 # Install a newer version of libxslt
355 install_libxslt:    
356         if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
357         tar xzf $(XSLT).tar.gz
358         cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
359
360 # Install a newer version of libxml2
361 install_libxml2:    
362         if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
363         tar xzf $(XML2).tar.gz
364         cd $(XML2) && ./configure && make && make install
365
366 # Install a known working version of YAZ
367 install_yaz:    
368         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
369         tar xzf $(YAZ).tar.gz
370         cd $(YAZ) && ./configure && make && make install
371
372 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
373 install_js_sm: 
374         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
375         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
376         tar -zxf $(LIBJS).tar.gz
377         tar -zxf $(LIBJS_PERL).tar.gz
378         cd js/src/ && make -f Makefile.ref
379         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
380         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
381         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
382         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
383         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
384         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
385
386
387 # Install libdbi and the postgres drivers
388 install_libdbi:
389         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
390         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
391         tar -zxf $(LIBDBI).tar.gz
392         tar -zxf $(LIBDBI_DRIVERS).tar.gz
393         cd $(LIBDBI) && ./configure --disable-docs && make all install
394         cd $(LIBDBI_DRIVERS) && ./configure  \
395                 --disable-docs --with-pgsql --enable-libdbi && make all install  
396
397
398 clean:
399         make -C $(LIBDBI) clean
400         make -C $(LIBDBI_DRIVERS) clean
401         make -C $(LIBJS_PERL) clean
402         make -C $(XML2) clean
403         make -C $(XSLT) clean
404         make -f Makefile.ref -C js/src/ clean
405
406
407 # ------------------------------------------------------------------
408 # - DEBIAN ---------------------------------------------------------
409
410 debian_sys_config: 
411         # link the apache modules in
412         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
413         
414         # adds a placeholder module so apxs will be happy
415         if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
416                 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
417                         >> /etc/apache2/httpd.conf; \
418         fi;
419
420 # Install the debian-specific dependencies
421 install_debs:
422         $(APT_TOOL) install $(DEBS)
423
424 install_pgsql_debian:
425         $(APT_TOOL) install $(PGSQL_DEBIAN)
426
427 install_pgsql_ubuntu:
428         $(APT_TOOL) install $(PGSQL_UBUNTU)
429
430 # ------------------------------------------------------------------
431 # - GENTOO ---------------------------------------------------------
432
433 install_gentoos:
434         emerge -n $(GENTOOS)
435
436 install_gentoo_rc:
437         for m in $(GENTOO_RC); do rc-update add $$m default; done;
438
439 install_gentoo_perl:
440         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
441
442 # ------------------------------------------------------------------
443     
444
445 # CENTOS
446 install_centos_rpms:
447         yum -y install $(CENTOS)
448
449 install_centos_pgsql:
450         yum -y install $(PGSQL_CENTOS)
451
452 install_centos_perl:
453         for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw/install $$m);"; done
454         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
455         for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
456         for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
457         for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
458
459 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
460 # if it is not already there
461 create_ld_local:
462         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
463                 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
464                 ldconfig; \
465         fi;
466
467 # vim:noet:sw=4:ts=4: