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\
113 libuniversal-require-perl\
148 perl-Cache-Memcached \
149 perl-Class-DBI-AbstractSearch \
150 perl-Class-DBI-SQLite \
152 perl-DateTime-Format-ISO8601 \
153 perl-DateTime-Format-Mail \
155 perl-DateTime-TimeZone \
159 perl-File-Find-Rule \
163 perl-Memcached-libmemcached \
167 perl-Template-Toolkit \
170 perl-UNIVERSAL-require \
209 perl-Cache-Memcached \
211 perl-Class-DBI-AbstractSearch \
212 perl-Class-DBI-SQLite \
213 perl-DateTime-Format-Builder \
214 perl-DateTime-Format-ISO8601 \
215 perl-DateTime-Format-Mail \
219 perl-File-Find-Rule \
228 perl-SQL-Abstract-Limit \
229 perl-Template-Toolkit \
231 perl-Test-Exception \
234 perl-UNIVERSAL-require \
251 libdatetime-format-iso8601-perl \
255 EXTRA_DEBS_SQUEEZE = \
261 EXTRA_DEBS_UBUNTU_LUCID = \
266 EXTRA_DEBS_UBUNTU_PRECISE = \
269 libxml-libxslt-perl \
273 # generic CPAN modules:
274 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
275 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
276 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
277 # - is there a specific need for 0.90?
279 DateTime::Format::ISO8601 \
280 RHANDOM/Net-Server-0.90.tar.gz \
283 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
284 # has broken namespace handling. so we still need to install these from
290 # ----------------------------------------------------------------------------
293 @echo "please specify an OS" && exit 0
296 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
298 debian-lenny: generic_debian install_cpan_xml lenny install_libmemcached
299 debian-squeeze: generic_debian squeeze
300 lenny: install_extra_debs
301 squeeze: install_extra_debs_squeeze
302 generic_debian: install_debs debian_sys_config
304 fedora14: install_fedora_rpms
308 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
309 ubuntu-lucid: generic_ubuntu lucid
310 ubuntu-precise: generic_ubuntu precise
311 hardy: install_cpan install_libmemcached
312 lucid: install_extra_debs install_extra_debs_lucid
313 precise: install_extra_debs install_extra_debs_precise
314 generic_ubuntu: install_debs debian_sys_config
316 # - COMMON TARGETS ---------------------------------------------------------
318 # Install the CPAN modules
320 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
322 # Install CPAN modules that need to be forced
324 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
326 # Install the CPAN XML modules
328 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
330 # Install ejabberd from official project installer binary
332 if [ $(LBITS) -eq 64 ]; then \
333 if [ ! -f $(EJABBERD_PKG_x64).gz ]; then \
334 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG_x64).gz; \
336 gunzip $(EJABBERD_PKG_x64).gz; \
337 chmod u+x $(EJABBERD_PKG_x64); \
338 ./$(EJABBERD_PKG_x64) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
340 if [ $(LBITS) -eq 32 ]; then \
341 if [ ! -f $(EJABBERD_PKG).gz ]; then \
342 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; \
344 gunzip $(EJABBERD_PKG).gz; \
345 chmod u+x $(EJABBERD_PKG); \
346 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
349 # Install rpmforge for redhat and centos
351 if [ $(LBITS) -eq 64 ]; then \
352 if [ ! -f $(RPMFORGE_PKG_x64) ]; then \
353 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG_x64) ; \
354 yum -y remove subversion*i386 ; \
356 rpm -Uvh --force ./$(RPMFORGE_PKG_x64) ; \
358 if [ $(LBITS) -eq 32 ]; then \
359 if [ ! -f $(RPMFORGE_PKG) ]; then \
360 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG) ; \
362 rpm -Uvh --force ./$(RPMFORGE_PKG) ; \
366 # Install automake, autoconf, and libtool
368 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
369 tar zxf $(LIBTOOL_PKG).tar.gz
370 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
372 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
373 tar zxf $(AUTOCONF_PKG).tar.gz
374 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
376 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
377 tar zxf $(AUTOMAKE_PKG).tar.gz
378 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
380 # Install libmemcached from the official project source
381 install_libmemcached:
382 if [ ! -f $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
383 tar xzf $(LIBMEMCACHED).tar.gz
384 cd $(LIBMEMCACHED) && ./configure && make && make install
386 # Install a newer version of libxslt
388 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
389 tar xzf $(XSLT).tar.gz
390 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
392 # Install a newer version of libxml2
394 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
395 tar xzf $(XML2).tar.gz
396 cd $(XML2) && ./configure && make && make install
399 make -C $(LIBJS_PERL) clean
400 make -C $(XML2) clean
401 make -C $(XSLT) clean
402 make -f Makefile.ref -C js/src/ clean
405 # ------------------------------------------------------------------
406 # - DEBIAN ---------------------------------------------------------
409 # link the apache modules in
410 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
412 # adds a placeholder module so apxs will be happy
413 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
414 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
415 >> /etc/apache2/httpd.conf; \
418 # Install the debian-specific dependencies
420 $(APT_TOOL) install $(DEBS)
422 # Install the debian-specific dependencies for more modern distros
424 $(APT_TOOL) install $(EXTRA_DEBS)
426 install_extra_debs_squeeze: install_extra_debs
427 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
429 # Install even more packaged dependencies on modern distros
430 install_extra_debs_lucid:
431 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_LUCID)
433 install_extra_debs_precise:
434 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_PRECISE)
438 yum -y install $(FEDORAS)
442 yum -y install $(CENTOS)
446 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
447 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
448 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
449 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
450 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
452 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
453 # if it is not already there
455 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
456 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
460 # vim:noet:sw=4:ts=4: