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 (14).
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 fedora14
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 # The libdbi sources can be fetched from sourceforge.net. They are stored on
40 # the open-ils.org site now for ease of direct linking
42 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
43 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
45 # We need a recent version of Yaz
46 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
48 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
50 # Business::OnlinePayment is not packaged on CentOS/RHEL
51 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
52 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
55 APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq
58 LBITS=$(shell getconf LONG_BIT)
61 FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.")
64 FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64")
67 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
68 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
69 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm
76 libbusiness-creditcard-perl\
77 libbusiness-onlinepayment-authorizenet-perl\
78 libbusiness-onlinepayment-perl\
79 libdatetime-format-builder-perl\
80 libdatetime-format-iso8601-perl\
81 libdatetime-format-mail-perl\
83 libdatetime-timezone-perl\
95 libole-storage-lite-perl\
99 libspreadsheet-writeexcel-perl\
103 libuniversal-require-perl\
107 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
109 libbusiness-isbn-perl\
110 libbusiness-isbn-data-perl\
111 libmarc-charset-perl \
113 libnet-z3950-zoom-perl \
117 EXTRA_DEBS_SQUEEZE = \
120 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
121 # > 2.12 - see bug 525069.
132 perl-Business-CreditCard \
134 perl-Business-ISBN-Data \
135 perl-Business-OnlinePayment \
136 perl-Class-Data-Inheritable \
137 perl-DateTime-Format-Builder \
138 perl-DateTime-Format-Strptime \
143 perl-Spreadsheet-WriteExcel \
149 DBIx::ContextualFetch \
168 perl-Business-CreditCard \
170 perl-Business-ISBN-Data \
177 perl-OLE-Storage_Lite \
178 perl-Spreadsheet-WriteExcel \
189 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
190 # Should be fixed in 3.22
191 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
193 Business::OnlinePayment \
194 Business::OnlinePayment::AuthorizeNet \
200 postgresql90-contrib \
203 postgresql90-plperl \
206 PGSQL_CLIENT_DEBS_90 = \
209 postgresql-client-9.0
211 PGSQL_SERVER_DEBS_90 = \
213 postgresql-contrib-9.0 \
214 postgresql-plperl-9.0 \
215 postgresql-server-dev-9.0
224 DEB_APACHE_DISMODS = \
227 # Chronically unpackaged CPAN modules
230 Library::CallNumber::LC \
231 Net::Z3950::Simple2ZOOM \
234 # More chronically unpackaged CPAN modules (available in Squeeze though)
235 CPAN_MODULES_MORE = \
236 Business::CreditCard::Object \
241 # Are we sure most distros don't come with an acceptable version of Safe.pm?
242 CPAN_MODULES_SAFE = \
245 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
246 CPAN_MODULES_MARC = \
248 Business::ISBN::Data \
253 CPAN_MODULES_MARC_RECORD = \
256 CPAN_MODULES_FORCE = \
257 Class::DBI::Frozen::301
259 # ----------------------------------------------------------------------------
262 @echo "please specify an OS" && exit 0
264 # these should be the same for any distro
265 install: install_cpan install_js_sm install_libdbi install_cpan_force
267 centos: install_centos_pgsql centos_like
268 rhel: install_redhat_pgsql centos_like
269 centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force
271 fedora14: install_fedora_rpms install_cpan install_cpan_fedora install_cpan_marc install_js_sm install_cpan_force
274 debian-squeeze: squeeze generic_debian
275 squeeze: install_pgsql_client_debs_90 install_extra_debs_squeeze
276 generic_debian: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_force
278 ubuntu-lucid: lucid generic_ubuntu
279 lucid: install_pgsql_client_debs_90 install_extra_debs install_cpan_marc_record
280 generic_ubuntu: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force
282 # - COMMON TARGETS ---------------------------------------------------------
284 # Install the CPAN modules
286 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
289 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
291 # Install the CPAN modules for MARC functionality
292 install_cpan_marc: install_cpan_marc_record
293 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
295 install_cpan_marc_record:
296 for m in $(CPAN_MODULES_MARC_RECORD); do perl -MCPAN -e "install \"$$m\";"; done
299 for m in $(CPAN_MODULES_FORCE); do \
300 echo "force install $$m" | perl -MCPAN -e shell ;\
303 # Install the Safe Perl module
304 # Is this really unpackaged everywhere except for Fedora?
306 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
308 # Install the CPAN modules for Fedora 13
310 for m in $(FEDORA_CPAN); do \
311 echo "force install $$m" | perl -MCPAN -e shell;\
314 # Install a known working version of YAZ
316 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
317 tar xzf $(YAZ).tar.gz
318 cd $(YAZ) && ./configure && make && make install && ldconfig
320 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
321 install_js_sm: install_libjs install_spidermonkey
324 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
325 tar -zxf $(LIBJS).tar.gz
326 cd js/src/ && JS_DIST=/usr make -f Makefile.ref
327 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
328 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
329 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
330 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
331 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
333 install_spidermonkey:
334 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
335 tar -zxf $(LIBJS_PERL).tar.gz
336 if [ ! -z $(FEDORA_64) ]; then \
337 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
339 if [ ! -z $(FEDORA) ]; then \
340 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
342 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
344 # On Ubuntu and possibly Debian, the libdbi0 package prevents the
345 # compiled-from-source version from being used and breaks the install.
346 # This package might get installed depending on the install-time choices
347 # for the distro. Test for its existence; if it's there, throw an error
350 @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \
351 echo "*** Detected locally installed libdbi0 package; you must remove this"; \
352 echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \
353 echo "*** to successfully install Evergreen."; \
355 echo "*** Note: this may break other applications on your system."; \
359 # Install libdbi and the postgres drivers
361 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
362 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
363 tar -zxf $(LIBDBI).tar.gz
364 tar -zxf $(LIBDBI_DRIVERS).tar.gz
365 cd $(LIBDBI) && ./configure --disable-docs && make all install
366 cd $(LIBDBI_DRIVERS) && ./configure \
367 --disable-docs --with-pgsql --enable-libdbi && make all install
370 make -C $(LIBDBI) clean
371 make -C $(LIBDBI_DRIVERS) clean
372 make -C $(LIBJS_PERL) clean
373 make -f Makefile.ref -C js/src/ clean
376 # ------------------------------------------------------------------
377 # - DEBIAN ---------------------------------------------------------
380 # link the apache modules in
381 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
382 # keep the bad apache modules away
383 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
384 # refresh the dynamic library cache
387 # Install the debian-specific dependencies
389 $(APT_TOOL) install $(DEBS)
391 # libpq5 / libpq-dev get installed as part of OpenSRF (a dependency
392 # of apache2-prefork-dev), but these are the 8.4 versions and they
393 # conflict with the 9.0 versions - so remove them, install the pinned
394 # backports of 9.0, then reinstall the apache2-prefork-dev package
395 install_pgsql_client_debs_90:
396 $(APT_TOOL) remove libpq5 libpq-dev
397 $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90)
398 $(APT_TOOL) install apache2-prefork-dev
400 install_pgsql_server_debs_90:
401 $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90)
403 # Install the debian-specific dependencies for more modern distros
404 install_extra_debs_squeeze: install_extra_debs
405 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
408 $(APT_TOOL) install $(EXTRA_DEBS)
410 # Install specific modules required by Ubuntu Hardy - see bug 525069
411 install_extra_encode:
412 $(APT_TOOL) install $(EXTRA_ENCODE)
414 # ------------------------------------------------------------------
419 yum -y install $(FEDORA_RPMS)
421 install_fedora_pgsql_server:
422 yum -y install $(PGSQL_84_RPMS)
426 yum -y install $(CENTOS)
428 if [ $(LBITS) -eq 64 ]; then \
429 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
430 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
433 if [ $(LBITS) -eq 32 ]; then \
434 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
438 install_centos_pgsql:
439 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
440 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
441 rpm -Uvh --force ./$(PGSQL_CENTOS)
443 yum -y install $(PGSQL_84_RPMS)
445 install_redhat_pgsql:
446 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
447 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
448 rpm -Uvh --force ./$(PGSQL_REDHAT)
450 yum -y install $(PGSQL_84_RPMS)
453 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
454 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
455 echo "force install Scalar::Util" | perl -MCPAN -e shell
457 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
458 # if it is not already there
460 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
461 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
465 # vim:noet:sw=4:ts=4: