1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
6 # Currently supports Debian (etch/lenny), Ubuntu (hardy/karmic), 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-karmic
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
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_64-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=rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
54 RPMFORGE_HOST=http://packages.sw.be/rpmforge-release
56 # need newer libtool, autoconf, and automake on centos
57 AUTOCONF_HOST=http://ftp.gnu.org/gnu/autoconf
58 AUTOCONF_PKG=autoconf-2.65
59 LIBTOOL_HOST=http://ftp.gnu.org/gnu/libtool
60 LIBTOOL_PKG=libtool-2.2.6b
61 AUTOMAKE_HOST=http://ftp.gnu.org/gnu/automake
62 AUTOMAKE_PKG=automake-1.11
64 # libmemcached is only packaged on newer distros
65 LIBMEMCACHED=libmemcached-0.35
66 LIBMEMCACHED_HOST=http://download.tangent.org
68 # XML::LibXSLT fails due to old libxslt
70 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
72 # libxslt depends on a newer version of libxml2:
74 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
88 libcache-memcached-perl\
89 libclass-dbi-abstractsearch-perl\
90 libclass-dbi-sqlite-perl\
91 libdatetime-format-builder-perl\
92 libdatetime-format-mail-perl\
94 libdatetime-timezone-perl\
97 libfile-find-rule-perl\
101 liblog-log4perl-perl\
102 libmodule-build-perl\
111 libuniversal-require-perl\
128 apr-util-devel.x86_64 \
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 \
163 perl-Memcached-libmemcached \
168 perl-Template-Toolkit \
171 perl-UNIVERSAL-require \
207 perl-Cache-Memcached \
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 \
243 Class::DBI::AbstractSearch
251 app-portage/gentoolkit\
257 dev-perl/Cache-Memcached\
259 dev-perl/Log-Log4perl\
260 dev-perl/Unix-Syslog\
262 dev-perl/XML-LibXSLT\
265 dev-perl/libwww-perl\
266 dev-perl/Template-Toolkit\
277 Class::DBI::AbstractSearch\
284 libdatetime-format-iso8601-perl \
288 EXTRA_DEBS_UBUNTU_KARMIC = \
293 # generic CPAN modules:
294 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
295 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
296 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
297 # - is there a specific need for 0.90?
299 DateTime::Format::ISO8601 \
300 RHANDOM/Net-Server-0.90.tar.gz \
303 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
304 # has broken namespace handling. so we still need to install these from
310 # generic CPAN modules to force
311 CPAN_MODULES_FORCE = \
312 TMTM/Class-DBI-0.96.tar.gz
314 # ----------------------------------------------------------------------------
317 @echo "please specify an OS" && exit 0
320 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
322 debian-etch: generic_debian etch install_libmemcached
323 debian-lenny: generic_debian lenny install_libmemcached
325 lenny: install_extra_debs
326 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
328 fedora13: install_fedora_rpms install_fedora_perl
330 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
334 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
335 ubuntu-karmic: generic_ubuntu karmic
336 hardy: install_cpan install_libmemcached
337 karmic: install_extra_debs install_extra_debs_karmic
338 generic_ubuntu: install_debs install_cpan_force debian_sys_config
340 # - COMMON TARGETS ---------------------------------------------------------
342 # Install the CPAN modules
344 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
346 # Install CPAN modules that need to be forced
348 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
350 # Install the CPAN XML modules
352 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
354 # Install ejabberd from official project installer binary
356 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
357 gunzip $(EJABBERD_PKG).gz
358 chmod u+x $(EJABBERD_PKG)
359 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
361 # Install rpmforge for redhat and centos
363 if [ ! -f $(RPMFORGE_PKG).gz ]; then wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG); fi;
364 rpm -Uvh --force ./$(RPMFORGE_PKG)
367 # Install automake, autoconf, and libtool
369 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
370 tar zxf $(LIBTOOL_PKG).tar.gz
371 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
373 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
374 tar zxf $(AUTOCONF_PKG).tar.gz
375 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
377 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
378 tar zxf $(AUTOMAKE_PKG).tar.gz
379 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
381 # Install libmemcached from the official project source
382 install_libmemcached:
383 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
384 tar xzf $(LIBMEMCACHED).tar.gz
385 cd $(LIBMEMCACHED) && ./configure && make && make install
387 # Install a newer version of libxslt
389 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
390 tar xzf $(XSLT).tar.gz
391 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
393 # Install a newer version of libxml2
395 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
396 tar xzf $(XML2).tar.gz
397 cd $(XML2) && ./configure && make && make install
400 make -C $(LIBJS_PERL) clean
401 make -C $(XML2) clean
402 make -C $(XSLT) clean
403 make -f Makefile.ref -C js/src/ clean
406 # ------------------------------------------------------------------
407 # - DEBIAN ---------------------------------------------------------
410 # link the apache modules in
411 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
413 # adds a placeholder module so apxs will be happy
414 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
415 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
416 >> /etc/apache2/httpd.conf; \
419 # Install the debian-specific dependencies
421 $(APT_TOOL) install $(DEBS)
423 # Install the debian-specific dependencies for more modern distros
425 $(APT_TOOL) install $(EXTRA_DEBS)
427 # Install even more packaged dependencies on modern distros
428 install_extra_debs_karmic:
429 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
431 # ------------------------------------------------------------------
432 # - GENTOO ---------------------------------------------------------
438 for m in $(GENTOO_RC); do rc-update add $$m default; done;
441 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
443 # ------------------------------------------------------------------
447 yum -y install $(FEDORAS)
450 for m in $(FEDORA_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
454 yum -y install $(CENTOS)
457 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
458 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
459 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
460 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
461 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
463 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
464 # if it is not already there
466 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
467 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
471 # vim:noet:sw=4:ts=4: