]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
adding datetime::set perl mod to debs
[working/Evergreen.git] / Open-ILS / src / extras / Makefile.install
1 # ---------------------------------------------------------------------
2 # Author: Bill Erickson <erickson@esilibrary.com>
3 #
4 # Makefile to install prerequisites for OpenSRF and Evergreen
5 #
6 # Currently supports Debian (etch/lenny), Ubuntu (gutsy/hardy/intrepid/karmic), and Gentoo.
7 # Working towards support of CentOS 5 / RHEL 5.
8 # Installs Perl prereqs, libjs with Perl wrapper, libdbi, libdbi-drivers, and libyaz
9 #
10 # usage:
11 #       make -f Makefile.install debian-etch
12 #       - or -
13 #       make -f Makefile.install debian-lenny
14 #       - or -
15 #       make -f Makefile.install ubuntu-gutsy
16 #       - or -
17 #       make -f Makefile.install ubuntu-hardy
18 #       - or -
19 #       make -f Makefile.install ubuntu-intrepid
20 #       - or -
21 #       make -f Makefile.install ubuntu-karmic
22 #       - or -
23 #       make -f Makefile.install centos
24 #       - or -
25 #       make -f Makefile.install rhel
26 #       - or -
27 #       make -f Makefile.install gentoo
28 #
29 # Notes:
30 #
31 #       This makefile has been tested much more with Debian and Ubuntu than
32 #       CentOS, Gentoo, or RHEL.
33 #
34 #       Gentoo (especially amd64) requires a good bit of masked package
35 #       mangling for some packages.  These are not documented here because
36 #       they will continue to evolve
37 #
38 # ---------------------------------------------------------------------
39  
40 # Make any assumptions about the shell being used explicit
41 SHELL=/bin/bash 
42
43 # XXX
44 # Gentoo needs explicit versions on many of these packages
45 # to simulate a "blessed" set of packages
46 #
47 # Also, I (think) Gentoo has a javascript::spidermonkey package that does
48 # not require fetching the sources externally ... needs testing/updating in here
49 #
50 # Intrepid has libmozjs-dev and spidermonkey-bin - might work
51
52 LIBJS=js-1.7.0
53 LIBJS_PERL=JavaScript-SpiderMonkey-0.19
54 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
55 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
56 # used for installing libjs lib and header files
57 JS_INSTALL_PREFIX=/usr/
58
59
60 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
61 # the open-ils.org site now for ease of direct linking
62 LIBDBI=libdbi-0.8.3
63 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
64 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
65
66 # We need a recent version of Yaz
67 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
68 YAZ=yaz-3.0.47
69 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
70
71 # Business::OnlinePayment is not packaged on CentOS/RHEL
72 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
73 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
74
75 APT_TOOL=aptitude -yq
76
77
78 # Debian dependencies
79 DEBS =  \
80         apache2-prefork-dev\
81         aspell\
82         aspell-en\
83         libbusiness-creditcard-perl\
84         libbusiness-onlinepayment-authorizenet-perl\
85         libbusiness-onlinepayment-perl\
86         libclass-dbi-pg-perl\
87         libdatetime-format-builder-perl\
88         libdatetime-format-iso8601-perl\
89         libdatetime-format-mail-perl\
90         libdatetime-perl\
91         libdatetime-timezone-perl\
92         libdatetime-set-perl\
93         libemail-send-perl\
94         libgd-graph3d-perl\
95         liblog-log4perl-perl\
96         libmarc-record-perl\
97         libncurses5-dev\
98         libnet-server-perl\
99         libole-storage-lite-perl\
100         libpq-dev\
101         libreadline5-dev\
102         libspreadsheet-writeexcel-perl\
103         libtext-aspell-perl\
104         libtext-csv-perl\
105         libtext-csv-perl\
106         libuniversal-require-perl\
107         libunix-syslog-perl
108
109 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
110 EXTRA_DEBS = \
111         libmarc-charset-perl \
112         libmarc-xml-perl \
113         libnet-z3950-zoom-perl \
114         libyaz-dev \
115         yaz
116
117 CENTOS = \
118         aspell \
119         aspell-devel \
120         aspell-en \
121         gd-devel \
122         perl-DBD-Pg
123
124 PGSQL_CENTOS = \
125         postgresql \
126         postgresql-contrib \
127         postgresql-devel \
128         postgresql-pl \
129         postgresql-server
130
131 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
132 CENTOS_PERL_FORCE = \
133         Scalar::Util
134
135 # Some of these packages have stupid bugs in their test suites
136 # that are simply too painful to workaround
137 CENTOS_PERL_NOTEST = \
138         Business::OnlinePayment::AuthorizeNet \
139         DateTime::Format::Strptime
140
141 # This is a developer's version, but B:OP:AuthorizeNet depends on it
142 CENTOS_PERL_VERSION = \
143         IVAN/Business-OnlinePayment-3.00_08.tar.gz
144
145 CENTOS_PERL = \
146         Business::CreditCard \
147         Class::DBI::Pg \
148         DateTime \
149         DateTime::TimeZone \
150         DateTime::Format::Builder \
151         GD::Graph3d \
152         MARC::Record \
153         Net::Z3950::ZOOM \
154         Spreadsheet::WriteExcel \
155         Text::Aspell \
156         Text::CSV
157
158 PGSQL_CLIENT_DEBS_8.1 = \
159         postgresql-client-8.1
160
161 PGSQL_SERVER_DEBS_8.1 = \
162         postgresql-8.1 \
163         postgresql-contrib-8.1 \
164         postgresql-plperl-8.1 \
165         postgresql-server-dev-8.1
166
167 PGSQL_CLIENT_DEBS_82 = \
168         postgresql-client
169
170 PGSQL_SERVER_DEBS_82 = \
171         postgresql \
172         postgresql-contrib-8.2 \
173         postgresql-plperl-8.2 \
174         postgresql-server-dev-8.2
175
176 PGSQL_CLIENT_DEBS_83 = \
177         postgresql-client
178
179 PGSQL_SERVER_DEBS_83 = \
180         postgresql \
181         postgresql-contrib-8.3 \
182         postgresql-plperl-8.3 \
183         postgresql-server-dev-8.3
184
185 PGSQL_CLIENT_DEBS_84 = \
186         postgresql-client
187
188 PGSQL_SERVER_DEBS_84 = \
189         postgresql \
190         postgresql-contrib-8.4 \
191         postgresql-plperl-8.4 \
192         postgresql-server-dev-8.4
193
194 GENTOOS = \
195     yaz\
196     aspell-en\
197     dev-db/libpq\
198     dev-db/postgresql\
199     dev-perl/Email-Send\
200     dev-perl/DateTime\
201     dev-perl/DateTime-TimeZone\
202     dev-perl/DBD-Pg\
203     dev-perl/GD-Graph3d\
204     dev-perl/Text-Aspell\
205     dev-perl/Template-Toolkit\
206     dev-perl/Text-CSV_XS\
207     dev-perl/Spreadsheet-WriteExcel
208
209 GENTOO_PERL = \
210     MARC::Record \
211     Net::Z3950::ZOOM \
212     Text::CSV
213
214 DEB_APACHE_MODS = \
215     expires\
216     include\
217     proxy\
218     proxy_http\
219     rewrite
220
221 DEB_APACHE_DISMODS = \
222     deflate
223
224 # Chronically unpackaged CPAN modules
225 CPAN_MODULES = \
226     Business::CreditCard::Object \
227     Net::Z3950::Simple2ZOOM \
228     UUID::Tiny \
229     SRU \
230     Safe
231
232 # Intrepid and Lenny have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
233 CPAN_MODULES_MARC = \
234     MARC::Charset \
235     MARC::File::XML \
236     Net::Z3950::ZOOM
237
238 # ----------------------------------------------------------------------------
239
240 all: 
241         @echo "please specify an OS" && exit 0
242
243 # these should be the same for any distro
244 install: install_cpan install_js_sm install_libdbi 
245
246 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local
247
248 debian-etch: etch generic_debian
249 debian-lenny: lenny generic_debian
250 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc
251 lenny: install_pgsql_client_debs_83 install_extra_debs
252 generic_debian:  install_debs install debian_sys_config
253
254 gentoo: install_gentoos install_gentoo_perl install
255
256 rhel: centos
257
258 ubuntu-gutsy: hardy generic_ubuntu 
259 ubuntu-hardy: hardy generic_ubuntu
260 ubuntu-intrepid: intrepid generic_ubuntu
261 ubuntu-karmic: karmic generic_ubuntu
262 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc
263 intrepid: install_pgsql_client_debs_83 install_extra_debs
264 karmic: install_pgsql_client_debs_84 install_extra_debs
265 generic_ubuntu: install_debs install debian_sys_config
266
267 # - COMMON TARGETS ---------------------------------------------------------
268
269 # Install the CPAN modules
270 install_cpan: 
271         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
272
273 # Install the CPAN modules for MARC functionality
274 install_cpan_marc: 
275         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
276
277 # Install a known working version of YAZ
278 install_yaz:    
279         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
280         tar xzf $(YAZ).tar.gz
281         cd $(YAZ) && ./configure && make && make install
282
283 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
284 install_js_sm: 
285         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
286         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
287         tar -zxf $(LIBJS).tar.gz
288         tar -zxf $(LIBJS_PERL).tar.gz
289         cd js/src/ && make -f Makefile.ref
290         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
291         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
292         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
293         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
294         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
295         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
296
297
298 # Install libdbi and the postgres drivers
299 install_libdbi:
300         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
301         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
302         tar -zxf $(LIBDBI).tar.gz
303         tar -zxf $(LIBDBI_DRIVERS).tar.gz
304         cd $(LIBDBI) && ./configure --disable-docs && make all install
305         cd $(LIBDBI_DRIVERS) && ./configure  \
306                 --disable-docs --with-pgsql --enable-libdbi && make all install  
307
308
309 clean:
310         make -C $(LIBDBI) clean
311         make -C $(LIBDBI_DRIVERS) clean
312         make -C $(LIBJS_PERL) clean
313         make -f Makefile.ref -C js/src/ clean
314
315
316 # ------------------------------------------------------------------
317 # - DEBIAN ---------------------------------------------------------
318
319 debian_sys_config: 
320         # link the apache modules in
321         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
322         # keep the bad apache modules away
323         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
324         # refresh the dynamic library cache
325         ldconfig
326
327 # Install the debian-specific dependencies
328 install_debs:
329         $(APT_TOOL) install $(DEBS)
330
331 install_pgsql_client_debs_84:
332         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
333
334 install_pgsql_server_debs_84:
335         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
336
337 install_pgsql_client_debs_83:
338         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
339
340 install_pgsql_server_debs_83:
341         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
342
343 install_pgsql_client_debs_82:
344         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
345
346 install_pgsql_server_debs_82:
347         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
348
349 # Etch requires an explicit version to avoid PostgreSQL 7.4
350 install_pgsql_client_debs_81:
351         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
352
353 # Etch requires an explicit version to avoid PostgreSQL 7.4
354 install_pgsql_server_debs_81:
355         $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
356
357 # Install the debian-specific dependencies for more modern distros
358 install_extra_debs:
359         $(APT_TOOL) install $(EXTRA_DEBS)
360
361
362 # ------------------------------------------------------------------
363 # - GENTOO ---------------------------------------------------------
364
365 install_gentoos:
366         emerge -n $(GENTOOS)
367
368 install_gentoo_perl:
369         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
370
371 # ------------------------------------------------------------------
372     
373
374 # CENTOS
375 install_centos_rpms:
376         yum -y install $(CENTOS)
377
378 install_centos_pgsql:
379         yum -y install $(PGSQL_CENTOS)
380
381 install_centos_perl:
382         for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
383         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
384         for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
385         for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
386
387 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
388 # if it is not already there
389 create_ld_local:
390         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
391                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
392                 ldconfig; \
393         fi;
394
395 # vim:noet:sw=4:ts=4: