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 (10.04), Ubuntu (12.04) and
10 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
13 # make -f Makefile.install debian-squeeze
15 # make -f Makefile.install ubuntu-lucid
17 # make -f Makefile.install ubuntu-precise
19 # make -f Makefile.install fedora
21 # ---------------------------------------------------------------------
23 # Make any assumptions about the shell being used explicit
27 LIBJS_PERL=JavaScript-SpiderMonkey-0.21
28 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
29 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
30 # used for installing libjs lib and header files
31 JS_INSTALL_PREFIX=/usr/
33 LIBNET_Z3950_SIMPLESERVER=Net-Z3950-SimpleServer-1.15
34 LIBNET_Z3950_SIMPLESERVER_URL=http://ftp.indexdata.dk/pub/simpleserver/$(LIBNET_Z3950_SIMPLESERVER)
36 # The libdbi sources can be fetched from sourceforge.net. They are stored on
37 # the open-ils.org site now for ease of direct linking
39 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
40 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
42 # We need a recent version of Yaz
43 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
45 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
48 APT_SAFE_TOOL=aptitude -P
49 APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq
52 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
55 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
62 libbusiness-creditcard-perl\
63 libbusiness-onlinepayment-authorizenet-perl\
64 libbusiness-onlinepayment-perl\
65 libdatetime-format-builder-perl\
66 libdatetime-format-iso8601-perl\
67 libdatetime-format-mail-perl\
69 libdatetime-timezone-perl\
82 libole-storage-lite-perl\
83 libspreadsheet-writeexcel-perl\
87 libuniversal-require-perl\
89 liblocale-maketext-lexicon-perl\
92 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
94 libbusiness-isbn-perl\
95 libbusiness-isbn-data-perl\
96 libmarc-charset-perl \
98 libnet-z3950-zoom-perl \
102 EXTRA_DEBS_SQUEEZE = \
109 EXTRA_DEBS_PRECISE = \
112 libmarc-record-perl \
113 libbusiness-edi-perl \
114 liblibrary-callnumber-lc-perl \
116 libnet-z3950-simple2zoom-perl \
118 libnet-https-any-perl \
130 mingw32-nsiswrapper \
135 perl-Business-CreditCard \
137 perl-Business-ISBN-Data \
145 perl-Library-CallNumber-LC \
151 perl-OLE-Storage_Lite \
153 perl-Spreadsheet-WriteExcel \
164 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
165 # Should be fixed in 3.22
166 # MARC::Record 2.0.1+ is required but only 2.0.0 is packaged
168 Business::OnlinePayment \
169 Business::OnlinePayment::AuthorizeNet \
170 Business::OnlinePayment::PayPal \
176 postgresql90-contrib \
179 postgresql90-plperl \
182 PGSQL_FEDORA_RPMS = \
189 PGSQL_CLIENT_DEBS_90 = \
192 postgresql-client-9.0
194 PGSQL_CLIENT_DEBS_91 = \
197 postgresql-client-9.1
199 PGSQL_SERVER_DEBS_90 = \
201 postgresql-contrib-9.0 \
202 postgresql-plperl-9.0 \
203 postgresql-server-dev-9.0
205 PGSQL_SERVER_DEBS_91 = \
207 postgresql-contrib-9.1 \
208 postgresql-plperl-9.1 \
209 postgresql-server-dev-9.1
218 DEB_APACHE_DISMODS = \
221 # Chronically unpackaged CPAN modules
223 Business::OnlinePayment::PayPal \
224 Library::CallNumber::LC \
225 Net::Z3950::Simple2ZOOM \
226 Template::Plugin::POSIX \
230 # More chronically unpackaged CPAN modules (available in Squeeze though)
231 CPAN_MODULES_MORE = \
232 Business::CreditCard::Object \
237 # Are we sure most distros don't come with an acceptable version of Safe.pm?
238 CPAN_MODULES_SAFE = \
241 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
242 CPAN_MODULES_MARC = \
244 Business::ISBN::Data \
249 CPAN_MODULES_MARC_RECORD = \
252 CPAN_MODULES_FORCE = \
253 Class::DBI::Frozen::301
255 # Debian Squeeze needs the following additional CPAN modules.
256 CPAN_MODULES_SQUEEZE = \
259 # Lucid Lynx needs the following additional CPAN modules.
260 CPAN_MODULES_LUCID = \
264 # Precise Pangolin needs the following CPAN modules. All others are
266 CPAN_MODULES_PRECISE = \
267 Business::CreditCard::Object \
268 Business::OnlinePayment::PayPal \
269 Template::Plugin::POSIX \
272 # ----------------------------------------------------------------------------
275 @echo "please specify an OS" && exit 0
277 # these should be the same for any distro
278 install: install_cpan install_js_sm install_cpan_force
280 fedora: install_fedora_rpms install_cpan_fedora install_cpan_marc install
282 debian-squeeze: squeeze generic_debian
283 squeeze: install_pgsql_client_backport_debs_91 install_extra_debs_squeeze install_cpan_squeeze
284 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
286 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
287 ubuntu-lucid: lucid generic_ubuntu
288 lucid: install_pgsql_client_debs_90 install_extra_debs_lucid \
289 install_cpan_marc_record install_yaz install_cpan_more \
290 install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
293 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
294 ubuntu-precise: precise generic_ubuntu
295 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
296 install_cpan_precise install_js_sm install_cpan_force
298 # We don't do the "install" target on generic_ubuntu because newer
299 # Ubuntu releases, like newer Debian releases, include packages for
300 # many of those prerequisites.
301 generic_ubuntu: install_debs debian_sys_config
303 # - COMMON TARGETS ---------------------------------------------------------
305 # Install the CPAN modules
306 install_cpan: install_net_z3950_simpleserver
307 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
310 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
312 # Install the CPAN modules for MARC functionality
313 install_cpan_marc: install_cpan_marc_record
314 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
316 install_cpan_marc_record:
317 for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
320 for m in $(CPAN_MODULES_FORCE); do \
321 echo "force install $$m" | perl -MCPAN -e shell ;\
324 # Install the Safe Perl module
325 # Is this really unpackaged everywhere except for Fedora?
327 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
329 # Install the CPAN modules for Fedora
331 for m in $(FEDORA_CPAN); do \
332 echo "force install $$m" | perl -MCPAN -e shell;\
335 # Install the CPAN modules needed for Squeeze
336 install_cpan_squeeze:
337 for m in $(CPAN_MODULES_SQUEEZE); do perl -MCPAN -e "install \"$$m\";"; done
339 # Install the CPAN modules needed for Lucid
341 for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
343 # Install the CPAN modules needed for Precise
344 install_cpan_precise:
345 for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
347 # Install a known working version of YAZ
349 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
350 tar xzf $(YAZ).tar.gz
351 cd $(YAZ) && ./configure && make && make install && ldconfig
353 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
354 install_js_sm: install_libjs install_spidermonkey
357 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
358 tar -zxf $(LIBJS).tar.gz
359 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
360 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
361 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
362 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
363 if [ ! -z $(FEDORA_64) ]; then \
364 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
365 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
367 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
368 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
372 install_spidermonkey:
373 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
374 tar -zxf $(LIBJS_PERL).tar.gz
375 if [ ! -z $(FEDORA_64) ]; then \
376 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
378 if [ ! -z $(FEDORA) ]; then \
379 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
381 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
383 install_net_z3950_simpleserver:
384 if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
385 tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
386 cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
388 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
389 # compiled-from-source version from being used and breaks the install.
390 # This package might get installed depending on the install-time choices
391 # for the distro. Test for its existence; if it's there, throw an error
394 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
395 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
396 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
397 echo "*** to successfully install Evergreen."; \
399 echo "*** Note: this may break other applications on your system."; \
403 # Install libdbi and the postgres drivers
405 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
406 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
407 tar -zxf $(LIBDBI).tar.gz
408 tar -zxf $(LIBDBI_DRIVERS).tar.gz
409 cd $(LIBDBI) && ./configure --disable-docs && make all install
410 cd $(LIBDBI_DRIVERS) && ./configure \
411 --disable-docs --with-pgsql --enable-libdbi && make all install
414 make -C $(LIBDBI) clean
415 make -C $(LIBDBI_DRIVERS) clean
416 make -C $(LIBJS_PERL) clean
417 make -f Makefile.ref -C js/src/ clean
420 # ------------------------------------------------------------------
421 # - DEBIAN ---------------------------------------------------------
424 # link the apache modules in
425 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
426 # keep the bad apache modules away
427 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
428 # refresh the dynamic library cache
431 # Install the debian-specific dependencies
433 $(APT_TOOL) install $(DEBS)
435 install_pgsql_client_debs_90:
436 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
438 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
439 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
440 "conflict with the 9.0 versions - so remove them, install the pinned" \
441 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
442 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
443 "databases that might currently exist on this machine." && \
444 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
446 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
447 $(APT_TOOL) install apache2-prefork-dev
449 install_pgsql_server_debs_90:
450 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
452 install_pgsql_client_backport_debs_91:
453 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
455 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
456 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
457 "conflict with the 9.0 versions - so remove them, install the pinned" \
458 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
459 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
460 "databases that might currently exist on this machine." && \
461 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
463 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
464 $(APT_TOOL) install apache2-prefork-dev
466 install_pgsql_client_debs_91:
467 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
469 install_pgsql_server_debs_91:
470 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
472 install_pgsql_server_backport_debs_91:
473 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
475 # Install the debian-specific dependencies for more modern distros
476 install_extra_debs_squeeze: install_extra_debs
477 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
479 # Install dependencies for Ubuntu 10.04:
480 install_extra_debs_lucid: install_extra_debs
481 $(APT_TOOL) install $(EXTRA_DEBS_LUCID)
483 # Install dependencies for Ubuntu 12.04:
484 install_extra_debs_precise: install_extra_debs
485 $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
488 $(APT_TOOL) install $(EXTRA_DEBS)
490 # ------------------------------------------------------------------
495 yum -y install $(FEDORA_RPMS)
497 install_fedora_pgsql_server:
498 yum -y install $(PGSQL_FEDORA_RPMS)
500 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
501 # if it is not already there
503 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
504 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
508 # vim:noet:sw=4:ts=4: