File: rules

package info (click to toggle)
kodi 2:18.8+dfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 101,296 kB
  • sloc: cpp: 624,410; xml: 61,024; ansic: 43,642; sh: 9,074; python: 3,403; makefile: 2,160; javascript: 2,001; perl: 1,070; objc: 641; cs: 608; java: 500; php: 12
file content (239 lines) | stat: -rwxr-xr-x 7,942 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
230
231
232
233
234
235
236
237
238
239
#!/usr/bin/make -f

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Avoid custom build rule silencing
export V=1

# bindnow breaks wrappers used in with libdvdread
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-bindnow

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Use package's version in Kodi
VERSION := $(shell dpkg-parsechangelog -S Version)
UPSTREAM_VERSION := $(shell dpkg-parsechangelog -S Version| sed 's/[0-9]*://;s/-[^-]*$$//')

DVDNAV_COMPONENT = libdvdnav-6-1-0
DVDNAV_URL = tools/depends/target/libdvdnav/libdvdnav-$$(grep VERSION tools/depends/target/libdvdnav/DVDNAV-VERSION | sed 's/^[^=]*=//').tar.xz
DVDREAD_COMPONENT = libdvdread-6-1-1
DVDREAD_URL = tools/depends/target/libdvdread/libdvdread-$$(grep VERSION tools/depends/target/libdvdread/DVDREAD-VERSION | sed 's/^[^=]*=//').tar.xz

export DEB_CFLAGS_MAINT_STRIP  = -O2
export DEB_CFLAGS_MAINT_APPEND  = -O3
export DEB_CXXFLAGS_MAINT_STRIP  = -O2
export DEB_CXXFLAGS_MAINT_APPEND  = -O3

# TODO enable wayland builds when waylandpp gets packaged
BUILD_WAYLAND := yes
BUILD_GBM := yes

# TODO fix
NUMCPU := $(shell grep -c processor /proc/cpuinfo)

# Various environment variables to set
export DEB_LDFLAGS_MAINT_APPEND = -latomic -lpthread
# for embedded libdvd*:
export DEB_CPPFLAGS_MAINT_APPEND = -D_XBMC

ifneq (,$(filter armel armhf,$(DEB_HOST_ARCH)))
EXTRA_FLAGS := $(EXTRA_FLAGS) -DWITH_ARCH=arm
else ifneq (,$(filter ppc64el,$(DEB_HOST_ARCH)))
EXTRA_FLAGS := $(EXTRA_FLAGS) -DWITH_ARCH=ppc64
else ifneq (,$(filter s390x,$(DEB_HOST_ARCH)))
EXTRA_FLAGS := $(EXTRA_FLAGS) -DWITH_ARCH=s390x
else ifneq (,$(filter mipsel,$(DEB_HOST_ARCH)))
EXTRA_FLAGS := $(EXTRA_FLAGS) -DWITH_ARCH=mips
else ifneq (,$(filter mips64el,$(DEB_HOST_ARCH)))
EXTRA_FLAGS := $(EXTRA_FLAGS) -DWITH_ARCH=mips64
endif

KODI_OPTS=\
-DVERBOSE=1 \
-DUSE_LTO=${NUMCPU} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_AIRTUNES=ON \
-DENABLE_ALSA=ON \
-DENABLE_AVAHI=ON \
-DENABLE_BLURAY=ON \
-DENABLE_CEC=ON \
-DENABLE_DBUS=ON \
-DENABLE_DVDCSS=OFF \
-DENABLE_EVENTCLIENTS=ON \
-DENABLE_INTERNAL_FFMPEG=OFF \
-DENABLE_INTERNAL_CROSSGUID=OFF \
-DENABLE_MICROHTTPD=ON \
-DENABLE_MYSQLCLIENT=ON \
-DENABLE_NFS=ON \
-DENABLE_OPTICAL=ON \
-DENABLE_PULSEAUDIO=ON \
-DENABLE_SMBCLIENT=ON \
-DENABLE_UDEV=ON \
-DENABLE_UPNP=ON \
-DENABLE_VAAPI=ON \
-DENABLE_XSLT=ON \
-DLIBDVDREAD_URL=${DVDREAD_URL} \
-DLIBDVDNAV_URL=${DVDNAV_URL} \
-DENABLE_LIRCCLIENT=ON \
-DNEON=False \
$(EXTRA_FLAGS)

