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.
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
27 # This makefile has been tested much more with Ubuntu and Debian than
28 # CentOS, Gentoo, or RHEL.
30 # Gentoo (especially amd64) requires a good bit of masked package
31 # mangling for some packages. These are not documented here because
32 # they will continue to evolve
34 # ---------------------------------------------------------------------
36 # Make any assumptions about the shell being used explicit
40 # Gentoo needs explicit versions on many of these packages
41 # to simulate a "blessed" set of packages
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_64-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=rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
52 RPMFORGE_HOST=http://packages.sw.be/rpmforge-release
54 # need newer libtool, autoconf, and automake on centos
55 AUTOCONF_HOST=http://ftp.gnu.org/gnu/autoconf
56 AUTOCONF_PKG=autoconf-2.65
57 LIBTOOL_HOST=http://ftp.gnu.org/gnu/libtool
58 LIBTOOL_PKG=libtool-2.2.6b
59 AUTOMAKE_HOST=http://ftp.gnu.org/gnu/automake
60 AUTOMAKE_PKG=automake-1.11
62 # libmemcached is only packaged on newer distros
63 LIBMEMCACHED=libmemcached-0.35
64 LIBMEMCACHED_HOST=http://download.tangent.org
66 # XML::LibXSLT fails due to old libxslt
68 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
70 # libxslt depends on a newer version of libxml2:
72 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
86 libcache-memcached-perl\
87 libclass-dbi-abstractsearch-perl\
88 libclass-dbi-sqlite-perl\
89 libdatetime-format-builder-perl\
90 libdatetime-format-mail-perl\
92 libdatetime-timezone-perl\
95 libfile-find-rule-perl\
100 libmodule-build-perl\
109 libuniversal-require-perl\
126 apr-util-devel.x86_64 \
145 perl-Cache-Memcached \
146 perl-Class-DBI-AbstractSearch \
147 perl-Class-DBI-SQLite \
149 perl-DateTime-Format-ISO8601 \
150 perl-DateTime-Format-Mail \
152 perl-DateTime-TimeZone \
156 perl-File-Find-Rule \
161 perl-Memcached-libmemcached \
166 perl-Template-Toolkit \
169 perl-UNIVERSAL-require \
190 app-portage/gentoolkit\
196 dev-perl/Cache-Memcached\
198 dev-perl/Log-Log4perl\
199 dev-perl/Unix-Syslog\
201 dev-perl/XML-LibXSLT\
204 dev-perl/libwww-perl\
205 dev-perl/Template-Toolkit\
216 Class::DBI::AbstractSearch\
223 libdatetime-format-iso8601-perl \
227 EXTRA_DEBS_UBUNTU_KARMIC = \
232 # generic CPAN modules:
233 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
234 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
235 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
236 # - is there a specific need for 0.90?
238 DateTime::Format::ISO8601 \
239 RHANDOM/Net-Server-0.90.tar.gz \
242 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
243 # has broken namespace handling. so we still need to install these from
249 # generic CPAN modules to force
250 CPAN_MODULES_FORCE = \
251 TMTM/Class-DBI-0.96.tar.gz
253 # ----------------------------------------------------------------------------
256 @echo "please specify an OS" && exit 0
259 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
261 debian-etch: generic_debian etch install_libmemcached
262 debian-lenny: generic_debian lenny install_libmemcached
264 lenny: install_extra_debs
265 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
267 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
271 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
272 ubuntu-karmic: generic_ubuntu karmic
273 hardy: install_cpan install_libmemcached
274 karmic: install_extra_debs install_extra_debs_karmic
275 generic_ubuntu: install_debs install_cpan_force debian_sys_config
277 # - COMMON TARGETS ---------------------------------------------------------
279 # Install the CPAN modules
281 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
283 # Install CPAN modules that need to be forced
285 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
287 # Install the CPAN XML modules
289 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
291 # Install ejabberd from official project installer binary
293 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
294 gunzip $(EJABBERD_PKG).gz
295 chmod u+x $(EJABBERD_PKG)
296 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
298 # Install rpmforge for redhat and centos
300 if [ ! -f $(RPMFORGE_PKG).gz ]; then wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG); fi;
301 rpm -Uvh --force ./$(RPMFORGE_PKG)
304 # Install automake, autoconf, and libtool
306 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
307 tar zxf $(LIBTOOL_PKG).tar.gz
308 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
310 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
311 tar zxf $(AUTOCONF_PKG).tar.gz
312 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
314 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
315 tar zxf $(AUTOMAKE_PKG).tar.gz
316 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
318 # Install libmemcached from the official project source
319 install_libmemcached:
320 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
321 tar xzf $(LIBMEMCACHED).tar.gz
322 cd $(LIBMEMCACHED) && ./configure && make && make install
324 # Install a newer version of libxslt
326 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
327 tar xzf $(XSLT).tar.gz
328 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
330 # Install a newer version of libxml2
332 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
333 tar xzf $(XML2).tar.gz
334 cd $(XML2) && ./configure && make && make install
337 make -C $(LIBJS_PERL) clean
338 make -C $(XML2) clean
339 make -C $(XSLT) clean
340 make -f Makefile.ref -C js/src/ clean
343 # ------------------------------------------------------------------
344 # - DEBIAN ---------------------------------------------------------
347 # link the apache modules in
348 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
350 # adds a placeholder module so apxs will be happy
351 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
352 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
353 >> /etc/apache2/httpd.conf; \
356 # Install the debian-specific dependencies
358 $(APT_TOOL) install $(DEBS)
360 # Install the debian-specific dependencies for more modern distros
362 $(APT_TOOL) install $(EXTRA_DEBS)
364 # Install even more packaged dependencies on modern distros
365 install_extra_debs_karmic:
366 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
368 # ------------------------------------------------------------------
369 # - GENTOO ---------------------------------------------------------
375 for m in $(GENTOO_RC); do rc-update add $$m default; done;
378 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
380 # ------------------------------------------------------------------
384 yum -y install $(CENTOS)
387 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
388 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
389 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
390 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
391 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
393 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
394 # if it is not already there
396 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
397 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
401 # vim:noet:sw=4:ts=4: