#!/usr/bin/make -f

ifneq (,$(filter mips mipsel mips64el,$(DEB_HOST_GNU_CPU)))
	confflags=--disable-asm
endif

ifeq "$(DEB_HOST_ARCH)" "arm64"
	EXTRA_LDFLAGS=-Wl,-fuse-ld=gold
	EXTRA_CFLAGS=-fuse-ld=gold
endif

%:
	dh $@ --with bash-completion

override_dh_auto_configure:
	./configure --prefix=/usr --host=$(DEB_HOST_GNU_TYPE) \
	--enable-debug --enable-static --disable-lavf --enable-shared \
	--disable-avs --enable-pic --system-libx264 \
	--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--extra-ldflags="-Wl,-z,defs -Wl,--as-needed $(EXTRA_LDFLAGS)" $(confflags) --extra-cflags=$(EXTRA_CFLAGS)

#	exit 1



override_dh_install:

ifeq "$(DEB_BUILD_ARCH)" "amd64"
	LD_LIBRARY_PATH=$(CURDIR):$(LD_LIBRARY_PATH) help2man -N --help-option=--fullhelp --name="video encoder for the H.264/MPEG-4 AVC standard" ./x264  > debian/x264.1
endif

	dh_install

override_dh_auto_clean:
	touch config.mak

	dh_auto_clean
