#!/usr/bin/make -f

DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

ifeq ($(DEB_BUILD_ARCH),amd64)
	filename="geckodriver-v0.33.0-linux64.tar.gz"
endif

ifeq ($(DEB_BUILD_ARCH),i386)
	filename="geckodriver-v0.33.0-linux32.tar.gz"
endif

ifeq ($(DEB_BUILD_ARCH),arm64)
	filename="geckodriver-v0.33.0-linux-aarch64.tar.gz"
endif

%:
	dh $@ --with python3

override_dh_auto_build:
	dh_auto_build
	wget https://github.com/mozilla/geckodriver/releases/download/v0.33.0/$(filename)
	tar -xvf $(filename)
	rm $(filename)

override_dh_auto_install:

override_dh_install:
	dh_install -Xgitignore -Xsetup
