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