1 diff -uN dav1d-0.4.0.orig/Makefile dav1d-0.4.0/Makefile
2 --- dav1d-0.4.0.orig/Makefile 1969-12-31 17:00:00.000000000 -0700
3 +++ dav1d-0.4.0/Makefile 2019-09-05 16:38:01.820636946 -0600
6 +_ARCH := $(shell uname -m)
7 +ARCH_I32 := $(shell expr "x$(_ARCH)" : 'xi[346]86.*')
8 +ARCH_X64 := $(shell expr "x$(_ARCH)" : 'x..._64*')
10 +ifneq ($(ARCH_I32),0)
15 +ifneq ($(ARCH_X64),0)
25 +INCDIR=$(PREFIX)/include
26 +# make Q="" for verbose
28 +OBJDIR?=$(BUILD)/static
29 +NASM_BLD=$(OBJDIR)/nasm
30 +ENTRY_BLD=$(OBJDIR)/entry
31 +SRC_BLD=$(OBJDIR)/src
32 +BIT8_BLD=$(OBJDIR)/bits8
33 +BIT16_BLD=$(OBJDIR)/bits16
34 +TOOLS_BLD=$(BUILD)/tools
35 +TESTS_BLD=$(BUILD)/tests
37 +STATIC_LIB=$(BUILD)/src/libdav1d.a
38 +SHARED_LIB=$(BUILD)/src/libdav1d.so
39 +DEFS= -DNDEBUG -D_FILE_OFFSET_BITS=64 -D_POSIX_C_SOURCE=200112L
40 +FUZZ= -DDAV1D_MT_FUZZING
42 +BLD_INCL= $(DEFS) -I. -Isrc -Iinclude/dav1d -Iinclude \
43 + -I$(BUILD) -I$(BUILD)/include -I$(BUILD)/include/dav1d
44 +TOOLS_INCL= $(DEFS) -Itools -I. -I$(BUILD) -I$(BUILD)/tools \
45 + -Iinclude -Iinclude/dav1d -I$(BUILD)/include/dav1d \
46 + -I$(BUILD)/include -I/usr/include/SDL2
50 +MAKE_P:=$(MAKE) -j NP=""
53 + $(MAKE_P) $(STATIC_LIB) OBJDIR=$(BUILD)/static
54 + $(MAKE_P) $(SHARED_LIB) OBJDIR=$(BUILD)/shared
56 +# $(MAKE_P) $(TOOLS) OBJDIR=$(BUILD)/static
57 +# $(MAKE_P) $(TESTS) OBJDIR=$(BUILD)/static
61 + -D_FILE_OFFSET_BITS=64 \
62 + -D_POSIX_C_SOURCE=200112L \
71 + -fvisibility=hidden \
74 + -Wno-maybe-uninitialized \
75 + -Wno-missing-field-initializers \
76 + -Wno-unused-parameter \
77 + -Werror=missing-prototypes \
78 + -fomit-frame-pointer \
81 + -mpreferred-stack-boundary=5 \
82 + -MD -MQ $@ -MF $@.d \
85 + -Wl,--no-undefined \
91 + -Wl,-soname,libdav1d.so.2 \
95 +CC_CC=$(Q)cc $(CC_OPTS) $(CFLAGS)
96 +NASM=$(Q)/usr/bin/nasm
97 +any=$(foreach i,$(2),$(1)/$(i))
100 +NASM_OBJS=$(call any,$(NASM_BLD), \
109 + looprestoration.obj \
110 + looprestoration_ssse3.obj \
114 +$(NASM_BLD)/%.obj: src/x86/%.asm
115 + $(NASM) -f $(ASM_ARCH) \
116 + -I src/ -I $(BUILD)/ -MQ $@ -MF $@.ndep \
120 +ENTRY_OBJS=$(call any,$(ENTRY_BLD), \
123 +$(ENTRY_BLD)/%.c.o: src/%.c
124 + $(CC_CC) -Iinclude -Ibuild/include/dav1d -Isrc/entry $(BLD_INCL) \
125 + -mincoming-stack-boundary=4 -o $@ -c $<
128 +SRC_OBJS=$(call any,$(SRC_BLD), \
149 +$(SRC_BLD)/%.o: src/%.c
150 + $(CC_CC) $(BLD_INCL) -pthread -o $@ -c $<
151 +$(SRC_BLD)/x86/%.c.o: src/x86/%.c
152 + $(CC_CC) $(BLD_INCL) -o $@ -c $<
157 + cdef_apply_tmpl.o \
158 + film_grain_tmpl.o \
160 + ipred_prepare_tmpl.o \
163 + loopfilter_tmpl.o \
164 + looprestoration_tmpl.o \
168 + x86/cdef_init_tmpl.c.o \
169 + x86/ipred_init_tmpl.c.o \
170 + x86/itx_init_tmpl.c.o \
171 + x86/loopfilter_init_tmpl.c.o \
172 + x86/looprestoration_init_tmpl.c.o \
173 + x86/mc_init_tmpl.c.o \
175 +BIT8_OBJS=$(call any,$(BIT8_BLD),$(BITS_OBJS))
176 +$(BIT8_BLD)/x86/%.c.o: src/x86/%.c
177 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<
178 +$(BIT8_BLD)/%.o: src/%.c
179 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<
181 +BIT16_OBJS=$(call any,$(BIT16_BLD),$(BITS_OBJS))
182 +$(BIT16_BLD)/x86/%.c.o: src/x86/%.c
183 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<
184 +$(BIT16_BLD)/%.o: src/%.c
185 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<
188 + echo > $@ "#pragma once"
189 + echo >> $@ "#define ARCH_AARCH64 0"
190 + echo >> $@ "#define ARCH_ARM 0"
191 + echo >> $@ "#define ARCH_PPC64LE 0"
192 + echo >> $@ "#define ARCH_X86 1"
193 + echo >> $@ "#define ARCH_X86_32 $(ARCH_X86_32)"
194 + echo >> $@ "#define ARCH_X86_64 $(ARCH_X86_64)"
195 + echo >> $@ "#define CONFIG_16BPC 1"
196 + echo >> $@ "#define CONFIG_8BPC 1"
197 + echo >> $@ "#define CONFIG_LOG 1"
198 + echo >> $@ "#define ENDIANNESS_BIG 0"
199 + echo >> $@ "#define HAVE_ASM 1"
200 + echo >> $@ "#define HAVE_POSIX_MEMALIGN 1"
201 + echo >> $@ "#define HAVE_UNISTD_H 1"
202 + echo >> $@ "#define STACK_ALIGNMENT 32"
204 +$(BUILD)/config.asm:
205 + echo > $@ "%define ARCH_X86_32 $(ARCH_X86_32)"
206 + echo >> $@ "%define ARCH_X86_64 $(ARCH_X86_64)"
207 + echo >> $@ "%define PIC 1"
208 + echo >> $@ "%define STACK_ALIGNMENT 32"
210 +$(BUILD)/include/vcs_version.h:
211 + mkdir -p $(BUILD)/include
212 + echo > $@ "#define DAV1D_VERSION \"0.4.0\""
214 +$(BUILD)/include/dav1d/version.h:
215 + mkdir -p $(BUILD)/include/dav1d
216 + echo > $@ "#ifndef DAV1D_VERSION_H"
217 + echo >> $@ "#define DAV1D_VERSION_H"
218 + echo >> $@ "#define DAV1D_API_VERSION_MAJOR 2"
219 + echo >> $@ "#define DAV1D_API_VERSION_MINOR 0"
220 + echo >> $@ "#define DAV1D_API_VERSION_PATCH 0"
221 + echo >> $@ "#endif /* DAV1D_VERSION_H */"
223 +$(TOOLS_BLD)/cli_config.h:
224 + mkdir -p $(TOOLS_BLD)
225 + echo > $@ "#pragma once"
226 + echo >> $@ "#define HAVE_CLOCK_GETTIME 1"
230 + make meson_dirs OBJDIR=$(BUILD)/static
231 + make meson_dirs OBJDIR=$(BUILD)/shared
232 + ln -sf ./include/compat/gcc/stdatomic.h .
235 +meson_dirs: $(OBJDIR) \
236 + $(BUILD)/config.h $(BUILD)/config.asm \
237 + $(BUILD)/include/vcs_version.h \
238 + $(BUILD)/include/dav1d/version.h \
239 + $(TOOLS_BLD)/cli_config.h \
241 +LIB_OBJS=$(ENTRY_OBJS) $(NASM_OBJS) $(SRC_OBJS) $(BIT8_OBJS) $(BIT16_OBJS)
243 +$(STATIC_LIB): DIR?=static
244 +$(STATIC_LIB): $(LIB_OBJS)
246 + gcc-ar csrD $@ $(LIB_OBJS)
248 +$(SHARED_LIB): DIR?=shared
249 +$(SHARED_LIB): $(LIB_OBJS)
251 + cc -o $@ $(LIB_OBJS) $(SHA_OPTS)
254 +DAV1D_OBJS=$(call any,$(TOOLS_BLD),\
256 + dav1d_cli_parse.o \
266 +DAV1DPLAY_OBJS=$(call any,$(TOOLS_BLD),\
272 +$(TOOLS_BLD)/%.o: tools/%.c
273 + $(CC_CC) $(TOOLS_INCL) -o $@ -c $<
275 +DAV1D=$(TOOLS_BLD)/dav1d
276 +$(DAV1D): $(DAV1D_OBJS)
277 + $(CC_CC) -pthread -I$(BUILD) -o $@ $(DAV1D_OBJS) $(STATIC_LIB)
279 +DAV1DPLAY=$(TOOLS_BLD)/dav1dplay
280 +$(DAV1DPLAY): $(DAV1DPLAY_OBJS)
281 + $(CC_CC) -pthread -o $(TOOLS_BLD)/dav1dplay $(DAV1DPLAY_OBJS) $(STATIC_LIB) -lSDL2
283 +TOOLS=$(DAV1D) $(DAV1DPLAY)
288 +TESTS_CHKASM=tests/checkasm
289 +TESTS_CHKASM_BLD=$(TESTS_BLD)/checkasm
290 +CHKASM_BIT8=$(TESTS_CHKASM_BLD)/bit8
291 +CHKASM_BIT16=$(TESTS_CHKASM_BLD)/bit16
297 + looprestoration.o \
300 +CHKASM_BIT8_OBJS=$(call any,$(CHKASM_BIT8),$(CHKASM_BITS))
301 +CHKASM_BIT16_OBJS=$(call any,$(CHKASM_BIT16),$(CHKASM_BITS))
303 +TESTS_CHKASM_OBJS= \
304 + $(TESTS_CHKASM_BLD)/checkasm.o \
305 + $(TESTS_CHKASM_BLD)/msac.o \
306 + $(CHKASM_BIT8_OBJS) $(CHKASM_BIT16_OBJS) \
307 + $(TESTS_CHKASM_BLD)/x86/checkasm.obj \
309 +$(TESTS_CHKASM_BLD)/%.o: $(TESTS_CHKASM)/%.c
310 + $(CC_CC) $(BLD_INCL) -o $@ -c $<
311 +$(CHKASM_BIT8)/%.o: $(TESTS_CHKASM)/%.c
312 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=8 -o $@ -c $<
313 +$(CHKASM_BIT16)/%.o: $(TESTS_CHKASM)/%.c
314 + $(CC_CC) $(BLD_INCL) -DBITDEPTH=16 -o $@ -c $<
315 +$(TESTS_CHKASM_BLD)/x86/%.obj: $(TESTS_CHKASM)/x86/%.asm
316 + @$(NASM) -f $(ASM_ARCH) \
317 + -I src/ -I $(BUILD)/ -MQ $@ -MF $@.ndep \
320 +CHECKASM=$(TESTS_BLD)/checkasm/checkasm
321 +$(CHECKASM): $(TESTS_CHKASM_OBJS) $(STATIC_LIB)
322 + $(CC_CC) -pthread -o $@ $(TESTS_CHKASM_OBJS) $(STATIC_LIB) -lm
324 +TESTS_FUZZER=tests/libfuzzer
325 +TESTS_FUZZER_BLD=$(TESTS_BLD)/libfuzzer
326 +TESTS_FUZZER_OBJS= \
327 + $(TESTS_FUZZER_BLD)/main.o \
328 + $(TESTS_FUZZER_BLD)/dav1d_fuzzer.o \
330 +$(TESTS_FUZZER_BLD)/%.o: $(TESTS_FUZZER)/%.c
331 + $(CC_CC) $(BLD_INCL) -o $@ -c $<
333 +DAV1D_FUZZER=$(TESTS_BLD)/dav1d_fuzzer
334 +$(DAV1D_FUZZER): $(TESTS_FUZZER_OBJS) $(STATIC_LIB)
335 + $(CC_CC) -pthread -o $@ $(TESTS_FUZZER_OBJS) $(STATIC_LIB)
337 +TESTS=$(CHECKASM) $(DAV1D_FUZZER)
342 + mkdir -p $@/include/dav1d \
343 + $(BUILD)/src $(BUILD)/include \
344 + $(ENTRY_BLD) $(NASM_BLD) \
345 + $(SRC_BLD)/x86 $(BIT8_BLD)/x86 $(BIT16_BLD)/x86 \
346 + $(TOOLS_BLD) $(TOOLS_BLD)/input $(TOOLS_BLD)/output \
347 + $(TESTS_CHKASM_BLD)/bit8 $(TESTS_CHKASM_BLD)/bit16 \
348 + $(TESTS_CHKASM_BLD)/x86 $(TESTS_FUZZER_BLD) \
354 + mkdir -p $(DESTDIR)$(LIBDIR)
355 + cp -a $(STATIC_LIB) $(DESTDIR)$(LIBDIR)
356 + cp -a $(SHARED_LIB) $(DESTDIR)$(LIBDIR)
357 + mkdir -p $(DESTDIR)$(INCDIR)
358 + cp -a include/dav1d $(DESTDIR)$(INCDIR)
359 + rm -f $(DESTDIR)$(INCDIR)/dav1d/meson.build
360 + rm -f $(DESTDIR)$(INCDIR)/dav1d/version.h.in
361 + cp -a $(BUILD)/include/dav1d/version.h $(DESTDIR)$(INCDIR)/version.h