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\
93 libfile-find-rule-perl\
107 libuniversal-require-perl\
124 apr-util-devel.x86_64 \
143 perl-Cache-Memcached \
144 perl-Class-DBI-AbstractSearch \
145 perl-Class-DBI-SQLite \
147 perl-DateTime-Format-ISO8601 \
148 perl-DateTime-Format-Mail \
150 perl-DateTime-TimeZone \
154 perl-File-Find-Rule \
159 perl-Memcached-libmemcached \
164 perl-Template-Toolkit \
167 perl-UNIVERSAL-require \
188 app-portage/gentoolkit\
194 dev-perl/Cache-Memcached\
196 dev-perl/Log-Log4perl\
197 dev-perl/Unix-Syslog\
199 dev-perl/XML-LibXSLT\
202 dev-perl/libwww-perl\
203 dev-perl/Template-Toolkit\
214 Class::DBI::AbstractSearch\
221 libdatetime-format-iso8601-perl \
225 EXTRA_DEBS_UBUNTU_KARMIC = \
230 # generic CPAN modules:
231 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
232 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
233 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
234 # - is there a specific need for 0.90?
236 DateTime::Format::ISO8601 \
237 RHANDOM/Net-Server-0.90.tar.gz \
240 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
241 # has broken namespace handling. so we still need to install these from
247 # generic CPAN modules to force
248 CPAN_MODULES_FORCE = \
249 TMTM/Class-DBI-0.96.tar.gz
251 # ----------------------------------------------------------------------------
254 @echo "please specify an OS" && exit 0
257 centos: install_rpmforge install_centos_rpms install_ejabberd install_buildutils install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
259 debian-etch: generic_debian etch install_libmemcached
260 debian-lenny: generic_debian lenny install_libmemcached
262 lenny: install_extra_debs
263 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
265 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
269 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
270 ubuntu-intrepid: generic_ubuntu install_cpan_xml intrepid
271 ubuntu-karmic: generic_ubuntu karmic
272 hardy: install_cpan install_libmemcached
273 intrepid: install_extra_debs 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: