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
94 libbusiness-creditcard-perl\
95 libbusiness-onlinepayment-authorizenet-perl\
96 libbusiness-onlinepayment-perl\
97 libcache-memcached-perl\
98 libclass-dbi-abstractsearch-perl\
100 libclass-dbi-sqlite-perl\
101 libdatetime-format-builder-perl\
102 libdatetime-format-mail-perl\
104 libdatetime-timezone-perl\
108 libfile-find-rule-perl\
111 liblog-log4perl-perl\
114 libmodule-build-perl\
116 libole-storage-lite-perl\
121 libspreadsheet-writeexcel-perl\
129 libuniversal-require-perl\
183 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
184 CENTOS_PERL_FORCE = \
187 # Some of these packages have stupid bugs in their test suites
188 # that are simply too painful to workaround
189 CENTOS_PERL_NOTEST = \
190 Business::OnlinePayment::AuthorizeNet \
191 DateTime::Format::Strptime \
194 # This is a developer's version, but B:OP:AuthorizeNet depends on it
195 CENTOS_PERL_VERSION = \
196 IVAN/Business-OnlinePayment-3.00_08.tar.gz
198 CENTOS_PERL_LOCAL = \
202 Business::CreditCard \
204 Class::DBI::AbstractSearch \
209 DateTime::Format::Builder \
218 Spreadsheet::WriteExcel \
230 postgresql-client-8.1\
231 postgresql-contrib-8.1\
232 postgresql-plperl-8.1\
233 postgresql-server-dev-8.1
237 postgresql-client-8.2\
238 postgresql-contrib-8.2\
239 postgresql-plperl-8.2\
240 postgresql-server-dev-8.2
248 app-portage/gentoolkit\
259 dev-perl/Cache-Memcached\
261 dev-perl/DateTime-TimeZone\
265 dev-perl/Log-Log4perl\
266 dev-perl/Text-Aspell\
267 dev-perl/Unix-Syslog\
269 dev-perl/XML-LibXSLT\
272 dev-perl/libwww-perl\
273 dev-perl/Template-Toolkit\
275 dev-perl/Text-CSV_XS\
276 dev-perl/Spreadsheet-WriteExcel\
287 Class::DBI::AbstractSearch\
301 # generic CPAN modules
303 DateTime::Format::ISO8601 \
304 TMTM/Class-DBI-0.96.tar.gz \
305 RHANDOM/Net-Server-0.90.tar.gz \
306 MARC::Charset MARC::File::XML \
310 Business::CreditCard::Object \
311 XML::LibXML::XPathContext
314 # ----------------------------------------------------------------------------
317 @echo "please specify an OS" && exit 0
320 # these should be the same for any distro
321 install: install_yaz install_cpan install_js_sm install_libdbi
323 centos: install_centos_pgsql install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
325 debian: install_pgsql_debian install_debs install debian_sys_config
327 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
331 ubuntu: install_pgsql_ubuntu install_debs install debian_sys_config
334 # - COMMON TARGETS ---------------------------------------------------------
336 # Install the CPAN modules
338 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
340 # Install ejabberd from official project installer binary
342 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
343 gunzip $(EJABBERD_PKG).gz
344 chmod u+x $(EJABBERD_PKG).gz
345 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw evergreen
347 # Install libmemcache from the official project source
349 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
350 tar xjf $(LIBMEMCACHE).tar.bz2
351 cd $(LIBMEMCACHE) && ./configure && make && make install
353 # Install a newer version of libxslt
355 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
356 tar xzf $(XSLT).tar.gz
357 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
359 # Install a newer version of libxml2
361 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
362 tar xzf $(XML2).tar.gz
363 cd $(XML2) && ./configure && make && make install
365 # Install a known working version of YAZ
367 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
368 tar xzf $(YAZ).tar.gz
369 cd $(YAZ) && ./configure && make && make install
371 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
373 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
374 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
375 tar -zxf $(LIBJS).tar.gz
376 tar -zxf $(LIBJS_PERL).tar.gz
377 cd js/src/ && make -f Makefile.ref
378 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
379 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
380 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
381 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
382 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
383 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
386 # Install libdbi and the postgres drivers
388 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
389 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
390 tar -zxf $(LIBDBI).tar.gz
391 tar -zxf $(LIBDBI_DRIVERS).tar.gz
392 cd $(LIBDBI) && ./configure --disable-docs && make all install
393 cd $(LIBDBI_DRIVERS) && ./configure \
394 --disable-docs --with-pgsql --enable-libdbi && make all install
398 make -C $(LIBDBI) clean
399 make -C $(LIBDBI_DRIVERS) clean
400 make -C $(LIBJS_PERL) clean
401 make -C $(XML2) clean
402 make -C $(XSLT) clean
403 make -f Makefile.ref -C js/src/ clean
406 # ------------------------------------------------------------------
407 # - DEBIAN ---------------------------------------------------------
410 # link the apache modules in
411 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
413 # adds a placeholder module so apxs will be happy
414 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
415 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
416 >> /etc/apache2/httpd.conf; \
419 # Install the debian-specific dependencies
421 $(APT_TOOL) install $(DEBS)
423 install_pgsql_debian:
424 $(APT_TOOL) install $(PGSQL_DEBIAN)
426 install_pgsql_ubuntu:
427 $(APT_TOOL) install $(PGSQL_UBUNTU)
429 # ------------------------------------------------------------------
430 # - GENTOO ---------------------------------------------------------
436 for m in $(GENTOO_RC); do rc-update add $$m default; done;
439 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
441 # ------------------------------------------------------------------
446 yum -y install $(CENTOS)
448 install_centos_pgsql:
449 yum -y install $(PGSQL_CENTOS)
452 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw/install $$m);"; done
453 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
454 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
455 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
456 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
458 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
459 # if it is not already there
461 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
462 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
466 # vim:noet:sw=4:ts=4: