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), 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 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.0.2_2-linux-x86-installer.bin
49 EJABBERD_PKG_x64=ejabberd-2.0.2_2-linux-x86_64-installer.bin
50 EJABBERD_HOST=http://www.process-one.net/downloads/ejabberd
52 # libmemcache is not packaged on CentOS/RHEL
53 LIBMEMCACHE=libmemcache-1.4.0.rc2
54 LIBMEMCACHE_HOST=http://people.freebsd.org/~seanc/libmemcache/
56 # XML::LibXSLT fails due to old libxslt
58 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
60 # libxslt depends on a newer version of libxml2:
61 XML2=libxml2-2.6.30.tar.gz
62 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
76 libcache-memcached-perl\
77 libclass-dbi-abstractsearch-perl\
78 libclass-dbi-sqlite-perl\
81 libfile-find-rule-perl\
94 libuniversal-require-perl\
136 # Some of these packages have stupid bugs in their test suites
137 # that are simply too painful to workaround
138 CENTOS_PERL_NOTEST = \
141 CENTOS_PERL_LOCAL = \
146 Class::DBI::AbstractSearch \
166 app-portage/gentoolkit\
172 dev-perl/Cache-Memcached\
174 dev-perl/Log-Log4perl\
175 dev-perl/Unix-Syslog\
177 dev-perl/XML-LibXSLT\
180 dev-perl/libwww-perl\
181 dev-perl/Template-Toolkit\
192 Class::DBI::AbstractSearch\
199 libdatetime-format-iso8601-perl \
203 # generic CPAN modules:
204 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
205 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
206 # * XML::LibXML::XPathContext is part of libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid
207 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
208 # - is there a specific need for 0.90?
210 DateTime::Format::ISO8601 \
211 RHANDOM/Net-Server-0.90.tar.gz \
213 XML::LibXML::XPathContext
215 # generic CPAN modules to force
216 CPAN_MODULES_FORCE = \
217 TMTM/Class-DBI-0.96.tar.gz
219 # ----------------------------------------------------------------------------
222 @echo "please specify an OS" && exit 0
225 centos: install_centos_rpms install_ejabberd install_libmemcache install install_libxml2 install_libxslt install_centos_perl create_ld_local
227 debian-etch: generic_debian etch
228 debian-lenny: generic_debian lenny
230 lenny: install_extra_debs
231 generic_debian: install_debs install_cpan_force debian_sys_config
233 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
237 ubuntu-gutsy: generic_ubuntu hardy
238 ubuntu-hardy: generic_ubuntu hardy
239 ubuntu-intrepid: generic_ubuntu intrepid
241 intrepid: install_extra_debs
242 generic_ubuntu: install_debs install_cpan_force debian_sys_config
244 # - COMMON TARGETS ---------------------------------------------------------
246 # Install the CPAN modules
248 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
250 # Install CPAN modules that need to be forced
252 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
254 # Install ejabberd from official project installer binary
256 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
257 gunzip $(EJABBERD_PKG).gz
258 chmod u+x $(EJABBERD_PKG).gz
259 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
261 # Install libmemcache from the official project source
263 if [ ! -d $(LIBMEMCACHE) ]; then wget $(LIBMEMCACHE_HOST)/$(LIBMEMCACHE).tar.bz2; fi;
264 tar xjf $(LIBMEMCACHE).tar.bz2
265 cd $(LIBMEMCACHE) && ./configure && make && make install
267 # Install a newer version of libxslt
269 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
270 tar xzf $(XSLT).tar.gz
271 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
273 # Install a newer version of libxml2
275 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
276 tar xzf $(XML2).tar.gz
277 cd $(XML2) && ./configure && make && make install
280 make -C $(LIBJS_PERL) clean
281 make -C $(XML2) clean
282 make -C $(XSLT) clean
283 make -f Makefile.ref -C js/src/ clean
286 # ------------------------------------------------------------------
287 # - DEBIAN ---------------------------------------------------------
290 # link the apache modules in
291 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
293 # adds a placeholder module so apxs will be happy
294 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
295 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
296 >> /etc/apache2/httpd.conf; \
299 # Install the debian-specific dependencies
301 $(APT_TOOL) install $(DEBS)
303 # Install the debian-specific dependencies for more modern distros
305 $(APT_TOOL) install $(EXTRA_DEBS)
307 # ------------------------------------------------------------------
308 # - GENTOO ---------------------------------------------------------
314 for m in $(GENTOO_RC); do rc-update add $$m default; done;
317 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
319 # ------------------------------------------------------------------
323 yum -y install $(CENTOS)
326 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
327 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
328 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
329 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
330 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
332 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
333 # if it is not already there
335 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
336 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
340 # vim:noet:sw=4:ts=4: