1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
6 # Currently supports Debian (etch/lenny), Ubuntu (hardy/lucid), and Gentoo.
7 # Working towards support of CentOS 5 / RHEL 5 and Fedora.
8 # Installs Perl prereqs, libjs with Perl wrapper
11 # make -f Makefile.install debian-etch
13 # make -f Makefile.install debian-lenny
15 # make -f Makefile.install ubuntu-hardy
17 # make -f Makefile.install ubuntu-lucid
19 # make -f Makefile.install centos
21 # make -f Makefile.install rhel
23 # make -f Makefile.install gentoo
25 # make -f Makefile.install fedora13
29 # This makefile has been tested much more with Ubuntu and Debian than
30 # CentOS, Gentoo, or RHEL.
32 # Gentoo (especially amd64) requires a good bit of masked package
33 # mangling for some packages. These are not documented here because
34 # they will continue to evolve
36 # ---------------------------------------------------------------------
38 # Make any assumptions about the shell being used explicit
42 # Gentoo needs explicit versions on many of these packages
43 # to simulate a "blessed" set of packages
46 LBITS=$(shell getconf LONG_BIT)
48 # ejabberd is not packaged on CentOS/RHEL, so we have to
49 # download the installable package from the source
51 EJABBERD_PKG=ejabberd-2.1.2-linux-x86-installer.bin
52 EJABBERD_PKG_x64=ejabberd-2.1.2-linux-x86_64-installer.bin
53 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
55 # Centos and Redhat will require the rpmforge repository mostly for memcache and perl modules
56 RPMFORGE_PKG_x64=rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
57 RPMFORGE_PKG=rpmforge-release-0.5.1-1.el5.rf.i386.rpm
58 RPMFORGE_HOST=http://packages.sw.be/rpmforge-release
60 # need newer libtool, autoconf, and automake on centos
61 AUTOCONF_HOST=http://ftp.gnu.org/gnu/autoconf
62 AUTOCONF_PKG=autoconf-2.65
63 LIBTOOL_HOST=http://ftp.gnu.org/gnu/libtool
64 LIBTOOL_PKG=libtool-2.2.6b
65 AUTOMAKE_HOST=http://ftp.gnu.org/gnu/automake
66 AUTOMAKE_PKG=automake-1.11
68 # libmemcached is only packaged on newer distros
69 LIBMEMCACHED=libmemcached-0.35
70 LIBMEMCACHED_HOST=http://download.tangent.org
72 # XML::LibXSLT fails due to old libxslt
74 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
76 # libxslt depends on a newer version of libxml2:
78 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
92 libcache-memcached-perl\
93 libclass-dbi-abstractsearch-perl\
94 libclass-dbi-sqlite-perl\
95 libdatetime-format-builder-perl\
96 libdatetime-format-mail-perl\
98 libdatetime-timezone-perl\
101 libfile-find-rule-perl\
105 liblog-log4perl-perl\
106 libmodule-build-perl\
115 libuniversal-require-perl\
151 perl-Cache-Memcached \
152 perl-Class-DBI-AbstractSearch \
153 perl-Class-DBI-SQLite \
155 perl-DateTime-Format-ISO8601 \
156 perl-DateTime-Format-Mail \
158 perl-DateTime-TimeZone \
162 perl-File-Find-Rule \
167 perl-Memcached-libmemcached \
170 perl-Template-Toolkit \
173 perl-UNIVERSAL-require \
211 perl-Cache-Memcached \
213 perl-Class-DBI-AbstractSearch \
214 perl-Class-DBI-SQLite \
215 perl-DateTime-Format-Builder \
216 perl-DateTime-Format-ISO8601 \
217 perl-DateTime-Format-Mail \
221 perl-File-Find-Rule \
230 perl-SQL-Abstract-Limit \
231 perl-Template-Toolkit \
233 perl-Test-Exception \
236 perl-UNIVERSAL-require \
255 app-portage/gentoolkit\
261 dev-perl/Cache-Memcached\
263 dev-perl/Log-Log4perl\
264 dev-perl/Unix-Syslog\
266 dev-perl/XML-LibXSLT\
269 dev-perl/libwww-perl\
270 dev-perl/Template-Toolkit\
281 Class::DBI::AbstractSearch\
288 libdatetime-format-iso8601-perl \
292 EXTRA_DEBS_UBUNTU_LUCID = \
297 # generic CPAN modules:
298 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
299 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
300 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
301 # - is there a specific need for 0.90?
303 DateTime::Format::ISO8601 \
304 RHANDOM/Net-Server-0.90.tar.gz \
307 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
308 # has broken namespace handling. so we still need to install these from
314 # generic CPAN modules to force
315 CPAN_MODULES_FORCE = \
316 TMTM/Class-DBI-0.96.tar.gz
318 # ----------------------------------------------------------------------------
321 @echo "please specify an OS" && exit 0
324 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
326 debian-etch: generic_debian etch install_libmemcached
327 debian-lenny: generic_debian lenny install_libmemcached
329 lenny: install_extra_debs
330 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
332 fedora13: install_fedora_rpms
334 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
338 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
339 ubuntu-lucid: generic_ubuntu lucid
340 hardy: install_cpan install_libmemcached
341 lucid: install_extra_debs install_extra_debs_lucid
342 generic_ubuntu: install_debs install_cpan_force debian_sys_config
344 # - COMMON TARGETS ---------------------------------------------------------
346 # Install the CPAN modules
348 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
350 # Install CPAN modules that need to be forced
352 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
354 # Install the CPAN XML modules
356 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
358 # Install ejabberd from official project installer binary
360 if [ $(LBITS) -eq 64 ]; then \
361 if [ ! -f $(EJABBERD_PKG_x64).gz ]; then \
362 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG_x64).gz; \
364 gunzip $(EJABBERD_PKG_x64).gz; \
365 chmod u+x $(EJABBERD_PKG_x64); \
366 ./$(EJABBERD_PKG_x64) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
368 if [ $(LBITS) -eq 32 ]; then \
369 if [ ! -f $(EJABBERD_PKG).gz ]; then \
370 wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; \
372 gunzip $(EJABBERD_PKG).gz; \
373 chmod u+x $(EJABBERD_PKG); \
374 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf ; \
377 # Install rpmforge for redhat and centos
379 if [ $(LBITS) -eq 64 ]; then \
380 if [ ! -f $(RPMFORGE_PKG_x64) ]; then \
381 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG_x64) ; \
382 yum -y remove subversion*i386 ; \
384 rpm -Uvh --force ./$(RPMFORGE_PKG_x64) ; \
386 if [ $(LBITS) -eq 32 ]; then \
387 if [ ! -f $(RPMFORGE_PKG) ]; then \
388 wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG) ; \
390 rpm -Uvh --force ./$(RPMFORGE_PKG) ; \
394 # Install automake, autoconf, and libtool
396 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
397 tar zxf $(LIBTOOL_PKG).tar.gz
398 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
400 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
401 tar zxf $(AUTOCONF_PKG).tar.gz
402 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
404 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
405 tar zxf $(AUTOMAKE_PKG).tar.gz
406 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
408 # Install libmemcached from the official project source
409 install_libmemcached:
410 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
411 tar xzf $(LIBMEMCACHED).tar.gz
412 cd $(LIBMEMCACHED) && ./configure && make && make install
414 # Install a newer version of libxslt
416 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
417 tar xzf $(XSLT).tar.gz
418 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
420 # Install a newer version of libxml2
422 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
423 tar xzf $(XML2).tar.gz
424 cd $(XML2) && ./configure && make && make install
427 make -C $(LIBJS_PERL) clean
428 make -C $(XML2) clean
429 make -C $(XSLT) clean
430 make -f Makefile.ref -C js/src/ clean
433 # ------------------------------------------------------------------
434 # - DEBIAN ---------------------------------------------------------
437 # link the apache modules in
438 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
440 # adds a placeholder module so apxs will be happy
441 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
442 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
443 >> /etc/apache2/httpd.conf; \
446 # Install the debian-specific dependencies
448 $(APT_TOOL) install $(DEBS)
450 # Install the debian-specific dependencies for more modern distros
452 $(APT_TOOL) install $(EXTRA_DEBS)
454 # Install even more packaged dependencies on modern distros
455 install_extra_debs_lucid:
456 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_LUCID)
458 # ------------------------------------------------------------------
459 # - GENTOO ---------------------------------------------------------
465 for m in $(GENTOO_RC); do rc-update add $$m default; done;
468 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
470 # ------------------------------------------------------------------
474 yum -y install $(FEDORAS)
478 yum -y install $(CENTOS)
482 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
483 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
484 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
485 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
486 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
488 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
489 # if it is not already there
491 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
492 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
496 # vim:noet:sw=4:ts=4: