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/lucid), and Fedora (13).
7 # Working towards support of CentOS 5 / RHEL 5.
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-lucid
19 # make -f Makefile.install fedora-13
21 # make -f Makefile.install centos
23 # make -f Makefile.install rhel
27 # This makefile has been tested much more with Debian and Ubuntu than
28 # Fedora, CentOS, or RHEL.
30 # ---------------------------------------------------------------------
32 # Make any assumptions about the shell being used explicit
36 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
37 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
38 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
39 # used for installing libjs lib and header files
40 JS_INSTALL_PREFIX=/usr/
42 # The libdbi sources can be fetched from sourceforge.net. They are stored on
43 # the open-ils.org site now for ease of direct linking
45 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
46 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
48 # We need a recent version of Yaz
49 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
51 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
53 # Business::OnlinePayment is not packaged on CentOS/RHEL
54 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
55 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
60 LBITS=$(shell getconf LONG_BIT)
63 FEDORA_64=$(shell uname -r | grep "fc[0-9][0-9].x86_64")
66 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
67 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
68 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm
75 libbusiness-creditcard-perl\
76 libbusiness-onlinepayment-authorizenet-perl\
77 libbusiness-onlinepayment-perl\
78 libdatetime-format-builder-perl\
79 libdatetime-format-iso8601-perl\
80 libdatetime-format-mail-perl\
82 libdatetime-timezone-perl\
92 libole-storage-lite-perl\
95 libspreadsheet-writeexcel-perl\
99 libuniversal-require-perl\
102 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
104 libbusiness-isbn-perl\
105 libbusiness-isbn-data-perl\
106 libmarc-charset-perl \
108 libnet-z3950-zoom-perl \
112 # Ubuntu Hardy and Debian Etch require libencode-perl
113 # to get a version of Encode > 2.12 - see bug 525069.
114 # Note that the Debian version of libencode-perl comes
115 # from etch-backports.
126 perl-Business-CreditCard \
128 perl-Business-ISBN-Data \
129 perl-Business-OnlinePayment \
130 perl-Class-Data-Inheritable \
131 perl-DateTime-Format-Builder \
132 perl-DateTime-Format-Strptime \
137 perl-Spreadsheet-WriteExcel \
142 Class::DBI::Frozen::301 \
144 DBIx::ContextualFetch \
164 perl-Business-CreditCard \
166 perl-Business-ISBN-Data \
171 perl-OLE-Storage_Lite \
172 perl-Spreadsheet-WriteExcel \
182 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
183 # Should be fixed in 3.22
185 Business::OnlinePayment \
186 Business::OnlinePayment::AuthorizeNet \
187 Class::DBI::Frozen::301
191 postgresql-contrib-8.4* \
192 postgresql-devel-8.4* \
193 postgresql-plpe*-8.4* \
194 postgresql-server-8.4*
196 PGSQL_CLIENT_DEBS_81 = \
197 postgresql-client-8.1
199 PGSQL_SERVER_DEBS_81 = \
201 postgresql-contrib-8.1 \
202 postgresql-plperl-8.1 \
203 postgresql-server-dev-8.1
205 PGSQL_CLIENT_DEBS_82 = \
208 PGSQL_SERVER_DEBS_82 = \
210 postgresql-contrib-8.2 \
211 postgresql-plperl-8.2 \
212 postgresql-server-dev-8.2
214 PGSQL_CLIENT_DEBS_83 = \
217 PGSQL_SERVER_DEBS_83 = \
219 postgresql-contrib-8.3 \
220 postgresql-plperl-8.3 \
221 postgresql-server-dev-8.3
223 PGSQL_CLIENT_DEBS_84 = \
226 PGSQL_SERVER_DEBS_84 = \
228 postgresql-contrib-8.4 \
229 postgresql-plperl-8.4 \
230 postgresql-server-dev-8.4
239 DEB_APACHE_DISMODS = \
242 # Chronically unpackaged CPAN modules
244 Business::CreditCard::Object \
247 Net::Z3950::Simple2ZOOM \
251 # Are we sure most distros don't come with an acceptable version of Safe.pm?
252 CPAN_MODULES_SAFE = \
255 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
256 CPAN_MODULES_MARC = \
258 Business::ISBN::Data \
263 # ----------------------------------------------------------------------------
266 @echo "please specify an OS" && exit 0
268 # these should be the same for any distro
269 install: install_cpan install_js_sm install_libdbi install_library_callnumber_lc
271 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
272 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
274 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey install_library_callnumber_lc
276 debian-etch: etch generic_debian
277 debian-lenny: lenny generic_debian
278 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
279 lenny: install_pgsql_client_debs_83 install_extra_debs
280 generic_debian: install_debs install debian_sys_config install_cpan_safe
282 ubuntu-hardy: hardy generic_ubuntu
283 ubuntu-lucid: lucid generic_ubuntu
284 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
285 lucid: install_pgsql_client_debs_84 install_extra_debs
286 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
288 # - COMMON TARGETS ---------------------------------------------------------
290 # Install the CPAN modules
292 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
294 # Install the CPAN modules for MARC functionality
296 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
298 # Install the Safe Perl module
299 # Is this really unpackaged everywhere except for Fedora?
301 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
303 # Install the CPAN modules for Fedora 13
305 for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
307 # Install a known working version of YAZ
309 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
310 tar xzf $(YAZ).tar.gz
311 cd $(YAZ) && ./configure && make && make install && ldconfig
313 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
314 install_js_sm: install_libjs install_spidermonkey
317 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
318 tar -zxf $(LIBJS).tar.gz
319 cd js/src/ && JS_THREADSAFE=true JS_DIST=/usr make -f Makefile.ref
320 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
321 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
322 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
323 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
324 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
326 install_spidermonkey:
327 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
328 tar -zxf $(LIBJS_PERL).tar.gz
329 if [ ! -z $(FEDORA_64) ]; then \
330 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
331 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
333 cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
336 # Install libdbi and the postgres drivers
338 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
339 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
340 tar -zxf $(LIBDBI).tar.gz
341 tar -zxf $(LIBDBI_DRIVERS).tar.gz
342 cd $(LIBDBI) && ./configure --disable-docs && make all install
343 cd $(LIBDBI_DRIVERS) && ./configure \
344 --disable-docs --with-pgsql --enable-libdbi && make all install
346 install_library_callnumber_lc:
347 if [ ! -d Library-CallNumber-LC ]; then svn checkout http://library-callnumber-lc.googlecode.com/svn/trunk/perl/Library-CallNumber-LC; fi;
348 cd Library-CallNumber-LC && perl Makefile.PL && make install
351 make -C $(LIBDBI) clean
352 make -C $(LIBDBI_DRIVERS) clean
353 make -C $(LIBJS_PERL) clean
354 make -f Makefile.ref -C js/src/ clean
357 # ------------------------------------------------------------------
358 # - DEBIAN ---------------------------------------------------------
361 # link the apache modules in
362 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
363 # keep the bad apache modules away
364 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
365 # refresh the dynamic library cache
368 # Install the debian-specific dependencies
370 $(APT_TOOL) install $(DEBS)
372 install_pgsql_client_debs_84:
373 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
375 install_pgsql_server_debs_84:
376 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
378 install_pgsql_client_debs_83:
379 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
381 install_pgsql_server_debs_83:
382 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
384 install_pgsql_client_debs_82:
385 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
387 install_pgsql_server_debs_82:
388 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
390 # Etch requires an explicit version to avoid PostgreSQL 7.4
391 install_pgsql_client_debs_81:
392 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
394 # Etch requires an explicit version to avoid PostgreSQL 7.4
395 install_pgsql_server_debs_81:
396 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
398 # Install the debian-specific dependencies for more modern distros
400 $(APT_TOOL) install $(EXTRA_DEBS)
402 # Install specific modules required by Ubuntu Hardy and
403 # Debian Etch - see bug 525069
404 install_extra_encode:
405 $(APT_TOOL) install $(EXTRA_ENCODE)
407 # ------------------------------------------------------------------
410 install_fedora_13_rpms:
412 yum -y install $(FEDORA_13_RPMS)
414 install_fedora_13_pgsql_server:
415 yum -y install $(PGSQL_84_RPMS)
419 yum -y install $(CENTOS)
421 if [ $(LBITS) -eq 64 ]; then \
422 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
423 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
426 if [ $(LBITS) -eq 32 ]; then \
427 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
431 install_centos_pgsql:
432 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
433 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
434 rpm -Uvh --force ./$(PGSQL_CENTOS)
436 yum -y install $(PGSQL_84_RPMS)
438 install_redhat_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_REDHAT)
441 rpm -Uvh --force ./$(PGSQL_REDHAT)
443 yum -y install $(PGSQL_84_RPMS)
446 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
447 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
448 echo "force install Scalar::Util" | perl -MCPAN -e shell
450 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
451 # if it is not already there
453 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
454 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
458 # vim:noet:sw=4:ts=4: