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