The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
748 bates 1
#!/usr/bin/make -f
2
# debian/rules file for the Debian GNU/Linux r-base package
23782 bates 3
# Copyright 1997-2003 by Douglas Bates <bates@stat.wisc.edu> 
4
#                    and Dirk Eddelbuettel <edd@debian.org>
748 bates 5
 
27169 bates 6
# $Id: rules,v 1.55 2003/11/20 16:13:01 bates Exp $
16947 bates 7
 
19086 bates 8
corepackage	= r-base-core
9
latexpackage	= r-base-latex
8628 pd 10
pdfpackage	= r-doc-pdf
16947 bates 11
htmlpackage	= r-doc-html
8628 pd 12
gnomepackage	= r-gnome
16947 bates 13
nmathpackage	= r-mathlib
20192 bates 14
infopackage	= r-doc-info
21978 bates 15
recdpackage	= r-recommended
748 bates 16
 
16947 bates 17
# for the standalone library, no sonames are assigned in the upstream Makefiles
18
somaj		= 1
19
somin		= 0
20
sorel		= 0
21
libver		= $(somaj).$(somin).$(sorel)
22
 
23
debbase		:= $(CURDIR)/debian
6994 pd 24
debtmp		:= $(debbase)/tmp
19086 bates 25
debdoc		:= $(debbase)/$(corepackage)/usr/share/doc/$(corepackage)
16947 bates 26
debmat		:= $(debbase)/$(nmathpackage)
22559 bates 27
debetc		:= $(debbase)/$(corepackage)/usr/lib/R/etc
6994 pd 28
 
16947 bates 29
arch		:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
30
 
31
# set this to 1 (default) if you want the Gnome GUI package
15876 pd 32
gnome		= 1
33
ifeq ($(gnome),0)
34
gnomeconfig 	= --without-gnome
35
else
36
gnomeconfig	= --with-gnome
37
endif
38
 
19086 bates 39
#export DH_VERBOSE = 1
40
export DH_COMPAT  = 3
6994 pd 41
 
25671 bates 42
# edd 15 Aug 2001  default to blas, atlas can override it 
43
#atlas 		= --with-blas=blas
24331 ripley 44
# dmb 04 Apr 2003  better to use no specify blas
45
# atlas 		= --with-blas
46
# edd 28 Apr 2003  try configuring with atlas
27169 bates 47
# atlas		= --with-blas=atlas
48
# edd 16 Oct 2003  back to older default
49
atlas 		= --with-blas=blas
25671 bates 50
# edd 08 Mar 2003  use the new lapack feature
51
# edd 27 Apr 2003  Set this to =no as we currently see numerical errors
24331 ripley 52
lapack		= --with-lapack=no
8628 pd 53
 
25671 bates 54
# edd 02 Sep 2001  default to g77 but let m68k use f2c
55
# edd 06 Mar 2003  enforce 3.2 versions explicitly 
56
#                  so that on testing we will pick them over 2.95
57
# edd 07 Jun 2003  let's fall back to the default compilers
58
fortrancompiler	= F77=g77
59
compiler	= gcc
60
cxxcompiler	= g++
23782 bates 61
compilerflags	= -O2
8628 pd 62
 
16947 bates 63
# edd 04 Sep 2001  default compiler flags, lowered for m68k
17355 bates 64
compilerflags	= -O2
16947 bates 65
# m68k barks when using g77, and when gcc use -O2
22559 bates 66
# edd 26 Nov 2002  switched back to g77
25671 bates 67
# edd 02 Jun 2003  switched back
68
# cts 04 Jun 2003  use -O1 on m68k
69
ifeq ($(arch),m68k-linux)
70
fortrancompiler	= F2C=f2c
71
compilerflags	= -O1
72
endif
8628 pd 73
 
16947 bates 74
## edd 09 Nov 2001  ia64 needs gcc-3.0, hppa gets it by default
23782 bates 75
#ifeq ($(arch),ia64-linux)
76
#fortrancompiler = F77=g77-3.0
77
#compiler	= gcc-3.0
78
#cxxcompiler	= g++-3.0
79
#compilerflags	= -O2
80
#endif
15876 pd 81
 
17355 bates 82
## lamont@debian.org 06 Dec 2001  hppa needs -ffunction-sections  
83
ifeq ($(arch),hppa-linux)
84
compilerflags   = -O2 -ffunction-sections
85
endif
86
 
21621 bates 87
## edd 20 Jun 2002      no optimisation or debugging on baby systems
25671 bates 88
## edd 02 Jun 2003	use this on arm only 
89
##ifneq "$(findstring $(arch), m68k-linux arm-linux)" ""
90
ifneq "$(findstring $(arch), arm-linux)" ""
21621 bates 91
compilerflags	= -O0 -g0
92
endif
93
 
16947 bates 94
get-orig-source: upstream
95
upstream:
21621 bates 96
	links http://cran.us.r-project.org/src/base
16947 bates 97
 
19395 bates 98
upstreamdevel:
27169 bates 99
	links ftp://ftp.stat.math.ethz.ch/Software/R
26524 bates 100
        #links http://cran.us.r-project.org/src/base
27169 bates 101
        #rsync -vaC rsync.r-project.org::r-devel .
19395 bates 102
 
27169 bates 103
## edd 24 Oct 2003  build is invoked by the buildd, so we would prefer to
104
##  		    not imply build-indep; unfortunately R does not build
105
##		    properly without it, so we have to stick with it
106
#build: build-arch build-indep
107
build: build-arch
15876 pd 108
 
27169 bates 109
build-arch: make-arch 
16947 bates 110
 
27169 bates 111
build-indep: make-indep 
19086 bates 112
 
15876 pd 113
configure: configure-stamp
114
configure-stamp:	
19086 bates 115
	@echo "*** configure ***"
27169 bates 116
 
117
        # we have to disable use of the expanded R_LD_LIBRARY_PATH as it
118
        # conflicts with Debian's Atlas-can-replace-Blas scheme
119
        # so set R_LD_LIBRARY_PATH to the minimal value R_HOME/bin
120
        # and discard what configure finds for it on this machine
121
	perl -p -i -e 's|:\@R_LD_LIBRARY_PATH\@||' src/scripts/R.sh.in
122
 
748 bates 123
	dh_testdir
23782 bates 124
	PERL=/usr/bin/perl				\
19395 bates 125
	R_UNZIPCMD=/usr/bin/miniunzip			\
126
	R_ZIPCMD=/usr/bin/minizip			\
27169 bates 127
	R_PRINTCMD=/usr/bin/lpr				\
19395 bates 128
	CC=${compiler}					\
129
	CXX=${cxxcompiler}				\
130
	${fortrancompiler}				\
131
	CPPFLAGS=					\
132
	LDFLAGS=					\
133
	FLIBS=						\
19086 bates 134
	./configure --prefix=/usr			\
135
		    --with-tcltk			\
136
		    --mandir=/usr/share/man		\
137
		    --infodir=/usr/share/info		\
27169 bates 138
		    $(atlas) 				\
139
		    $(lapack)				\
19086 bates 140
		    $(gnomeconfig)			\
141
		    --enable-R-profiling		\
142
		    --enable-R-shlib			\
25671 bates 143
		    --with-recommended-packages		\
23782 bates 144
		    --build $(arch)
21621 bates 145
 
22559 bates 146
#		    --with-tcl-config=/usr/lib/tcl8.3/tclConfig.sh	
147
#		    --with-tk-config=/usr/lib/tk8.3/tkConfig.sh		
148
 
15876 pd 149
	touch configure-stamp
150
 
16947 bates 151
make-arch: configure make-arch-stamp 
152
make-arch-stamp: 
19086 bates 153
	@echo "*** make-arch ***"
17355 bates 154
	make		CFLAGS="$(compilerflags)"		\
155
			CXXFLAGS="$(compilerflags)"		\
156
			FFLAGS="$(compilerflags)"		\
16947 bates 157
			CC=${compiler} 				\
19086 bates 158
			CXX=${cxxcompiler}			\
25671 bates 159
			${fortrancompiler}			\
19086 bates 160
			R
27169 bates 161
 
162
        # the top-level 'make stamp-recommended' target implies 'make docs'
163
        # which (for the buildds) implies a lot of time wasted generating 
164
        # output we already take from the initial i386 build
21978 bates 165
	make		CFLAGS="$(compilerflags)"		\
166
			CXXFLAGS="$(compilerflags)"		\
167
			FFLAGS="$(compilerflags)"		\
168
			CC=${compiler} 				\
169
			CXX=${cxxcompiler}			\
25671 bates 170
			${fortrancompiler}			\
21978 bates 171
			stamp-recommended
19086 bates 172
 
173
        # make standalone math lib
16947 bates 174
	(cd src/nmath/standalone; 				\
175
		make	CFLAGS="$(compilerflags) -D_REENTRANT"	\
176
			CXXFLAGS="$(compilerflags) -D_REENTRANT"\
177
			FFLAGS="$(compilerflags) -D_REENTRANT"	\
178
			CC=${compiler} 				\
179
			CXX=${cxxcompiler} 			\
25671 bates 180
			${fortrancompiler}			\
19086 bates 181
			libRmath_la_LDFLAGS=-Wl,-soname,libRmath.so.$(somaj) \
182
			)
27169 bates 183
 
16947 bates 184
	touch make-arch-stamp
185
 
19086 bates 186
make-indep: configure make-indep-stamp
187
make-indep-stamp:
188
	@echo "*** make-indep ***"
27169 bates 189
#	make docs
190
	make html
191
	make help
19086 bates 192
	make info
8628 pd 193
	make pdf
19086 bates 194
	touch make-indep-stamp
748 bates 195
 
27169 bates 196
make: make-arch make-indep 
19086 bates 197
 
27169 bates 198
check: make-arch check-stamp
16947 bates 199
check-stamp: 
19086 bates 200
	@echo "*** check ***"
16947 bates 201
ifneq	($(arch),arm-linux)
19086 bates 202
	-make check
16947 bates 203
endif
204
	touch check-stamp
205
 
748 bates 206
clean:
19086 bates 207
	@echo "*** clean ***"
748 bates 208
	dh_testdir
8628 pd 209
	dh_testroot
19086 bates 210
	rm -f 	configure-stamp \
211
		build-stamp build-indep-stamp build-arch-stamp \
212
		make-stamp make-arch-stamp make-indep-stamp \
213
		install-indep-stamp install-arch-stamp \
214
		check-stamp 
748 bates 215
	-make distclean
216
	-rm -f `find . -name "*~"`
217
	-rm -rf debian/tmp debian/files* core debian/substvars
3279 pd 218
	-rm -f doc/html/function.html doc/html/packages.html
15876 pd 219
	-rm -f modules/*.so
19086 bates 220
        # left over in CVS from r-base --> r-base-core transition
221
	(cd debian; rm -vf r-base.dirs r-base.files r-base.lintian \
222
			r-base.menu r-base.postinst)	
8628 pd 223
	dh_clean
748 bates 224
 
19086 bates 225
install: install-arch install-indep 
226
 
16947 bates 227
install-arch: make-arch check install-arch-stamp
228
install-arch-stamp: 
19086 bates 229
	@echo "*** install-arch ***"
748 bates 230
	dh_testdir
231
	dh_testroot
16947 bates 232
	dh_clean -a -k
233
	dh_installdirs -A
8628 pd 234
 
19086 bates 235
	make    	prefix=$(debtmp)/usr   	 		\
236
			mandir=$(debtmp)/usr/share/man	 	install
21978 bates 237
 
27169 bates 238
        # link $R_HOME/bin/R to real one, and set R_HOME_DIR env.var. 
239
	(cd $(debtmp)/usr/lib/R/bin/; 					\
240
		ln -svf ../../../bin/R R;				\
241
		cd ../../../bin;					\
242
		perl -p -i -e						\
243
		    's|^R_HOME_DIR=.*|R_HOME_DIR=/usr/lib/R|' R)
21978 bates 244
 
245
        # set browser to mozilla as mozilla-1.0.0 works with help.start()
27169 bates 246
	(cd $(debtmp)/usr/lib/R/etc; \
247
		perl -p -i -e \
248
			"s|R_BROWSER-'.*'|R_BROWSER-'/usr/bin/mozilla'|" \
249
			Renviron)
21978 bates 250
 
16947 bates 251
        # fix permissions (Lintian)
21621 bates 252
	chmod a+x 	$(debtmp)/usr/lib/R/share/sh/echo.sh 		\
253
			$(debtmp)/usr/lib/R/share/sh/help-links.sh	\
254
			$(debtmp)/usr/lib/R/share/sh/help-print.sh
8628 pd 255
 
16947 bates 256
        # remove unneeded license files, but link them back
257
	rm -v 	$(debtmp)/usr/lib/R/COPYING 		\
258
		$(debtmp)/usr/lib/R/COPYING.LIB 
259
	(cd $(debtmp)/usr/lib/R/; \
260
		ln -s ../../share/common-licenses/GPL COPYING; \
261
		ln -s ../../share/common-licenses/LGPL COPYING.LIB)
262
 
21621 bates 263
        # edd 15 Jul 2002 reduce compile load on small machines
264
ifneq "$(findstring $(arch), m68k-linux arm-linux)" ""
265
	perl -p -i -e 's/-g -O2/-g0 -O0/g' $(debtmp)/usr/lib/R/etc/Makeconf
266
endif
267
 
23782 bates 268
        # edd 10 Jan 2003 fix Perl interpreter path
269
	(cd $(debtmp)/usr/lib/R/bin; 					\
25671 bates 270
	    for file in Rdconv Rdindex Rprof Sd2Rd build check; do 	\
23782 bates 271
		perl -p -i -e "s|/usr/local/bin/perl|/usr/bin/perl|" 	\
272
		   $${file};						\
273
	done)
274
 
21978 bates 275
        # that being done, now install in different sub-packages
276
 
16947 bates 277
        # move the GNOME version to the r-gnome package
15876 pd 278
ifneq ($(gnome),0)
16947 bates 279
	dh_movefiles	-p$(gnomepackage) 	usr/lib/R/modules/R_gnome.so
15876 pd 280
endif
8628 pd 281
 
21978 bates 282
        # move files for r-recommended
283
        # doing this before html/latex moves ensure they keep their tex/latex
284
	dh_movefiles	-p$(recdpackage)
16947 bates 285
        # move the html manual files in r-doc-html.files into r-doc-html 
286
        # these get built in make-arch too ...
287
	dh_movefiles	-p$(htmlpackage)		
19086 bates 288
        # move files for r-base-html
289
	dh_movefiles	-pr-base-html
290
        # move files for r-base-latex
291
	dh_movefiles	-pr-base-latex
21978 bates 292
        # move all the rest into r-base-core
19086 bates 293
	dh_movefiles	-p$(corepackage)
16947 bates 294
 
295
        # for the standalone library package, move the two libs
27169 bates 296
        # as 'make install' ignores these, we have to do it by hand
16947 bates 297
	dh_installdirs -p$(nmathpackage) usr/include usr/lib
298
	install -m 0644 src/nmath/standalone/libRmath.a     \
299
			$(debmat)/usr/lib
300
	install -m 0644 src/nmath/standalone/libRmath.so    \
301
			$(debmat)//usr/lib/libRmath.so.$(libver)
302
	(cd $(debmat)/usr/lib; \
20192 bates 303
			ln -s libRmath.so.$(libver) libRmath.so.$(somaj); \
304
			ln -s libRmath.so.$(somaj)  libRmath.so)
16947 bates 305
        # and create a link for Rmath.h 
306
	(cd $(debmat)/usr/include; \
307
			ln -s ../lib/R/include/Rmath.h .)
22559 bates 308
 
309
        # now deal with $R_HOME/etc <--> /etc/R
27169 bates 310
        # edd 03 Apr 2003  patch Renviron for new R_LIBS standard
23970 bates 311
	(cd $(debetc); \
312
		cat $(debbase)/Renviron-R_LIBS.patch | patch --verbose;	\
313
		mv Makeconf Renviron	../../../../etc/R/; 		\
314
		ln -s  /etc/R/Makeconf  .; 				\
315
		ln -s  /etc/R/Renviron  .  				)
27169 bates 316
 
16947 bates 317
	touch install-arch-stamp
318
 
19086 bates 319
#install-indep: make-arch make-indep install-arch install-indep-stamp
320
install-indep: make-indep install-indep-stamp
321
install-indep-stamp: 
322
	@echo "*** install-indep ***"
8628 pd 323
	dh_testdir
324
	dh_testroot
16947 bates 325
	dh_clean -a -k
326
	dh_installdirs -A
19086 bates 327
 
328
	make    	prefix=$(debtmp)/usr   	 		install-pdf
329
 
330
        # the indep package r-doc-info is made now 
331
	make    	prefix=$(debtmp)/usr  \
332
			infodir=$(debtmp)/usr/share/info	install-info
333
 
16947 bates 334
        # move the pdf manual files listed in r-doc-pdf.files into r-doc-pdf 
335
	dh_movefiles	-p$(pdfpackage)		
336
        # move the html manual files in r-doc-html.files into r-doc-html 
337
	dh_movefiles	-p$(htmlpackage)		
19086 bates 338
	touch install-indep-stamp
339
        # move files for r-doc-info
20192 bates 340
	dh_movefiles	-p$(infopackage)
341
        # but clean up dir and old.dir	
342
	rm -vf 		$(debbase)/$(infopackage)/usr/share/info/dir \
343
			$(debbase)/$(infopackage)/usr/share/info/dir.old
8628 pd 344
 
16947 bates 345
# Build architecture-independent files here.
19086 bates 346
binary-indep: build-indep install-indep
347
	@echo "*** binary-indep ***"
16947 bates 348
	dh_testdir -i
349
	dh_testroot -i
350
	dh_link -i
19086 bates 351
        #dh_installdebconf -i
16947 bates 352
	dh_installdocs -i
19086 bates 353
        #dh_installexamples -i
354
        #dh_installmenu -i
355
        #dh_installemacsen -i
356
        #dh_installpam -i
357
        #dh_installmime -i
358
        #dh_installinit -i
359
        #dh_installcron -i
360
        #dh_installmanpages -i
361
        #dh_installinfo -i
362
        #dh_undocumented -i
16947 bates 363
	dh_installchangelogs -i	
19086 bates 364
        # install lintian "silencer"
365
	install -p -m 0644  debian/$(latexpackage).lintian \
366
	 $(debbase)/$(latexpackage)/usr/share/lintian/overrides/$(latexpackage)
16947 bates 367
	dh_compress -i
368
	dh_fixperms -i
19086 bates 369
        #dh_suidregister -i
16947 bates 370
	dh_installdeb -i
19086 bates 371
        #dh_perl -i
16947 bates 372
	dh_gencontrol -i
373
	dh_md5sums -i
374
	dh_builddeb -i
375
 
8628 pd 376
# Build architecture-dependent files here.
27169 bates 377
binary-arch: build-arch check install-arch 
19086 bates 378
	@echo "*** binary-arch ***"
16947 bates 379
	dh_testdir -a
380
	dh_testroot -a
19086 bates 381
        #dh_installdebconf -a
16947 bates 382
	dh_link -a
19086 bates 383
	dh_installdocs -p$(corepackage) AUTHORS BUGS  NEWS ONEWS README \
384
					RESOURCES THANKS Y2K \
20192 bates 385
					debian/README.Atlas \
386
					debian/README.mathlib
16947 bates 387
	dh_installexamples -a
20192 bates 388
	dh_installexamples -p$(corepackage)	src/nmath/standalone/test.c
16947 bates 389
	dh_installmenu -a
19086 bates 390
        #dh_installemacsen -a
391
        #dh_installpam -a
392
        #dh_installmime -a
393
        #dh_installinit -a
394
        #dh_installcron -a
395
        #dh_installmanpages -a	-N$(gnomepackage) -p$(corepackage) getline.3
396
        #dh_installman 		-p$(corepackage) doc/R.1
27169 bates 397
        ## dh_installinfo -a	-n doc/manual/R-*.info*
398
        ## edd 04 Apr 2004 manual is dangling unless r-doc-pdf is installed ...
399
        ##(cd $(debdoc)/doc && ln -s ../../../../lib/R/doc/html .)
400
        ##(cd $(debdoc)/doc && ln -s ../../../../lib/R/doc/manual .)
401
        # ... so install doc as a link, as we already did with library
23882 bates 402
	(cd $(debdoc) && ln -s ../../../lib/R/doc .)
6994 pd 403
	(cd $(debdoc) && ln -s ../../../lib/R/library .)
16947 bates 404
        # install lintian "silencer"
19086 bates 405
	install -p -m 0644  debian/$(corepackage).lintian \
406
	   $(debbase)/$(corepackage)/usr/share/lintian/overrides/$(corepackage)
21978 bates 407
	install -p -m 0644  debian/$(recdpackage).lintian \
408
	   $(debbase)/$(recdpackage)/usr/share/lintian/overrides/$(recdpackage)
19086 bates 409
        #dh_undocumented -a
16947 bates 410
	dh_installchangelogs -a	-k NEWS 
411
	dh_strip -a
412
	dh_compress -a
413
	dh_fixperms -a
19086 bates 414
        #dh_suidregister -a
16947 bates 415
	dh_makeshlibs -a
416
	dh_installdeb -a
417
	dh_perl -a
418
	dh_shlibdeps -a
27169 bates 419
#	@echo "*** Pruning shlibdeps result from double atlas entry ***"
420
#	cat debian/r-base-core.substvars
421
#	perl -p -i -e 's/atlas2-base, //' debian/r-base-core.substvars
422
#	cat debian/r-base-core.substvars
423
#	@echo "*** Pruning atlas from r-recommended shlibdeps ***"
424
#	cat debian/r-recommended.substvars
425
#	perl -p -i -e 's/atlas2-base, //' debian/r-recommended.substvars
426
#	cat debian/r-recommended.substvars
427
#	echo "*** Done ***"
16947 bates 428
	dh_gencontrol -a
429
	dh_md5sums -a		-X'usr/bin/R'  -XLibIndex -Xindex.txt \
8628 pd 430
					-Xfunction.html -Xpackages.html
16947 bates 431
	dh_builddeb -a
748 bates 432
 
16947 bates 433
binary: binary-arch binary-indep 
19086 bates 434
.PHONY: build clean binary-indep binary-arch binary install install-arch install-indep