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/precise)
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 ubuntu-precise
22 # make -f Makefile.install centos
24 # make -f Makefile.install rhel
26 # make -f Makefile.install fedora14
30 # This makefile has been tested much more with Ubuntu and Debian than
31 # CentOS, Fedora, or RHEL.
33 # ---------------------------------------------------------------------
35 # Make any assumptions about the shell being used explicit
39 # Gentoo needs explicit versions on many of these packages
40 # to simulate a "blessed" set of packages
43 LBITS=$(shell getconf LONG_BIT)
45 # ejabberd is not packaged on CentOS/RHEL, so we have to
46 # download the installable package from the source
48 EJABBERD_PKG=ejabberd-2.1.2-linux-x86-installer.bin
49 EJABBERD_PKG_x64=ejabberd-2.1.2-linux-x86_64-installer.bin
50 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
52 # Centos and Redhat will require the rpmforge repository mostly for memcache and perl modules
53 RPMFORGE_PKG_x64=rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
54 RPMFORGE_PKG=rpmforge-release-0.5.1-1.el5.rf.i386.rpm
55 RPMFORGE_HOST=http://packages.sw.be/rpmforge-release
57 # need newer libtool, autoconf, and automake on centos
58 AUTOCONF_HOST=http://ftp.gnu.org/gnu/autoconf
59 AUTOCONF_PKG=autoconf-2.65
60 LIBTOOL_HOST=http://ftp.gnu.org/gnu/libtool
61 LIBTOOL_PKG=libtool-2.2.6b
62 AUTOMAKE_HOST=http://ftp.gnu.org/gnu/automake
63 AUTOMAKE_PKG=automake-1.11
65 # libmemcached is only packaged on newer distros
66 LIBMEMCACHED=libmemcached-0.40
67 LIBMEMCACHED_HOST=http://download.tangent.org
69 # XML::LibXSLT fails due to old libxslt
71 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
73 # libxslt depends on a newer version of libxml2:
75 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
90 libcache-memcached-perl\
91 libclass-dbi-abstractsearch-perl\
92 libclass-dbi-sqlite-perl\
93 libdatetime-format-builder-perl\
94 libdatetime-format-mail-perl\
96 libdatetime-timezone-perl\
99 libfile-find-rule-perl\
102 liblog-log4perl-perl\
103 libmodule-build-perl\
112 libuniversal-require-perl\
147 perl-Cache-Memcached \
148 perl-Class-DBI-AbstractSearch \
149 perl-Class-DBI-SQLite \
151 perl-DateTime-Format-ISO8601 \
152 perl-DateTime-Format-Mail \
154 perl-DateTime-TimeZone \
158 perl-File-Find-Rule \
162 perl-Memcached-libmemcached \
165 perl-Template-Toolkit \
168 perl-UNIVERSAL-require \
207 perl-Cache-Memcached \
209 perl-Class-DBI-AbstractSearch \
210 perl-Class-DBI-SQLite \
211 perl-DateTime-Format-Builder \
212 perl-DateTime-Format-ISO8601 \
213 perl-DateTime-Format-Mail \
217 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 = \
258 EXTRA_DEBS_UBUNTU_LUCID = \
263 EXTRA_DEBS_UBUNTU_PRECISE = \
266 libxml-libxslt-perl \
270 # generic CPAN modules:
271 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
272 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
273 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
274 # - is there a specific need for 0.90?
276 DateTime::Format::ISO8601 \
277 RHANDOM/Net-Server-0.90.tar.gz \
280 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
281 # has broken namespace handling. so we still need to install these from
287 # ----------------------------------------------------------------------------
290 @echo "please specify an OS" && exit 0
293 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
295 debian-lenny: generic_debian install_cpan_xml lenny install_libmemcached
296 debian-squeeze: generic_debian squeeze
297 lenny: install_extra_debs
298 squeeze: install_extra_debs_squeeze
299 generic_debian: install_debs debian_sys_config
301 fedora14: install_fedora_rpms
305 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
306 ubuntu-lucid: generic_ubuntu lucid
307 ubuntu-precise: generic_ubuntu precise
308 hardy: install_cpan install_libmemcached
309 lucid: install_extra_debs install_extra_debs_lucid
310 precise: install_extra_debs install_extra_debs_precise
311 generic_ubuntu: install_debs debian_sys_config
313 # - COMMON TARGETS ---------------------------------------------------------
315 # Install the CPAN modules
317 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
319 # Install CPAN modules that need to be forced
321 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
323 # Install the CPAN XML modules
325 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
327 # Install ejabberd from official project installer binary
329 if [ $(LBITS) -eq 64 ]; then \
330 if [ ! -f $(EJABBERD_PKG_x64).gz ]; then \
331 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG_x64).gz; \
333 gunzip $(EJABBERD_PKG_x64).gz; \
334 chmod u+x $(EJABBERD_PKG_x64); \
335 ./$(EJABBERD_PKG_x64) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
337 if [ $(LBITS) -eq 32 ]; then \
338 if [ ! -f $(EJABBERD_PKG).gz ]; then \
339 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; \
341 gunzip $(EJABBERD_PKG).gz; \
342 chmod u+x $(EJABBERD_PKG); \
343 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
346 # Install rpmforge for redhat and centos
348 if [ $(LBITS) -eq 64 ]; then \
349 if [ ! -f $(RPMFORGE_PKG_x64) ]; then \
350 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG_x64) ; \
351 yum -y remove subversion*i386 ; \
353 rpm -Uvh --force ./$(RPMFORGE_PKG_x64) ; \
355 if [ $(LBITS) -eq 32 ]; then \
356 if [ ! -f $(RPMFORGE_PKG) ]; then \
357 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG) ; \
359 rpm -Uvh --force ./$(RPMFORGE_PKG) ; \
363 # Install automake, autoconf, and libtool
365 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
366 tar zxf $(LIBTOOL_PKG).tar.gz
367 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
369 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
370 tar zxf $(AUTOCONF_PKG).tar.gz
371 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
373 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
374 tar zxf $(AUTOMAKE_PKG).tar.gz
375 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
377 # Install libmemcached from the official project source
378 install_libmemcached:
379 if [ ! -f $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
380 tar xzf $(LIBMEMCACHED).tar.gz
381 cd $(LIBMEMCACHED) && ./configure && make && make install
383 # Install a newer version of libxslt
385 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
386 tar xzf $(XSLT).tar.gz
387 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
389 # Install a newer version of libxml2
391 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
392 tar xzf $(XML2).tar.gz
393 cd $(XML2) && ./configure && make && make install
396 make -C $(LIBJS_PERL) clean
397 make -C $(XML2) clean
398 make -C $(XSLT) clean
399 make -f Makefile.ref -C js/src/ clean
402 # ------------------------------------------------------------------
403 # - DEBIAN ---------------------------------------------------------
406 # link the apache modules in
407 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
409 # adds a placeholder module so apxs will be happy
410 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
411 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
412 >> /etc/apache2/httpd.conf; \
415 # Install the debian-specific dependencies
417 $(APT_TOOL) install $(DEBS)
419 # Install the debian-specific dependencies for more modern distros
421 $(APT_TOOL) install $(EXTRA_DEBS)
423 install_extra_debs_squeeze: install_extra_debs
424 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
426 # Install even more packaged dependencies on modern distros
427 install_extra_debs_lucid:
428 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_LUCID)
430 install_extra_debs_precise:
431 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_PRECISE)
435 yum -y install $(FEDORAS)
439 yum -y install $(CENTOS)
443 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
444 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
445 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
446 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
447 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
449 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
450 # if it is not already there
452 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
453 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
457 # vim:noet:sw=4:ts=4: