File: rules

package info (click to toggle)
openh323 1.15.3-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 28,544 kB
  • ctags: 27,016
  • sloc: cpp: 171,284; ansic: 42,216; sh: 2,619; makefile: 967; awk: 17
file content (210 lines) | stat: -rwxr-xr-x 6,174 bytes parent folder | download
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
#!/usr/bin/make -f

export DH_COMPAT=4

# Change this on API breakage
export LIBH323COMPAT=1.15.2

PACKAGE=libopenh323-$(LIBH323COMPAT)

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=OPENH323DIR=$(PWD)

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


build: build-arch build-indep

build-arch: build-arch-stamp

Makefile: patch-stamp autotools configure
	./configure $(confflags) --prefix=/usr --enable-plugins

autotools:
	-if [ -f config.sub.old ]; then \
	  rm -f config.sub; \
	elif [ -f config.sub ];then \
	  mv config.sub config.sub.old; \
	fi
	-if [ -f config.guess.old ]; then \
	  rm -f config.guess; \
	elif [ -f config.guess ];then \
	  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
	
	- (cd plugins ; \
	if [ -f config.sub.old ]; then \
	  rm -f config.sub; \
	elif [ -f config.sub ];then \
	  mv config.sub config.sub.old; \
	fi; \
	if [ -f config.guess.old ]; then \
	  rm -f config.guess; \
	elif [ -f config.guess ];then \
	  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; \
	cd ..)
	touch autotools

build-arch-stamp: Makefile
	$(MAKE) opt optnoshared 
	
	# 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=$(PWD)/lib samples/simple/obj_*_r/simph323 --help >/dev/null
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean 
	
	touch build-arch-stamp

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

clean: 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
	if [ -f Makefile ];then \
	$(MAKE) $(MAKE_BUILD_PARAM) optclean clean ;\
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean;\
	fi
	-rm -rf samples/simple/obj*
	-rm -f Makefile openh323u.mak include/openh323buildopts.h
	-rm -rf lib
	-rm -f src/speex/libspeex/Makefile
	-rm -rf html
	-rm -f `find . -name "*~"`
	-rm -rf `find debian/* -type d -name libopenh323-*` debian/files* core
	-rm -rf debian/simph323/
	-rm -f debian/*substvars
	-rm -f debian/*.debhelper
	-rm -f debian/libopenh323-*.*.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
	
	-(cd plugins; \
	if [ -f config.sub.old ]; then \
	   mv -f config.sub.old config.sub; \
	fi; \
	if [ -f config.guess.old ]; then \
	   mv -f config.guess.old config.guess; \
	fi; \
	cd ..)
	dh_clean

install: install-indep install-arch
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) INSTALL_DIR=$(PWD)/debian/$(PACKAGE)/usr -C src install
	$(MAKE) $(MAKE_BUILD_PARAM) DESTDIR=$(PWD)/debian/$(PACKAGE) -C plugins install
ifneq ($(SHLIBSVER),$(LIBH323COMPAT))
	ln -s libopenh323.so.$(SHLIBSVER) \
		debian/$(PACKAGE)/usr/lib/libopenh323.so.$(LIBH323COMPAT)
endif
	$(MAKE) $(MAKE_BUILD_PARAM) INSTALL_DIR=$(PWD)/debian/simph323/usr -C samples/simple install
#	clean simple to install it as a sample in the docs
	$(MAKE) $(MAKE_BUILD_PARAM) -C samples/simple clean
	-rmdir samples/simple/obj*

#	libopenh323-dev package
	dh_movefiles --sourcedir=debian/$(PACKAGE) -plibopenh323-dev `cd debian/$(PACKAGE); ls -1 usr/lib/*.so`
	cp -v lib/libopenh323.a debian/libopenh323-dev/usr/lib
	sed -e 's#^OPENH323DIR.*#OPENH323DIR = \/usr\/lib\/openh323#g' \
	    openh323u.mak > debian/libopenh323-dev/usr/share/openh323/openh323u.mak
	cp -vr include/* $(PWD)/debian/libopenh323-dev/usr/include/openh323/.
	cp version.h debian/libopenh323-dev/usr/include/openh323/
	find debian/libopenh323-dev/usr/include -type f -exec chmod 644 {} \;

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

#	doc
	cp debian/libopenh323.docs debian/$(PACKAGE).docs

# 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) (>= $(SHLIBSVER))"
	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=libopenh323_d

	cp -af debian/libopenh323-$(LIBH323COMPAT)/usr/lib/debug debian/libopenh323-dbg/usr/lib && \
		rm -rf debian/libopenh323-$(LIBH323COMPAT)/usr/lib/debug
	rm -rf debian/simph323/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

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