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