File: rules

package info (click to toggle)
opal 2.2.3.dfsg-3%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 29,508 kB
  • ctags: 30,804
  • sloc: cpp: 196,251; ansic: 42,509; makefile: 872; sh: 298
file content (237 lines) | stat: -rwxr-xr-x 7,352 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#!/usr/bin/make -f

export DH_COMPAT=4

# Change this on API breakage
export LIBOPALCOMPAT=2.2.0
export LIBOPALCOMPAT2=2.2.1
export LIBOPALCOMPAT3=2.1.3
export LIBOPALCOMPAT4=2.2.2

PACKAGE=libopal-$(LIBOPALCOMPAT)

VER_MAJOR := $(shell awk '/MAJOR_VERSION/ { print $$3 }' version.h)
VER_MINOR := $(shell awk '/MINOR_VERSION/ { print $$3 }' version.h)
VER_SUB   := $(shell awk '/BUILD_NUMBER/  { print $$3 }' version.h)

SHLIBSVER=$(VER_MAJOR).$(VER_MINOR).$(VER_SUB)

MAKE_BUILD_PARAM=OPALDIR=$(CURDIR) PWLIBDIR=/usr/share/pwlib

include /usr/share/dpatch/dpatch.make

export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

DEBVERSION:=$(shell head -n 1 debian/changelog \
		    | sed -e 's/^[^(]*(\([^)]*\)).*/\1/')
UPVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//')
URLVERSION:=$(shell echo $(DEBVERSION) | sed -e 's/^.*://' -e 's/-[0-9.]*$$//' -e 's/.dfsg$$//' -e 's/\./_/g')

FILENAME := opal_$(UPVERSION).dfsg.orig.tar.gz
UPFILENAME := opal_$(UPVERSION).orig.tar.gz
URL := http://www.voxgratia.org/releases/opal-v$(URLVERSION)-src-tar.gz

build: build-arch build-indep

build-arch: build-arch-stamp

config.status: patch-stamp autotools configure
	./configure $(confflags) --prefix=/usr 

autotools:
	-if [ -f config.sub.old ]; then \
	  rm -f config.sub; \
	else \
	  mv config.sub config.sub.old; \
	fi
	-if [ -f config.guess.old ]; then \
	  rm -f config.guess; \
	else \
	  mv config.guess config.guess.old; \
	fi
	ln -s /usr/share/misc/config.sub config.sub
	ln -s /usr/share/misc/config.guess config.guess
	
	touch autotools

check-ilbc:
	( [ ! -d src/codec/iLBC ] ) || \
	  ( echo "ERROR: iLBC code must be removed from upstream sources" ; false )

	touch $@

build-arch-stamp: config.status
	$(MAKE) $(MAKE_BUILD_PARAM) opt
	
	# This dirty stuff is done to compile simple with apropiate options
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean opt

	# Check that there is not any blatant error
	LD_LIBRARY_PATH=$(CURDIR)/lib samples/simple/obj_*_r/simpleopal --help >/dev/null
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean 
	
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp:
	$(MAKE) $(MAKE_BUILD_PARAM) docs
	touch build-indep-stamp

clean: check-ilbc clean-patched unpatch
clean-patched:
	dh_testdir
	dh_testroot
	-rm -f build-arch-stamp build-indep-stamp patch-stamp
	-rm -f config.status config.log autotools
	-$(MAKE) $(MAKE_BUILD_PARAM) optclean clean 
	-$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
	-rm -rf samples/simple/obj*
	-rm -f opal_inc.mak include/opal/buildopts.h
	-rm -rf lib
	-rm -f src/speex/libspeex/Makefile
	-rm -rf html
	-rm -f `find . -name "*~"`
	-rm -rf `find debian/* -type d -name libopal-*` debian/files* core
	-rm -rf debian/simpleopal/
	-rm -f debian/*substvars
	-rm -f debian/*.debhelper
	-rm -f debian/libopal-*.*.docs
	
	-if [ -f config.sub.old ]; then \
	   mv config.sub.old config.sub; \
	fi
	-if [ -f config.guess.old ]; then \
	   mv config.guess.old config.guess; \
	fi
	-rm -f config.status
	
	dh_clean

install: install-arch install-indep
install-indep:
	dh_testdir
	dh_testroot
	dh_clean -k -i
	dh_installdirs -i

install-arch:
	dh_testdir
	dh_testroot
	dh_clean -k -a
	dh_installdirs -a
	
	$(MAKE) $(MAKE_BUILD_PARAM) DESTDIR=$(CURDIR)/debian/$(PACKAGE) OPAL_LIBDIR=/usr/lib install
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT))
	ln -s libopal.so.$(SHLIBSVER) \
		debian/$(PACKAGE)/usr/lib/libopal.so.$(LIBOPALCOMPAT)
endif
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT2))
	ln -s libopal.so.$(SHLIBSVER) \
		debian/$(PACKAGE)/usr/lib/libopal.so.$(LIBOPALCOMPAT2)
endif
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT3))
	ln -s libopal.so.$(SHLIBSVER) \
		debian/$(PACKAGE)/usr/lib/libopal.so.$(LIBOPALCOMPAT3)
endif
ifneq ($(SHLIBSVER),$(LIBOPALCOMPAT4))
	ln -s libopal.so.$(SHLIBSVER) \
		debian/$(PACKAGE)/usr/lib/libopal.so.$(LIBOPALCOMPAT4)
endif
	$(MAKE) $(MAKE_BUILD_PARAM) INSTALL_DIR=$(CURDIR)/debian/simpleopal/usr -C samples/simple install
#	clean simple to install it as a sample in the docs
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
	-$(RM) -rf samples/simple/obj_*
	
#	libopal-dev package
	dh_movefiles --sourcedir=debian/$(PACKAGE) -plibopal-dev `cd debian/$(PACKAGE); ls -1 usr/lib/*.so` usr/include
	rm -rf debian/$(PACKAGE)/usr/include debian/$(PACKAGE)/usr/share/opal/opal_inc.mak
	rm -f debian/$(PACKAGE)/usr/lib/libopal.so.? 
	#rm -f debian/$(PACKAGE)/usr/lib/libopal.so.?.??

	#cp -v lib/libopal.a debian/libopal-dev/usr/lib
	sed -e 's#^OPALDIR.*#OPALDIR = \/usr\/lib\/opal#g' \
	    opal_inc.mak > debian/libopal-dev/usr/share/opal/opal_inc.mak
	#cp -vr include/* $(CURDIR)/debian/libopal-dev/usr/include/opal/.
	#find debian/libopal-dev/usr/include -type f -exec chmod 644 {} \;

	cp version.h debian/libopal-dev/usr/include/opal/

	# linking stuff under usr/share/opal
	ln -s ../../include/opal/version.h debian/libopal-dev/usr/share/opal/
	ln -s ../../include/opal debian/libopal-dev/usr/share/opal/include
	ln -s ../../lib debian/libopal-dev/usr/share/opal/

# Must not depend on anything. This is to be called by
# binary-arch/binary-multi
# in another 'make' thread.
binary-common:
	
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installman
	dh_installexamples
	dh_installchangelogs ChangeLog
	
	# Remove all CVS sub-directories
	find debian -name "CVS" -type d|xargs rm -rf
	find debian -name .cvsignore -exec rm -f {} \;
	
	dh_link
	dh_compress 
	dh_fixperms
	dh_makeshlibs -V "$(PACKAGE) (>= $(DEBVERSION))"
	dh_installdeb
	
	dh_shlibdeps -L $(PACKAGE) -l debian/$(PACKAGE)/usr/lib
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-strip:
	dh_testdir
	dh_testroot
	dh_strip --keep-debug --exclude=libopal_d
	
	cp -af debian/$(PACKAGE)/usr/lib/debug debian/libopal-dbg/usr/lib && \
		rm -rf debian/$(PACKAGE)/usr/lib/debug
	rm -rf debian/simpleopal/usr/lib/

# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-strip
	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common

print-version:
	@@echo "Debian version:          $(DEBVERSION)"
	@@echo "Upstream version:        $(UPVERSION)"

get-orig-source:
	@@dh_testdir
	@@[ -d ../tarballs/. ]||mkdir -p ../tarballs
	@@echo Downloading $(UPFILENAME) from $(URL) ...
	@@wget -N -nv -T10 -t3 -O ../tarballs/$(UPFILENAME) $(URL)
	@@echo 'Repacking as DFSG-free (removing iLBC)...'
	@@mkdir -p ../tarballs/opal-$(UPVERSION).tmp/
	@@cd ../tarballs/opal-$(UPVERSION).tmp ; \
	tar xfz ../$(UPFILENAME) 
	@@rm -rf ../tarballs/opal-$(UPVERSION).tmp/opal*/src/codec/iLBC
	@@echo Writing archive ../tarballs/$(FILENAME) ...
	@@cd ../tarballs/opal-$(UPVERSION).tmp ; \
	tar cfz ../$(FILENAME) *
	@@echo Cleaning up...
	@@$(RM) -rf ../tarballs/opal-$(UPVERSION).tmp/ ../tarballs/$(UPFILENAME)

binary: binary-arch binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch clean-patched