~linaro-maintainers/xbmc/xbmc-linaro-pkg-precise

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
#!/usr/bin/make -f

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

# Set this variable to yes for release builds to disable debugging and enable
# optimizations.
# NOTE: DEB_BUILD_OPTIONS must have 'nostrip' otherwise debugging symbols will
# be stripped from binaries.
XBMC_RELEASE ?= yes
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
XBMC_RELEASE ?= no
endif

# Whether we're building for release or not
ifeq (yes,$(XBMC_RELEASE))
  DEBUG_OPTIONS = --disable-debug --enable-optimizations
else
  DEBUG_OPTIONS = --enable-debug --disable-optimizations
endif

GL_CONFIG_OPTIONS = --disable-gl --enable-gles
OPENMAX_OPTIONS = --disable-openmax
VDPAU_OPTIONS = --disable-vdpau
VAAPI_OPTIONS = --disable-vaapi
CRYSTALHD_OPTIONS = --disable-crystalhd

# Enable neon for armel and armhf
ifneq (,$(filter armel armhf,$(DEB_HOST_ARCH)))
NEON_OPTIONS = --enable-neon
endif

ifeq (--enable-vdpau, $(VDPAU_OPTIONS))
  LIB_VDPAU = -lvdpau
endif

# Various environment variables to set
ENV_OPTIONS = CFLAGS="$(DEB_CFLAGS)" CXXFLAGS="$(DEB_CXXFLAGS)"

# List of options to pass to configure. Can be overridden.
# Extra options can simply be passed using XBMC_CONFIG_EXTRA_OPTIONS env
# variable.
XBMC_CONFIG_OPTIONS ?= --host=$(DEB_HOST_GNU_TYPE) \
  --build=$(DEB_BUILD_GNU_TYPE) \
  --prefix=/usr --docdir=/usr/share/doc/xbmc \
  $(DEBUG_OPTIONS) \
  $(GL_CONFIG_OPTIONS) \
  $(VDPAU_OPTIONS) \
  $(VAAPI_OPTIONS) \
  $(NEON_OPTIONS) \
  $(CRYSTALHD_OPTIONS) \
  --disable-vdadecoder \
  --disable-vtbdecoder \
  $(OPENMAX_OPTIONS) \
  --disable-tegra \
  --disable-profiling \
  --enable-joystick \
  --enable-xrandr \
  --disable-ccache \
  --enable-pulse \
  --enable-rtmp \
  --enable-ffmpeg-libvorbis \
  --disable-mid \
  --enable-hal \
  --enable-avahi \
  --disable-asap-codec \
  --enable-webserver \
  --enable-optical-drive \
  --enable-texturepacker \
  --enable-nfs \
  --enable-libcec \
  --enable-afpclient \
  --enable-airtunes \
  --enable-gstreamer \
  $(XBMC_CONFIG_EXTRA_OPTIONS) \
  $(ENV_OPTIONS)

# Input files used for generating other files
INPUT_FILES = debian/control.in

# Use --parallel option only if debhelper supports it
DH_PARALLEL_OPT=$(shell dh_testdir --parallel 2>/dev/null && echo "--parallel")

# Used to show what config options are enabled
show-xbmc-config-options:
	$(info $(XBMC_CONFIG_OPTIONS))

%:
	dh $@ $(DH_PARALLEL_OPT)

# Target for generating control files
.PHONY: debian/var_info
%.in: debian/var_info
	@echo "Generating $$(echo $@ | sed 's/\.in$$//') from $@"
	perl -p \
	-e 's{#BUILD_DEPENDS#}{qx(sh debian/var_info BUILD_DEPENDS)}ge;' \
	-e 's{#XBMC_LIVE_DEPENDS#}{qx(sh debian/var_info XBMC_LIVE_DEPENDS)}ge;' \
	< $@ > $$(echo $@ | sed 's/\.in$$//')

override_dh_clean:
	dh_clean libtool xbmc/config.h xbmc/stamp-h1
	find . -name config.status -o -name config.cache -o -name config.log \
		-exec rm -f "{}" \;
	debian/rules $(INPUT_FILES)

override_dh_auto_configure:
	./bootstrap
	./configure $(XBMC_CONFIG_OPTIONS)

override_dh_auto_install:
	$(MAKE) -C lib/addons/script.module.pil
	$(MAKE) install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) eventclients DESTDIR=$(CURDIR)/debian/tmp \
		WII_EXTRA_OPTS=-DCWIID_OLD

override_dh_install:
	dh_install --sourcedir=$(CURDIR)/debian/tmp -XLICENCE \
		-XLicence.txt -XLicense.txt -XLiberationSans-Regular.ttf \
		-XDejaVuSans.ttf -XDejaVuSans-Bold.ttf -XLICENSE.txt
	# Add in scripts to packaging
	mkdir -p debian/xbmc-live/usr/bin/
	cp -f live-scripts/diskmounter live-scripts/runXBMC \
		debian/xbmc-live/usr/bin/
	mkdir -p debian/xbmc-live/etc/xbmc
	cp -rf live-scripts/live.d debian/xbmc-live/etc/xbmc

override_dh_makeshlibs:
	# We don't install shared libraries in standard locations so don't run
	# dh_makeshlibs

override_dh_shlibdeps: debian/tmp/xbmc-bin-dummy.so
	dh_shlibdeps -a -O--parallel \
		-l$(CURDIR)/debian/xbmc-bin/usr/lib/xbmc/system/players/dvdplayer
	# Need to manually add dependencies for dlopened libs.
	dpkg-shlibdeps -dRecommends -edebian/tmp/xbmc-bin-dummy.so -xlibc6 -O >>debian/xbmc-bin.substvars

debian/tmp/xbmc-bin-dummy.so:
	mkdir -p debian/tmp
	cc -xc -shared -Wl,--no-as-needed -o $@ /dev/null \
		-lcurl-gnutls \
		$(LIB_VDPAU) \
		-lrtmp \
		-lnfs \
		-lshairport \
		-lplist \
		-lafpclient \
		-lass \
		-lcec