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 Fedora (16).
8 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
11 # make -f Makefile.install debian-squeeze
13 # make -f Makefile.install ubuntu-lucid
15 # make -f Makefile.install ubuntu-precise
17 # make -f Makefile.install fedora16
19 # ---------------------------------------------------------------------
21 # Make any assumptions about the shell being used explicit
25 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
26 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
27 LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
28 # used for installing libjs lib and header files
29 JS_INSTALL_PREFIX=/usr/
31 LIBNET_Z3950_SIMPLESERVER=Net-Z3950-SimpleServer-1.15
32 LIBNET_Z3950_SIMPLESERVER_URL=http://ftp.indexdata.dk/pub/simpleserver/$(LIBNET_Z3950_SIMPLESERVER)
34 # The libdbi sources can be fetched from sourceforge.net. They are stored on
35 # the open-ils.org site now for ease of direct linking
37 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
38 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
40 # We need a recent version of Yaz
41 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
43 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
46 APT_SAFE_TOOL=aptitude -P
47 APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq
50 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
53 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
60 libbusiness-creditcard-perl\
61 libbusiness-onlinepayment-authorizenet-perl\
62 libbusiness-onlinepayment-perl\
63 libdatetime-format-builder-perl\
64 libdatetime-format-iso8601-perl\
65 libdatetime-format-mail-perl\
67 libdatetime-timezone-perl\
80 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 = \
105 EXTRA_DEBS_PRECISE = \
108 libmarc-record-perl \
109 libbusiness-edi-perl \
110 liblibrary-callnumber-lc-perl \
112 libnet-z3950-simple2zoom-perl \
115 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
116 # > 2.12 - see bug 525069.
133 perl-Business-CreditCard \
135 perl-Business-ISBN-Data \
145 perl-OLE-Storage_Lite \
146 perl-Spreadsheet-WriteExcel \
157 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
158 # Should be fixed in 3.22
159 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
161 Business::OnlinePayment \
162 Business::OnlinePayment::AuthorizeNet \
163 Business::OnlinePayment::PayPal \
169 postgresql90-contrib \
172 postgresql90-plperl \
175 PGSQL_FEDORA_RPMS = \
182 PGSQL_CLIENT_DEBS_90 = \
185 postgresql-client-9.0
187 PGSQL_CLIENT_DEBS_91 = \
190 postgresql-client-9.1
192 PGSQL_SERVER_DEBS_90 = \
194 postgresql-contrib-9.0 \
195 postgresql-plperl-9.0 \
196 postgresql-server-dev-9.0
198 PGSQL_SERVER_DEBS_91 = \
200 postgresql-contrib-9.1 \
201 postgresql-plperl-9.1 \
202 postgresql-server-dev-9.1
211 DEB_APACHE_DISMODS = \
214 # Chronically unpackaged CPAN modules
217 Business::OnlinePayment::PayPal \
218 Library::CallNumber::LC \
219 Net::Z3950::Simple2ZOOM \
220 Template::Plugin::POSIX \
223 # More chronically unpackaged CPAN modules (available in Squeeze though)
224 CPAN_MODULES_MORE = \
225 Business::CreditCard::Object \
230 # Are we sure most distros don't come with an acceptable version of Safe.pm?
231 CPAN_MODULES_SAFE = \
234 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
235 CPAN_MODULES_MARC = \
237 Business::ISBN::Data \
242 CPAN_MODULES_MARC_RECORD = \
245 CPAN_MODULES_FORCE = \
246 Class::DBI::Frozen::301
248 # Lucid Lynx needs the following additional CPAN modules.
249 CPAN_MODULES_LUCID = \
252 # Precise Pangolin needs the following CPAN modules. All others are
253 # avaialalbe as debs.
254 CPAN_MODULES_PRECISE = \
255 Business::CreditCard::Object \
256 Business::OnlinePayment::PayPal \
257 Template::Plugin::POSIX \
260 # ----------------------------------------------------------------------------
263 @echo "please specify an OS" && exit 0
265 # these should be the same for any distro
266 install: install_cpan install_js_sm install_cpan_force
268 fedora16: install_fedora_rpms install_cpan_fedora install_cpan_marc install
270 debian-squeeze: squeeze generic_debian
271 squeeze: install_pgsql_client_backport_debs_91 install_extra_debs_squeeze
272 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
274 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
275 ubuntu-lucid: lucid generic_ubuntu
276 lucid: install_pgsql_client_debs_90 install_extra_debs \
277 install_cpan_marc_record install_yaz install_cpan_more \
278 install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
281 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
282 ubuntu-precise: precise generic_ubuntu
283 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
284 install_cpan_precise install_js_sm install_cpan_force
286 # We don't do the "install" target on generic_ubuntu because newer
287 # Ubuntu releases, like newer Debian releases, include packages for
288 # many of those prerequisites.
289 generic_ubuntu: install_debs debian_sys_config
291 # - COMMON TARGETS ---------------------------------------------------------
293 # Install the CPAN modules
294 install_cpan: install_net_z3950_simpleserver
295 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
298 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
300 # Install the CPAN modules for MARC functionality
301 install_cpan_marc: install_cpan_marc_record
302 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
304 install_cpan_marc_record:
305 for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
308 for m in $(CPAN_MODULES_FORCE); do \
309 echo "force install $$m" | perl -MCPAN -e shell ;\
312 # Install the Safe Perl module
313 # Is this really unpackaged everywhere except for Fedora?
315 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
317 # Install the CPAN modules for Fedora
319 for m in $(FEDORA_CPAN); do \
320 echo "force install $$m" | perl -MCPAN -e shell;\
323 # Install the CPAN modules needed for Lucid
325 for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
327 # Install the CPAN modules needed for Precise
328 install_cpan_precise:
329 for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
331 # Install a known working version of YAZ
333 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
334 tar xzf $(YAZ).tar.gz
335 cd $(YAZ) && ./configure && make && make install && ldconfig
337 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
338 install_js_sm: install_libjs install_spidermonkey
341 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
342 tar -zxf $(LIBJS).tar.gz
343 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
344 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
345 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
346 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
347 if [ ! -z $(FEDORA_64) ]; then \
348 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
349 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
351 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
352 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
356 install_spidermonkey:
357 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
358 tar -zxf $(LIBJS_PERL).tar.gz
359 if [ ! -z $(FEDORA_64) ]; then \
360 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
362 if [ ! -z $(FEDORA) ]; then \
363 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
365 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
367 install_net_z3950_simpleserver:
368 if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
369 tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
370 cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
372 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
373 # compiled-from-source version from being used and breaks the install.
374 # This package might get installed depending on the install-time choices
375 # for the distro. Test for its existence; if it's there, throw an error
378 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
379 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
380 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
381 echo "*** to successfully install Evergreen."; \
383 echo "*** Note: this may break other applications on your system."; \
387 # Install libdbi and the postgres drivers
389 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
390 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
391 tar -zxf $(LIBDBI).tar.gz
392 tar -zxf $(LIBDBI_DRIVERS).tar.gz
393 cd $(LIBDBI) && ./configure --disable-docs && make all install
394 cd $(LIBDBI_DRIVERS) && ./configure \
395 --disable-docs --with-pgsql --enable-libdbi && make all install
398 make -C $(LIBDBI) clean
399 make -C $(LIBDBI_DRIVERS) clean
400 make -C $(LIBJS_PERL) clean
401 make -f Makefile.ref -C js/src/ clean
404 # ------------------------------------------------------------------
405 # - DEBIAN ---------------------------------------------------------
408 # link the apache modules in
409 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
410 # keep the bad apache modules away
411 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
412 # refresh the dynamic library cache
415 # Install the debian-specific dependencies
417 $(APT_TOOL) install $(DEBS)
419 install_pgsql_client_debs_90:
420 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
422 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
423 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
424 "conflict with the 9.0 versions - so remove them, install the pinned" \
425 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
426 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
427 "databases that might currently exist on this machine." && \
428 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
430 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
431 $(APT_TOOL) install apache2-prefork-dev
433 install_pgsql_server_debs_90:
434 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
436 install_pgsql_client_backport_debs_91:
437 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
439 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
440 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
441 "conflict with the 9.0 versions - so remove them, install the pinned" \
442 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
443 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
444 "databases that might currently exist on this machine." && \
445 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
447 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
448 $(APT_TOOL) install apache2-prefork-dev
450 install_pgsql_client_debs_91:
451 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
453 install_pgsql_server_debs_91:
454 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
456 install_pgsql_server_backport_debs_91:
457 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
459 # Install the debian-specific dependencies for more modern distros
460 install_extra_debs_squeeze: install_extra_debs
461 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
463 # Install dependencies for Ubuntu 12.04:
464 install_extra_debs_precise: install_extra_debs
465 $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
468 $(APT_TOOL) install $(EXTRA_DEBS)
470 # Install specific modules required by Ubuntu Hardy - see bug 525069
471 install_extra_encode:
472 $(APT_TOOL) install $(EXTRA_ENCODE)
474 # ------------------------------------------------------------------
479 yum -y install $(FEDORA_RPMS)
481 install_fedora_pgsql_server:
482 yum -y install $(PGSQL_FEDORA_RPMS)
484 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
485 # if it is not already there
487 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
488 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
492 # vim:noet:sw=4:ts=4: