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-timezone-perl\
108 libuniversal-require-perl\
109 libclass-dbi-sqlite-perl\
110 liblog-log4perl-perl\
113 libfile-find-rule-perl\
114 libdatetime-format-builder-perl\
126 libapache2-mod-perl2\
129 libspreadsheet-writeexcel-perl\
130 libole-storage-lite-perl\
135 libbusiness-creditcard-perl\
136 libbusiness-onlinepayment-perl\
137 libbusiness-onlinepayment-authorizenet-perl
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 \
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
188 CENTOS_PERL_LOCAL = \
192 Business::CreditCard \
194 Class::DBI::AbstractSearch \
199 DateTime::Format::Builder \
208 Spreadsheet::WriteExcel \
220 postgresql-client-8.1\
221 postgresql-contrib-8.1\
222 postgresql-plperl-8.1\
223 postgresql-server-dev-8.1
227 postgresql-client-8.2\
228 postgresql-contrib-8.2\
229 postgresql-plperl-8.2\
230 postgresql-server-dev-8.2
238 app-portage/gentoolkit\
249 dev-perl/Cache-Memcached\
251 dev-perl/DateTime-TimeZone\
255 dev-perl/Log-Log4perl\
256 dev-perl/Text-Aspell\
257 dev-perl/Unix-Syslog\
259 dev-perl/XML-LibXSLT\
262 dev-perl/libwww-perl\
263 dev-perl/Template-Toolkit\
265 dev-perl/Text-CSV_XS\
266 dev-perl/Spreadsheet-WriteExcel\
277 Class::DBI::AbstractSearch\
291 # generic 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 \
300 Business::CreditCard::Object \
301 XML::LibXML::XPathContext
304 # ----------------------------------------------------------------------------
307 @echo "please specify an OS" && exit 0
310 # these should be the same for any distro
311 install: install_yaz install_cpan install_js_sm install_libdbi
313 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
315 debian: install_pgsql_debian install_debs install debian_sys_config
317 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
321 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
324 # - COMMON TARGETS ---------------------------------------------------------
326 # Install the CPAN modules
328 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
330 # Install ejabberd from official project installer binary
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
337 # Install libmemcache from the official project source
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
343 # Install a newer version of 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
349 # Install a newer version of 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
355 # Install a known working version of 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
361 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
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
376 # Install libdbi and the postgres drivers
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
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
396 # ------------------------------------------------------------------
397 # - DEBIAN ---------------------------------------------------------
400 # link the apache modules in
401 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
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; \
409 # Install the debian-specific dependencies
411 $(APT_TOOL) install $(DEBS)
413 install_pgsql_debian:
414 $(APT_TOOL) install $(PGSQL_DEBIAN)
416 install_pgsql_ubuntu:
417 $(APT_TOOL) install $(PGSQL_UBUNTU)
419 # ------------------------------------------------------------------
420 # - GENTOO ---------------------------------------------------------
426 for m in $(GENTOO_RC); do rc-update add $$m default; done;
429 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
431 # ------------------------------------------------------------------
436 yum -y install $(CENTOS)
438 install_centos_pgsql:
439 yum -y install $(PGSQL_CENTOS)
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
447 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
448 # if it is not already there
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; \