#!/usr/bin/make -f #export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all include /usr/share/dpkg/pkg-info.mk PKD = $(abspath $(dir $(MAKEFILE_LIST))) PKG = $(DEB_SOURCE) VER = $(DEB_VERSION_UPSTREAM) COMMIT = $$(git log -1 --pretty=%h) LAST_TAG=$$(git describe --tags --abbrev=0) COUNT_SINCE_LAST_TAG=$$(git rev-list $(LAST_TAG).. --count) BASENAME=$(PKG)_$(VER)+$(COUNT_SINCE_LAST_TAG)+git$(COMMIT) DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) rav1e_archs = $(shell sed -n 's/.*\blibrav1e-dev[[:space:]]*\[\(.*\)\].*/\1/p' debian/control) %: dh $@ override_dh_auto_configure: dh_auto_configure --buildsystem=cmake -- \ -DCMAKE_INSTALL_INCLUDEDIR=include/$(DEB_HOST_MULTIARCH) \ -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_HOST_MULTIARCH)" \ -DPLUGIN_DIRECTORY=/usr/lib/$(DEB_HOST_MULTIARCH)/libheif/plugins \ -DCMAKE_COMPILE_WARNING_AS_ERROR=OFF \ -DWITH_AOM_DECODER_PLUGIN=ON \ -DWITH_AOM_ENCODER_PLUGIN=ON \ -DWITH_DAV1D=ON \ -DWITH_DAV1D_PLUGIN=ON \ -DWITH_HEADER_COMPRESSION=ON \ -DWITH_FFMPEG_DECODER=ON \ -DWITH_FFMPEG_DECODER_PLUGIN=ON \ -DWITH_JPEG_DECODER=ON \ -DWITH_JPEG_DECODER_PLUGIN=ON \ -DWITH_JPEG_ENCODER=ON \ -DWITH_JPEG_ENCODER_PLUGIN=ON \ -DWITH_LIBDE265_PLUGIN=ON \ -DWITH_OpenJPEG_DECODER=ON \ -DWITH_OpenJPEG_DECODER_PLUGIN=ON \ -DWITH_OpenJPEG_ENCODER=ON \ -DWITH_OpenJPEG_ENCODER_PLUGIN=ON \ -DWITH_X265_PLUGIN=ON \ -DWITH_RAV1E=$(if $(filter $(DEB_HOST_ARCH),$(rav1e_archs)),ON,OFF) \ -DWITH_RAV1E_PLUGIN=$(if $(filter $(DEB_HOST_ARCH),$(rav1e_archs)),ON,OFF) \ -DWITH_SvtEnc=ON \ -DWITH_SvtEnc_PLUGIN=ON \ -DWITH_UNCOMPRESSED_CODEC=ON override_dh_auto_test: ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) LIBHEIF_PLUGIN_PATH=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/libheif/plugins ./debian/tests/test-decode LIBHEIF_PLUGIN_PATH=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/libheif/plugins dh_auto_test endif # some dependencies are in Ubuntu "universe" # https://launchpad.net/bugs/2004453 https://launchpad.net/bugs/2004446 override_dh_gencontrol: ifeq ($(shell dpkg-vendor --query vendor),Ubuntu) dh_gencontrol -- \ -Vlibheif:Depends='libheif-plugin-aomdec (= $${binary:Version}) | libheif-plugin-dav1d (= $${binary:Version})' \ -Vlibheif:Suggests:'libheif-plugin-x265 (= $${binary:Version})' else dh_gencontrol -- \ -Vlibheif:Depends='libheif-plugin-dav1d (= $${binary:Version}) | libheif-plugin-aomdec (= $${binary:Version})' \ -Vlibheif:Recommends:'libheif-plugin-x265 (= $${binary:Version})' endif UURL = git://github.com/strukturag/libheif.git get-head-source: $(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting.)) @echo "# Downloading..." git clone $(UURL) $(PKG)-$(VER) \ || $(RM) -r $(PKG)-$(VER) cd $(PKG)-$(VER) \ && echo "# Checking out commit $(COMMIT)..." \ && git checkout -q $(COMMIT) \ && echo "# Setting times..." \ && git ls-tree -r --name-only HEAD | while read F ; do touch --no-dereference -d "@$$(git log -1 --format="%ct" -- "$$F")" "$$F"; done \ && echo "# Writing to $(BASENAME).orig.tar.xz..." \ && find -L . -xdev -type f -not -path "*/.git/*" -print | LC_ALL=C sort \ | XZ_OPT="-6v" tar -caf "../$(BASENAME).orig.tar.xz" -T- --transform "s/^\./$(BASENAME)/g" --owner=root --group=root --mode=a+rX @echo "# Cleaning up..." \ && $(RM) -r "$(PKG)-$(VER)"