1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
4 # Makefile to install prerequisites for OpenSRF and Evergreen
6 # Currently supports Debian (etch/lenny), Ubuntu (gutsy/hardy/intrepid), and Gentoo.
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-gutsy
17 # make -f Makefile.install ubuntu-hardy
19 # make -f Makefile.install ubuntu-intrepid
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 # 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
48 # Intrepid has libmozjs-dev and spidermonkey-bin - might work
51 LIBJS_PERL=JavaScript-SpiderMonkey-0.19
52 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
53 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
54 # used for installing libjs lib and header files
55 JS_INSTALL_PREFIX=/usr/
58 # The libdbi sources can be fetched from sourceforge.net. They are stored on
59 # the open-ils.org site now for ease of direct linking
61 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
62 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
64 # We need a recent version of Yaz
65 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
67 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
69 # Business::OnlinePayment is not packaged on CentOS/RHEL
70 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
71 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
80 libbusiness-creditcard-perl\
81 libbusiness-onlinepayment-authorizenet-perl\
82 libbusiness-onlinepayment-perl\
84 libdatetime-format-builder-perl\
85 libdatetime-format-iso8601-perl\
86 libdatetime-format-mail-perl\
88 libdatetime-timezone-perl\
95 libole-storage-lite-perl\
98 libspreadsheet-writeexcel-perl\
102 libuniversal-require-perl\
106 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
108 libmarc-charset-perl \
110 libnet-z3950-zoom-perl \
128 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
129 CENTOS_PERL_FORCE = \
132 # Some of these packages have stupid bugs in their test suites
133 # that are simply too painful to workaround
134 CENTOS_PERL_NOTEST = \
135 Business::OnlinePayment::AuthorizeNet \
136 DateTime::Format::Strptime
138 # This is a developer's version, but B:OP:AuthorizeNet depends on it
139 CENTOS_PERL_VERSION = \
140 IVAN/Business-OnlinePayment-3.00_08.tar.gz
143 Business::CreditCard \
147 DateTime::Format::Builder \
151 Spreadsheet::WriteExcel \
155 PGSQL_CLIENT_DEBS_8.1 = \
156 postgresql-client-8.1
158 PGSQL_SERVER_DEBS_8.1 = \
160 postgresql-contrib-8.1 \
161 postgresql-plperl-8.1 \
162 postgresql-server-dev-8.1
164 PGSQL_CLIENT_DEBS_82 = \
167 PGSQL_SERVER_DEBS_82 = \
169 postgresql-contrib-8.2 \
170 postgresql-plperl-8.2 \
171 postgresql-server-dev-8.2
173 PGSQL_CLIENT_DEBS_83 = \
176 PGSQL_SERVER_DEBS_83 = \
178 postgresql-contrib-8.3 \
179 postgresql-plperl-8.3 \
180 postgresql-server-dev-8.3
189 dev-perl/DateTime-TimeZone\
192 dev-perl/Text-Aspell\
193 dev-perl/Template-Toolkit\
194 dev-perl/Text-CSV_XS\
195 dev-perl/Spreadsheet-WriteExcel
209 DEB_APACHE_DISMODS = \
212 # Chronically unpackaged CPAN modules
214 Business::CreditCard::Object \
215 Net::Z3950::Simple2ZOOM \
218 # Intrepid and Lenny have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
219 CPAN_MODULES_MARC = \
224 # ----------------------------------------------------------------------------
227 @echo "please specify an OS" && exit 0
229 # these should be the same for any distro
230 install: install_cpan install_js_sm install_libdbi
232 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local
234 debian-etch: etch generic_debian
235 debian-lenny: lenny generic_debian
236 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc
237 lenny: install_pgsql_client_debs_83 install_extra_debs
238 generic_debian: install_debs install debian_sys_config
240 gentoo: install_gentoos install_gentoo_perl install
244 ubuntu-gutsy: hardy generic_ubuntu
245 ubuntu-hardy: hardy generic_ubuntu
246 ubuntu-intrepid: intrepid generic_ubuntu
247 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc
248 intrepid: install_pgsql_client_debs_83 install_extra_debs
249 generic_ubuntu: install_debs install debian_sys_config
251 # - COMMON TARGETS ---------------------------------------------------------
253 # Install the CPAN modules
255 for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
257 # Install the CPAN modules for MARC functionality
259 for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
261 # Install a known working version of YAZ
263 if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
264 tar xzf $(YAZ).tar.gz
265 cd $(YAZ) && ./configure && make && make install
267 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
269 if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
270 if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
271 tar -zxf $(LIBJS).tar.gz
272 tar -zxf $(LIBJS_PERL).tar.gz
273 cd js/src/ && make -f Makefile.ref
274 mkdir -p $(JS_INSTALL_PREFIX)/include/js/
275 cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
276 cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
277 cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
278 cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
279 cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
282 # Install libdbi and the postgres drivers
284 if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
285 if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
286 tar -zxf $(LIBDBI).tar.gz
287 tar -zxf $(LIBDBI_DRIVERS).tar.gz
288 cd $(LIBDBI) && ./configure --disable-docs && make all install
289 cd $(LIBDBI_DRIVERS) && ./configure \
290 --disable-docs --with-pgsql --enable-libdbi && make all install
294 make -C $(LIBDBI) clean
295 make -C $(LIBDBI_DRIVERS) clean
296 make -C $(LIBJS_PERL) clean
297 make -f Makefile.ref -C js/src/ clean
300 # ------------------------------------------------------------------
301 # - DEBIAN ---------------------------------------------------------
304 # link the apache modules in
305 for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
306 # keep the bad apache modules away
307 for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
308 # refresh the dynamic library cache
311 # Install the debian-specific dependencies
313 $(APT_TOOL) install $(DEBS)
315 install_pgsql_client_debs_83:
316 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
318 install_pgsql_server_debs_83:
319 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
321 install_pgsql_client_debs_82:
322 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
324 install_pgsql_server_debs_82:
325 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
327 # Etch requires an explicit version to avoid PostgreSQL 7.4
328 install_pgsql_client_debs_81:
329 $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
331 # Etch requires an explicit version to avoid PostgreSQL 7.4
332 install_pgsql_server_debs_81:
333 $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
335 # Install the debian-specific dependencies for more modern distros
337 $(APT_TOOL) install $(EXTRA_DEBS)
340 # ------------------------------------------------------------------
341 # - GENTOO ---------------------------------------------------------
347 for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
349 # ------------------------------------------------------------------
354 yum -y install $(CENTOS)
356 install_centos_pgsql:
357 yum -y install $(PGSQL_CENTOS)
360 for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
361 for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
362 for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
363 for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
365 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
366 # if it is not already there
368 if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
369 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
373 # vim:noet:sw=4:ts=4: