]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
stringify the copy location list before making it a param
[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 # 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     TMTM/Class-DBI-0.96.tar.gz \
305     RHANDOM/Net-Server-0.90.tar.gz \
306     MARC::Charset MARC::File::XML \
307     JSON::XS \
308     SRU \
309     Net::Z3950::ZOOM \
310         Business::CreditCard::Object \
311         XML::LibXML::XPathContext
312
313
314 # ----------------------------------------------------------------------------
315
316 all: 
317         @echo "please specify an OS" && exit 0
318
319
320 # these should be the same for any distro
321 install: install_yaz install_cpan install_js_sm install_libdbi 
322
323 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
324
325 debian: install_pgsql_debian install_debs install debian_sys_config
326
327 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
328
329 rhel: centos
330
331 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
332
333
334 # - COMMON TARGETS ---------------------------------------------------------
335
336 # Install the CPAN modules
337 install_cpan: 
338         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
339
340 # Install ejabberd from official project installer binary
341 install_ejabberd:    
342         if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
343         gunzip $(EJABBERD_PKG).gz
344         chmod u+x $(EJABBERD_PKG).gz
345         ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
346
347 # Install libmemcache from the official project source
348 install_libmemcache:
349         if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
350         tar xjf $(LIBMEMCACHE).tar.bz2
351         cd $(LIBMEMCACHE) && ./configure && make && make install
352
353 # Install a newer version of libxslt
354 install_libxslt:    
355         if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
356         tar xzf $(XSLT).tar.gz
357         cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
358
359 # Install a newer version of libxml2
360 install_libxml2:    
361         if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
362         tar xzf $(XML2).tar.gz
363         cd $(XML2) && ./configure && make && make install
364
365 # Install a known working version of YAZ
366 install_yaz:    
367         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
368         tar xzf $(YAZ).tar.gz
369         cd $(YAZ) && ./configure && make && make install
370
371 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
372 install_js_sm: 
373         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
374         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
375         tar -zxf $(LIBJS).tar.gz
376         tar -zxf $(LIBJS_PERL).tar.gz
377         cd js/src/ && make -f Makefile.ref
378         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
379         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
380         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
381         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
382         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
383         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
384
385
386 # Install libdbi and the postgres drivers
387 install_libdbi:
388         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
389         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
390         tar -zxf $(LIBDBI).tar.gz
391         tar -zxf $(LIBDBI_DRIVERS).tar.gz
392         cd $(LIBDBI) && ./configure --disable-docs && make all install
393         cd $(LIBDBI_DRIVERS) && ./configure  \
394                 --disable-docs --with-pgsql --enable-libdbi && make all install  
395
396
397 clean:
398         make -C $(LIBDBI) clean
399         make -C $(LIBDBI_DRIVERS) clean
400         make -C $(LIBJS_PERL) clean
401         make -C $(XML2) clean
402         make -C $(XSLT) clean
403         make -f Makefile.ref -C js/src/ clean
404
405
406 # ------------------------------------------------------------------
407 # - DEBIAN ---------------------------------------------------------
408
409 debian_sys_config: 
410         # link the apache modules in
411         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
412         
413         # adds a placeholder module so apxs will be happy
414         if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
415                 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
416                         >> /etc/apache2/httpd.conf; \
417         fi;
418
419 # Install the debian-specific dependencies
420 install_debs:
421         $(APT_TOOL) install $(DEBS)
422
423 install_pgsql_debian:
424         $(APT_TOOL) install $(PGSQL_DEBIAN)
425
426 install_pgsql_ubuntu:
427         $(APT_TOOL) install $(PGSQL_UBUNTU)
428
429 # ------------------------------------------------------------------
430 # - GENTOO ---------------------------------------------------------
431
432 install_gentoos:
433         emerge -n $(GENTOOS)
434
435 install_gentoo_rc:
436         for m in $(GENTOO_RC); do rc-update add $$m default; done;
437
438 install_gentoo_perl:
439         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
440
441 # ------------------------------------------------------------------
442     
443
444 # CENTOS
445 install_centos_rpms:
446         yum -y install $(CENTOS)
447
448 install_centos_pgsql:
449         yum -y install $(PGSQL_CENTOS)
450
451 install_centos_perl:
452         for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw/install $$m);"; done
453         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
454         for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
455         for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
456         for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
457
458 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
459 # if it is not already there
460 create_ld_local:
461         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
462                 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
463                 ldconfig; \
464         fi;
465
466 # vim:noet:sw=4:ts=4: