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 # ---------------------------------------------------------------------
31 # Make any assumptions about the shell being used explicit
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
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/
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
51 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
52 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
55 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
57 # ejabberd is not packaged on CentOS/RHEL, so we have to
58 # download the installable package from the source
60 EJABBERD_PKG=ejabberd-2.0.1_2-linux-x86-installer.bin
61 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
63 # libmemcache is not packaged on CentOS/RHEL
64 LIBMEMCACHE=libmemcache-1.4.0.rc2
65 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
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/
72 # XML::LibXSLT fails due to old libxslt
74 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
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
97 libcache-memcached-perl\
104 libclass-dbi-pg-perl\
105 libclass-dbi-abstractsearch-perl\
108 libdatetime-format-mail-perl\
109 libdatetime-timezone-perl\
113 libuniversal-require-perl\
114 libclass-dbi-sqlite-perl\
115 liblog-log4perl-perl\
118 libfile-find-rule-perl\
119 libdatetime-format-builder-perl\
131 libapache2-mod-perl2\
134 libspreadsheet-writeexcel-perl\
135 libole-storage-lite-perl\
140 libbusiness-creditcard-perl\
141 libbusiness-onlinepayment-perl\
142 libbusiness-onlinepayment-authorizenet-perl
182 # Some of these packages have stupid bugs in their test suites
183 # that are simply too painful to workaround
184 CENTOS_PERL_NOTEST = \
185 Business::OnlinePayment::AuthorizeNet \
186 DateTime::Format::Strptime \
189 # This is a developer's version, but B:OP:AuthorizeNet depends on it
190 CENTOS_PERL_VERSION = \
191 IVAN/Business-OnlinePayment-3.00_08.tar.gz
193 CENTOS_PERL_LOCAL = \
197 Business::CreditCard \
199 Class::DBI::AbstractSearch \
204 DateTime::Format::Builder \
213 Spreadsheet::WriteExcel \
225 postgresql-client-8.1\
226 postgresql-contrib-8.1\
227 postgresql-plperl-8.1\
228 postgresql-server-dev-8.1
232 postgresql-client-8.2\
233 postgresql-contrib-8.2\
234 postgresql-plperl-8.2\
235 postgresql-server-dev-8.2
243 app-portage/gentoolkit\
254 dev-perl/Cache-Memcached\
256 dev-perl/DateTime-TimeZone\
260 dev-perl/Log-Log4perl\
261 dev-perl/Text-Aspell\
262 dev-perl/Unix-Syslog\
264 dev-perl/XML-LibXSLT\
267 dev-perl/libwww-perl\
268 dev-perl/Template-Toolkit\
270 dev-perl/Text-CSV_XS\
271 dev-perl/Spreadsheet-WriteExcel\
282 Class::DBI::AbstractSearch\
296 # generic CPAN modules
298 DateTime::Format::ISO8601 \
299 TMTM/Class-DBI-0.96.tar.gz \
300 RHANDOM/Net-Server-0.90.tar.gz \
301 MARC::Charset MARC::File::XML \
305 Business::CreditCard::Object \
306 XML::LibXML::XPathContext
309 # ----------------------------------------------------------------------------
312 @echo "please specify an OS" && exit 0
315 # these should be the same for any distro
316 install: install_yaz install_cpan install_js_sm install_libdbi
318 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
320 debian: install_pgsql_debian install_debs install debian_sys_config
322 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
326 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
329 # - COMMON TARGETS ---------------------------------------------------------
331 # Install the CPAN modules
333 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
335 # Install ejabberd from official project installer binary
337 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
338 gunzip $(EJABBERD_PKG).gz
339 chmod u+x $(EJABBERD_PKG).gz
340 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
342 # Install libmemcache from the official project source
344 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
345 tar xjf $(LIBMEMCACHE).tar.bz2
346 cd $(LIBMEMCACHE) && ./configure && make && make install
348 # Install a newer version of libxslt
350 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
351 tar xzf $(XSLT).tar.gz
352 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
354 # Install a newer version of libxml2
356 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
357 tar xzf $(XML2).tar.gz
358 cd $(XML2) && ./configure && make && make install
360 # Install a known working version of YAZ
362 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
363 tar xzf $(YAZ).tar.gz
364 cd $(YAZ) && ./configure && make && make install
366 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
368 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
369 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
370 tar -zxf $(LIBJS).tar.gz
371 tar -zxf $(LIBJS_PERL).tar.gz
372 cd js/src/ && make -f Makefile.ref
373 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
374 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
375 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
376 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
377 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
378 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
381 # Install libdbi and the postgres drivers
383 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
384 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
385 tar -zxf $(LIBDBI).tar.gz
386 tar -zxf $(LIBDBI_DRIVERS).tar.gz
387 cd $(LIBDBI) && ./configure --disable-docs && make all install
388 cd $(LIBDBI_DRIVERS) && ./configure \
389 --disable-docs --with-pgsql --enable-libdbi && make all install
393 make -C $(LIBDBI) clean
394 make -C $(LIBDBI_DRIVERS) clean
395 make -C $(LIBJS_PERL) clean
396 make -C $(XML2) clean
397 make -C $(XSLT) clean
398 make -f Makefile.ref -C js/src/ clean
401 # ------------------------------------------------------------------
402 # - DEBIAN ---------------------------------------------------------
405 # link the apache modules in
406 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
408 # adds a placeholder module so apxs will be happy
409 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
410 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
411 >> /etc/apache2/httpd.conf; \
414 # Install the debian-specific dependencies
416 $(APT_TOOL) install $(DEBS)
418 install_pgsql_debian:
419 $(APT_TOOL) install $(PGSQL_DEBIAN)
421 install_pgsql_ubuntu:
422 $(APT_TOOL) install $(PGSQL_UBUNTU)
424 # ------------------------------------------------------------------
425 # - GENTOO ---------------------------------------------------------
431 for m in $(GENTOO_RC); do rc-update add $$m default; done;
434 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
436 # ------------------------------------------------------------------
441 yum -y install $(CENTOS)
443 install_centos_pgsql:
444 yum -y install $(PGSQL_CENTOS)
447 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
448 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
449 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
450 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
452 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
453 # if it is not already there
455 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
456 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
460 # vim:noet:sw=4:ts=4: