1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
6 # Currently supports Debian (etch/lenny), Ubuntu (hardy/intrepid/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-intrepid
19 # make -f Makefile.install ubuntu-karmic
21 # make -f Makefile.install centos
23 # make -f Makefile.install rhel
25 # make -f Makefile.install gentoo
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 \
192 app-portage/gentoolkit\
198 dev-perl/Cache-Memcached\
200 dev-perl/Log-Log4perl\
201 dev-perl/Unix-Syslog\
203 dev-perl/XML-LibXSLT\
206 dev-perl/libwww-perl\
207 dev-perl/Template-Toolkit\
218 Class::DBI::AbstractSearch\
225 libdatetime-format-iso8601-perl \
229 EXTRA_DEBS_UBUNTU_KARMIC = \
234 # generic CPAN modules:
235 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
236 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
237 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
238 # - is there a specific need for 0.90?
240 DateTime::Format::ISO8601 \
241 RHANDOM/Net-Server-0.90.tar.gz \
244 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
245 # has broken namespace handling. so we still need to install these from
251 # generic CPAN modules to force
252 CPAN_MODULES_FORCE = \
253 TMTM/Class-DBI-0.96.tar.gz
255 # ----------------------------------------------------------------------------
258 @echo "please specify an OS" && exit 0
261 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
263 debian-etch: generic_debian etch install_libmemcached
264 debian-lenny: generic_debian lenny install_libmemcached
266 lenny: install_extra_debs
267 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
269 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
273 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
274 ubuntu-intrepid: generic_ubuntu install_cpan_xml intrepid
275 ubuntu-karmic: generic_ubuntu karmic
276 hardy: install_cpan install_libmemcached
277 intrepid: install_extra_debs install_libmemcached
278 karmic: install_extra_debs install_extra_debs_karmic
279 generic_ubuntu: install_debs install_cpan_force debian_sys_config
281 # - COMMON TARGETS ---------------------------------------------------------
283 # Install the CPAN modules
285 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
287 # Install CPAN modules that need to be forced
289 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
291 # Install the CPAN XML modules
293 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
295 # Install ejabberd from official project installer binary
297 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
298 gunzip $(EJABBERD_PKG).gz
299 chmod u+x $(EJABBERD_PKG)
300 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
302 # Install rpmforge for redhat and centos
304 if [ ! -f $(RPMFORGE_PKG).gz ]; then wget $(RPMFORGE_HOST)/$(RPMFORGE_PKG); fi;
305 rpm -Uvh --force ./$(RPMFORGE_PKG)
308 # Install automake, autoconf, and libtool
310 if [ ! -f $(LIBTOOL_PKG).tar.gz ]; then wget $(LIBTOOL_HOST)/$(LIBTOOL_PKG).tar.gz; fi;
311 tar zxf $(LIBTOOL_PKG).tar.gz
312 cd $(LIBTOOL_PKG) && ./configure --prefix=/usr && make && make install
314 if [ ! -f $(AUTOCONF_PKG).tar.gz ]; then wget $(AUTOCONF_HOST)/$(AUTOCONF_PKG).tar.gz; fi;
315 tar zxf $(AUTOCONF_PKG).tar.gz
316 cd $(AUTOCONF_PKG) && ./configure --prefix=/usr && make && make install
318 if [ ! -f $(AUTOMAKE_PKG).tar.gz ]; then wget $(AUTOMAKE_HOST)/$(AUTOMAKE_PKG).tar.gz; fi;
319 tar zxf $(AUTOMAKE_PKG).tar.gz
320 cd $(AUTOMAKE_PKG) && ./configure --prefix=/usr && make && make install
322 # Install libmemcached from the official project source
323 install_libmemcached:
324 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
325 tar xzf $(LIBMEMCACHED).tar.gz
326 cd $(LIBMEMCACHED) && ./configure && make && make install
328 # Install a newer version of libxslt
330 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
331 tar xzf $(XSLT).tar.gz
332 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
334 # Install a newer version of libxml2
336 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
337 tar xzf $(XML2).tar.gz
338 cd $(XML2) && ./configure && make && make install
341 make -C $(LIBJS_PERL) clean
342 make -C $(XML2) clean
343 make -C $(XSLT) clean
344 make -f Makefile.ref -C js/src/ clean
347 # ------------------------------------------------------------------
348 # - DEBIAN ---------------------------------------------------------
351 # link the apache modules in
352 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
354 # adds a placeholder module so apxs will be happy
355 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
356 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
357 >> /etc/apache2/httpd.conf; \
360 # Install the debian-specific dependencies
362 $(APT_TOOL) install $(DEBS)
364 # Install the debian-specific dependencies for more modern distros
366 $(APT_TOOL) install $(EXTRA_DEBS)
368 # Install even more packaged dependencies on modern distros
369 install_extra_debs_karmic:
370 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
372 # ------------------------------------------------------------------
373 # - GENTOO ---------------------------------------------------------
379 for m in $(GENTOO_RC); do rc-update add $$m default; done;
382 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
384 # ------------------------------------------------------------------
388 yum -y install $(CENTOS)
391 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
392 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
393 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
394 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
395 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
397 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
398 # if it is not already there
400 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
401 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
405 # vim:noet:sw=4:ts=4: