1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF and Evergreen
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
11 # make -f Makefile.install debian
13 # make -f Makefile.install ubuntu
15 # make -f Makefile.install centos
17 # make -f Makefile.install rhel
19 # make -f Makefile.install gentoo
23 # This makefile has been tested much more with Debian than CentOS, Gentoo, or RHEL.
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
29 # ---------------------------------------------------------------------
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
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/
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
49 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
50 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
53 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
55 # ejabberd is not packaged on CentOS/RHEL, so we have to
56 # download the installable package from the source
58 EJABBERD_PKG=ejabberd-2.0.1_2-linux-x86-installer.bin
59 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
61 # libmemcache is not packaged on CentOS/RHEL
62 LIBMEMCACHE=libmemcache-1.4.0.rc2
63 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
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/
70 # XML::LibXSLT fails due to old libxslt
72 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
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
93 libcache-memcached-perl\
100 libclass-dbi-pg-perl\
101 libclass-dbi-abstractsearch-perl\
104 libdatetime-format-mail-perl\
105 libdatetime-timezone-perl\
109 libuniversal-require-perl\
110 libclass-dbi-sqlite-perl\
111 liblog-log4perl-perl\
114 libfile-find-rule-perl\
115 libdatetime-format-builder-perl\
127 libapache2-mod-perl2\
130 libspreadsheet-writeexcel-perl\
131 libole-storage-lite-perl\
136 libbusiness-creditcard-perl\
137 libbusiness-onlinepayment-perl\
138 libbusiness-onlinepayment-authorizenet-perl
178 # Some of these packages have stupid bugs in their test suites
179 # that are simply too painful to workaround
180 CENTOS_PERL_NOTEST = \
181 Business::OnlinePayment::AuthorizeNet \
182 DateTime::Format::Strptime \
185 # This is a developer's version, but B:OP:AuthorizeNet depends on it
186 CENTOS_PERL_VERSION = \
187 IVAN/Business-OnlinePayment-3.00_08.tar.gz
189 CENTOS_PERL_LOCAL = \
193 Business::CreditCard \
195 Class::DBI::AbstractSearch \
200 DateTime::Format::Builder \
209 Spreadsheet::WriteExcel \
221 postgresql-client-8.1\
222 postgresql-contrib-8.1\
223 postgresql-plperl-8.1\
224 postgresql-server-dev-8.1
228 postgresql-client-8.2\
229 postgresql-contrib-8.2\
230 postgresql-plperl-8.2\
231 postgresql-server-dev-8.2
239 app-portage/gentoolkit\
250 dev-perl/Cache-Memcached\
252 dev-perl/DateTime-TimeZone\
256 dev-perl/Log-Log4perl\
257 dev-perl/Text-Aspell\
258 dev-perl/Unix-Syslog\
260 dev-perl/XML-LibXSLT\
263 dev-perl/libwww-perl\
264 dev-perl/Template-Toolkit\
266 dev-perl/Text-CSV_XS\
267 dev-perl/Spreadsheet-WriteExcel\
278 Class::DBI::AbstractSearch\
292 # generic CPAN modules
294 DateTime::Format::ISO8601 \
295 TMTM/Class-DBI-0.96.tar.gz \
296 RHANDOM/Net-Server-0.90.tar.gz \
297 MARC::Charset MARC::File::XML \
301 Business::CreditCard::Object \
302 XML::LibXML::XPathContext
305 # ----------------------------------------------------------------------------
308 @echo "please specify an OS" && exit 0
311 # these should be the same for any distro
312 install: install_yaz install_cpan install_js_sm install_libdbi
314 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
316 debian: install_pgsql_debian install_debs install debian_sys_config
318 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
322 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
325 # - COMMON TARGETS ---------------------------------------------------------
327 # Install the CPAN modules
329 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
331 # Install ejabberd from official project installer binary
333 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
334 gunzip $(EJABBERD_PKG).gz
335 chmod u+x $(EJABBERD_PKG).gz
336 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
338 # Install libmemcache from the official project source
340 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
341 tar xjf $(LIBMEMCACHE).tar.bz2
342 cd $(LIBMEMCACHE) && ./configure && make && make install
344 # Install a newer version of libxslt
346 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
347 tar xzf $(XSLT).tar.gz
348 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
350 # Install a newer version of libxml2
352 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
353 tar xzf $(XML2).tar.gz
354 cd $(XML2) && ./configure && make && make install
356 # Install a known working version of YAZ
358 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
359 tar xzf $(YAZ).tar.gz
360 cd $(YAZ) && ./configure && make && make install
362 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
364 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
365 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
366 tar -zxf $(LIBJS).tar.gz
367 tar -zxf $(LIBJS_PERL).tar.gz
368 cd js/src/ && make -f Makefile.ref
369 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
370 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
371 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
372 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
373 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
374 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
377 # Install libdbi and the postgres drivers
379 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
380 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
381 tar -zxf $(LIBDBI).tar.gz
382 tar -zxf $(LIBDBI_DRIVERS).tar.gz
383 cd $(LIBDBI) && ./configure --disable-docs && make all install
384 cd $(LIBDBI_DRIVERS) && ./configure \
385 --disable-docs --with-pgsql --enable-libdbi && make all install
389 make -C $(LIBDBI) clean
390 make -C $(LIBDBI_DRIVERS) clean
391 make -C $(LIBJS_PERL) clean
392 make -C $(XML2) clean
393 make -C $(XSLT) clean
394 make -f Makefile.ref -C js/src/ clean
397 # ------------------------------------------------------------------
398 # - DEBIAN ---------------------------------------------------------
401 # link the apache modules in
402 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
404 # adds a placeholder module so apxs will be happy
405 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
406 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
407 >> /etc/apache2/httpd.conf; \
410 # Install the debian-specific dependencies
412 $(APT_TOOL) install $(DEBS)
414 install_pgsql_debian:
415 $(APT_TOOL) install $(PGSQL_DEBIAN)
417 install_pgsql_ubuntu:
418 $(APT_TOOL) install $(PGSQL_UBUNTU)
420 # ------------------------------------------------------------------
421 # - GENTOO ---------------------------------------------------------
427 for m in $(GENTOO_RC); do rc-update add $$m default; done;
430 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
432 # ------------------------------------------------------------------
437 yum -y install $(CENTOS)
439 install_centos_pgsql:
440 yum -y install $(PGSQL_CENTOS)
443 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
444 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
445 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
446 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
448 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
449 # if it is not already there
451 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
452 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \