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\
85 libspreadsheet-writeexcel-perl\
89 libuniversal-require-perl\
91 liblocale-maketext-lexicon-perl\
94 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
96 libbusiness-isbn-perl\
97 libbusiness-isbn-data-perl\
98 libmarc-charset-perl \
100 libnet-z3950-zoom-perl \
104 EXTRA_DEBS_SQUEEZE = \
107 EXTRA_DEBS_PRECISE = \
110 libmarc-record-perl \
111 libbusiness-edi-perl \
112 liblibrary-callnumber-lc-perl \
114 libnet-z3950-simple2zoom-perl \
116 libnet-https-any-perl
127 mingw32-nsiswrapper \
132 perl-Business-CreditCard \
134 perl-Business-ISBN-Data \
141 perl-Library-CallNumber-LC \
147 perl-OLE-Storage_Lite \
148 perl-Spreadsheet-WriteExcel \
159 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
160 # Should be fixed in 3.22
161 # MARC::Record 2.0.1+ is required but only 2.0.0 is packaged
163 Business::OnlinePayment \
164 Business::OnlinePayment::AuthorizeNet \
165 Business::OnlinePayment::PayPal \
171 postgresql90-contrib \
174 postgresql90-plperl \
177 PGSQL_FEDORA_RPMS = \
184 PGSQL_CLIENT_DEBS_90 = \
187 postgresql-client-9.0
189 PGSQL_CLIENT_DEBS_91 = \
192 postgresql-client-9.1
194 PGSQL_SERVER_DEBS_90 = \
196 postgresql-contrib-9.0 \
197 postgresql-plperl-9.0 \
198 postgresql-server-dev-9.0
200 PGSQL_SERVER_DEBS_91 = \
202 postgresql-contrib-9.1 \
203 postgresql-plperl-9.1 \
204 postgresql-server-dev-9.1
213 DEB_APACHE_DISMODS = \
216 # Chronically unpackaged CPAN modules
219 Business::OnlinePayment::PayPal \
220 Library::CallNumber::LC \
221 Net::Z3950::Simple2ZOOM \
222 Template::Plugin::POSIX \
225 # More chronically unpackaged CPAN modules (available in Squeeze though)
226 CPAN_MODULES_MORE = \
227 Business::CreditCard::Object \
232 # Are we sure most distros don't come with an acceptable version of Safe.pm?
233 CPAN_MODULES_SAFE = \
236 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
237 CPAN_MODULES_MARC = \
239 Business::ISBN::Data \
244 CPAN_MODULES_MARC_RECORD = \
247 CPAN_MODULES_FORCE = \
248 Class::DBI::Frozen::301
250 # Lucid Lynx needs the following additional CPAN modules.
251 CPAN_MODULES_LUCID = \
254 # Precise Pangolin needs the following CPAN modules. All others are
255 # avaialalbe as debs.
256 CPAN_MODULES_PRECISE = \
257 Business::CreditCard::Object \
258 Business::OnlinePayment::PayPal \
259 Template::Plugin::POSIX \
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_cpan_force
270 fedora: install_fedora_rpms install_cpan_fedora install_cpan_marc install
272 debian-squeeze: squeeze generic_debian
273 squeeze: install_pgsql_client_backport_debs_91 install_extra_debs_squeeze
274 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
276 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
277 ubuntu-lucid: lucid generic_ubuntu
278 lucid: install_pgsql_client_debs_90 install_extra_debs \
279 install_cpan_marc_record install_yaz install_cpan_more \
280 install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
283 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
284 ubuntu-precise: precise generic_ubuntu
285 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
286 install_cpan_precise install_js_sm install_cpan_force
288 # We don't do the "install" target on generic_ubuntu because newer
289 # Ubuntu releases, like newer Debian releases, include packages for
290 # many of those prerequisites.
291 generic_ubuntu: install_debs debian_sys_config
293 # - COMMON TARGETS ---------------------------------------------------------
295 # Install the CPAN modules
296 install_cpan: install_net_z3950_simpleserver
297 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
300 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
302 # Install the CPAN modules for MARC functionality
303 install_cpan_marc: install_cpan_marc_record
304 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
306 install_cpan_marc_record:
307 for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
310 for m in $(CPAN_MODULES_FORCE); do \
311 echo "force install $$m" | perl -MCPAN -e shell ;\
314 # Install the Safe Perl module
315 # Is this really unpackaged everywhere except for Fedora?
317 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
319 # Install the CPAN modules for Fedora
321 for m in $(FEDORA_CPAN); do \
322 echo "force install $$m" | perl -MCPAN -e shell;\
325 # Install the CPAN modules needed for Lucid
327 for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
329 # Install the CPAN modules needed for Precise
330 install_cpan_precise:
331 for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
333 # Install a known working version of YAZ
335 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
336 tar xzf $(YAZ).tar.gz
337 cd $(YAZ) && ./configure && make && make install && ldconfig
339 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
340 install_js_sm: install_libjs install_spidermonkey
343 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
344 tar -zxf $(LIBJS).tar.gz
345 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
346 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
347 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
348 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
349 if [ ! -z $(FEDORA_64) ]; then \
350 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
351 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
353 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
354 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
358 install_spidermonkey:
359 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
360 tar -zxf $(LIBJS_PERL).tar.gz
361 if [ ! -z $(FEDORA_64) ]; then \
362 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
364 if [ ! -z $(FEDORA) ]; then \
365 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
367 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
369 install_net_z3950_simpleserver:
370 if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
371 tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
372 cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
374 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
375 # compiled-from-source version from being used and breaks the install.
376 # This package might get installed depending on the install-time choices
377 # for the distro. Test for its existence; if it's there, throw an error
380 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
381 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
382 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
383 echo "*** to successfully install Evergreen."; \
385 echo "*** Note: this may break other applications on your system."; \
389 # Install libdbi and the postgres drivers
391 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
392 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
393 tar -zxf $(LIBDBI).tar.gz
394 tar -zxf $(LIBDBI_DRIVERS).tar.gz
395 cd $(LIBDBI) && ./configure --disable-docs && make all install
396 cd $(LIBDBI_DRIVERS) && ./configure \
397 --disable-docs --with-pgsql --enable-libdbi && make all install
400 make -C $(LIBDBI) clean
401 make -C $(LIBDBI_DRIVERS) clean
402 make -C $(LIBJS_PERL) clean
403 make -f Makefile.ref -C js/src/ clean
406 # ------------------------------------------------------------------
407 # - DEBIAN ---------------------------------------------------------
410 # link the apache modules in
411 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
412 # keep the bad apache modules away
413 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
414 # refresh the dynamic library cache
417 # Install the debian-specific dependencies
419 $(APT_TOOL) install $(DEBS)
421 install_pgsql_client_debs_90:
422 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
424 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
425 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
426 "conflict with the 9.0 versions - so remove them, install the pinned" \
427 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
428 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
429 "databases that might currently exist on this machine." && \
430 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
432 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
433 $(APT_TOOL) install apache2-prefork-dev
435 install_pgsql_server_debs_90:
436 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
438 install_pgsql_client_backport_debs_91:
439 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
441 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
442 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
443 "conflict with the 9.0 versions - so remove them, install the pinned" \
444 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
445 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
446 "databases that might currently exist on this machine." && \
447 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
449 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
450 $(APT_TOOL) install apache2-prefork-dev
452 install_pgsql_client_debs_91:
453 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
455 install_pgsql_server_debs_91:
456 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
458 install_pgsql_server_backport_debs_91:
459 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
461 # Install the debian-specific dependencies for more modern distros
462 install_extra_debs_squeeze: install_extra_debs
463 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
465 # Install dependencies for Ubuntu 12.04:
466 install_extra_debs_precise: install_extra_debs
467 $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
470 $(APT_TOOL) install $(EXTRA_DEBS)
472 # ------------------------------------------------------------------
477 yum -y install $(FEDORA_RPMS)
479 install_fedora_pgsql_server:
480 yum -y install $(PGSQL_FEDORA_RPMS)
482 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
483 # if it is not already there
485 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
486 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
490 # vim:noet:sw=4:ts=4: