1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
6 # Currently supports Debian (etch), Ubuntu (gutsy/hardy), 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.2_2-linux-x86-installer.bin
43 EJABBERD_PKG_x64=ejabberd-2.0.2_2-linux-x86_64-installer.bin
44 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
46 # libmemcache is not packaged on CentOS/RHEL
47 LIBMEMCACHE=libmemcache-1.4.0.rc2
48 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
50 # XML::LibXSLT fails due to old libxslt
52 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
54 # libxslt depends on a newer version of libxml2:
55 XML2=libxml2-2.6.30.tar.gz
56 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
70 libcache-memcached-perl\
71 libclass-dbi-abstractsearch-perl\
72 libclass-dbi-sqlite-perl\
75 libfile-find-rule-perl\
88 libuniversal-require-perl\
130 # Some of these packages have stupid bugs in their test suites
131 # that are simply too painful to workaround
132 CENTOS_PERL_NOTEST = \
135 CENTOS_PERL_LOCAL = \
140 Class::DBI::AbstractSearch \
160 app-portage/gentoolkit\
166 dev-perl/Cache-Memcached\
168 dev-perl/Log-Log4perl\
169 dev-perl/Unix-Syslog\
171 dev-perl/XML-LibXSLT\
174 dev-perl/libwww-perl\
175 dev-perl/Template-Toolkit\
186 Class::DBI::AbstractSearch\
198 # generic CPAN modules
200 DateTime::Format::ISO8601 \
201 RHANDOM/Net-Server-0.90.tar.gz \
203 XML::LibXML::XPathContext
205 # generic CPAN modules to force
206 CPAN_MODULES_FORCE = \
207 TMTM/Class-DBI-0.96.tar.gz
209 # ----------------------------------------------------------------------------
212 @echo "please specify an OS" && exit 0
215 # these should be the same for any distro
216 install: install_cpan
218 centos: install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
220 debian: install_debs install debian_sys_config
222 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
226 ubuntu: install_debs install debian_sys_config
229 # - COMMON TARGETS ---------------------------------------------------------
231 # Install the CPAN modules
233 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
234 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
236 # Install ejabberd from official project installer binary
238 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
239 gunzip $(EJABBERD_PKG).gz
240 chmod u+x $(EJABBERD_PKG).gz
241 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
243 # Install libmemcache from the official project source
245 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
246 tar xjf $(LIBMEMCACHE).tar.bz2
247 cd $(LIBMEMCACHE) && ./configure && make && make install
249 # Install a newer version of libxslt
251 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
252 tar xzf $(XSLT).tar.gz
253 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
255 # Install a newer version of libxml2
257 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
258 tar xzf $(XML2).tar.gz
259 cd $(XML2) && ./configure && make && make install
262 make -C $(LIBJS_PERL) clean
263 make -C $(XML2) clean
264 make -C $(XSLT) clean
265 make -f Makefile.ref -C js/src/ clean
268 # ------------------------------------------------------------------
269 # - DEBIAN ---------------------------------------------------------
272 # link the apache modules in
273 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
275 # adds a placeholder module so apxs will be happy
276 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
277 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
278 >> /etc/apache2/httpd.conf; \
281 # Install the debian-specific dependencies
283 $(APT_TOOL) install $(DEBS)
285 # ------------------------------------------------------------------
286 # - GENTOO ---------------------------------------------------------
292 for m in $(GENTOO_RC); do rc-update add $$m default; done;
295 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
297 # ------------------------------------------------------------------
301 yum -y install $(CENTOS)
304 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
305 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
306 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
307 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
308 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
310 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
311 # if it is not already there
313 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
314 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
318 # vim:noet:sw=4:ts=4: