1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
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
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 Ubuntu and Debian than
24 # CentOS, Gentoo, or RHEL.
26 # Gentoo (especially amd64) requires a good bit of masked package
27 # mangling for some packages. These are not documented here because
28 # they will continue to evolve
30 # ---------------------------------------------------------------------
32 # Make any assumptions about the shell being used explicit
36 # Gentoo needs explicit versions on many of these packages
37 # to simulate a "blessed" set of packages
39 # ejabberd is not packaged on CentOS/RHEL, so we have to
40 # download the installable package from the source
42 EJABBERD_PKG=ejabberd-2.0.1_2-linux-x86-installer.bin
43 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
45 # libmemcache is not packaged on CentOS/RHEL
46 LIBMEMCACHE=libmemcache-1.4.0.rc2
47 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
49 # XML::LibXSLT fails due to old libxslt
51 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
53 # libxslt depends on a newer version of libxml2:
54 XML2=libxml2-2.6.30.tar.gz
55 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
69 libcache-memcached-perl\
70 libclass-dbi-abstractsearch-perl\
71 libclass-dbi-sqlite-perl\
74 libfile-find-rule-perl\
87 libuniversal-require-perl\
129 # Some of these packages have stupid bugs in their test suites
130 # that are simply too painful to workaround
131 CENTOS_PERL_NOTEST = \
134 CENTOS_PERL_LOCAL = \
139 Class::DBI::AbstractSearch \
159 app-portage/gentoolkit\
165 dev-perl/Cache-Memcached\
167 dev-perl/Log-Log4perl\
168 dev-perl/Unix-Syslog\
170 dev-perl/XML-LibXSLT\
173 dev-perl/libwww-perl\
174 dev-perl/Template-Toolkit\
185 Class::DBI::AbstractSearch\
197 # generic CPAN modules
199 DateTime::Format::ISO8601 \
200 RHANDOM/Net-Server-0.90.tar.gz \
202 XML::LibXML::XPathContext
204 # generic CPAN modules to force
205 CPAN_MODULES_FORCE = \
206 TMTM/Class-DBI-0.96.tar.gz
208 # ----------------------------------------------------------------------------
211 @echo "please specify an OS" && exit 0
214 # these should be the same for any distro
215 install: install_cpan
217 centos: install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
219 debian: install_debs install debian_sys_config
221 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
225 ubuntu: install_debs install debian_sys_config
228 # - COMMON TARGETS ---------------------------------------------------------
230 # Install the CPAN modules
232 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
233 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw/install $$m);"; done
235 # Install ejabberd from official project installer binary
237 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
238 gunzip $(EJABBERD_PKG).gz
239 chmod u+x $(EJABBERD_PKG).gz
240 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
242 # Install libmemcache from the official project source
244 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
245 tar xjf $(LIBMEMCACHE).tar.bz2
246 cd $(LIBMEMCACHE) && ./configure && make && make install
248 # Install a newer version of libxslt
250 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
251 tar xzf $(XSLT).tar.gz
252 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
254 # Install a newer version of libxml2
256 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
257 tar xzf $(XML2).tar.gz
258 cd $(XML2) && ./configure && make && make install
261 make -C $(LIBJS_PERL) clean
262 make -C $(XML2) clean
263 make -C $(XSLT) clean
264 make -f Makefile.ref -C js/src/ clean
267 # ------------------------------------------------------------------
268 # - DEBIAN ---------------------------------------------------------
271 # link the apache modules in
272 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
274 # adds a placeholder module so apxs will be happy
275 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
276 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
277 >> /etc/apache2/httpd.conf; \
280 # Install the debian-specific dependencies
282 $(APT_TOOL) install $(DEBS)
284 # ------------------------------------------------------------------
285 # - GENTOO ---------------------------------------------------------
291 for m in $(GENTOO_RC); do rc-update add $$m default; done;
294 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
296 # ------------------------------------------------------------------
300 yum -y install $(CENTOS)
303 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw/install $$m);"; done
304 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
305 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
306 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
307 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
309 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
310 # if it is not already there
312 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
313 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
317 # vim:noet:sw=4:ts=4: