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