X11_OPTS=\
-DENABLE_VDPAU=ON

WAYLAND_OPTS=\
-DCORE_PLATFORM_NAME=wayland \
-DWAYLAND_RENDER_SYSTEM=gl


GBM_OPTS=\
-DCORE_PLATFORM_NAME=gbm \
-DGBM_RENDER_SYSTEM=gl

%:
	dh $@ --buildsystem cmake --with python2,python3

override_dh_clean:
	dh_clean \
		addons/skin.estuary/media/from-debian-logo.png \
		addons/webinterface.default/ \
		debian/dh-addon/*.1 \
		kodi_build_*/ \
		lib/gtest/ \
		media/Fonts/arial.ttf

override_dh_auto_clean:
	dh_auto_clean


# fall back to old location of DejaVuSans.ttf if needed
ifneq ("$(wildcard /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf)","")
DEJAVUSANS=/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf
else
DEJAVUSANS=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf
endif

media/Fonts/arial.ttf: debian/mergefonts.ff
	# work around #948876 until fontforge is fixed by using cached result
	! fontforge -script $< \
		/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf \
		$(DEJAVUSANS) \
		$@ && cp debian/extra/arial.ttf $@

lib/gtest/lib/.libs/libgtest.a:
	cp -r /usr/src/gtest/ $(CURDIR)/lib/ && mkdir -p $(CURDIR)/lib/gtest/lib/.libs

addons/skin.estuary/media/from-debian-logo.png: debian/from-debian-logo.svg
	rsvg-convert -w 250 -h 82 -o $@ $<

override_dh_auto_configure: addons/skin.estuary/media/from-debian-logo.png lib/gtest/lib/.libs/libgtest.a media/Fonts/arial.ttf
	cp -r $(CURDIR)/webinterface-default $(CURDIR)/addons/webinterface.default
	sed -i 's/DEB_VERSION/"'$(VERSION)'"/' xbmc/Application.cpp xbmc/utils/SystemInfo.cpp
	tar -cf $(DVDNAV_URL) $(DVDNAV_COMPONENT)
	tar -cf $(DVDREAD_URL) $(DVDREAD_COMPONENT)
	dh_auto_configure --builddir kodi_build_x11 -- ${KODI_OPTS} ${X11_OPTS}
ifeq ($(BUILD_WAYLAND),yes)
	dh_auto_configure --builddir kodi_build_wayland -- ${KODI_OPTS} ${WAYLAND_OPTS}
endif
ifeq ($(BUILD_GBM),yes)
	dh_auto_configure --builddir kodi_build_gbm -- ${KODI_OPTS} ${GBM_OPTS}
endif

override_dh_auto_build:
	dh_auto_build --builddir kodi_build_x11
ifeq ($(BUILD_WAYLAND),yes)
	dh_auto_build --builddir kodi_build_wayland
endif
ifeq ($(BUILD_GBM),yes)
	dh_auto_build --builddir kodi_build_gbm
endif
	for file in $$(ls debian/dh-addon/dh_*); do \
		pod2man --section=1 --utf8 $$file $$file.1; \
	done

override_dh_auto_test-arch:
	dh_auto_test -a --no-parallel --builddir kodi_build_x11
ifeq ($(BUILD_WAYLAND),yes)
	dh_auto_test -a --no-parallel --builddir kodi_build_wayland
endif
ifeq ($(BUILD_GBM),yes)
	dh_auto_test -a --no-parallel --builddir kodi_build_gbm
endif

# No tests for indep build.
override_dh_auto_test-indep:

override_dh_auto_install:
ifeq ($(BUILD_WAYLAND),yes)
	dh_auto_install --builddir kodi_build_wayland --destdir debian/tmp
endif
ifeq ($(BUILD_GBM),yes)
	dh_auto_install --builddir kodi_build_gbm --destdir debian/tmp
endif
	dh_auto_install --builddir kodi_build_x11 --destdir debian/tmp

override_dh_install-indep:
	dh_install -i -XLICENCE -XLICENSE \
		-XLicence.txt -XLicense.txt -XLICENSE.txt \
		-XNOTICE.txt \
		-Xjquery-1.8.2.min.js -Xiscroll-min.js
	# python-pycryptodome is not available in Debian anymore
	# TODO ship the addon again in Kodi 19 with depending on python3-pycryptodome
	rm -rf debian/kodi-data/usr/share/kodi/addons/script.module.pycryptodome
	rm -rf debian/kodi-data/usr/share/kodi/addons/repository.xbmc.org
	dh_install -pkodi-repository-kodi \
		addons/repository.xbmc.org/* usr/share/kodi/addons/repository.xbmc.org

override_dh_install-arch:
ifeq ($(BUILD_WAYLAND)-$(BUILD_GBM),yes-yes)
	dh_install -a -XLICENCE -XLICENSE -XLicence.txt -XLicense.txt -XLICENSE.txt -XNOTICE.txt
else ifeq ($(BUILD_WAYLAND),yes)
	dh_install -a -Nkodi-gbm -XLICENCE -XLICENSE -XLicence.txt -XLicense.txt -XLICENSE.txt -XNOTICE.txt
else ifeq ($(BUILD_GBM),yes)
	dh_install -a -Nkodi-wayland -XLICENCE -XLICENSE -XLicence.txt -XLicense.txt -XLICENSE.txt -XNOTICE.txt
else
	dh_install -a -Nkodi-wayland -Nkodi-gbm -XLICENCE -XLICENSE -XLicence.txt -XLicense.txt -XLICENSE.txt -XNOTICE.txt
endif
	# ship xbmcclient.h only in kodi-eventclients-dev
	rm -f debian/kodi-addons-dev/usr/include/kodi/xbmcclient.h
	# check if all needed headers are included
	$(CXX) -c debian/headers-check.c -DBUILD_KODI_ADDON \
	$(shell dpkg-buildflags --get CPPFLAGS) \
	$(shell dpkg-buildflags --get CXXFLAGS) \
	-Idebian/kodi-addons-dev/usr/include \
	-o /dev/null

override_dh_shlibdeps:
	dh_shlibdeps -a -O--parallel \
		-l$(CURDIR)/debian/kodi-bin/usr/lib/*/kodi/system/players/dvdplayer

override_dh_builddeb:
ifeq ($(BUILD_WAYLAND)-$(BUILD_GBM),yes-yes)
	dh_builddeb
else ifeq ($(BUILD_WAYLAND),yes)
	dh_builddeb -Nkodi-gbm
	sed -Ei '/kodi-gbm_/d' debian/files
else ifeq ($(BUILD_GBM),yes)
	dh_builddeb -Nkodi-wayland
	sed -Ei '/kodi-wayland_/d' debian/files
else
	dh_builddeb -Nkodi-wayland -Nkodi-gbm
	sed -Ei '/kodi-(wayland|gbm)_/d' debian/files
endif

override_dh_gencontrol-arch:
	debian/dh-addon/dh_kodiaddon_depends
	dh_gencontrol -a

override_dh_gencontrol-indep:
	dh_gencontrol -i

# extract customized additional tarballs
extract-components:
	tar -xf $(CURDIR)/../kodi_"$(UPSTREAM_VERSION)".orig-$(DVDNAV_COMPONENT).tar.xz && \
		test -d $(CURDIR)/$(DVDNAV_COMPONENT) || mv libdvdnav-* $(CURDIR)/$(DVDNAV_COMPONENT)
	tar -xf $(CURDIR)/../kodi_"$(UPSTREAM_VERSION)".orig-$(DVDREAD_COMPONENT).tar.xz && \
		test -d $(CURDIR)/$(DVDREAD_COMPONENT) || mv libdvdread-* $(CURDIR)/$(DVDREAD_COMPONENT)
	tar -xf $(CURDIR)/../kodi_"$(UPSTREAM_VERSION)".orig-webinterface-default.tar.xz