1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
3 # Author: Dan Scott <dscott@laurentian.ca>
5 # Makefile to install prerequisites for OpenSRF and Evergreen
7 # Currently supports Debian (lenny/squeeze), Ubuntu (hardy/lucid), and Fedora (13).
8 # Working towards support of CentOS 5 / RHEL 5.
9 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
12 # make -f Makefile.install debian-lenny
14 # make -f Makefile.install debian-squeeze
16 # make -f Makefile.install ubuntu-hardy
18 # make -f Makefile.install ubuntu-lucid
20 # make -f Makefile.install fedora14
22 # make -f Makefile.install centos
24 # make -f Makefile.install rhel
28 # This makefile has been tested much more with Debian and Ubuntu than
29 # Fedora, CentOS, or RHEL.
31 # ---------------------------------------------------------------------
33 # Make any assumptions about the shell being used explicit
37 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
38 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
39 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
40 # used for installing libjs lib and header files
41 JS_INSTALL_PREFIX=/usr/
43 # The libdbi sources can be fetched from sourceforge.net. They are stored on
44 # the open-ils.org site now for ease of direct linking
46 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
47 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
49 # We need a recent version of Yaz
50 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
52 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
54 # Business::OnlinePayment is not packaged on CentOS/RHEL
55 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
56 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
61 LBITS=$(shell getconf LONG_BIT)
64 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
67 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
70 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
71 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
72 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm
79 libbusiness-creditcard-perl\
80 libbusiness-onlinepayment-authorizenet-perl\
81 libbusiness-onlinepayment-perl\
82 libdatetime-format-builder-perl\
83 libdatetime-format-iso8601-perl\
84 libdatetime-format-mail-perl\
86 libdatetime-timezone-perl\
98 libole-storage-lite-perl\
102 libspreadsheet-writeexcel-perl\
106 libuniversal-require-perl\
110 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
112 libbusiness-isbn-perl\
113 libbusiness-isbn-data-perl\
114 libmarc-charset-perl \
116 libnet-z3950-zoom-perl \
120 EXTRA_DEBS_SQUEEZE = \
123 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
124 # > 2.12 - see bug 525069.
135 perl-Business-CreditCard \
137 perl-Business-ISBN-Data \
138 perl-Business-OnlinePayment \
139 perl-Class-Data-Inheritable \
140 perl-DateTime-Format-Builder \
141 perl-DateTime-Format-Strptime \
146 perl-Spreadsheet-WriteExcel \
152 DBIx::ContextualFetch \
171 perl-Business-CreditCard \
173 perl-Business-ISBN-Data \
180 perl-OLE-Storage_Lite \
181 perl-Spreadsheet-WriteExcel \
192 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
193 # Should be fixed in 3.22
194 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
196 Business::OnlinePayment \
197 Business::OnlinePayment::AuthorizeNet \
203 postgresql-contrib-8.4* \
204 postgresql-devel-8.4* \
205 postgresql-plpe*-8.4* \
206 postgresql-server-8.4*
208 PGSQL_CLIENT_DEBS_82 = \
211 PGSQL_CLIENT_DEBS_83 = \
214 PGSQL_CLIENT_DEBS_84 = \
215 postgresql-client-8.4
217 PGSQL_SERVER_DEBS_84 = \
219 postgresql-contrib-8.4 \
220 postgresql-plperl-8.4 \
221 postgresql-server-dev-8.4
230 DEB_APACHE_DISMODS = \
233 # Chronically unpackaged CPAN modules
236 Library::CallNumber::LC \
237 Net::Z3950::Simple2ZOOM \
240 # More chronically unpackaged CPAN modules (available in Squeeze though)
241 CPAN_MODULES_MORE = \
242 Business::CreditCard::Object \
247 # Are we sure most distros don't come with an acceptable version of Safe.pm?
248 CPAN_MODULES_SAFE = \
251 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
252 CPAN_MODULES_MARC = \
254 Business::ISBN::Data \
259 CPAN_MODULES_FORCE = \
260 Class::DBI::Frozen::301
262 # ----------------------------------------------------------------------------
265 @echo "please specify an OS" && exit 0
267 # these should be the same for any distro
268 install: install_cpan install_js_sm install_libdbi install_cpan_force
270 centos: install_centos_pgsql centos_like
271 rhel: install_redhat_pgsql centos_like
272 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force
274 fedora13: install_fedora_13_rpms install_cpan install_cpan_fedora install_cpan_marc install_js_sm install_cpan_force
277 debian-lenny: lenny generic_debian install_cpan_more install_cpan_safe
278 debian-squeeze: squeeze generic_debian
279 lenny: install_pgsql_client_debs_83 install_extra_debs
280 squeeze: install_pgsql_client_debs_84 install_extra_debs_squeeze
281 generic_debian: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_force
283 ubuntu-hardy: hardy generic_ubuntu
284 ubuntu-lucid: lucid generic_ubuntu
285 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
286 lucid: install_pgsql_client_debs_84 install_extra_debs
287 generic_ubuntu: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force
289 # - COMMON TARGETS ---------------------------------------------------------
291 # Install the CPAN modules
293 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
296 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
298 # Install the CPAN modules for MARC functionality
300 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
303 for m in $(CPAN_MODULES_FORCE); do \
304 echo "force install $$m" | perl -MCPAN -e shell ;\
307 # Install the Safe Perl module
308 # Is this really unpackaged everywhere except for Fedora?
310 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
312 # Install the CPAN modules for Fedora 13
314 for m in $(FEDORA_13_CPAN); do \
315 echo "force install $$m" | perl -MCPAN -e shell;\
318 # Install a known working version of YAZ
320 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
321 tar xzf $(YAZ).tar.gz
322 cd $(YAZ) && ./configure && make && make install && ldconfig
324 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
325 install_js_sm: install_libjs install_spidermonkey
328 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
329 tar -zxf $(LIBJS).tar.gz
330 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
331 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
332 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
333 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
334 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
335 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
337 install_spidermonkey:
338 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
339 tar -zxf $(LIBJS_PERL).tar.gz
340 if [ ! -z $(FEDORA_64) ]; then \
341 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
343 if [ ! -z $(FEDORA) ]; then \
344 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
346 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
348 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
349 # compiled-from-source version from being used and breaks the install.
350 # This package might get installed depending on the install-time choices
351 # for the distro. Test for its existence; if it's there, throw an error
354 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
355 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
356 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
357 echo "*** to successfully install Evergreen."; \
359 echo "*** Note: this may break other applications on your system."; \
363 # Install libdbi and the postgres drivers
365 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
366 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
367 tar -zxf $(LIBDBI).tar.gz
368 tar -zxf $(LIBDBI_DRIVERS).tar.gz
369 cd $(LIBDBI) && ./configure --disable-docs && make all install
370 cd $(LIBDBI_DRIVERS) && ./configure \
371 --disable-docs --with-pgsql --enable-libdbi && make all install
374 make -C $(LIBDBI) clean
375 make -C $(LIBDBI_DRIVERS) clean
376 make -C $(LIBJS_PERL) clean
377 make -f Makefile.ref -C js/src/ clean
380 # ------------------------------------------------------------------
381 # - DEBIAN ---------------------------------------------------------
384 # link the apache modules in
385 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
386 # keep the bad apache modules away
387 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
388 # refresh the dynamic library cache
391 # Install the debian-specific dependencies
393 $(APT_TOOL) install $(DEBS)
395 install_pgsql_client_debs_84:
396 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
398 install_pgsql_server_debs_84:
399 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
401 install_pgsql_client_debs_83:
402 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
404 install_pgsql_client_debs_82:
405 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
407 # Install the debian-specific dependencies for more modern distros
408 install_extra_debs_squeeze: install_extra_debs
409 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
412 $(APT_TOOL) install $(EXTRA_DEBS)
414 # Install specific modules required by Ubuntu Hardy - see bug 525069
415 install_extra_encode:
416 $(APT_TOOL) install $(EXTRA_ENCODE)
418 # ------------------------------------------------------------------
421 install_fedora_13_rpms:
423 yum -y install $(FEDORA_13_RPMS)
425 install_fedora_13_pgsql_server:
426 yum -y install $(PGSQL_84_RPMS)
430 yum -y install $(CENTOS)
432 if [ $(LBITS) -eq 64 ]; then \
433 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
434 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
437 if [ $(LBITS) -eq 32 ]; then \
438 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
442 install_centos_pgsql:
443 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
444 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
445 rpm -Uvh --force ./$(PGSQL_CENTOS)
447 yum -y install $(PGSQL_84_RPMS)
449 install_redhat_pgsql:
450 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
451 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
452 rpm -Uvh --force ./$(PGSQL_REDHAT)
454 yum -y install $(PGSQL_84_RPMS)
457 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
458 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
459 echo "force install Scalar::Util" | perl -MCPAN -e shell
461 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
462 # if it is not already there
464 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
465 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
469 # vim:noet:sw=4:ts=4: