]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Net::uFTP dependency (which on Debian-based systems appears to need libssh2-1-dev...
[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         libssh2-1-dev\
104         libtext-aspell-perl\
105         libtext-csv-perl\
106         libtext-csv-perl\
107         libuniversal-require-perl\
108         libunix-syslog-perl
109
110 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
111 EXTRA_DEBS = \
112         libmarc-charset-perl \
113         libmarc-xml-perl \
114         libnet-z3950-zoom-perl \
115         libyaz-dev \
116         yaz
117
118 CENTOS = \
119         aspell \
120         aspell-devel \
121         aspell-en \
122         gd-devel \
123         perl-DBD-Pg
124
125 PGSQL_CENTOS = \
126         postgresql \
127         postgresql-contrib \
128         postgresql-devel \
129         postgresql-pl \
130         postgresql-server
131
132 # Avoids a weak reference error that otherwise sinks DateTime:Format:ISO8601
133 CENTOS_PERL_FORCE = \
134         Scalar::Util
135
136 # Some of these packages have stupid bugs in their test suites
137 # that are simply too painful to workaround
138 CENTOS_PERL_NOTEST = \
139         Business::OnlinePayment::AuthorizeNet \
140         DateTime::Format::Strptime
141
142 # This is a developer's version, but B:OP:AuthorizeNet depends on it
143 CENTOS_PERL_VERSION = \
144         IVAN/Business-OnlinePayment-3.00_08.tar.gz
145
146 CENTOS_PERL = \
147         Business::CreditCard \
148         Class::DBI::Pg \
149         DateTime \
150         DateTime::TimeZone \
151         DateTime::Format::Builder \
152         GD::Graph3d \
153         MARC::Record \
154         Net::Z3950::ZOOM \
155         Spreadsheet::WriteExcel \
156         Text::Aspell \
157         Text::CSV
158
159 PGSQL_CLIENT_DEBS_8.1 = \
160         postgresql-client-8.1
161
162 PGSQL_SERVER_DEBS_8.1 = \
163         postgresql-8.1 \
164         postgresql-contrib-8.1 \
165         postgresql-plperl-8.1 \
166         postgresql-server-dev-8.1
167
168 PGSQL_CLIENT_DEBS_82 = \
169         postgresql-client
170
171 PGSQL_SERVER_DEBS_82 = \
172         postgresql \
173         postgresql-contrib-8.2 \
174         postgresql-plperl-8.2 \
175         postgresql-server-dev-8.2
176
177 PGSQL_CLIENT_DEBS_83 = \
178         postgresql-client
179
180 PGSQL_SERVER_DEBS_83 = \
181         postgresql \
182         postgresql-contrib-8.3 \
183         postgresql-plperl-8.3 \
184         postgresql-server-dev-8.3
185
186 PGSQL_CLIENT_DEBS_84 = \
187         postgresql-client
188
189 PGSQL_SERVER_DEBS_84 = \
190         postgresql \
191         postgresql-contrib-8.4 \
192         postgresql-plperl-8.4 \
193         postgresql-server-dev-8.4
194
195 GENTOOS = \
196     yaz\
197     aspell-en\
198     dev-db/libpq\
199     dev-db/postgresql\
200     dev-perl/Email-Send\
201     dev-perl/DateTime\
202     dev-perl/DateTime-TimeZone\
203     dev-perl/DBD-Pg\
204     dev-perl/GD-Graph3d\
205     dev-perl/Text-Aspell\
206     dev-perl/Template-Toolkit\
207     dev-perl/Text-CSV_XS\
208     dev-perl/Spreadsheet-WriteExcel
209
210 GENTOO_PERL = \
211     MARC::Record \
212     Net::Z3950::ZOOM \
213     Text::CSV
214
215 DEB_APACHE_MODS = \
216     expires\
217     include\
218     proxy\
219     proxy_http\
220     rewrite
221
222 DEB_APACHE_DISMODS = \
223     deflate
224
225 # Chronically unpackaged CPAN modules
226 CPAN_MODULES = \
227     Business::CreditCard::Object \
228     Net::uFTP \
229     Net::Z3950::Simple2ZOOM \
230     UUID::Tiny \
231     SRU \
232     Safe
233
234 # Intrepid and Lenny have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
235 CPAN_MODULES_MARC = \
236     MARC::Charset \
237     MARC::File::XML \
238     Net::Z3950::ZOOM
239
240 # ----------------------------------------------------------------------------
241
242 all: 
243         @echo "please specify an OS" && exit 0
244
245 # these should be the same for any distro
246 install: install_cpan install_js_sm install_libdbi 
247
248 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local
249
250 debian-etch: etch generic_debian
251 debian-lenny: lenny generic_debian
252 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc
253 lenny: install_pgsql_client_debs_83 install_extra_debs
254 generic_debian:  install_debs install debian_sys_config
255
256 gentoo: install_gentoos install_gentoo_perl install
257
258 rhel: centos
259
260 ubuntu-gutsy: hardy generic_ubuntu 
261 ubuntu-hardy: hardy generic_ubuntu
262 ubuntu-intrepid: intrepid generic_ubuntu
263 ubuntu-karmic: karmic generic_ubuntu
264 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc
265 intrepid: install_pgsql_client_debs_83 install_extra_debs
266 karmic: install_pgsql_client_debs_84 install_extra_debs
267 generic_ubuntu: install_debs install debian_sys_config
268
269 # - COMMON TARGETS ---------------------------------------------------------
270
271 # Install the CPAN modules
272 install_cpan: 
273         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
274
275 # Install the CPAN modules for MARC functionality
276 install_cpan_marc: 
277         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
278
279 # Install a known working version of YAZ
280 install_yaz:    
281         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
282         tar xzf $(YAZ).tar.gz
283         cd $(YAZ) && ./configure && make && make install
284
285 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
286 install_js_sm: 
287         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
288         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
289         tar -zxf $(LIBJS).tar.gz
290         tar -zxf $(LIBJS_PERL).tar.gz
291         cd js/src/ && make -f Makefile.ref
292         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
293         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
294         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
295         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
296         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
297         cd $(LIBJS_PERL) && perl Makefile.PL -E4X && make && make test && make install
298
299
300 # Install libdbi and the postgres drivers
301 install_libdbi:
302         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
303         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
304         tar -zxf $(LIBDBI).tar.gz
305         tar -zxf $(LIBDBI_DRIVERS).tar.gz
306         cd $(LIBDBI) && ./configure --disable-docs && make all install
307         cd $(LIBDBI_DRIVERS) && ./configure  \
308                 --disable-docs --with-pgsql --enable-libdbi && make all install  
309
310
311 clean:
312         make -C $(LIBDBI) clean
313         make -C $(LIBDBI_DRIVERS) clean
314         make -C $(LIBJS_PERL) clean
315         make -f Makefile.ref -C js/src/ clean
316
317
318 # ------------------------------------------------------------------
319 # - DEBIAN ---------------------------------------------------------
320
321 debian_sys_config: 
322         # link the apache modules in
323         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
324         # keep the bad apache modules away
325         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
326         # refresh the dynamic library cache
327         ldconfig
328
329 # Install the debian-specific dependencies
330 install_debs:
331         $(APT_TOOL) install $(DEBS)
332
333 install_pgsql_client_debs_84:
334         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
335
336 install_pgsql_server_debs_84:
337         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
338
339 install_pgsql_client_debs_83:
340         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
341
342 install_pgsql_server_debs_83:
343         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
344
345 install_pgsql_client_debs_82:
346         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
347
348 install_pgsql_server_debs_82:
349         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
350
351 # Etch requires an explicit version to avoid PostgreSQL 7.4
352 install_pgsql_client_debs_81:
353         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
354
355 # Etch requires an explicit version to avoid PostgreSQL 7.4
356 install_pgsql_server_debs_81:
357         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
358
359 # Install the debian-specific dependencies for more modern distros
360 install_extra_debs:
361         $(APT_TOOL) install $(EXTRA_DEBS)
362
363
364 # ------------------------------------------------------------------
365 # - GENTOO ---------------------------------------------------------
366
367 install_gentoos:
368         emerge -n $(GENTOOS)
369
370 install_gentoo_perl:
371         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
372
373 # ------------------------------------------------------------------
374     
375
376 # CENTOS
377 install_centos_rpms:
378         yum -y install $(CENTOS)
379
380 install_centos_pgsql:
381         yum -y install $(PGSQL_CENTOS)
382
383 install_centos_perl:
384         for m in $(CENTOS_PERL_FORCE); do perl -MCPAN -e "CPAN::Shell->force(qw#install $$m#);"; done
385         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
386         for m in $(CENTOS_PERL_VERSION); do perl -MCPAN -e "CPAN::Shell->install \"$$m\";"; done
387         for m in $(CENTOS_PERL_NOTEST); do perl -MCPAN -e "CPAN::Shell->notest('install', \"$$m\";"; done
388
389 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
390 # if it is not already there
391 create_ld_local:
392         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
393                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
394                 ldconfig; \
395         fi;
396
397 # vim:noet:sw=4:ts=4: