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