summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 996041add8042ec7b5a104d0ce7ba6f8fe488ce3 (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
#! /usr/bin/make -f
# from official debian package: testing welcome!
ifeq ($(DEB_HOST_ARCH_CPU),$(filter $(DEB_HOST_ARCH_CPU),powerpc sparc))
	export CC=gcc-4.8 # fixes #73363
endif

# 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: update_version
	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 $@

MPV_VERSION=$(shell cd mpv && git describe --tags | sed 's/^v//';)
update_version:
	dch -v "1:$(MPV_VERSION)" "local build"

# this should really create multiple shared object debian packages but
# this will do for now
# the dependencies must be built before mpv is configured
ffmpeg_config:
	scripts/ffmpeg-config --enable-libx264 --enable-libmp3lame

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

libass_config:
	scripts/libass-config

libass_build: libass_config
	scripts/libass-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 

override_dh_auto_build:
	scripts/mpv-build $(WAFLAGS)

# call waf to install to the debian packageing dir
override_dh_auto_install:
	cd mpv && python waf -v install --destdir=../debian/mpv

# call all the cleans
override_dh_auto_clean:
	scripts/mpv-clean
	scripts/ffmpeg-clean
	scripts/libass-clean