# --------------------------------------------------------------------- # Author: Bill Erickson # Author: Dan Scott # # Makefile to install prerequisites for OpenSRF and Evergreen # # Currently supports Debian (squeeze), Ubuntu (lucid), and Fedora (14). # Working towards support of CentOS 5 / RHEL 5. # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz # # usage: # make -f Makefile.install debian-squeeze # - or - # make -f Makefile.install ubuntu-lucid # - or - # make -f Makefile.install fedora14 # - or - # make -f Makefile.install centos # - or - # make -f Makefile.install rhel # # Notes: # # This makefile has been tested much more with Debian, Ubuntu, and # Fedora than CentOS, or RHEL. # # --------------------------------------------------------------------- # Make any assumptions about the shell being used explicit SHELL=/bin/bash LIBJS=js-1.7.0 LIBJS_PERL=JavaScript-SpiderMonkey-0.20 LIBJS_URL=http://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz LIBJS_PERL_URL=http://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz # used for installing libjs lib and header files JS_INSTALL_PREFIX=/usr/ # The libdbi sources can be fetched from sourceforge.net. They are stored on # the open-ils.org site now for ease of direct linking LIBDBI=libdbi-0.8.3 LIBDBI_DRIVERS=libdbi-drivers-0.8.3 LIBDBI_HOST=http://open-ils.org/~denials/evergreen # We need a recent version of Yaz # Debian Lenny and Ubuntu 8.10 come with 3.0.34 YAZ=yaz-3.0.47 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz # Business::OnlinePayment is not packaged on CentOS/RHEL PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/ APT_TOOL=aptitude -yq APT_BACKPORT_TOOL=aptitude -t squeeze-backports -yq # 64 or 32 bit os? LBITS=$(shell getconf LONG_BIT) # Fedora? FEDORA=$(shell uname -r | grep "\.fc[0-9][0-9]\.") # Fedora 64-bit? FEDORA_64=$(shell uname -r | grep "\.fc[0-9][0-9]\.x86_64") #RHEL/Centos PGSQL PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm # Debian dependencies DEBS = \ apache2-prefork-dev\ aspell\ aspell-en\ libbusiness-creditcard-perl\ libbusiness-onlinepayment-authorizenet-perl\ libbusiness-onlinepayment-perl\ libdatetime-format-builder-perl\ libdatetime-format-iso8601-perl\ libdatetime-format-mail-perl\ libdatetime-perl\ libdatetime-timezone-perl\ libdatetime-set-perl\ libdbd-pg-perl\ libemail-send-perl\ libemail-simple-perl\ libgd-graph3d-perl\ liblog-log4perl-perl\ libmarc-record-perl\ libncurses5-dev\ libnet-server-perl\ libnet-ssh2-perl\ libnspr4-dev\ libole-storage-lite-perl\ libparent-perl \ libpq-dev\ libreadline5-dev\ libspreadsheet-writeexcel-perl\ libssh2-1-dev\ libtext-aspell-perl\ libtext-csv-perl\ libuniversal-require-perl\ libnet-ip-perl\ libunix-syslog-perl # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz EXTRA_DEBS = \ libbusiness-isbn-perl\ libbusiness-isbn-data-perl\ libmarc-charset-perl \ libmarc-xml-perl \ libnet-z3950-zoom-perl \ libyaz-dev \ yaz EXTRA_DEBS_SQUEEZE = \ libuuid-tiny-perl # Ubuntu Hardy requires libencode-perl # to get a version of Encode # > 2.12 - see bug 525069. EXTRA_ENCODE = \ libencode-perl CENTOS = \ aspell \ aspell-devel \ aspell-en \ gd-devel \ libssh2-devel \ openssl-devel \ perl-Business-CreditCard \ perl-Business-ISBN \ perl-Business-ISBN-Data \ perl-Business-OnlinePayment \ perl-Class-Data-Inheritable \ perl-DateTime-Format-Builder \ perl-DateTime-Format-Strptime \ perl-Ima-DBI \ perl-DBD-Pg \ perl-GD-Graph3d \ perl-IO-stringy \ perl-Spreadsheet-WriteExcel \ perl-Text-Aspell \ perl-Text-CSV CENTOS_PERL = \ Encode \ DBIx::ContextualFetch \ Getopt::Long \ Net::SSH2 \ Net::XMPP \ Net::Z3950::ZOOM FEDORA_RPMS = \ aspell \ aspell-en \ libdbi \ libdbi-dbd-pgsql \ libdbi-devel \ libssh2-devel \ libyaz \ libyaz-devel \ mod_ssl \ ncurses-devel \ ncurses-libs \ perl-parent \ perl-Business-CreditCard \ perl-Business-ISBN \ perl-Business-ISBN-Data \ perl-DBD-Pg \ perl-Email-Send \ perl-Email-Simple \ perl-GDGraph3d \ perl-Net-IP \ perl-Net-SSH2 \ perl-OLE-Storage_Lite \ perl-Spreadsheet-WriteExcel \ perl-Text-Aspell \ perl-Text-CSV \ perl-Text-CSV_XS \ perl-XML-Writer \ postgresql90-devel \ readline-devel \ tcp_wrappers-devel \ wget \ yaz # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172 # Should be fixed in 3.22 # MARC::Record 2.0.1 is required but only 2.0.0 is packaged FEDORA_CPAN = \ Business::OnlinePayment \ Business::OnlinePayment::AuthorizeNet \ MARC::Record \ UUID::Tiny PGSQL_90_RPMS = \ postgresql90 \ postgresql90-contrib \ postgresql90-devel \ postgresql90-libs \ postgresql90-plperl \ postgresql90-server PGSQL_CLIENT_DEBS_90 = \ libpq5 \ libpq-dev \ postgresql-client-9.0 PGSQL_SERVER_DEBS_90 = \ postgresql-9.0 \ postgresql-contrib-9.0 \ postgresql-plperl-9.0 \ postgresql-server-dev-9.0 DEB_APACHE_MODS = \ expires\ include\ proxy\ proxy_http\ rewrite DEB_APACHE_DISMODS = \ deflate # Chronically unpackaged CPAN modules CPAN_MODULES = \ Business::EDI \ Library::CallNumber::LC \ Net::Z3950::Simple2ZOOM \ SRU # More chronically unpackaged CPAN modules (available in Squeeze though) CPAN_MODULES_MORE = \ Business::CreditCard::Object \ MARC::Record \ Net::SSH2 \ UUID::Tiny # Are we sure most distros don't come with an acceptable version of Safe.pm? CPAN_MODULES_SAFE = \ Safe # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl CPAN_MODULES_MARC = \ Business::ISBN \ Business::ISBN::Data \ MARC::Charset \ MARC::File::XML \ Net::Z3950::ZOOM CPAN_MODULES_FORCE = \ Class::DBI::Frozen::301 # ---------------------------------------------------------------------------- all: @echo "please specify an OS" && exit 0 # these should be the same for any distro install: install_cpan install_js_sm install_libdbi install_cpan_force centos: install_centos_pgsql centos_like rhel: install_redhat_pgsql centos_like centos_like: install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe install_cpan_force fedora14: install_fedora_rpms install_cpan install_cpan_fedora install_cpan_marc install_js_sm install_cpan_force fedora15: fedora14 debian-squeeze: squeeze generic_debian squeeze: install_pgsql_client_debs_90 install_extra_debs_squeeze generic_debian: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_force ubuntu-lucid: lucid generic_ubuntu lucid: install_pgsql_client_debs_90 install_extra_debs generic_ubuntu: install_debs test_for_libdbi_pkg install debian_sys_config install_cpan_more install_cpan_safe install_cpan_force # - COMMON TARGETS --------------------------------------------------------- # Install the CPAN modules install_cpan: for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done install_cpan_more: for m in $(CPAN_MODULES_MORE); do perl -MCPAN -e "install \"$$m\";"; done # Install the CPAN modules for MARC functionality install_cpan_marc: for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done install_cpan_force: for m in $(CPAN_MODULES_FORCE); do \ echo "force install $$m" | perl -MCPAN -e shell ;\ done # Install the Safe Perl module # Is this really unpackaged everywhere except for Fedora? install_cpan_safe: for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done # Install the CPAN modules for Fedora 13 install_cpan_fedora: for m in $(FEDORA_CPAN); do \ echo "force install $$m" | perl -MCPAN -e shell;\ done # Install a known working version of YAZ install_yaz: if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi; tar xzf $(YAZ).tar.gz cd $(YAZ) && ./configure && make && make install && ldconfig # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules install_js_sm: install_libjs install_spidermonkey install_libjs: if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi; tar -zxf $(LIBJS).tar.gz cd js/src/ && JS_DIST=/usr make -f Makefile.ref mkdir -p $(JS_INSTALL_PREFIX)/include/js/ cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/ cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/ cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/ cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/ install_spidermonkey: if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi; tar -zxf $(LIBJS_PERL).tar.gz if [ ! -z $(FEDORA_64) ]; then \ sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \ fi; if [ ! -z $(FEDORA) ]; then \ sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \ fi; cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install # On Ubuntu and possibly Debian, the libdbi0 package prevents the # compiled-from-source version from being used and breaks the install. # This package might get installed depending on the install-time choices # for the distro. Test for its existence; if it's there, throw an error # message and exit. test_for_libdbi_pkg: @if [ "$$(apt-cache policy libdbi0 | grep Installed | grep none | wc -l)" -eq 0 ]; then \ echo "*** Detected locally installed libdbi0 package; you must remove this"; \ echo "*** with a command like 'aptitude remove libdbi0' before proceeding"; \ echo "*** to successfully install Evergreen."; \ echo; \ echo "*** Note: this may break other applications on your system."; \ exit 0; \ fi; # Install libdbi and the postgres drivers install_libdbi: if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi; if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi; tar -zxf $(LIBDBI).tar.gz tar -zxf $(LIBDBI_DRIVERS).tar.gz cd $(LIBDBI) && ./configure --disable-docs && make all install cd $(LIBDBI_DRIVERS) && ./configure \ --disable-docs --with-pgsql --enable-libdbi && make all install clean: make -C $(LIBDBI) clean make -C $(LIBDBI_DRIVERS) clean make -C $(LIBJS_PERL) clean make -f Makefile.ref -C js/src/ clean # ------------------------------------------------------------------ # - DEBIAN --------------------------------------------------------- debian_sys_config: # link the apache modules in for m in $(DEB_APACHE_MODS); do a2enmod $$m; done; # keep the bad apache modules away for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done; # refresh the dynamic library cache ldconfig # Install the debian-specific dependencies install_debs: $(APT_TOOL) install $(DEBS) # libpq5 / libpq-dev get installed as part of OpenSRF (a dependency # of apache2-prefork-dev), but these are the 8.4 versions and they # conflict with the 9.0 versions - so remove them, install the pinned # backports of 9.0, then reinstall the apache2-prefork-dev package install_pgsql_client_debs_90: $(APT_TOOL) remove libpq5 libpq-dev $(APT_BACKPORT_TOOL) install $(PGSQL_CLIENT_DEBS_90) $(APT_TOOL) install apache2-prefork-dev install_pgsql_server_debs_90: $(APT_BACKPORT_TOOL) install $(PGSQL_SERVER_DEBS_90) # Install the debian-specific dependencies for more modern distros install_extra_debs_squeeze: install_extra_debs $(APT_TOOL) install $(EXTRA_DEBS_SQUEEZE) install_extra_debs: $(APT_TOOL) install $(EXTRA_DEBS) # Install specific modules required by Ubuntu Hardy - see bug 525069 install_extra_encode: $(APT_TOOL) install $(EXTRA_ENCODE) # ------------------------------------------------------------------ # FEDORA 13 install_fedora_rpms: yum -y update yum -y install $(FEDORA_RPMS) install_fedora_pgsql_server: yum -y install $(PGSQL_84_RPMS) # CENTOS install_centos_rpms: yum -y install $(CENTOS) yum -y update if [ $(LBITS) -eq 64 ]; then \ ln -sf /usr/lib64/libpq.* /usr/lib/ && \ ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \ ldconfig ; \ fi; if [ $(LBITS) -eq 32 ]; then \ ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \ ldconfig ; \ fi; install_centos_pgsql: if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi; wget $(PGSQL_HOST)/$(PGSQL_CENTOS) rpm -Uvh --force ./$(PGSQL_CENTOS) yum update -y yum -y install $(PGSQL_84_RPMS) install_redhat_pgsql: if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi; wget $(PGSQL_HOST)/$(PGSQL_REDHAT) rpm -Uvh --force ./$(PGSQL_REDHAT) yum update -y yum -y install $(PGSQL_84_RPMS) install_centos_perl: for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell echo "force install Scalar::Util" | perl -MCPAN -e shell # We need to add /usr/local/lib to the ldconfig list of directories on CentOS, # if it is not already there create_ld_local: if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \ echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \ ldconfig; \ fi; # vim:noet:sw=4:ts=4: