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 (lenny/squeeze), Ubuntu (hardy/lucid), and Fedora (13).
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-lenny
14 # make -f Makefile.install debian-squeeze
16 # make -f Makefile.install ubuntu-hardy
18 # make -f Makefile.install ubuntu-lucid
20 # make -f Makefile.install fedora-13
22 # make -f Makefile.install centos
24 # make -f Makefile.install rhel
28 # This makefile has been tested much more with Debian and Ubuntu than
29 # Fedora, CentOS, or RHEL.
31 # ---------------------------------------------------------------------
33 # Make any assumptions about the shell being used explicit
37 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
38 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
39 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
40 # used for installing libjs lib and header files
41 JS_INSTALL_PREFIX=/usr/
43 # The libdbi sources can be fetched from sourceforge.net. They are stored on
44 # the open-ils.org site now for ease of direct linking
46 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
47 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
49 # We need a recent version of Yaz
50 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
52 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
54 # Business::OnlinePayment is not packaged on CentOS/RHEL
55 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
56 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
61 LBITS=$(shell getconf LONG_BIT)
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\
93 libole-storage-lite-perl\
96 libspreadsheet-writeexcel-perl\
100 libuniversal-require-perl\
103 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
105 libbusiness-isbn-perl\
106 libbusiness-isbn-data-perl\
107 libmarc-charset-perl \
109 libnet-z3950-zoom-perl \
113 EXTRA_DEBS_SQUEEZE = \
116 # Ubuntu Hardy requires libencode-perl # to get a version of Encode
117 # > 2.12 - see bug 525069.
128 perl-Business-CreditCard \
130 perl-Business-ISBN-Data \
131 perl-Business-OnlinePayment \
132 perl-Class-Data-Inheritable \
133 perl-DateTime-Format-Builder \
134 perl-DateTime-Format-Strptime \
139 perl-Spreadsheet-WriteExcel \
144 Class::DBI::Frozen::301 \
146 DBIx::ContextualFetch \
166 perl-Business-CreditCard \
168 perl-Business-ISBN-Data \
172 perl-OLE-Storage_Lite \
173 perl-Spreadsheet-WriteExcel \
183 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
184 # Should be fixed in 3.22
185 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged
187 Business::OnlinePayment \
188 Business::OnlinePayment::AuthorizeNet \
189 Class::DBI::Frozen::301 \
194 postgresql-contrib-8.4* \
195 postgresql-devel-8.4* \
196 postgresql-plpe*-8.4* \
197 postgresql-server-8.4*
199 PGSQL_CLIENT_DEBS_82 = \
202 PGSQL_CLIENT_DEBS_83 = \
205 PGSQL_CLIENT_DEBS_84 = \
208 PGSQL_SERVER_DEBS_84 = \
210 postgresql-contrib-8.4 \
211 postgresql-plperl-8.4 \
212 postgresql-server-dev-8.4
221 DEB_APACHE_DISMODS = \
224 # Chronically unpackaged CPAN modules
227 Library::CallNumber::LC \
229 Net::Z3950::Simple2ZOOM \
232 # More chronically unpackaged CPAN modules (available in Squeeze though)
233 CPAN_MODULES_MORE = \
234 Business::CreditCard::Object \
238 # Are we sure most distros don't come with an acceptable version of Safe.pm?
239 CPAN_MODULES_SAFE = \
242 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
243 CPAN_MODULES_MARC = \
245 Business::ISBN::Data \
250 CPAN_MODULES_FORCE = \
251 Class::DBI::Frozen::301
253 # ----------------------------------------------------------------------------
256 @echo "please specify an OS" && exit 0
258 # these should be the same for any distro
259 install: install_cpan install_js_sm install_libdbi
261 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
262 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
264 fedora-13: install_fedora_13_rpms install_cpan install_cpan_fedora install_cpan_marc install_spidermonkey
266 debian-lenny: lenny generic_debian install_cpan_more install_cpan_safe
267 debian-squeeze: squeeze generic_debian install_cpan_force
268 lenny: install_pgsql_client_debs_83 install_extra_debs
269 squeeze: install_pgsql_client_debs_84 install_extra_debs_squeeze
270 generic_debian: install_debs install debian_sys_config
272 ubuntu-hardy: hardy generic_ubuntu
273 ubuntu-lucid: lucid generic_ubuntu
274 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
275 lucid: install_pgsql_client_debs_84 install_extra_debs
276 generic_ubuntu: install_debs install debian_sys_config install_cpan_more install_cpan_safe
278 # - COMMON TARGETS ---------------------------------------------------------
280 # Install the CPAN modules
282 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
285 for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done
287 # Install the CPAN modules for MARC functionality
289 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
292 for m in $(CPAN_MODULES_FORCE); do perl -MCPAN -e "force install \"$$m\";"; done
294 # Install the Safe Perl module
295 # Is this really unpackaged everywhere except for Fedora?
297 for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
299 # Install the CPAN modules for Fedora 13
301 for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
303 # Install a known working version of YAZ
305 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
306 tar xzf $(YAZ).tar.gz
307 cd $(YAZ) && ./configure && make && make install && ldconfig
309 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
310 install_js_sm: install_libjs install_spidermonkey
313 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
314 tar -zxf $(LIBJS).tar.gz
315 cd js/src/ && JS_THREADSAFE=true JS_DIST=/usr make -f Makefile.ref
316 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
317 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
318 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
319 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
320 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
322 install_spidermonkey:
323 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
324 tar -zxf $(LIBJS_PERL).tar.gz
325 if [ ! -z $(FEDORA_64) ]; then \
326 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
327 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
329 cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
332 # Install libdbi and the postgres drivers
334 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
335 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
336 tar -zxf $(LIBDBI).tar.gz
337 tar -zxf $(LIBDBI_DRIVERS).tar.gz
338 cd $(LIBDBI) && ./configure --disable-docs && make all install
339 cd $(LIBDBI_DRIVERS) && ./configure \
340 --disable-docs --with-pgsql --enable-libdbi && make all install
343 make -C $(LIBDBI) clean
344 make -C $(LIBDBI_DRIVERS) clean
345 make -C $(LIBJS_PERL) clean
346 make -f Makefile.ref -C js/src/ clean
349 # ------------------------------------------------------------------
350 # - DEBIAN ---------------------------------------------------------
353 # link the apache modules in
354 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
355 # keep the bad apache modules away
356 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
357 # refresh the dynamic library cache
360 # Install the debian-specific dependencies
362 $(APT_TOOL) install $(DEBS)
364 install_pgsql_client_debs_84:
365 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
367 install_pgsql_server_debs_84:
368 LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
370 install_pgsql_client_debs_83:
371 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
373 install_pgsql_client_debs_82:
374 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
376 # Install the debian-specific dependencies for more modern distros
377 install_extra_debs_squeeze: install_extra_debs
378 $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE)
381 $(APT_TOOL) install $(EXTRA_DEBS)
383 # Install specific modules required by Ubuntu Hardy - see bug 525069
384 install_extra_encode:
385 $(APT_TOOL) install $(EXTRA_ENCODE)
387 # ------------------------------------------------------------------
390 install_fedora_13_rpms:
392 yum -y install $(FEDORA_13_RPMS)
394 install_fedora_13_pgsql_server:
395 yum -y install $(PGSQL_84_RPMS)
399 yum -y install $(CENTOS)
401 if [ $(LBITS) -eq 64 ]; then \
402 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
403 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
406 if [ $(LBITS) -eq 32 ]; then \
407 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
411 install_centos_pgsql:
412 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
413 wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
414 rpm -Uvh --force ./$(PGSQL_CENTOS)
416 yum -y install $(PGSQL_84_RPMS)
418 install_redhat_pgsql:
419 if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
420 wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
421 rpm -Uvh --force ./$(PGSQL_REDHAT)
423 yum -y install $(PGSQL_84_RPMS)
426 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
427 echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
428 echo "force install Scalar::Util" | perl -MCPAN -e shell
430 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
431 # if it is not already there
433 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
434 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
438 # vim:noet:sw=4:ts=4: