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