summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 709d4d5885ee6adaccd716926668e1f9d09d1699 (plain)
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
#! /usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS:=hardening=+all

# To enable parallel building:
# You can either set DEB_BUILD_OPTIONS=paralell=<num-procs> in your build environment
# or provide the -j<numprocs> option to debuild or dpkg-buildpackage, which
# ammounts to the same thing.
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
# use MFLAGS, rather than MAKEFLAGS as the latter is used by make internally
	MFLAGS += -j$(NUMJOBS)
	WAFFLAGS += -j$(NUMJOBS)
endif

# make .PHONY all the targets that have name collisions with the scripts
# see http://www.debian.org/doc/manuals/maint-guide/dreq.en.html#rules
.PHONY: clean build install
# Apparently, the above isn't enough because of the "%" target. Make the problematic targets explicit
clean:
	exec dh $@
build:
	exec dh $@
install:
	exec dh $@
# Handle all other targets in the usual way.
# The --parallel flag to dh doesn't seem to have the intended effect
# so leave it out.
%:
	exec dh $@

libass_config:
	scripts/libass-config

libass_build: libass_config
	scripts/libass-build $(MFLAGS)

# depend on libass_build in case the user specified --enable-libass in ffmpeg_options
ffmpeg_config: libass_build
	scripts/ffmpeg-config \
		--enable-gnutls \
		--enable-libgme \
		--enable-libgsm \
		--enable-libmodplug \
		--enable-libmp3lame \
		--enable-libopus \
		--enable-libpulse \
		--enable-libsoxr \
		--enable-libspeex \
		--enable-libssh \
		--enable-libvorbis \
		--enable-libvpx \
		--enable-libwavpack \
		--enable-ladspa \
		--enable-libbs2b \
		--enable-gpl --enable-libxvid --enable-libx264 \
		--enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc

ffmpeg_build: ffmpeg_config
	scripts/ffmpeg-build $(MFLAGS)

# put the config in the right place and drop the local/ since it's package managed now
override_dh_auto_configure: ffmpeg_build libass_build
	scripts/mpv-config --prefix=/usr --confdir=/etc/mpv \
		--enable-openal \
		--enable-dvdread \
		--enable-dvdnav \
		--enable-cdda \
		--enable-libsmbclient \
		--enable-zsh-comp

override_dh_auto_build:
	scripts/mpv-build $(WAFLAGS)


DOCSOURCE=mpv/DOCS
TOOLSSOURCE=mpv/TOOLS
DOCDEST=debian/mpv/usr/share/doc/mpv
TOOLSDEST=$(DOCDEST)/TOOLS
# call waf to install to the debian packageing dir
override_dh_auto_install:
	cd mpv && python waf -v install --destdir=../debian/mpv

	find "$(DOCSOURCE)" -mindepth 1 -type d \
	-not -regex '.*man.*' \
	-not -regex '.*client_api_examples.*' \
	-printf "%P\0" | \
	xargs -0i /usr/bin/install -d "$(DOCDEST)/{}"

	find "$(DOCSOURCE)" -mindepth 1 -type f \
	-not -regex '.*man.*' \
	-not -regex '.*client_api_examples.*' \
	-not -name 'tech-overview.txt' \
	-not -name 'waf-buildsystem.rst' \
	-not -name 'crosscompile-mingw.md' \
	-not -name 'coding-style.md' \
	-printf "%P\0" | \
	xargs -0i /usr/bin/install -m644 "$(DOCSOURCE)/{}" "$(DOCDEST)/{}"

	find "$(TOOLSSOURCE)" -mindepth 1 -type d \
	-not -regex '.*osxbundle.*' \
	-printf "%P\0" | \
	xargs -0i /usr/bin/install -d "$(TOOLSDEST)/{}"

	find "$(TOOLSSOURCE)" -mindepth 1 -type f \
	-not -regex '.*osxbundle.*' \
	-not -name 'gen-x11-icon.sh' \
	-not -name 'file2string.pl' \
	-not -name 'uncrustify.cfg' \
	-printf "%P\0" | \
	xargs -0i /usr/bin/install -m644 "$(TOOLSSOURCE)/{}" "$(TOOLSDEST)/{}"

# for manually installed dependencies
override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info

# call all the cleans
override_dh_auto_clean:
	./clean