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 \
173 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 \
194 Class::DBI::Frozen::301
198 postgresql-contrib-8.4* \
199 postgresql-devel-8.4* \
200 postgresql-plpe*-8.4* \
201 postgresql-server-8.4*
203 PGSQL_CLIENT_DEBS_81 = \
204 postgresql-client-8.1
206 PGSQL_SERVER_DEBS_81 = \
208 postgresql-contrib-8.1 \
209 postgresql-plperl-8.1 \
210 postgresql-server-dev-8.1
212 PGSQL_CLIENT_DEBS_82 = \
215 PGSQL_SERVER_DEBS_82 = \
217 postgresql-contrib-8.2 \
218 postgresql-plperl-8.2 \
219 postgresql-server-dev-8.2
221 PGSQL_CLIENT_DEBS_83 = \
224 PGSQL_SERVER_DEBS_83 = \
226 postgresql-contrib-8.3 \
227 postgresql-plperl-8.3 \
228 postgresql-server-dev-8.3
230 PGSQL_CLIENT_DEBS_84 = \
233 PGSQL_SERVER_DEBS_84 = \
235 postgresql-contrib-8.4 \
236 postgresql-plperl-8.4 \
237 postgresql-server-dev-8.4
246 dev-perl/DateTime-TimeZone\
249 dev-perl/Text-Aspell\
250 dev-perl/Template-Toolkit\
251 dev-perl/Text-CSV_XS\
252 dev-perl/Spreadsheet-WriteExcel
266 DEB_APACHE_DISMODS = \
269 # Chronically unpackaged CPAN modules
271 Business::CreditCard::Object \
274 Net::Z3950::Simple2ZOOM \
278 # Are we sure most distros don't come with an acceptable version of Safe.pm?
279 CPAN_MODULES_SAFE = \
282 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
283 CPAN_MODULES_MARC = \
288 # ----------------------------------------------------------------------------
291 @echo "please specify an OS" && exit 0
293 # these should be the same for any distro
294 install: install_cpan install_js_sm install_libdbi
296 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
297 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
299 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
301 debian-etch: etch generic_debian
302 debian-lenny: lenny generic_debian
303 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
304 lenny: install_pgsql_client_debs_83 install_extra_debs
305 generic_debian: install_debs install debian_sys_config install_cpan_safe
307 gentoo: install_gentoos install_gentoo_perl install
309 ubuntu-hardy: hardy generic_ubuntu
310 ubuntu-karmic: karmic generic_ubuntu
311 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
312 karmic: install_pgsql_client_debs_84 install_extra_debs
313 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
315 # - COMMON TARGETS ---------------------------------------------------------
317 # Install the CPAN modules
319 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
321 # Install the CPAN modules for MARC functionality
323 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
325 # Install the Safe Perl module
326 # Is this really unpackaged everywhere except for Fedora?
328 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
330 # Install the CPAN modules for Fedora 13
332 for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
334 # Install a known working version of YAZ
336 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
337 tar xzf $(YAZ).tar.gz
338 cd $(YAZ) && ./configure && make && make install && ldconfig
340 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
341 install_js_sm: install_libjs install_spidermonkey
344 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
345 tar -zxf $(LIBJS).tar.gz
346 cd js/src/ && make -f Makefile.ref
347 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
348 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
349 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
350 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
351 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
353 install_spidermonkey:
354 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
355 tar -zxf $(LIBJS_PERL).tar.gz
356 if [ ! -z $(FEDORA_64) ]; then \
357 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
358 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
360 cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
363 # Install libdbi and the postgres drivers
365 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
366 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
367 tar -zxf $(LIBDBI).tar.gz
368 tar -zxf $(LIBDBI_DRIVERS).tar.gz
369 cd $(LIBDBI) && ./configure --disable-docs && make all install
370 cd $(LIBDBI_DRIVERS) && ./configure \
371 --disable-docs --with-pgsql --enable-libdbi && make all install
375 make -C $(LIBDBI) clean
376 make -C $(LIBDBI_DRIVERS) clean
377 make -C $(LIBJS_PERL) clean
378 make -f Makefile.ref -C js/src/ clean
381 # ------------------------------------------------------------------
382 # - DEBIAN ---------------------------------------------------------
385 # link the apache modules in
386 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
387 # keep the bad apache modules away
388 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
389 # refresh the dynamic library cache
392 # Install the debian-specific dependencies
394 $(APT_TOOL) install $(DEBS)
396 install_pgsql_client_debs_84:
397 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
399 install_pgsql_server_debs_84:
400 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
402 install_pgsql_client_debs_83:
403 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
405 install_pgsql_server_debs_83:
406 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
408 install_pgsql_client_debs_82:
409 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
411 install_pgsql_server_debs_82:
412 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
414 # Etch requires an explicit version to avoid PostgreSQL 7.4
415 install_pgsql_client_debs_81:
416 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
418 # Etch requires an explicit version to avoid PostgreSQL 7.4
419 install_pgsql_server_debs_81:
420 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
422 # Install the debian-specific dependencies for more modern distros
424 $(APT_TOOL) install $(EXTRA_DEBS)
426 # Install specific modules required by Ubuntu Hardy and
427 # Debian Etch - see bug 525069
428 install_extra_encode:
429 $(APT_TOOL) install $(EXTRA_ENCODE)
431 # ------------------------------------------------------------------
432 # - GENTOO ---------------------------------------------------------
438 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
440 # ------------------------------------------------------------------
443 install_fedora_13_rpms:
445 yum -y install $(FEDORA_13_RPMS)
447 install_fedora_13_pgsql_server:
448 yum -y install $(PGSQL_84_RPMS)
452 yum -y install $(CENTOS)
454 if [ $(LBITS) -eq 64 ]; then \
455 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
456 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
459 if [ $(LBITS) -eq 32 ]; then \
460 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
464 install_centos_pgsql:
465 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
466 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
467 rpm -Uvh --force ./$(PGSQL_CENTOS)
469 yum -y install $(PGSQL_84_RPMS)
471 install_redhat_pgsql:
472 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
473 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
474 rpm -Uvh --force ./$(PGSQL_REDHAT)
476 yum -y install $(PGSQL_84_RPMS)
479 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
480 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
481 echo "force install Scalar::Util" | perl -MCPAN -e shell
483 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
484 # if it is not already there
486 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
487 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
491 # vim:noet:sw=4:ts=4: