1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF
6 # Currently supports Debian (etch/lenny), Ubuntu (gutsy/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-gutsy
17 # make -f Makefile.install ubuntu-hardy
19 # make -f Makefile.install ubuntu-intrepid
21 # make -f Makefile.install ubuntu-karmic
23 # make -f Makefile.install centos
25 # make -f Makefile.install rhel
27 # make -f Makefile.install gentoo
31 # This makefile has been tested much more with Ubuntu and Debian than
32 # CentOS, Gentoo, or RHEL.
34 # Gentoo (especially amd64) requires a good bit of masked package
35 # mangling for some packages. These are not documented here because
36 # they will continue to evolve
38 # ---------------------------------------------------------------------
40 # Make any assumptions about the shell being used explicit
44 # Gentoo needs explicit versions on many of these packages
45 # to simulate a "blessed" set of packages
47 # ejabberd is not packaged on CentOS/RHEL, so we have to
48 # download the installable package from the source
50 EJABBERD_PKG=ejabberd-2.0.2_2-linux-x86-installer.bin
51 EJABBERD_PKG_x64=ejabberd-2.0.2_2-linux-x86_64-installer.bin
52 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
54 # libmemcached is only packaged on newer distros
55 LIBMEMCACHED=libmemcached-0.35
56 LIBMEMCACHED_HOST=http://download.tangent.org
58 # XML::LibXSLT fails due to old libxslt
60 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
62 # libxslt depends on a newer version of libxml2:
64 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
78 libcache-memcached-perl\
79 libclass-dbi-abstractsearch-perl\
80 libclass-dbi-sqlite-perl\
83 libfile-find-rule-perl\
97 libuniversal-require-perl\
140 # Some of these packages have stupid bugs in their test suites
141 # that are simply too painful to workaround
142 CENTOS_PERL_NOTEST = \
145 CENTOS_PERL_LOCAL = \
150 Class::DBI::AbstractSearch \
170 app-portage/gentoolkit\
176 dev-perl/Cache-Memcached\
178 dev-perl/Log-Log4perl\
179 dev-perl/Unix-Syslog\
181 dev-perl/XML-LibXSLT\
184 dev-perl/libwww-perl\
185 dev-perl/Template-Toolkit\
196 Class::DBI::AbstractSearch\
203 libdatetime-format-iso8601-perl \
207 EXTRA_DEBS_UBUNTU_KARMIC = \
212 # generic CPAN modules:
213 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
214 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
215 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
216 # - is there a specific need for 0.90?
218 DateTime::Format::ISO8601 \
219 RHANDOM/Net-Server-0.90.tar.gz \
222 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
223 # has broken namespace handling. so we still need to install these from
229 # generic CPAN modules to force
230 CPAN_MODULES_FORCE = \
231 TMTM/Class-DBI-0.96.tar.gz
233 # ----------------------------------------------------------------------------
236 @echo "please specify an OS" && exit 0
239 centos: install_centos_rpms install_ejabberd install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
241 debian-etch: generic_debian etch install_libmemcached
242 debian-lenny: generic_debian lenny install_libmemcached
244 lenny: install_extra_debs
245 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
247 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
251 ubuntu-gutsy: generic_ubuntu install_cpan_xml hardy
252 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
253 ubuntu-intrepid: generic_ubuntu install_cpan_xml intrepid
254 ubuntu-karmic: generic_ubuntu karmic
255 hardy: install_cpan install_libmemcached
256 intrepid: install_extra_debs install_libmemcached
257 karmic: install_extra_debs install_extra_debs_karmic
258 generic_ubuntu: install_debs install_cpan_force debian_sys_config
260 # - COMMON TARGETS ---------------------------------------------------------
262 # Install the CPAN modules
264 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
266 # Install CPAN modules that need to be forced
268 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
270 # Install the CPAN XML modules
272 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
274 # Install ejabberd from official project installer binary
276 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
277 gunzip $(EJABBERD_PKG).gz
278 chmod u+x $(EJABBERD_PKG)
279 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
281 # Install libmemcached from the official project source
282 install_libmemcached:
283 if [ ! -d $(LIBMEMCACHED).tar.gz ]; then wget $(LIBMEMCACHED_HOST)/$(LIBMEMCACHED).tar.gz; fi;
284 tar xzf $(LIBMEMCACHED).tar.gz
285 cd $(LIBMEMCACHED) && ./configure && make && make install
287 # Install a newer version of libxslt
289 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
290 tar xzf $(XSLT).tar.gz
291 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
293 # Install a newer version of libxml2
295 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
296 tar xzf $(XML2).tar.gz
297 cd $(XML2) && ./configure && make && make install
300 make -C $(LIBJS_PERL) clean
301 make -C $(XML2) clean
302 make -C $(XSLT) clean
303 make -f Makefile.ref -C js/src/ clean
306 # ------------------------------------------------------------------
307 # - DEBIAN ---------------------------------------------------------
310 # link the apache modules in
311 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
313 # adds a placeholder module so apxs will be happy
314 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
315 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
316 >> /etc/apache2/httpd.conf; \
319 # Install the debian-specific dependencies
321 $(APT_TOOL) install $(DEBS)
323 # Install the debian-specific dependencies for more modern distros
325 $(APT_TOOL) install $(EXTRA_DEBS)
327 # Install even more packaged dependencies on modern distros
328 install_extra_debs_karmic:
329 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
331 # ------------------------------------------------------------------
332 # - GENTOO ---------------------------------------------------------
338 for m in $(GENTOO_RC); do rc-update add $$m default; done;
341 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
343 # ------------------------------------------------------------------
347 yum -y install $(CENTOS)
350 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
351 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
352 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
353 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
354 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
356 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
357 # if it is not already there
359 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
360 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
364 # vim:noet:sw=4:ts=4: