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 # XML::LibXSLT fails due to old libxslt
56 XSLT_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1
58 # libxslt depends on a newer version of libxml2:
60 XML2_HOST=ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6
74 libcache-memcached-perl\
75 libclass-dbi-abstractsearch-perl\
76 libclass-dbi-sqlite-perl\
79 libfile-find-rule-perl\
94 libuniversal-require-perl\
137 # Some of these packages have stupid bugs in their test suites
138 # that are simply too painful to workaround
139 CENTOS_PERL_NOTEST = \
142 CENTOS_PERL_LOCAL = \
147 Class::DBI::AbstractSearch \
167 app-portage/gentoolkit\
173 dev-perl/Cache-Memcached\
175 dev-perl/Log-Log4perl\
176 dev-perl/Unix-Syslog\
178 dev-perl/XML-LibXSLT\
181 dev-perl/libwww-perl\
182 dev-perl/Template-Toolkit\
193 Class::DBI::AbstractSearch\
200 libdatetime-format-iso8601-perl \
204 EXTRA_DEBS_UBUNTU_KARMIC = \
208 # generic CPAN modules:
209 # * DateTime::Format::ISO8601 is packaged by both Debian Lenny and Ubuntu Intrepid
210 # * JSON::XS is packaged by both Debian Lenny and Ubuntu Intrepid
211 # * libnet-server-perl 0.97 is packaged on Debian Lenny and Ubuntu Intrepid
212 # - is there a specific need for 0.90?
214 DateTime::Format::ISO8601 \
215 RHANDOM/Net-Server-0.90.tar.gz \
218 # libxml-libxml-perl on Debian Lenny and Ubuntu Intrepid is 1.66, which
219 # has broken namespace handling. so we still need to install these from
225 # generic CPAN modules to force
226 CPAN_MODULES_FORCE = \
227 TMTM/Class-DBI-0.96.tar.gz
229 # ----------------------------------------------------------------------------
232 @echo "please specify an OS" && exit 0
235 centos: install_centos_rpms install_ejabberd install_libmemcached install_libxml2 install_libxslt install_centos_perl create_ld_local
237 debian-etch: generic_debian etch
238 debian-lenny: generic_debian lenny
240 lenny: install_extra_debs
241 generic_debian: install_debs install_cpan_force install_cpan_xml debian_sys_config
243 gentoo: install_gentoos install_gentoo_rc install_gentoo_perl install
247 ubuntu-gutsy: generic_ubuntu install_cpan_xml hardy
248 ubuntu-hardy: generic_ubuntu install_cpan_xml hardy
249 ubuntu-intrepid: generic_ubuntu install_cpan_xml intrepid
250 ubuntu-karmic: generic_ubuntu karmic
252 intrepid: install_extra_debs
253 karmic: install_extra_debs install_extra_debs_karmic
254 generic_ubuntu: install_debs install_cpan_force debian_sys_config
256 # - COMMON TARGETS ---------------------------------------------------------
258 # Install the CPAN modules
260 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
262 # Install CPAN modules that need to be forced
264 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
266 # Install the CPAN XML modules
268 for m in $(CPAN_MODULES_XML); do perl -MCPAN -e "install \"$$m\";"; done
270 # Install ejabberd from official project installer binary
272 if [ ! -f $(EJABBERD_PKG).gz ]; then wget $(EJABBERD_HOST)/$(EJABBERD_VER)/$(EJABBERD_PKG).gz; fi;
273 gunzip $(EJABBERD_PKG).gz
274 chmod u+x $(EJABBERD_PKG)
275 ./$(EJABBERD_PKG) --mode unattended --prefix /opt/ejabberd --adminpw opensrf
277 # Install libmemcached from the official project source
278 install_libmemcached:
279 @echo "TODO: work out how to build or grab libmemcached packages for CentOS/RHEL"
281 # Install a newer version of libxslt
283 if [ ! -d $(XSLT) ]; then wget $(XSLT_HOST)/$(XSLT).tar.gz; fi;
284 tar xzf $(XSLT).tar.gz
285 cd $(XSLT) && ./configure --with-libxml-prefix=/usr/local && make && make install
287 # Install a newer version of libxml2
289 if [ ! -d $(XML2) ]; then wget $(XML2_HOST)/$(XML2).tar.gz; fi;
290 tar xzf $(XML2).tar.gz
291 cd $(XML2) && ./configure && make && make install
294 make -C $(LIBJS_PERL) clean
295 make -C $(XML2) clean
296 make -C $(XSLT) clean
297 make -f Makefile.ref -C js/src/ clean
300 # ------------------------------------------------------------------
301 # - DEBIAN ---------------------------------------------------------
304 # link the apache modules in
305 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
307 # adds a placeholder module so apxs will be happy
308 if [ ! "$$(grep mod_placeholder /etc/apache2/httpd.conf)" ]; then \
309 echo -e "#\n#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so" \
310 >> /etc/apache2/httpd.conf; \
313 # Install the debian-specific dependencies
315 $(APT_TOOL) install $(DEBS)
317 # Install the debian-specific dependencies for more modern distros
319 $(APT_TOOL) install $(EXTRA_DEBS)
321 # Install even more packaged dependencies on modern distros
322 install_extra_debs_karmic:
323 $(APT_TOOL) install $(EXTRA_DEBS_UBUNTU_KARMIC)
325 # ------------------------------------------------------------------
326 # - GENTOO ---------------------------------------------------------
332 for m in $(GENTOO_RC); do rc-update add $$m default; done;
335 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
337 # ------------------------------------------------------------------
341 yum -y install $(CENTOS)
344 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
345 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
346 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
347 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
348 for m in $(CENTOS_PERL_LOCAL); do LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/lib perl -MCPAN -e "install \"$$m\";"; done
350 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
351 # if it is not already there
353 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
354 echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; \
358 # vim:noet:sw=4:ts=4: