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