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 (squeeze), Ubuntu (lucid), and Fedora (16).
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-squeeze
14 # make -f Makefile.install ubuntu-lucid
16 # make -f Makefile.install fedora16
18 # make -f Makefile.install centos
20 # make -f Makefile.install rhel
24 # This makefile has been tested much more with Debian, Ubuntu, and
25 # Fedora than CentOS, or RHEL.
27 # ---------------------------------------------------------------------
29 # Make any assumptions about the shell being used explicit
33 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
34 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
35 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
36 # used for installing libjs lib and header files
37 JS_INSTALL_PREFIX=/usr/
39 LIBNET_Z3950_SIMPLESERVER=Net-Z3950-SimpleServer-1.15
40 LIBNET_Z3950_SIMPLESERVER_URL=http://ftp.indexdata.dk/pub/simpleserver/$(LIBNET_Z3950_SIMPLESERVER)
42 # The libdbi sources can be fetched from sourceforge.net. They are stored on
43 # the open-ils.org site now for ease of direct linking
45 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
46 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
48 # We need a recent version of Yaz
49 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
51 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
53 # Business::OnlinePayment is not packaged on CentOS/RHEL
54 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
55 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
58 APT_SAFE_TOOL=aptitude -P
59 APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq
62 LBITS=$(shell getconf LONG_BIT)
65 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
68 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
71 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/9.0
72 PGSQL_CENTOS=pgdg-centos-9.0-2.noarch.rpm
73 PGSQL_REDHAT=pgdg-redhat-9.0-2.noarch.rpm
80 libbusiness-creditcard-perl\
81 libbusiness-onlinepayment-authorizenet-perl\
82 libbusiness-onlinepayment-perl\
83 libdatetime-format-builder-perl\
84 libdatetime-format-iso8601-perl\
85 libdatetime-format-mail-perl\
87 libdatetime-timezone-perl\
99 libole-storage-lite-perl\
103 libspreadsheet-writeexcel-perl\
107 libuniversal-require-perl\
109 liblocale-maketext-lexicon-perl\
112 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
114 libbusiness-isbn-perl\
115 libbusiness-isbn-data-perl\
116 libmarc-charset-perl \
118 libnet-z3950-zoom-perl \
122 EXTRA_DEBS_SQUEEZE = \
125 EXTRA_DEBS_PRECISE = \
128 libmarc-record-perl \
129 libbusiness-edi-perl \
130 liblibrary-callnumber-lc-perl \
132 libnet-z3950-simple2zoom-perl \
135 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
136 # > 2.12 - see bug 525069.
148 perl-Business-CreditCard \
150 perl-Business-ISBN-Data \
151 perl-Business-OnlinePayment \
152 perl-Class-Data-Inheritable \
153 perl-DateTime-Format-Builder \
154 perl-DateTime-Format-Strptime \
159 perl-Spreadsheet-WriteExcel \
165 DBIx::ContextualFetch \
184 perl-Business-CreditCard \
186 perl-Business-ISBN-Data \
194 perl-OLE-Storage_Lite \
195 perl-Spreadsheet-WriteExcel \
206 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
207 # Should be fixed in 3.22
208 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
210 Business::OnlinePayment \
211 Business::OnlinePayment::AuthorizeNet \
217 postgresql90-contrib \
220 postgresql90-plperl \
223 PGSQL_FEDORA_RPMS = \
230 PGSQL_CLIENT_DEBS_90 = \
233 postgresql-client-9.0
235 PGSQL_CLIENT_DEBS_91 = \
238 postgresql-client-9.1
240 PGSQL_SERVER_DEBS_90 = \
242 postgresql-contrib-9.0 \
243 postgresql-plperl-9.0 \
244 postgresql-server-dev-9.0
246 PGSQL_SERVER_DEBS_91 = \
248 postgresql-contrib-9.1 \
249 postgresql-plperl-9.1 \
250 postgresql-server-dev-9.1
259 DEB_APACHE_DISMODS = \
262 # Chronically unpackaged CPAN modules
265 Library::CallNumber::LC \
266 Net::Z3950::Simple2ZOOM \
267 Template::Plugin::POSIX \
270 # More chronically unpackaged CPAN modules (available in Squeeze though)
271 CPAN_MODULES_MORE = \
272 Business::CreditCard::Object \
277 # Are we sure most distros don't come with an acceptable version of Safe.pm?
278 CPAN_MODULES_SAFE = \
281 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
282 CPAN_MODULES_MARC = \
284 Business::ISBN::Data \
289 CPAN_MODULES_MARC_RECORD = \
292 CPAN_MODULES_FORCE = \
293 Class::DBI::Frozen::301
295 # Lucid Lynx needs the following additional CPAN modules.
296 CPAN_MODULES_LUCID = \
299 # Precise Pangolin needs the following CPAN modules. All others are
300 # avaialalbe as debs.
301 CPAN_MODULES_PRECISE = \
302 Business::CreditCard::Object \
303 Template::Plugin::POSIX \
306 # ----------------------------------------------------------------------------
309 @echo "please specify an OS" && exit 0
311 # these should be the same for any distro
312 install: install_cpan install_js_sm install_cpan_force
314 centos: install_centos_pgsql centos_like
315 rhel: install_redhat_pgsql centos_like
316 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_libdbi
318 fedora16: install_fedora_rpms install_cpan_fedora install_cpan_marc install
320 debian-squeeze: squeeze generic_debian
321 squeeze: install_pgsql_client_debs_90 install_extra_debs_squeeze
322 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
324 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
325 ubuntu-lucid: lucid generic_ubuntu
326 lucid: install_pgsql_client_debs_90 install_extra_debs \
327 install_cpan_marc_record install_yaz install_cpan_more \
328 install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
331 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
332 ubuntu-precise: precise generic_ubuntu
333 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
334 install_cpan_precise install_js_sm install_cpan_force
336 # We don't do the "install" target on generic_ubuntu because newer
337 # Ubuntu releases, like newer Debian releases, include packages for
338 # many of those prerequisites.
339 generic_ubuntu: install_debs debian_sys_config
341 # - COMMON TARGETS ---------------------------------------------------------
343 # Install the CPAN modules
344 install_cpan: install_net_z3950_simpleserver
345 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
348 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
350 # Install the CPAN modules for MARC functionality
351 install_cpan_marc: install_cpan_marc_record
352 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
354 install_cpan_marc_record:
355 for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
358 for m in $(CPAN_MODULES_FORCE); do \
359 echo "force install $$m" | perl -MCPAN -e shell ;\
362 # Install the Safe Perl module
363 # Is this really unpackaged everywhere except for Fedora?
365 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
367 # Install the CPAN modules for Fedora
369 for m in $(FEDORA_CPAN); do \
370 echo "force install $$m" | perl -MCPAN -e shell;\
373 # Install the CPAN modules needed for Lucid
375 for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
377 # Install the CPAN modules needed for Precise
378 install_cpan_precise:
379 for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
381 # Install a known working version of YAZ
383 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
384 tar xzf $(YAZ).tar.gz
385 cd $(YAZ) && ./configure && make && make install && ldconfig
387 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
388 install_js_sm: install_libjs install_spidermonkey
391 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
392 tar -zxf $(LIBJS).tar.gz
393 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
394 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
395 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
396 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
397 if [ ! -z $(FEDORA_64) ]; then \
398 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
399 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
401 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
402 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
406 install_spidermonkey:
407 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
408 tar -zxf $(LIBJS_PERL).tar.gz
409 if [ ! -z $(FEDORA_64) ]; then \
410 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
412 if [ ! -z $(FEDORA) ]; then \
413 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
415 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
417 install_net_z3950_simpleserver:
418 if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
419 tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
420 cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
422 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
423 # compiled-from-source version from being used and breaks the install.
424 # This package might get installed depending on the install-time choices
425 # for the distro. Test for its existence; if it's there, throw an error
428 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
429 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
430 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
431 echo "*** to successfully install Evergreen."; \
433 echo "*** Note: this may break other applications on your system."; \
437 # Install libdbi and the postgres drivers
439 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
440 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
441 tar -zxf $(LIBDBI).tar.gz
442 tar -zxf $(LIBDBI_DRIVERS).tar.gz
443 cd $(LIBDBI) && ./configure --disable-docs && make all install
444 cd $(LIBDBI_DRIVERS) && ./configure \
445 --disable-docs --with-pgsql --enable-libdbi && make all install
448 make -C $(LIBDBI) clean
449 make -C $(LIBDBI_DRIVERS) clean
450 make -C $(LIBJS_PERL) clean
451 make -f Makefile.ref -C js/src/ clean
454 # ------------------------------------------------------------------
455 # - DEBIAN ---------------------------------------------------------
458 # link the apache modules in
459 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
460 # keep the bad apache modules away
461 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
462 # refresh the dynamic library cache
465 # Install the debian-specific dependencies
467 $(APT_TOOL) install $(DEBS)
469 install_pgsql_client_debs_90:
470 @if [ `$(APT_TOOL) versions libpq-dev | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
472 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
473 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
474 "conflict with the 9.0 versions - so remove them, install the pinned" \
475 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
476 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
477 "databases that might currently exist on this machine." && \
478 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
480 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
481 $(APT_TOOL) install apache2-prefork-dev
483 install_pgsql_server_debs_90:
484 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
486 install_pgsql_client_debs_91:
487 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
489 install_pgsql_server_debs_91:
490 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
492 # Install the debian-specific dependencies for more modern distros
493 install_extra_debs_squeeze: install_extra_debs
494 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
496 # Install dependencies for Ubuntu 12.04:
497 install_extra_debs_precise: install_extra_debs
498 $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
501 $(APT_TOOL) install $(EXTRA_DEBS)
503 # Install specific modules required by Ubuntu Hardy - see bug 525069
504 install_extra_encode:
505 $(APT_TOOL) install $(EXTRA_ENCODE)
507 # ------------------------------------------------------------------
512 yum -y install $(FEDORA_RPMS)
514 install_fedora_pgsql_server:
515 yum -y install $(PGSQL_FEDORA_RPMS)
519 yum -y install $(CENTOS)
521 if [ $(LBITS) -eq 64 ]; then \
522 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
523 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
526 if [ $(LBITS) -eq 32 ]; then \
527 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
531 install_centos_pgsql:
532 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
533 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
534 rpm -Uvh --force ./$(PGSQL_CENTOS)
536 yum -y install $(PGSQL_90_RPMS)
538 install_redhat_pgsql:
539 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
540 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
541 rpm -Uvh --force ./$(PGSQL_REDHAT)
543 yum -y install $(PGSQL_90_RPMS)
546 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
547 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
548 echo "force install Scalar::Util" | perl -MCPAN -e shell
550 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
551 # if it is not already there
553 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
554 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
558 # vim:noet:sw=4:ts=4: