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