1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF and Evergreen
6 # Currently supports Debian (etch/lenny), Ubuntu (hardy/karmic), and Gentoo.
7 # Working towards support of CentOS 5 / RHEL 5 / Fedora 13.
8 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
11 # make -f Makefile.install debian-etch
13 # make -f Makefile.install debian-lenny
15 # make -f Makefile.install ubuntu-hardy
17 # make -f Makefile.install ubuntu-karmic
19 # make -f Makefile.install fedora-13
21 # make -f Makefile.install centos
23 # make -f Makefile.install rhel
25 # make -f Makefile.install gentoo
29 # This makefile has been tested much more with Debian and Ubuntu than
30 # Fedora, CentOS, Gentoo, or RHEL.
32 # Gentoo (especially amd64) requires a good bit of masked package
33 # mangling for some packages. These are not documented here because
34 # they will continue to evolve
36 # ---------------------------------------------------------------------
38 # Make any assumptions about the shell being used explicit
42 # Gentoo needs explicit versions on many of these packages
43 # to simulate a "blessed" set of packages
45 # Also, I (think) Gentoo has a javascript::spidermonkey package that does
46 # not require fetching the sources externally ... needs testing/updating in here
49 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
50 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
51 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
52 # used for installing libjs lib and header files
53 JS_INSTALL_PREFIX=/usr/
55 # The libdbi sources can be fetched from sourceforge.net. They are stored on
56 # the open-ils.org site now for ease of direct linking
58 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
59 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
61 # We need a recent version of Yaz
62 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
64 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
66 # Business::OnlinePayment is not packaged on CentOS/RHEL
67 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
68 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
73 LBITS=$(shell getconf LONG_BIT)
76 FEDORA_64=$(shell uname -r | grep "fc[0-9][0-9].x86_64")
79 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
80 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
81 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm
88 libbusiness-creditcard-perl\
89 libbusiness-onlinepayment-authorizenet-perl\
90 libbusiness-onlinepayment-perl\
92 libdatetime-format-builder-perl\
93 libdatetime-format-iso8601-perl\
94 libdatetime-format-mail-perl\
96 libdatetime-timezone-perl\
100 liblog-log4perl-perl\
104 libole-storage-lite-perl\
107 libspreadsheet-writeexcel-perl\
111 libuniversal-require-perl\
114 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
116 libmarc-charset-perl \
118 libnet-z3950-zoom-perl \
122 # Ubuntu Hardy and Debian Etch require libencode-perl
123 # to get a version of Encode > 2.12 - see bug 525069.
124 # Note that the Debian version of libencode-perl comes
125 # from etch-backports.
136 perl-Business-CreditCard \
137 perl-Business-OnlinePayment \
138 perl-Class-Data-Inheritable \
139 perl-DateTime-Format-Builder \
140 perl-DateTime-Format-Strptime \
145 perl-Spreadsheet-WriteExcel \
153 DBIx::ContextualFetch \
171 perl-Business-CreditCard \
177 perl-OLE-Storage_Lite \
178 perl-Spreadsheet-WriteExcel \
188 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
189 # Should be fixed in 3.22
191 Business::OnlinePayment \
192 Business::OnlinePayment::AuthorizeNet
196 postgresql-contrib-8.4* \
197 postgresql-devel-8.4* \
198 postgresql-plpe*-8.4* \
199 postgresql-server-8.4*
201 PGSQL_CLIENT_DEBS_81 = \
202 postgresql-client-8.1
204 PGSQL_SERVER_DEBS_81 = \
206 postgresql-contrib-8.1 \
207 postgresql-plperl-8.1 \
208 postgresql-server-dev-8.1
210 PGSQL_CLIENT_DEBS_82 = \
213 PGSQL_SERVER_DEBS_82 = \
215 postgresql-contrib-8.2 \
216 postgresql-plperl-8.2 \
217 postgresql-server-dev-8.2
219 PGSQL_CLIENT_DEBS_83 = \
222 PGSQL_SERVER_DEBS_83 = \
224 postgresql-contrib-8.3 \
225 postgresql-plperl-8.3 \
226 postgresql-server-dev-8.3
228 PGSQL_CLIENT_DEBS_84 = \
231 PGSQL_SERVER_DEBS_84 = \
233 postgresql-contrib-8.4 \
234 postgresql-plperl-8.4 \
235 postgresql-server-dev-8.4
244 dev-perl/DateTime-TimeZone\
247 dev-perl/Text-Aspell\
248 dev-perl/Template-Toolkit\
249 dev-perl/Text-CSV_XS\
250 dev-perl/Spreadsheet-WriteExcel
264 DEB_APACHE_DISMODS = \
267 # Chronically unpackaged CPAN modules
269 Business::CreditCard::Object \
272 Net::Z3950::Simple2ZOOM \
276 # Are we sure most distros don't come with an acceptable version of Safe.pm?
277 CPAN_MODULES_SAFE = \
280 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
281 CPAN_MODULES_MARC = \
286 # ----------------------------------------------------------------------------
289 @echo "please specify an OS" && exit 0
291 # these should be the same for any distro
292 install: install_cpan install_js_sm install_libdbi
294 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
295 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
297 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
299 debian-etch: etch generic_debian
300 debian-lenny: lenny generic_debian
301 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
302 lenny: install_pgsql_client_debs_83 install_extra_debs
303 generic_debian: install_debs install debian_sys_config install_cpan_safe
305 gentoo: install_gentoos install_gentoo_perl install
307 ubuntu-hardy: hardy generic_ubuntu
308 ubuntu-karmic: karmic generic_ubuntu
309 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
310 karmic: install_pgsql_client_debs_84 install_extra_debs
311 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
313 # - COMMON TARGETS ---------------------------------------------------------
315 # Install the CPAN modules
317 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
319 # Install the CPAN modules for MARC functionality
321 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
323 # Install the Safe Perl module
324 # Is this really unpackaged everywhere except for Fedora?
326 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
328 # Install the CPAN modules for Fedora 13
330 for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
332 # Install a known working version of YAZ
334 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
335 tar xzf $(YAZ).tar.gz
336 cd $(YAZ) && ./configure && make && make install && ldconfig
338 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
339 install_js_sm: install_libjs install_spidermonkey
342 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
343 tar -zxf $(LIBJS).tar.gz
344 cd js/src/ && make -f Makefile.ref
345 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
346 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
347 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
348 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
349 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 ; \
356 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
358 cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
361 # Install libdbi and the postgres drivers
363 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
364 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
365 tar -zxf $(LIBDBI).tar.gz
366 tar -zxf $(LIBDBI_DRIVERS).tar.gz
367 cd $(LIBDBI) && ./configure --disable-docs && make all install
368 cd $(LIBDBI_DRIVERS) && ./configure \
369 --disable-docs --with-pgsql --enable-libdbi && make all install
373 make -C $(LIBDBI) clean
374 make -C $(LIBDBI_DRIVERS) clean
375 make -C $(LIBJS_PERL) clean
376 make -f Makefile.ref -C js/src/ clean
379 # ------------------------------------------------------------------
380 # - DEBIAN ---------------------------------------------------------
383 # link the apache modules in
384 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
385 # keep the bad apache modules away
386 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
387 # refresh the dynamic library cache
390 # Install the debian-specific dependencies
392 $(APT_TOOL) install $(DEBS)
394 install_pgsql_client_debs_84:
395 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
397 install_pgsql_server_debs_84:
398 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
400 install_pgsql_client_debs_83:
401 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
403 install_pgsql_server_debs_83:
404 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
406 install_pgsql_client_debs_82:
407 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
409 install_pgsql_server_debs_82:
410 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
412 # Etch requires an explicit version to avoid PostgreSQL 7.4
413 install_pgsql_client_debs_81:
414 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
416 # Etch requires an explicit version to avoid PostgreSQL 7.4
417 install_pgsql_server_debs_81:
418 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
420 # Install the debian-specific dependencies for more modern distros
422 $(APT_TOOL) install $(EXTRA_DEBS)
424 # Install specific modules required by Ubuntu Hardy and
425 # Debian Etch - see bug 525069
426 install_extra_encode:
427 $(APT_TOOL) install $(EXTRA_ENCODE)
429 # ------------------------------------------------------------------
430 # - GENTOO ---------------------------------------------------------
436 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
438 # ------------------------------------------------------------------
441 install_fedora_13_rpms:
443 yum -y install $(FEDORA_13_RPMS)
445 install_fedora_13_pgsql_server:
446 yum -y install $(PGSQL_84_RPMS)
450 yum -y install $(CENTOS)
452 if [ $(LBITS) -eq 64 ]; then \
453 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
454 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
457 if [ $(LBITS) -eq 32 ]; then \
458 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
462 install_centos_pgsql:
463 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
464 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
465 rpm -Uvh --force ./$(PGSQL_CENTOS)
467 yum -y install $(PGSQL_84_RPMS)
469 install_redhat_pgsql:
470 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
471 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
472 rpm -Uvh --force ./$(PGSQL_REDHAT)
474 yum -y install $(PGSQL_84_RPMS)
477 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
478 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
479 echo "force install Scalar::Util" | perl -MCPAN -e shell
481 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
482 # if it is not already there
484 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
485 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
489 # vim:noet:sw=4:ts=4: