File: rules

package info (click to toggle)
ring 20190215.1.f152c98~ds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 66,208 kB
  • sloc: ansic: 304,045; cpp: 187,144; python: 16,054; xml: 8,285; sh: 5,217; makefile: 3,448; objc: 2,805; java: 1,909; cs: 1,575; asm: 236
file content (229 lines) | stat: -rwxr-xr-x 7,850 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/usr/bin/make -f
# -*- makefile -*-

# Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# Build with LFS (See #913186)
CFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CXXFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64

# Number of CPUS
NO_CPUS=$(shell nproc)
ifeq ($(NO_CPUS),0)
NO_CPUS=1
endif

%:
	dh $@

override_dh_auto_configure:
	###############################################
	## Re-create tarballs from tarballs-unpacked ##
	###############################################
	mkdir -p daemon/contrib/tarballs

	# Create tarballs
	for i in $(CURDIR)/daemon/contrib/tarballs-unpacked/*; do \
		projectname=`basename $$i` && \
		cd $$i && tar -caf ../../tarballs/$$projectname * && \
		echo "Repacked $$projectname"; \
	done

	###########################
	## daemon configure ##
	###########################
	mkdir -p daemon/contrib/native
	cd daemon/contrib/native && \
        ../bootstrap \
				--disable-downloads \
				--no-checksums \
				--disable-ogg \
				--disable-flac \
				--disable-gmp \
				--disable-vorbis \
				--disable-vorbisenc \
				--disable-speex \
				--disable-sndfile \
				--disable-gsm \
				--disable-speexdsp \
				--disable-asio \
				--disable-boost \
				--disable-cryptopp \
				--disable-ffmpeg \
				--disable-restbed \
				--disable-vpx \
				--disable-x264 \
				--disable-yaml-cpp \
				--disable-opendht \
				--disable-gnutls \
				--disable-dbus-cpp \
				--disable-secp256k1 \
				--disable-upnp \
				--disable-natpmp && \
		make list && \
		make -j$(NO_CPUS) V=1
	cd daemon && \
		./autogen.sh && \
		./configure \
				--prefix=/usr \
				--disable-shared

	#############################
	## libringclient configure ##
	#############################
	cd lrc && \
		mkdir build && \
		cd build && \
		cmake  \
			-DRING_BUILD_DIR=$(CURDIR)/daemon/src \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DCMAKE_BUILD_TYPE=Debug \
			..

	############################
	## gnome client configure ##
	############################
	cd client-gnome && \
		mkdir build && \
		cd build && \
		cmake \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DLibRingClient_PROJECT_DIR=/$(CURDIR)/lrc \
			-DGSETTINGS_LOCALCOMPILE=OFF \
			..

	dh_auto_configure

override_dh_auto_build:
	#######################
	## Ring Daemon build ##
	#######################
	make -C daemon -j$(NO_CPUS) V=1
	pod2man daemon/man/dring.pod > daemon/dring.1

	#########################
	## libringclient build ##
	#########################
	make -C lrc/build -j$(NO_CPUS) V=1

	########################
	## gnome client build ##
	########################
	make -C client-gnome/build LDFLAGS="-lpthread" -j$(NO_CPUS) V=1

override_dh_auto_clean:
	################################
	## Generated contrib tarballs ##
	################################
	rm -rfv daemon/contrib/tarballs

	#######################
	## daemon clean ##
	#######################
	if [ -f daemon/contrib/native/Makefile ]; then make -C daemon/contrib/native distclean; fi
	rm -rfv daemon/contrib/native
	rm -rfv daemon/dring.1

	#########################
	## libringclient clean ##
	#########################
	if [ -f lrc/build/Makefile ]; then make -C lrc/build distclean; fi
	rm -rfv lrc/build

	########################
	## gnome client clean ##
	########################
	if [ -f client-gnome/build/Makefile ]; then make -C client-gnome/build distclean; fi
	rm -rfv client-gnome/build

override_dh_auto_install:
	#########################
	## daemon install ##
	#########################
	cd daemon && make DESTDIR=$(CURDIR)/debian/jami-daemon install
	rm -rfv $(CURDIR)/debian/jami-daemon/usr/include
	rm -rfv $(CURDIR)/debian/jami-daemon/usr/lib/*.a
	rm -rfv $(CURDIR)/debian/jami-daemon/usr/lib/*.la

	###########################
	## libringclient install ##
	###########################
	cd lrc/build && make DESTDIR=$(CURDIR)/debian/jami install
	rm -rfv $(CURDIR)/debian/jami/usr/include

	# This is a symlink, should be in -dev package
	rm -v $(CURDIR)/debian/jami/usr/lib/libringclient.so

	# cmake files
	rm -rfv $(CURDIR)/debian/jami/usr/lib/cmake

	##########################
	## gnome client install ##
	##########################
	cd client-gnome/build && make DESTDIR=$(CURDIR)/debian/jami install

	# Remove ring binary: it is not needed for now
	rm $(CURDIR)/debian/jami/usr/bin/ring.cx

tmpdir:= $(shell mktemp -d)
workdir:= $(shell pwd)
PKD := $(abspath $(dir $(MAKEFILE_LIST)))
version_to_download := $(shell dpkg-parsechangelog -ldebian/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\~ds.+)(?:\-\d+.*)};')

# Repacks the tarball with contrib tarballs unpacked.
get-orig-source:
	# Download ring tarball
	if [ -n "$$GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL" ]; then \
	    mv $$GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL ${tmpdir}; \
	else \
	    uscan --rename --destdir=${tmpdir} --download-version ${version_to_download} ;\
	fi

	# Unpack ring tarball
	tar -C ${tmpdir} -xf ${tmpdir}/*.tar.*

	# Remove original tarball
	rm ${tmpdir}/*.tar.*

	# Unpack all of the orig tarballs into tarballs-unpacked
	mkdir ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked
	for i in `find ${tmpdir}/ring-project/daemon/contrib/tarballs/ -name "*.tar.*"`; do \
		projectname=`basename $$i` && \
		mkdir ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/$$projectname && \
		tar -C ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/$$projectname -xf $$i && \
		echo "Unpacked $$projectname"; \
    done

	###################
	## Exclude files ##
	###################
	# This does not exclude everything that we need to exclude.
	# debian/copyright's File-Excluded section also excludes files.

    ## pjproject
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/g7221 # non-distributable (requires a license from Polycom)
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/ilbc # non distributable (the version included with pjproject)
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/milenage # non distributable
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/BaseClasses # non distributable (?)
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/portaudio # not needed
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/speex # not needed
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/mp3 # not needed
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/gsm # not needed
	rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/bdsound # not needed
	#rm -rf  ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp # not needed
	rm -f ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjmedia/src/pjmedia-audiodev/s60_g729_bitstream.h # non distributable
	rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/build/vs # not needed, VisualStudio files.
	rm -f ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjsip-apps/src/swig/java/android/gradle/wrapper/* # not needed
	rm -f ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjsip-apps/src/pjsua/android/gradle/wrapper/* # not needed

	# Remove all contrib tarballs
	rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs

	# Create the new tarball
	cd  ${tmpdir} && tar -czf ${workdir}/ring_${version_to_download}~ds1.orig.tar.gz ring-project

	# Clear the temp dir
	rm -rf ${tmpdir}