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 \
172 perl-Business-CreditCard \
178 perl-OLE-Storage_Lite \
179 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
192 Business::OnlinePayment \
193 Business::OnlinePayment::AuthorizeNet
197 postgresql-contrib-8.4* \
198 postgresql-devel-8.4* \
199 postgresql-plpe*-8.4* \
200 postgresql-server-8.4*
202 PGSQL_CLIENT_DEBS_81 = \
203 postgresql-client-8.1
205 PGSQL_SERVER_DEBS_81 = \
207 postgresql-contrib-8.1 \
208 postgresql-plperl-8.1 \
209 postgresql-server-dev-8.1
211 PGSQL_CLIENT_DEBS_82 = \
214 PGSQL_SERVER_DEBS_82 = \
216 postgresql-contrib-8.2 \
217 postgresql-plperl-8.2 \
218 postgresql-server-dev-8.2
220 PGSQL_CLIENT_DEBS_83 = \
223 PGSQL_SERVER_DEBS_83 = \
225 postgresql-contrib-8.3 \
226 postgresql-plperl-8.3 \
227 postgresql-server-dev-8.3
229 PGSQL_CLIENT_DEBS_84 = \
232 PGSQL_SERVER_DEBS_84 = \
234 postgresql-contrib-8.4 \
235 postgresql-plperl-8.4 \
236 postgresql-server-dev-8.4
245 dev-perl/DateTime-TimeZone\
248 dev-perl/Text-Aspell\
249 dev-perl/Template-Toolkit\
250 dev-perl/Text-CSV_XS\
251 dev-perl/Spreadsheet-WriteExcel
265 DEB_APACHE_DISMODS = \
268 # Chronically unpackaged CPAN modules
270 Business::CreditCard::Object \
273 Net::Z3950::Simple2ZOOM \
277 # Are we sure most distros don't come with an acceptable version of Safe.pm?
278 CPAN_MODULES_SAFE = \
281 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
282 CPAN_MODULES_MARC = \
287 # ----------------------------------------------------------------------------
290 @echo "please specify an OS" && exit 0
292 # these should be the same for any distro
293 install: install_cpan install_js_sm install_libdbi
295 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
296 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
298 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
300 debian-etch: etch generic_debian
301 debian-lenny: lenny generic_debian
302 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
303 lenny: install_pgsql_client_debs_83 install_extra_debs
304 generic_debian: install_debs install debian_sys_config install_cpan_safe
306 gentoo: install_gentoos install_gentoo_perl install
308 ubuntu-hardy: hardy generic_ubuntu
309 ubuntu-karmic: karmic generic_ubuntu
310 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
311 karmic: install_pgsql_client_debs_84 install_extra_debs
312 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
314 # - COMMON TARGETS ---------------------------------------------------------
316 # Install the CPAN modules
318 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
320 # Install the CPAN modules for MARC functionality
322 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
324 # Install the Safe Perl module
325 # Is this really unpackaged everywhere except for Fedora?
327 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
329 # Install the CPAN modules for Fedora 13
331 for m in $(FEDORA_13_CPAN); 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/ && 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 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
350 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
352 install_spidermonkey:
353 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
354 tar -zxf $(LIBJS_PERL).tar.gz
355 if [ ! -z $(FEDORA_64) ]; then \
356 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
357 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
359 cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
362 # Install libdbi and the postgres drivers
364 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
365 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
366 tar -zxf $(LIBDBI).tar.gz
367 tar -zxf $(LIBDBI_DRIVERS).tar.gz
368 cd $(LIBDBI) && ./configure --disable-docs && make all install
369 cd $(LIBDBI_DRIVERS) && ./configure \
370 --disable-docs --with-pgsql --enable-libdbi && make all install
374 make -C $(LIBDBI) clean
375 make -C $(LIBDBI_DRIVERS) clean
376 make -C $(LIBJS_PERL) clean
377 make -f Makefile.ref -C js/src/ clean
380 # ------------------------------------------------------------------
381 # - DEBIAN ---------------------------------------------------------
384 # link the apache modules in
385 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
386 # keep the bad apache modules away
387 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
388 # refresh the dynamic library cache
391 # Install the debian-specific dependencies
393 $(APT_TOOL) install $(DEBS)
395 install_pgsql_client_debs_84:
396 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
398 install_pgsql_server_debs_84:
399 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
401 install_pgsql_client_debs_83:
402 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
404 install_pgsql_server_debs_83:
405 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
407 install_pgsql_client_debs_82:
408 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
410 install_pgsql_server_debs_82:
411 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
413 # Etch requires an explicit version to avoid PostgreSQL 7.4
414 install_pgsql_client_debs_81:
415 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
417 # Etch requires an explicit version to avoid PostgreSQL 7.4
418 install_pgsql_server_debs_81:
419 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
421 # Install the debian-specific dependencies for more modern distros
423 $(APT_TOOL) install $(EXTRA_DEBS)
425 # Install specific modules required by Ubuntu Hardy and
426 # Debian Etch - see bug 525069
427 install_extra_encode:
428 $(APT_TOOL) install $(EXTRA_ENCODE)
430 # ------------------------------------------------------------------
431 # - GENTOO ---------------------------------------------------------
437 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
439 # ------------------------------------------------------------------
442 install_fedora_13_rpms:
444 yum -y install $(FEDORA_13_RPMS)
446 install_fedora_13_pgsql_server:
447 yum -y install $(PGSQL_84_RPMS)
451 yum -y install $(CENTOS)
453 if [ $(LBITS) -eq 64 ]; then \
454 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
455 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
458 if [ $(LBITS) -eq 32 ]; then \
459 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
463 install_centos_pgsql:
464 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
465 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
466 rpm -Uvh --force ./$(PGSQL_CENTOS)
468 yum -y install $(PGSQL_84_RPMS)
470 install_redhat_pgsql:
471 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
472 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
473 rpm -Uvh --force ./$(PGSQL_REDHAT)
475 yum -y install $(PGSQL_84_RPMS)
478 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
479 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
480 echo "force install Scalar::Util" | perl -MCPAN -e shell
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: