1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
3 # Author: Dan Scott <dscott@laurentian.ca>
5 # Makefile to install prerequisites for OpenSRF
7 # Currently supports Debian (lenny/squeeze), Ubuntu (hardy/lucid)
8 # Working towards support of CentOS 5 / RHEL 5 and Fedora.
9 # Installs Perl prereqs, libjs with Perl wrapper
12 # make -f Makefile.install debian-lenny
14 # make -f Makefile.install debian-squeeze
16 # make -f Makefile.install ubuntu-hardy
18 # make -f Makefile.install ubuntu-lucid
20 # make -f Makefile.install centos
22 # make -f Makefile.install rhel
24 # make -f Makefile.install fedora13
28 # This makefile has been tested much more with Ubuntu and Debian than
29 # CentOS, Fedora, or RHEL.
31 # ---------------------------------------------------------------------
33 # Make any assumptions about the shell being used explicit
37 # Gentoo needs explicit versions on many of these packages
38 # to simulate a "blessed" set of packages
41 LBITS=$(shell getconf LONG_BIT)
43 # ejabberd is not packaged on CentOS/RHEL, so we have to
44 # download the installable package from the source
46 EJABBERD_PKG=ejabberd-2.1.2-linux-x86-installer.bin
47 EJABBERD_PKG_x64=ejabberd-2.1.2-linux-x86_64-installer.bin
48 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
50 # Centos and Redhat will require the rpmforge repository mostly for memcache and perl modules
51 RPMFORGE_PKG_x64=rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
52 RPMFORGE_PKG=rpmforge-release-0.5.1-1.el5.rf.i386.rpm
53 RPMFORGE_HOST=http://packages.sw.be/rpmforge-release
55 # need newer libtool, autoconf, and automake on centos
56 AUTOCONF_HOST=http://ftp.gnu.org/gnu/autoconf
57 AUTOCONF_PKG=autoconf-2.65
58 LIBTOOL_HOST=http://ftp.gnu.org/gnu/libtool
59 LIBTOOL_PKG=libtool-2.2.6b
60 AUTOMAKE_HOST=http://ftp.gnu.org/gnu/automake
61 AUTOMAKE_PKG=automake-1.11
63 # libmemcached is only packaged on newer distros
64 LIBMEMCACHED=libmemcached-0.40
65 LIBMEMCACHED_HOST=http://download.tangent.org
67 # XML::LibXSLT fails due to old libxslt
69 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
71 # libxslt depends on a newer version of libxml2:
73 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
87 libcache-memcached-perl\
88 libclass-dbi-abstractsearch-perl\
89 libclass-dbi-sqlite-perl\
90 libdatetime-format-builder-perl\
91 libdatetime-format-mail-perl\
93 libdatetime-timezone-perl\
96 libfile-find-rule-perl\
100 liblog-log4perl-perl\
101 libmodule-build-perl\
110 libuniversal-require-perl\
146 perl-Cache-Memcached \
147 perl-Class-DBI-AbstractSearch \
148 perl-Class-DBI-SQLite \
150 perl-DateTime-Format-ISO8601 \
151 perl-DateTime-Format-Mail \
153 perl-DateTime-TimeZone \
157 perl-File-Find-Rule \
162 perl-Memcached-libmemcached \
165 perl-Template-Toolkit \
168 perl-UNIVERSAL-require \
206 perl-Cache-Memcached \
208 perl-Class-DBI-AbstractSearch \
209 perl-Class-DBI-SQLite \
210 perl-DateTime-Format-Builder \
211 perl-DateTime-Format-ISO8601 \
212 perl-DateTime-Format-Mail \
216 perl-File-Find-Rule \
225 perl-SQL-Abstract-Limit \
226 perl-Template-Toolkit \
228 perl-Test-Exception \
231 perl-UNIVERSAL-require \
248 libdatetime-format-iso8601-perl \
252 EXTRA_DEBS_SQUEEZE = \
255 libxml-libxslt-perl \
258 EXTRA_DEBS_UBUNTU_LUCID = \
263 # generic CPAN modules:
264 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
265 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
266 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
267 # - is there a specific need for 0.90?
269 DateTime::Format::ISO8601 \
270 RHANDOM/Net-Server-0.90.tar.gz \
273 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
274 # has broken namespace handling. so we still need to install these from
280 # ----------------------------------------------------------------------------
283 @echo "please specify an OS" && exit 0
286 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
288 debian-lenny: generic_debian install_cpan_xml lenny install_libmemcached
289 debian-squeeze: generic_debian squeeze
290 lenny: install_extra_debs
291 squeeze: install_extra_squeeze_debs
292 generic_debian: install_debs debian_sys_config
294 fedora13: install_fedora_rpms
298 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
299 ubuntu-lucid: generic_ubuntu lucid
300 hardy: install_cpan install_libmemcached
301 lucid: install_extra_debs install_extra_debs_lucid
302 generic_ubuntu: install_debs debian_sys_config
304 # - COMMON TARGETS ---------------------------------------------------------
306 # Install the CPAN modules
308 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
310 # Install CPAN modules that need to be forced
312 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
314 # Install the CPAN XML modules
316 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
318 # Install ejabberd from official project installer binary
320 if [ $(LBITS) -eq 64 ]; then \
321 if [ ! -f $(EJABBERD_PKG_x64).gz ]; then \
322 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG_x64).gz; \
324 gunzip $(EJABBERD_PKG_x64).gz; \
325 chmod u+x $(EJABBERD_PKG_x64); \
326 ./$(EJABBERD_PKG_x64) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
328 if [ $(LBITS) -eq 32 ]; then \
329 if [ ! -f $(EJABBERD_PKG).gz ]; then \
330 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; \
332 gunzip $(EJABBERD_PKG).gz; \
333 chmod u+x $(EJABBERD_PKG); \
334 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
337 # Install rpmforge for redhat and centos
339 if [ $(LBITS) -eq 64 ]; then \
340 if [ ! -f $(RPMFORGE_PKG_x64) ]; then \
341 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG_x64) ; \
342 yum -y remove subversion*i386 ; \
344 rpm -Uvh --force ./$(RPMFORGE_PKG_x64) ; \
346 if [ $(LBITS) -eq 32 ]; then \
347 if [ ! -f $(RPMFORGE_PKG) ]; then \
348 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG) ; \
350 rpm -Uvh --force ./$(RPMFORGE_PKG) ; \
354 # Install automake, autoconf, and libtool
356 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
357 tar zxf $(LIBTOOL_PKG).tar.gz
358 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
360 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
361 tar zxf $(AUTOCONF_PKG).tar.gz
362 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
364 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
365 tar zxf $(AUTOMAKE_PKG).tar.gz
366 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
368 # Install libmemcached from the official project source
369 install_libmemcached:
370 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
371 tar xzf $(LIBMEMCACHED).tar.gz
372 cd $(LIBMEMCACHED) && ./configure && make && make install
374 # Install a newer version of libxslt
376 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
377 tar xzf $(XSLT).tar.gz
378 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
380 # Install a newer version of libxml2
382 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
383 tar xzf $(XML2).tar.gz
384 cd $(XML2) && ./configure && make && make install
387 make -C $(LIBJS_PERL) clean
388 make -C $(XML2) clean
389 make -C $(XSLT) clean
390 make -f Makefile.ref -C js/src/ clean
393 # ------------------------------------------------------------------
394 # - DEBIAN ---------------------------------------------------------
397 # link the apache modules in
398 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
400 # adds a placeholder module so apxs will be happy
401 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
402 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
403 >> /etc/apache2/httpd.conf; \
406 # Install the debian-specific dependencies
408 $(APT_TOOL) install $(DEBS)
410 # Install the debian-specific dependencies for more modern distros
412 $(APT_TOOL) install $(EXTRA_DEBS)
414 install_extra_debs_squeeze:
415 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
417 # Install even more packaged dependencies on modern distros
418 install_extra_debs_lucid:
419 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_LUCID)
423 yum -y install $(FEDORAS)
427 yum -y install $(CENTOS)
431 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
432 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
433 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
434 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
435 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
437 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
438 # if it is not already there
440 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
441 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
445 # vim:noet:sw=4:ts=4: