3
# debian/rules file for the Debian/GNU Linux octave package
4
# Copyright 1997-99,2000-03 by Dirk Eddelbuettel <edd@debian.org>
6
# $Id: rules 1128 2007-12-21 14:53:46Z rafael $
8
include /usr/share/dpatch/dpatch.make
10
# in order: octave, octave2.1, 2.1.28, 2.1 (or whatever the version is), 3.0
11
# the difference in major and PACKAGEVER: first one is taken from the octave
12
# version (ie 2.1.69), the second one from the binary package name in Debian
13
# (ie octave2.1); necessary for the 3.0 rc uploads.
14
source := $(shell head -1 debian/changelog | \
15
perl -nle 'm/^([a-z]+)/ and print $$1')
16
PACKAGE := $(shell head -1 debian/changelog | \
17
perl -nle 'm/^(\S+)\s+/ and print $$1')
18
version := $(shell head -1 debian/changelog | \
19
perl -nle 'm/\S+\s+\((?:\d:)*(\S+)-\S+\)/ and print $$1')
20
major := $(shell echo $(version) | perl -nle \
21
'm/(\d\.\d)\.\d+/ and print $$1')
22
PACKAGEVER := $(shell echo $(PACKAGE) | \
23
perl -nle 'm/.*(\d.\d)/ and print $$1')
24
#FIXME: drop PACKAGEVER after the release of 3.0 source packages!
37
doc_package = $(PACKAGE)-doc
38
html_package = $(PACKAGE)-htmldoc
39
dev_package = $(PACKAGE)-headers
40
emacs_package = $(PACKAGE)-emacsen
41
info_package = $(PACKAGE)-info
43
debbase := $(CURDIR)/debian
44
debtmp := $(debbase)/$(PACKAGE)
45
debshare := $(debtmp)/usr/share
46
deblib := $(debtmp)/usr/lib
47
debdoc := $(debshare)/doc/$(PACKAGE)
48
debhtmldoc := $(debtmp)-htmldoc/usr/share/doc/$(PACKAGE)-htmldoc
49
deblsp := $(debbase)/$(emacs_package)/usr/share/emacs/site-lisp/$(emacs_package)
50
debini := $(debshare)/octave/site/m/startup
51
debininew := $(debshare)/octave/$(version)/m/startup
52
debapp := $(debshare)/applications
54
savefiles := configure config.h.in scripts/configure \
55
doc/conf.texi examples/octave.desktop.in
56
texifiles := doc/interpreter/octave.texi \
57
doc/liboctave/liboctave.texi \
58
doc/faq/Octave-FAQ.texi
60
## edd 3 Feb 2003 gcc 3.2, also imposed uniformly via Build-Depends
61
## edd 27 Jun 2003 now that gcc 3.3 is in unstable and testing, relax this
62
#c_compiler = /usr/bin/gcc-3.3
63
#cxx_compiler = /usr/bin/g++-3.3
64
#f77_compiler = /usr/bin/g77-3.3
65
c_compiler = /usr/bin/gcc
66
cxx_compiler = /usr/bin/g++
67
f77_compiler = /usr/bin/g77
68
fc_flag = --with-f77=$(f77_compiler)
73
# default to blas, atlas can overload where available (see README.Atlas)
74
#atlas = --with-blas=/usr/lib/libblas.so \
75
# --with-lapack=/usr/lib/liblapack.so
76
#atlas = --with-blas=/usr/lib/libblas-3.so \
77
# --with-lapack=/usr/lib/liblapack-3.so
78
atlas = --with-blas=-lblas-3 --with-lapack=-llapack-3
80
arch := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
82
## edd 20 Jun 2002 no optimisation or debugging on baby systems
83
ifneq "$(findstring $(arch), arm-linux-gnu)" ""
84
compilerflags = -O0 -g0
87
# edd 25 Aug 2002 arm does not have atlas
88
ifeq ($(arch),arm-linux)
89
atlas = --without-blas
94
sliceterm = UNDEF+V_$(shell echo $(PACKAGEVER) | sed s/\\./_/g)
96
debian/control: debian/in/control
97
slice -o $(sliceterm):$@ $<
102
maintainer-scripts: debian/control
103
for in in debian/in/PACKAGE* ; do \
104
out=`echo $$in | sed 's:/in/:/:;s/PACKAGE/$(PACKAGE)/'` ; \
105
sed 's/@VERSION@/$(version)/g;s/@PACKAGE@/$(PACKAGE)/g;s/@MAJOR@/$(major)/g;s/@PRIORITY@/$(priority)/g;' \
109
for f in octave-depends defs.make ; do \
110
sed 's/@VERSION@/$(version)/g;s/@MAJOR@/$(major)/g' \
111
< debian/in/$$f > debian/$$f ; \
113
cp debian/in/$(PACKAGE)-00list debian/patches/00list
114
cp debian/in/$(PACKAGE)-watch debian/watch
115
for ext in .conf .dirs -emacsen.dirs ; do \
116
slice -o $(sliceterm):debian/$(PACKAGE)$$ext \
117
debian/in/PACKAGE$$ext ; \
119
-cp debian/in/$(PACKAGE)-NEWS debian/NEWS
121
get-orig-source: upstream
123
links ftp://ftp.octave.org/pub/octave/bleeding-edge
125
$(patsubst %,build-%,arch indep) :: build-% : \
126
build-%-stamp configure-stamp make-%-stamp check-stamp
127
$(patsubst %,build-%-stamp,arch indep) :: build-%-stamp : \
128
configure make-% check
133
-for f in $(savefiles) $(texifiles) ; do \
134
test -f $$f && cp $$f $$f-save ; \
137
configure: maintainer-scripts save-files patch-stamp configure-stamp
141
[ -f autogen.sh ] && ./autogen.sh && chmod 0755 configure
143
# Patch desktop file such that the referenced command exists
144
-test -f examples/octave.desktop.in \
145
&& perl -pi -e 's:/bin/octave:/bin/octave-$(version):' \
146
examples/octave.desktop.in
148
DEFAULT_PAGER=pager \
150
CXX=$(cxx_compiler) \
151
F77=$(f77_compiler) \
153
infofile=/usr/share/info/$(PACKAGE).info \
156
--datadir=/usr/share \
158
--libexecdir=/usr/lib \
159
--infodir=/usr/share/info \
160
--mandir=/usr/share/man \
170
pod2man debian/octave-depends > octave-depends-$(version).1
172
for f in $(texifiles) ; do \
173
perl -pi -e 's/^(\@setfilename .+ctave)/$${1}$(major)/' \
177
chmod +x debian/subdirs-vars.pl
178
cp octMakefile octMakefile-orig
179
for i in no-doc only-doc ; do \
180
debian/subdirs-vars.pl $$i \
181
< octMakefile > octMakefile-$$i ; \
184
touch configure-stamp
186
make-arch: configure-stamp make-arch-stamp
189
ln -fs octMakefile-no-doc octMakefile
190
$(MAKE) CFLAGS="$(compilerflags)" \
191
CXXFLAGS="$(compilerflags)" \
192
FFLAGS="$(compilerflags)" \
193
LDFLAGS="$(linkerflags)" \
195
CXX="$(cxx_compiler)" \
196
F77="$(f77_compiler)"
198
touch make-arch-stamp
200
make-indep: configure-stamp make-arch-stamp make-indep-stamp
203
ln -fs octMakefile-only-doc octMakefile
206
touch make-indep-stamp
208
check: configure-stamp make-arch-stamp check-stamp
210
ln -fs octMakefile-no-doc octMakefile
218
[ ! -f doc/Makefile ] || $(MAKE) -C doc clean
219
[ ! -f doc/interpreter/images/Makefile ] \
220
|| $(MAKE) -C doc/interpreter/images distclean
221
[ ! -f doc/Makefile ] || $(MAKE) -C doc maintainer-clean
222
find doc -name \*.info\* | xargs rm -f
224
-test -f octMakefile-orig && mv octMakefile-orig octMakefile
225
[ ! -f Makefile ] || $(MAKE) -i distclean \
226
|| $(MAKE) -f Makefile.in distclean
228
rm -f build-*-stamp configure-stamp make-*-stamp check-stamp \
229
install-*-stamp Makefile.tmp octMakefile-*
231
rm -f `ls debian/in/PACKAGE* | sed 's/PACKAGE/$(PACKAGE)/;s:/in::'`
232
rm -f octave-depends-$(version).1
233
( cd debian ; rm -f watch octave-depends defs.make )
235
-for f in $(savefiles) $(texifiles) ; do \
236
test -f $$f-save && mv $$f-save $$f ; \
243
install: install-arch install-indep
245
install-indep: configure-stamp make-indep-stamp install-indep-stamp
246
install-indep-stamp :
251
ln -fs octMakefile-only-doc octMakefile
252
$(MAKE) INSTALL_PROGRAM="install -s" DESTDIR=$(debtmp) \
255
touch install-indep-stamp
257
install-arch: configure-stamp make-arch-stamp check-stamp install-arch-stamp
263
ln -fs octMakefile-no-doc octMakefile
264
$(MAKE) INSTALL_PROGRAM="install -s" DESTDIR=$(debtmp) \
268
octave-depends-$(version).1 \
269
doc/interpreter/octave.1 \
270
doc/interpreter/octave-bug.1 \
271
doc/interpreter/mkoctfile.1 \
272
doc/interpreter/octave-config.1
274
install debian/octave-depends \
275
$(debtmp)/usr/bin/octave-depends-$(version)
276
install --mode=644 debian/defs.make \
277
$(debtmp)/usr/share/octave/debian/defs.make-$(version)
279
(cd $(debtmp)/usr/share/man/man1; \
280
mv -v octave.1 octave-$(version).1; \
281
ln -s octave-$(version).1 octave$(major).1; \
282
mv -v octave-bug.1 octave-bug-$(version).1; \
283
mv -v octave-config.1 octave-config-$(version).1; \
284
mv -v mkoctfile.1 mkoctfile-$(version).1; )
285
(cd $(debtmp)/usr/bin; \
286
rm -v octave octave-bug mkoctfile octave-config)
288
-test "$(PACKAGEVER)" = 2.1 \
289
|| install --mode=644 debian/octave.st \
290
$(debtmp)/usr/share/enscript/hl
292
touch install-arch-stamp
294
binary-indep: build-indep install-indep
298
# already installed by make
299
dh_installinfo -n -p$(info_package) doc/*/*$(major)*.info*
301
dh_installdocs -n -p$(doc_package) doc/*/*.pdf
303
for dir in faq interpreter liboctave ; do \
304
test -d $(debhtmldoc)/$$dir \
305
|| mkdir $(debhtmldoc)/$$dir ; \
306
find doc/$$dir \( -name \*.html -o -name \*.png \) \
307
-exec cp \{} $(debhtmldoc)/$$dir \; ; \
310
# install Octave Emacs files and Debian Emacsen files
311
dh_installdirs -p$(emacs_package)
312
dh_installdirs -p$(emacs_package) \
313
usr/share/emacs/site-lisp/$(emacs_package)
314
install -p -m 0644 emacs/*.el $(deblsp)
315
dh_installemacsen -p$(emacs_package)
316
-install -p -m 0755 emacs/octave-tags \
317
$(debbase)/$(emacs_package)/usr/bin/octave-tags-$(version)
318
-install -p -m 0644 emacs/octave-tags.1 \
319
$(debbase)/$(emacs_package)/usr/share/man/man1/octave-tags-$(version).1
321
dh_installchangelogs -i ChangeLog
322
dh_compress -i --exclude=.pdf
328
# Build architecture-dependent files here.
329
binary-arch: build-arch install-arch check
332
dh_installdirs -p$(PACKAGE)
334
# remove the /usr/share/info/dir stab
335
rm -vf $(debtmp)/usr/share/info/dir
337
# save the include files for the header package
338
dh_movefiles -p$(dev_package) --sourcedir=debian/$(PACKAGE) \
340
usr/bin/mkoctfile-$(version) \
341
usr/bin/octave-config-$(version) \
342
usr/bin/octave-depends-$(version) \
343
usr/share/man/man1/mkoctfile-$(version).1 \
344
usr/share/man/man1/octave-config-$(version).1 \
345
usr/share/man/man1/octave-depends-$(version).1 \
346
usr/share/octave/debian/defs.make-$(version)
347
rm -r $(debtmp)/usr/include
348
rm -rf $(debtmp)/usr/share/info
349
rm -rf $(debtmp)/usr/share/octave/debian/
351
install -p -m 0644 debian/$(PACKAGE).conf $(debtmp)/etc
353
# install lintian overrride
354
install -p -m 0644 debian/$(PACKAGE).lintian \
355
$(debtmp)/usr/share/lintian/overrides/$(PACKAGE)
357
## link the conf.file back from /etc over the version.spec. rc
358
ln -sf /etc/$(PACKAGE).conf $(debininew)/octaverc
361
rm -rf $(debshare)/octave/site \
362
$(deblib)/octave/*/site \
363
$(deblib)/octave/site
365
dh_installdocs -a README README.kpathsea \
366
NEWS* PROJECTS THANKS \
368
dh_installdocs -p$(PACKAGE) debian/README.Atlas
369
# recreated in postinst in share/, not needed in lib
370
rm -vf $(debtmp)/usr/lib/octave/ls-R \
371
$(debtmp)/usr/share/octave/ls-R
373
## Rename the desktop file
374
-[ -e $(debapp)/www.octave.org-octave.desktop ] \
375
&& mv $(debapp)/www.octave.org-octave.desktop \
376
$(debapp)/octave$(major).desktop
378
dh_installexamples -p$(dev_package) examples/* \
379
--exclude=octave.desktop
381
dh_installmenu -p$(PACKAGE)
382
dh_installchangelogs -a ChangeLog ChangeLog.1
383
for i in glob libcruft liboctave src scripts test doc; do \
384
cp -vax $$i/ChangeLog $(debdoc)/changelog.$$i; done
385
# make octaveX.Y a symlink to octave-x.y.z and link the manpage to octaveX.Y
386
dh_link --package=$(PACKAGE) \
387
usr/bin/octave-$(version) usr/bin/$(PACKAGE)
388
dh_link --package=$(PACKAGE) \
389
usr/share/man/man1/octave-$(version).1.gz \
390
usr/share/man/man1/octave$(major).1.gz
391
# FIXME: The following should be removed after the final 3.0 release
392
ifneq ($(PACKAGEVER),$(major))
393
dh_link --package=$(PACKAGE) \
394
usr/share/man/man1/octave$(major).1.gz \
395
usr/share/man/man1/octave$(PACKAGEVER).1.gz
397
# make mkoctfileX.Y a symlink and symlink the manpage as well
398
dh_link --package=$(dev_package) \
399
usr/bin/mkoctfile-$(version) usr/bin/mkoctfile$(major)
400
dh_link --package=$(dev_package) \
401
usr/share/man/man1/mkoctfile-$(version).1.gz \
402
usr/share/man/man1/mkoctfile$(major).1.gz
403
# FIXME: The following should be removed after the final 3.0 release
404
ifneq ($(PACKAGEVER),$(major))
405
dh_link --package=$(dev_package) \
406
usr/share/man/man1/mkoctfile$(major).1.gz \
407
usr/share/man/man1/mkoctfile$(PACKAGEVER).1.gz
409
# make octaveX.Y-depends a symlink and symlink the manpage as well
410
dh_link --package=$(dev_package) \
411
usr/bin/octave-depends-$(version) \
412
usr/bin/octave$(major)-depends
413
dh_link --package=$(dev_package) \
414
usr/share/man/man1/octave-depends-$(version).1.gz \
415
usr/share/man/man1/octave$(major)-depends.1.gz
416
# FIXME: The following should be removed after the final 3.0 release
417
ifneq ($(PACKAGEVER),$(major))
418
dh_link --package=$(dev_package) \
419
usr/share/man/man1/octave$(major)-depends.1.gz \
420
usr/share/man/man1/octave$(PACKAGEVER)-depends.1.gz
426
dh_shlibdeps -a -l/usr/lib/octave-$(version)
427
if [ `dpkg-architecture -qDEB_BUILD_ARCH` = "m68k" ];then \
428
echo "m68k:Depends=f2c" >> debian/$(PACKAGE)-headers.substvars; \
434
@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
436
binary: binary-arch binary-indep
437
.PHONY: build clean make configure binary-indep binary-arch binary