]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/extras/Makefile.install
Fix Fedora 13 compiling for libdbi/libdbd
[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 (hardy/karmic), and Gentoo.
7 # Working towards support of CentOS 5 / RHEL 5 / Fedora 13.
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-hardy
16 #       - or -
17 #       make -f Makefile.install ubuntu-karmic
18 #       - or -
19 #       make -f Makefile.install fedora-13
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 #       Fedora, 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 LIBJS=js-1.7.0
49 LIBJS_PERL=JavaScript-SpiderMonkey-0.20
50 LIBJS_URL=ftp://ftp.mozilla.org/pub/mozilla.org/js/$(LIBJS).tar.gz
51 LIBJS_PERL_URL=ftp://mirror.datapipe.net/pub/CPAN/authors/id/T/TB/TBUSCH/$(LIBJS_PERL).tar.gz
52 # used for installing libjs lib and header files
53 JS_INSTALL_PREFIX=/usr/
54
55 # The libdbi sources can be fetched from sourceforge.net.  They are stored on
56 # the open-ils.org site now for ease of direct linking
57 LIBDBI=libdbi-0.8.3
58 LIBDBI_DRIVERS=libdbi-drivers-0.8.3
59 LIBDBI_HOST=http://open-ils.org/~denials/evergreen
60
61 # We need a recent version of Yaz
62 # Debian Lenny and Ubuntu 8.10 come with 3.0.34
63 YAZ=yaz-3.0.47
64 YAZ_HOST=http://ftp.indexdata.dk/pub/yaz
65
66 # Business::OnlinePayment is not packaged on CentOS/RHEL
67 PAY_ONLINE=Business-OnlinePayment-3.00_08.tar.gz
68 PAY_ONLINE_HOST=http://ftp.perl.org/pub/CPAN/authors/id/I/IV/IVAN/
69
70 APT_TOOL=aptitude -yq
71
72 # 64 or 32 bit os?
73 LBITS=$(shell getconf LONG_BIT)
74
75 # Fedora 64-bit?
76 FEDORA_64=$(shell uname -r | grep "fc[0-9][0-9].x86_64")
77
78 #RHEL/Centos PGSQL 
79 PGSQL_HOST=http://yum.pgsqlrpms.org/reporpms/8.4
80 PGSQL_CENTOS=pgdg-centos-8.4-2.noarch.rpm
81 PGSQL_REDHAT=pgdg-redhat-8.4-2.noarch.rpm       
82
83 # Debian dependencies
84 DEBS =  \
85         apache2-prefork-dev\
86         aspell\
87         aspell-en\
88         libbusiness-creditcard-perl\
89         libbusiness-onlinepayment-authorizenet-perl\
90         libbusiness-onlinepayment-perl\
91         libclass-dbi-pg-perl\
92         libdatetime-format-builder-perl\
93         libdatetime-format-iso8601-perl\
94         libdatetime-format-mail-perl\
95         libdatetime-perl\
96         libdatetime-timezone-perl\
97         libdatetime-set-perl\
98         libemail-send-perl\
99         libgd-graph3d-perl\
100         liblog-log4perl-perl\
101         libmarc-record-perl\
102         libncurses5-dev\
103         libnet-server-perl\
104         libole-storage-lite-perl\
105         libpq-dev\
106         libreadline5-dev\
107         libspreadsheet-writeexcel-perl\
108         libssh2-1-dev\
109         libtext-aspell-perl\
110         libtext-csv-perl\
111         libuniversal-require-perl\
112         libunix-syslog-perl
113
114 # Debian Lenny and Ubuntu Intrepid bundle recent versions of yaz
115 EXTRA_DEBS = \
116         libmarc-charset-perl \
117         libmarc-xml-perl \
118         libnet-z3950-zoom-perl \
119         libyaz-dev \
120         yaz
121
122 # Ubuntu Hardy and Debian Etch require libencode-perl 
123 # to get a version of Encode > 2.12 - see bug 525069.
124 # Note that the Debian version of libencode-perl comes
125 # from etch-backports.
126 EXTRA_ENCODE = \
127         libencode-perl
128
129 CENTOS = \
130         aspell \
131         aspell-devel \
132         aspell-en \
133         gd-devel \
134         libssh2-devel \
135         openssl-devel \
136         perl-Business-CreditCard \
137         perl-Business-OnlinePayment \
138         perl-Class-Data-Inheritable \
139         perl-DateTime-Format-Builder \
140         perl-DateTime-Format-Strptime \
141         perl-Ima-DBI \
142         perl-DBD-Pg \
143         perl-GD-Graph3d \
144         perl-IO-stringy \
145         perl-Spreadsheet-WriteExcel \
146         perl-Text-Aspell \
147         perl-Text-CSV
148
149 CENTOS_PERL = \
150         Class::DBI \
151         Class::DBI::Pg \
152         Encode \
153         DBIx::ContextualFetch \
154         Getopt::Long \
155         Net::SSH2 \
156         Net::uFTP \
157         Net::XMPP \
158         Net::Z3950::ZOOM
159
160 FEDORA_13_RPMS = \
161         aspell \
162         aspell-en \
163         js-devel \
164         libdbi \
165         libdbi-dbd-pgsql \
166         libdbi-devel \
167         libssh2-devel \
168         libyaz \
169         libyaz-devel \
170         ncurses-devel \
171         ncurses-libs \
172         perl-Business-CreditCard \
173         perl-Class-DBI-Pg \
174         perl-Email-Send \
175         perl-GDGraph3d \
176         perl-MARC-Record \
177         perl-Net-SSH2 \
178         perl-OLE-Storage_Lite \
179         perl-Spreadsheet-WriteExcel \
180         perl-Text-Aspell \
181         perl-Text-CSV \
182         perl-Text-CSV_XS \
183         perl-XML-Writer \
184         postgresql-devel \
185         readline-devel \
186         tcp_wrappers-devel \
187         yaz
188
189 # Note: B:O:AuthorizeNet 3.21 fails with https://rt.cpan.org/Public/Bug/Display.html?id=55172
190 # Should be fixed in 3.22
191 FEDORA_13_CPAN = \
192         Business::OnlinePayment \
193         Business::OnlinePayment::AuthorizeNet
194
195 PGSQL_84_RPMS = \
196         postgresql-8.4* \
197         postgresql-contrib-8.4* \
198         postgresql-devel-8.4* \
199         postgresql-plpe*-8.4* \
200         postgresql-server-8.4*
201
202 PGSQL_CLIENT_DEBS_81 = \
203         postgresql-client-8.1
204
205 PGSQL_SERVER_DEBS_81 = \
206         postgresql-8.1 \
207         postgresql-contrib-8.1 \
208         postgresql-plperl-8.1 \
209         postgresql-server-dev-8.1
210
211 PGSQL_CLIENT_DEBS_82 = \
212         postgresql-client
213
214 PGSQL_SERVER_DEBS_82 = \
215         postgresql \
216         postgresql-contrib-8.2 \
217         postgresql-plperl-8.2 \
218         postgresql-server-dev-8.2
219
220 PGSQL_CLIENT_DEBS_83 = \
221         postgresql-client
222
223 PGSQL_SERVER_DEBS_83 = \
224         postgresql \
225         postgresql-contrib-8.3 \
226         postgresql-plperl-8.3 \
227         postgresql-server-dev-8.3
228
229 PGSQL_CLIENT_DEBS_84 = \
230         postgresql-client
231
232 PGSQL_SERVER_DEBS_84 = \
233         postgresql \
234         postgresql-contrib-8.4 \
235         postgresql-plperl-8.4 \
236         postgresql-server-dev-8.4
237
238 GENTOOS = \
239     yaz\
240     aspell-en\
241     dev-db/libpq\
242     dev-db/postgresql\
243     dev-perl/Email-Send\
244     dev-perl/DateTime\
245     dev-perl/DateTime-TimeZone\
246     dev-perl/DBD-Pg\
247     dev-perl/GD-Graph3d\
248     dev-perl/Text-Aspell\
249     dev-perl/Template-Toolkit\
250     dev-perl/Text-CSV_XS\
251     dev-perl/Spreadsheet-WriteExcel
252
253 GENTOO_PERL = \
254     MARC::Record \
255     Net::Z3950::ZOOM \
256     Text::CSV
257
258 DEB_APACHE_MODS = \
259     expires\
260     include\
261     proxy\
262     proxy_http\
263     rewrite
264
265 DEB_APACHE_DISMODS = \
266     deflate
267
268 # Chronically unpackaged CPAN modules
269 CPAN_MODULES = \
270     Business::CreditCard::Object \
271     Business::EDI \
272     Net::uFTP \
273     Net::Z3950::Simple2ZOOM \
274     UUID::Tiny \
275     SRU
276
277 # Are we sure most distros don't come with an acceptable version of Safe.pm?
278 CPAN_MODULES_SAFE = \
279         Safe
280
281 # Recent Debian/Ubuntus have libmarc-charset-perl, libmarc-xml-perl, libnet-z3950-zoom-perl
282 CPAN_MODULES_MARC = \
283     MARC::Charset \
284     MARC::File::XML \
285     Net::Z3950::ZOOM
286
287 # ----------------------------------------------------------------------------
288
289 all: 
290         @echo "please specify an OS" && exit 0
291
292 # these should be the same for any distro
293 install: install_cpan install_js_sm install_libdbi 
294
295 centos: install_centos_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
296 rhel: install_redhat_pgsql install_centos_rpms install_yaz install_cpan_marc install install_centos_perl create_ld_local install_cpan_safe
297
298 fedora-13: install_fedora_13_rpms install_cpan install_cpan_marc install_cpan_fedora install_spidermonkey
299
300 debian-etch: etch generic_debian
301 debian-lenny: lenny generic_debian
302 etch: install_pgsql_client_debs_81 install_yaz install_cpan_marc install_extra_encode
303 lenny: install_pgsql_client_debs_83 install_extra_debs
304 generic_debian:  install_debs install debian_sys_config install_cpan_safe
305
306 gentoo: install_gentoos install_gentoo_perl install
307
308 ubuntu-hardy: hardy generic_ubuntu
309 ubuntu-karmic: karmic generic_ubuntu
310 hardy: install_pgsql_client_debs_82 install_yaz install_cpan_marc install_extra_encode
311 karmic: install_pgsql_client_debs_84 install_extra_debs
312 generic_ubuntu: install_debs install debian_sys_config install_cpan_safe
313
314 # - COMMON TARGETS ---------------------------------------------------------
315
316 # Install the CPAN modules
317 install_cpan: 
318         for m in $(CPAN_MODULES); do perl -MCPAN -e "install \"$$m\";"; done
319
320 # Install the CPAN modules for MARC functionality
321 install_cpan_marc: 
322         for m in $(CPAN_MODULES_MARC); do perl -MCPAN -e "install \"$$m\";"; done
323
324 # Install the Safe Perl module
325 # Is this really unpackaged everywhere except for Fedora?
326 install_cpan_safe: 
327         for m in $(CPAN_MODULES_SAFE); do perl -MCPAN -e "install \"$$m\";"; done
328
329 # Install the CPAN modules for Fedora 13
330 install_cpan_fedora: 
331         for m in $(FEDORA_13_CPAN); do perl -MCPAN -e "install \"$$m\";"; done
332
333 # Install a known working version of YAZ
334 install_yaz:    
335         if [ ! -d $(YAZ) ]; then wget $(YAZ_HOST)/$(YAZ).tar.gz; fi;
336         tar xzf $(YAZ).tar.gz
337         cd $(YAZ) && ./configure && make && make install && ldconfig
338
339 # Install the custom spidermonkey libs and JavaScript-SpiderMonkey Perl modules
340 install_js_sm: install_libjs install_spidermonkey
341
342 install_libjs: 
343         if [ ! -f $(LIBJS).tar.gz ]; then wget $(LIBJS_URL); fi;
344         tar -zxf $(LIBJS).tar.gz
345         cd js/src/ && make -f Makefile.ref
346         mkdir -p $(JS_INSTALL_PREFIX)/include/js/
347         cp js/src/*.h $(JS_INSTALL_PREFIX)/include/js/
348         cp js/src/*.tbl $(JS_INSTALL_PREFIX)/include/js/
349         cp js/src/Linux_All_DBG.OBJ/*.so $(JS_INSTALL_PREFIX)/lib/
350         cp js/src/Linux_All_DBG.OBJ/*.a $(JS_INSTALL_PREFIX)/lib/
351
352 install_spidermonkey:
353         if [ ! -f $(LIBJS_PERL).tar.gz ]; then wget $(LIBJS_PERL_URL); fi;
354         tar -zxf $(LIBJS_PERL).tar.gz
355         if [ ! -z $(FEDORA_64) ]; then \
356                 sed -i -e 's/"\/usr\/lib"/"\/usr\/lib64"/' $(LIBJS_PERL)/Makefile.PL ; \
357                 sed -i -e 's/js32.dll/libjs.so/' $(LIBJS_PERL)/Makefile.PL ; \
358         fi;
359         cd $(LIBJS_PERL) && perl Makefile.PL -E4X -JS_THREADSAFE && make && make test && make install
360
361
362 # Install libdbi and the postgres drivers
363 install_libdbi:
364         if [ ! -d $(LIBDBI) ]; then wget $(LIBDBI_HOST)/$(LIBDBI).tar.gz; fi;
365         if [ ! -d $(LIBDBI_DRIVERS) ]; then wget $(LIBDBI_HOST)/$(LIBDBI_DRIVERS).tar.gz; fi;
366         tar -zxf $(LIBDBI).tar.gz
367         tar -zxf $(LIBDBI_DRIVERS).tar.gz
368         cd $(LIBDBI) && ./configure --disable-docs && make all install
369         cd $(LIBDBI_DRIVERS) && ./configure  \
370                 --disable-docs --with-pgsql --enable-libdbi && make all install  
371
372
373 clean:
374         make -C $(LIBDBI) clean
375         make -C $(LIBDBI_DRIVERS) clean
376         make -C $(LIBJS_PERL) clean
377         make -f Makefile.ref -C js/src/ clean
378
379
380 # ------------------------------------------------------------------
381 # - DEBIAN ---------------------------------------------------------
382
383 debian_sys_config: 
384         # link the apache modules in
385         for m in $(DEB_APACHE_MODS); do a2enmod $$m; done;
386         # keep the bad apache modules away
387         for m in $(DEB_APACHE_DISMODS); do a2dismod $$m; done;
388         # refresh the dynamic library cache
389         ldconfig
390
391 # Install the debian-specific dependencies
392 install_debs:
393         $(APT_TOOL) install $(DEBS)
394
395 install_pgsql_client_debs_84:
396         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_84)
397
398 install_pgsql_server_debs_84:
399         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_84)
400
401 install_pgsql_client_debs_83:
402         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_83)
403
404 install_pgsql_server_debs_83:
405         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_83)
406
407 install_pgsql_client_debs_82:
408         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_82)
409
410 install_pgsql_server_debs_82:
411         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_82)
412
413 # Etch requires an explicit version to avoid PostgreSQL 7.4
414 install_pgsql_client_debs_81:
415         $(APT_TOOL) install $(PGSQL_CLIENT_DEBS_81)
416
417 # Etch requires an explicit version to avoid PostgreSQL 7.4
418 install_pgsql_server_debs_81:
419         LANG=C $(APT_TOOL) install $(PGSQL_SERVER_DEBS_81)
420
421 # Install the debian-specific dependencies for more modern distros
422 install_extra_debs:
423         $(APT_TOOL) install $(EXTRA_DEBS)
424
425 # Install specific modules required by Ubuntu Hardy and
426 # Debian Etch - see bug 525069
427 install_extra_encode:
428         $(APT_TOOL) install $(EXTRA_ENCODE)
429
430 # ------------------------------------------------------------------
431 # - GENTOO ---------------------------------------------------------
432
433 install_gentoos:
434         emerge -n $(GENTOOS)
435
436 install_gentoo_perl:
437         for m in $(GENTOO_PERL); do perl -MCPAN -e "install \"$$m\";"; done
438
439 # ------------------------------------------------------------------
440
441 # FEDORA 13
442 install_fedora_13_rpms:
443         yum -y update
444         yum -y install $(FEDORA_13_RPMS)
445
446 install_fedora_13_pgsql_server:
447         yum -y install $(PGSQL_84_RPMS)
448
449 # CENTOS
450 install_centos_rpms:
451         yum -y install $(CENTOS)
452         yum -y update
453         if [ $(LBITS) -eq 64 ]; then \
454                 ln -sf /usr/lib64/libpq.* /usr/lib/ && \
455                 ln -sf /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE/libperl.so /usr/lib/ && \
456                 ldconfig ; \
457         fi;
458         if [ $(LBITS) -eq 32 ]; then \
459                 ln -sf /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so /usr/lib && \
460                 ldconfig ; \
461         fi;
462
463 install_centos_pgsql:
464         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
465         wget $(PGSQL_HOST)/$(PGSQL_CENTOS)
466         rpm -Uvh --force ./$(PGSQL_CENTOS)
467         yum update -y
468         yum -y install $(PGSQL_84_RPMS)
469
470 install_redhat_pgsql:
471         if [ $(LBITS) -eq 64 ]; then yum remove -y postgresql-libs-8.1*i386 apr-util-devel-*i386 ; fi;
472         wget $(PGSQL_HOST)/$(PGSQL_REDHAT)
473         rpm -Uvh --force ./$(PGSQL_REDHAT)
474         yum update -y
475         yum -y install $(PGSQL_84_RPMS)
476
477 install_centos_perl:
478         for m in $(CENTOS_PERL); do perl -MCPAN -e "install \"$$m\";"; done
479         echo "force install Business::OnlinePayment::AuthorizeNet" | perl -MCPAN -e shell
480         echo "force install Scalar::Util" | perl -MCPAN -e shell        
481
482 # We need to add /usr/local/lib to the ldconfig list of directories on CentOS,
483 # if it is not already there
484 create_ld_local:
485         if [ "$$(ldconfig -v 2> /dev/null | grep '^/usr/local/lib' | wc -l)" -eq 0 ]; then \
486                 echo '/usr/local/lib' >> /etc/ld.so.conf.d/local.conf; \
487                 ldconfig; \
488         fi;
489
490 # vim:noet:sw=4:ts=4: