-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
143 lines (112 loc) · 3.88 KB
/
GNUmakefile
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
IMAGE_NAMESPACE:=outlyernet
IMAGE_NAME=$(IMAGE_NAMESPACE)/ffmpeg-nonfree
DESTDIR:=
prefix:=/usr/local
bindir:=$(DESTDIR)$(prefix)/bin
BINARIES=ffmpeg ffplay ffprobe
###
### Main targets
###
all: build
build:
docker build -t $(IMAGE_NAME) .
install: wrapper.sh
mkdir -p $(bindir)
for binary in $(BINARIES); do \
install -m755 wrapper.sh $(bindir)/$$binary-nonfree-docker ; \
sed -i "s/BINARY=ffmpeg/BINARY=$$binary/" $(bindir)/$$binary-nonfree-docker ; \
done
install-shortnames: install
for binary in $(BINARIES); do \
ln -s $$binary-nonfree-docker $(bindir)/$$binary ; \
done
uninstall:
$(RM) $(addprefix $(bindir)/,$(addsuffix -nonfree-docker,$(BINARIES)))
uninstall-shortnames: uninstall
$(RM) $(addprefix $(bindir)/,$(BINARIES))
# Print ffmpeg version and quit
version:
@docker run --rm -it $(IMAGE_NAME) -version | grep ^ffmpeg
# Print the list of included codecs
codecs:
docker run --rm -it $(IMAGE_NAME) -codecs
###
### Image/registry maintenance
###
pull:
docker image pull $(IMAGE_NAME):latest
# Tag the image with relevant data:
# 1. Timestamp from the base Debian Testing image
# 2. ffmpeg package version
# debian:testing-slim has additional timestamp-based tags, e.g. testing-20201117-slim
# https://hub.docker.com/_/debian?tab=tags&page=1&ordering=last_updated
# matching their build date. The timestamp of files coming from it can be used
BASEIMAGE_TIMESTAMP=$(shell docker run --rm -it \
--entrypoint stat $(IMAGE_NAME) /usr --format='%y' \
| awk '{print $$1}' \
| sed 's/-//g')
FFMPEG_VERSION=$(shell docker run --rm -it \
--entrypoint dpkg $(IMAGE_NAME) -s ffmpeg \
| grep ^Version: \
| cut -d: -f3)
# tag the image with the base debian tag
tag-snapshot: # pull
docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):debian-testing-$(BASEIMAGE_TIMESTAMP)-ffmpeg-$(FFMPEG_VERSION)
docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):$(FFMPEG_VERSION)
docker tag $(IMAGE_NAME):latest $(IMAGE_NAME):$(shell echo $(FFMPEG_VERSION) | sed 's/-dmo[0-9]*$$//')
shell:
docker run --rm -it --entrypoint bash $(IMAGE_NAME)
###
### Targets aimed at comparing the differences between distributions' ffmpeg
### and this image's
###
### The -% suffix in the targets below map to the dockerfiles in downstream/
###
# Build a list of distributions present in downstream/
DOWNSTREAM_IMAGES=$(shell ls downstream/*.Dockerfile | xargs -n1 -I'{}' basename '{}' .Dockerfile)
# build all downstream distros
build-distros: $(addprefix build-,$(DOWNSTREAM_IMAGES))
build-%:
@# Avoid attempting to build "distros.Dockerfile"
test "$*" = 'distros' || \
docker build \
-t $(IMAGE_NAME):downstream-$* \
-f downstream/$*.Dockerfile \
.
version-%:
@echo $*:
@docker run --rm -it $(IMAGE_NAME):downstream-$* -version | grep ^ffmpeg
versions: version $(addprefix version-,$(DOWNSTREAM_IMAGES))
pull-distro-%:
docker pull $(IMAGE_NAME):downstream-$*
pull-distros: $(addprefix pull-distro-,$(DOWNSTREAM_IMAGES))
codecs-%:
docker run --rm -it \
$(IMAGE_NAME):downstream-$* \
-codecs
# Filter the list of codecs to a small selection
codecs-selected:
@$(MAKE) codecs | grep -E '[[:space:]](h264|hevc|mjpeg|mpeg2video|aac)[[:space:]]'
codecs-selected-%:
@$(MAKE) codecs-$* | grep -E '[[:space:]](h264|hevc|mjpeg|mpeg2video|aac)[[:space:]]'
compare-codecs-%:
@-bash -c 'diff --color \
<( $(MAKE) codecs-selected-$* ) \
<( $(MAKE) codecs-selected )'
@echo
# Special comparison: Check if there's an actual difference in Ubuntu versions
compare-codecs-ubuntu-lts-vs-current:
@-bash -c 'diff --color \
<( $(MAKE) codecs-ubuntu-lts ) \
<( $(MAKE) codecs-ubuntu )'
@echo
###
### Maintainer-use target
###
push: build tag-snapshot
docker push $(IMAGE_NAME):latest
docker push $(IMAGE_NAME):debian-testing-$(BASEIMAGE_TIMESTAMP)-ffmpeg-$(FFMPEG_VERSION)
docker push $(IMAGE_NAME):$(FFMPEG_VERSION)
push-distro-%:
docker push $(IMAGE_NAME):downstream-$*
push-distros: $(addprefix push-distro-,$(DOWNSTREAM_IMAGES))