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 # libmemcache is not packaged on CentOS/RHEL
55 LIBMEMCACHE=libmemcache-1.4.0.rc2
56 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
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\
98 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 = \
211 # generic CPAN modules:
212 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
213 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
214 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
215 # - is there a specific need for 0.90?
217 DateTime::Format::ISO8601 \
218 RHANDOM/Net-Server-0.90.tar.gz \
221 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
222 # has broken namespace handling. so we still need to install these from
228 # generic CPAN modules to force
229 CPAN_MODULES_FORCE = \
230 TMTM/Class-DBI-0.96.tar.gz
232 # ----------------------------------------------------------------------------
235 @echo "please specify an OS" && exit 0
238 centos: install_centos_rpms install_ejabberd install_libmemcache install_libxml2 install_libxslt install_centos_perl create_ld_local
240 debian-etch: generic_debian etch
241 debian-lenny: generic_debian lenny
243 lenny: install_extra_debs
244 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
246 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
250 ubuntu-gutsy: generic_ubuntu install_cpan_xml hardy
251 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
252 ubuntu-intrepid: generic_ubuntu install_cpan_xml intrepid
253 ubuntu-karmic: generic_ubuntu karmic
255 intrepid: install_extra_debs
256 karmic: install_extra_debs install_extra_debs_karmic
257 generic_ubuntu: install_debs install_cpan_force debian_sys_config
259 # - COMMON TARGETS ---------------------------------------------------------
261 # Install the CPAN modules
263 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
265 # Install CPAN modules that need to be forced
267 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
269 # Install the CPAN XML modules
271 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
273 # Install ejabberd from official project installer binary
275 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
276 gunzip $(EJABBERD_PKG).gz
277 chmod u+x $(EJABBERD_PKG)
278 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
280 # Install libmemcache from the official project source
282 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
283 tar xjf $(LIBMEMCACHE).tar.bz2
284 cd $(LIBMEMCACHE) && ./configure && make && make install
286 # Install a newer version of libxslt
288 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
289 tar xzf $(XSLT).tar.gz
290 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
292 # Install a newer version of libxml2
294 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
295 tar xzf $(XML2).tar.gz
296 cd $(XML2) && ./configure && make && make install
299 make -C $(LIBJS_PERL) clean
300 make -C $(XML2) clean
301 make -C $(XSLT) clean
302 make -f Makefile.ref -C js/src/ clean
305 # ------------------------------------------------------------------
306 # - DEBIAN ---------------------------------------------------------
309 # link the apache modules in
310 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
312 # adds a placeholder module so apxs will be happy
313 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
314 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
315 >> /etc/apache2/httpd.conf; \
318 # Install the debian-specific dependencies
320 $(APT_TOOL) install $(DEBS)
322 # Install the debian-specific dependencies for more modern distros
324 $(APT_TOOL) install $(EXTRA_DEBS)
326 # Install even more packaged dependencies on modern distros
327 install_extra_debs_karmic:
328 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
330 # ------------------------------------------------------------------
331 # - GENTOO ---------------------------------------------------------
337 for m in $(GENTOO_RC); do rc-update add $$m default; done;
340 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
342 # ------------------------------------------------------------------
346 yum -y install $(CENTOS)
349 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
350 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
351 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
352 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
353 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
355 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
356 # if it is not already there
358 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
359 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
363 # vim:noet:sw=4:ts=4: