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.21
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 \
128 perl-Business-CreditCard \
130 perl-Business-ISBN-Data \
140 perl-OLE-Storage_Lite \
141 perl-Spreadsheet-WriteExcel \
152 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
153 # Should be fixed in 3.22
154 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
156 Business::OnlinePayment \
157 Business::OnlinePayment::AuthorizeNet \
158 Business::OnlinePayment::PayPal \
164 postgresql90-contrib \
167 postgresql90-plperl \
170 PGSQL_FEDORA_RPMS = \
177 PGSQL_CLIENT_DEBS_90 = \
180 postgresql-client-9.0
182 PGSQL_CLIENT_DEBS_91 = \
185 postgresql-client-9.1
187 PGSQL_SERVER_DEBS_90 = \
189 postgresql-contrib-9.0 \
190 postgresql-plperl-9.0 \
191 postgresql-server-dev-9.0
193 PGSQL_SERVER_DEBS_91 = \
195 postgresql-contrib-9.1 \
196 postgresql-plperl-9.1 \
197 postgresql-server-dev-9.1
206 DEB_APACHE_DISMODS = \
209 # Chronically unpackaged CPAN modules
212 Business::OnlinePayment::PayPal \
213 Library::CallNumber::LC \
214 Net::Z3950::Simple2ZOOM \
215 Template::Plugin::POSIX \
218 # More chronically unpackaged CPAN modules (available in Squeeze though)
219 CPAN_MODULES_MORE = \
220 Business::CreditCard::Object \
225 # Are we sure most distros don't come with an acceptable version of Safe.pm?
226 CPAN_MODULES_SAFE = \
229 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
230 CPAN_MODULES_MARC = \
232 Business::ISBN::Data \
237 CPAN_MODULES_MARC_RECORD = \
240 CPAN_MODULES_FORCE = \
241 Class::DBI::Frozen::301
243 # Lucid Lynx needs the following additional CPAN modules.
244 CPAN_MODULES_LUCID = \
247 # Precise Pangolin needs the following CPAN modules. All others are
248 # avaialalbe as debs.
249 CPAN_MODULES_PRECISE = \
250 Business::CreditCard::Object \
251 Business::OnlinePayment::PayPal \
252 Template::Plugin::POSIX \
255 # ----------------------------------------------------------------------------
258 @echo "please specify an OS" && exit 0
260 # these should be the same for any distro
261 install: install_cpan install_js_sm install_cpan_force
263 fedora16: install_fedora_rpms install_cpan_fedora install_cpan_marc install
265 debian-squeeze: squeeze generic_debian
266 squeeze: install_pgsql_client_backport_debs_91 install_extra_debs_squeeze
267 generic_debian: install_debs install_yaz test_for_libdbi_pkg install debian_sys_config install_libdbi
269 # Needs for Ubuntu Lucid Lynx (10.04 LTS):
270 ubuntu-lucid: lucid generic_ubuntu
271 lucid: install_pgsql_client_debs_90 install_extra_debs \
272 install_cpan_marc_record install_yaz install_cpan_more \
273 install_cpan_safe install_cpan_lucid install test_for_libdbi_pkg \
276 # Needs for Ubuntu Precise Pangolin (12.04 LTS):
277 ubuntu-precise: precise generic_ubuntu
278 precise: install_pgsql_client_debs_91 install_extra_debs_precise \
279 install_cpan_precise install_js_sm install_cpan_force
281 # We don't do the "install" target on generic_ubuntu because newer
282 # Ubuntu releases, like newer Debian releases, include packages for
283 # many of those prerequisites.
284 generic_ubuntu: install_debs debian_sys_config
286 # - COMMON TARGETS ---------------------------------------------------------
288 # Install the CPAN modules
289 install_cpan: install_net_z3950_simpleserver
290 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
293 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
295 # Install the CPAN modules for MARC functionality
296 install_cpan_marc: install_cpan_marc_record
297 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
299 install_cpan_marc_record:
300 for m in $(CPAN_MODULES_MARC_RECORD); 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
314 for m in $(FEDORA_CPAN); do \
315 echo "force install $$m" | perl -MCPAN -e shell;\
318 # Install the CPAN modules needed for Lucid
320 for m in $(CPAN_MODULES_LUCID); do perl -MCPAN -e "install \"$$m\";"; done
322 # Install the CPAN modules needed for Precise
323 install_cpan_precise:
324 for m in $(CPAN_MODULES_PRECISE); do perl -MCPAN -e "install \"$$m\";"; done
326 # Install a known working version of YAZ
328 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
329 tar xzf $(YAZ).tar.gz
330 cd $(YAZ) && ./configure && make && make install && ldconfig
332 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
333 install_js_sm: install_libjs install_spidermonkey
336 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
337 tar -zxf $(LIBJS).tar.gz
338 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
339 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
340 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
341 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
342 if [ ! -z $(FEDORA_64) ]; then \
343 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib64/ && \
344 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib64/; \
346 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ && \
347 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/; \
351 install_spidermonkey:
352 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
353 tar -zxf $(LIBJS_PERL).tar.gz
354 if [ ! -z $(FEDORA_64) ]; then \
355 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
357 if [ ! -z $(FEDORA) ]; then \
358 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
360 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
362 install_net_z3950_simpleserver:
363 if [ ! -f $(LIBNET_Z3950_SIMPLESERVER).tar.gz ]; then wget $(LIBNET_Z3950_SIMPLESERVER_URL).tar.gz; fi;
364 tar -zxf $(LIBNET_Z3950_SIMPLESERVER).tar.gz
365 cd $(LIBNET_Z3950_SIMPLESERVER) && perl Makefile.PL && make && make test && make install
367 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
368 # compiled-from-source version from being used and breaks the install.
369 # This package might get installed depending on the install-time choices
370 # for the distro. Test for its existence; if it's there, throw an error
373 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
374 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
375 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
376 echo "*** to successfully install Evergreen."; \
378 echo "*** Note: this may break other applications on your system."; \
382 # Install libdbi and the postgres drivers
384 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
385 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
386 tar -zxf $(LIBDBI).tar.gz
387 tar -zxf $(LIBDBI_DRIVERS).tar.gz
388 cd $(LIBDBI) && ./configure --disable-docs && make all install
389 cd $(LIBDBI_DRIVERS) && ./configure \
390 --disable-docs --with-pgsql --enable-libdbi && make all install
393 make -C $(LIBDBI) clean
394 make -C $(LIBDBI_DRIVERS) clean
395 make -C $(LIBJS_PERL) clean
396 make -f Makefile.ref -C js/src/ clean
399 # ------------------------------------------------------------------
400 # - DEBIAN ---------------------------------------------------------
403 # link the apache modules in
404 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
405 # keep the bad apache modules away
406 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
407 # refresh the dynamic library cache
410 # Install the debian-specific dependencies
412 $(APT_TOOL) install $(DEBS)
414 install_pgsql_client_debs_90:
415 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
417 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
418 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
419 "conflict with the 9.0 versions - so remove them, install the pinned" \
420 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
421 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
422 "databases that might currently exist on this machine." && \
423 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
425 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
426 $(APT_TOOL) install apache2-prefork-dev
428 install_pgsql_server_debs_90:
429 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
431 install_pgsql_client_backport_debs_91:
432 @if [ `$(APT_TOOL) versions libpq5 | grep ^i|sed 's/^i[ \t]*//'|cut -d. -f1` -eq 8 ]; \
434 echo -e "libpq5 / libpq-dev are installed as part of OpenSRF (a dependency" \
435 "of apache2-prefork-dev), but these are the 8.4 versions and they" \
436 "conflict with the 9.0 versions - so remove them, install the pinned" \
437 "backports of 9.0, then reinstall the apache2-prefork-dev package.\n\n" \
438 "**WARNING**: Saying 'Yes' to this step will _remove_ any PostgreSQL" \
439 "databases that might currently exist on this machine." && \
440 $(APT_SAFE_TOOL) remove libpq5 libpq-dev ; \
442 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
443 $(APT_TOOL) install apache2-prefork-dev
445 install_pgsql_client_debs_91:
446 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_91)
448 install_pgsql_server_debs_91:
449 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_91)
451 install_pgsql_server_backport_debs_91:
452 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_91)
454 # Install the debian-specific dependencies for more modern distros
455 install_extra_debs_squeeze: install_extra_debs
456 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
458 # Install dependencies for Ubuntu 12.04:
459 install_extra_debs_precise: install_extra_debs
460 $(APT_TOOL) install $(EXTRA_DEBS_PRECISE)
463 $(APT_TOOL) install $(EXTRA_DEBS)
465 # ------------------------------------------------------------------
470 yum -y install $(FEDORA_RPMS)
472 install_fedora_pgsql_server:
473 yum -y install $(PGSQL_FEDORA_RPMS)
475 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
476 # if it is not already there
478 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
479 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
483 # vim:noet:sw=4:ts=4: