Imported Debian patch 1.4-3~trusty
[deb_x265.git] / debian / rules
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..3fc0ba7
--- /dev/null
@@ -0,0 +1,78 @@
+#!/usr/bin/make -f
+
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+DEB_HOST_GNU_CPU   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
+DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+API ?= $(shell debian/getapi.sh)
+LIB  = $(CURDIR)/debian/install/usr/lib/$(DEB_HOST_MULTIARCH)
+
+include debian/confflags
+
+builddir     = compiling
+x265-clean   = rm -rf $(builddir) && mkdir $(builddir)
+x265-install = $(MAKE) -C $(builddir) install DESTDIR=$(CURDIR)/debian/install
+x265-build   = dh_auto_build -D$(builddir)
+test-build   = \
+       $(builddir)/x265 --pass 1 --bitrate 10 -o /dev/null debian/test.y4m && \
+       $(builddir)/x265 --pass 2 --bitrate 10 -o test.hevc debian/test.y4m
+
+
+%:
+       dh ${@} --parallel
+
+override_dh_auto_clean:
+       dh_auto_clean
+       rm -rf $(builddir) doc/reST/build debian/install debian/test.y4m
+
+override_dh_auto_build:
+       sed -e 's/@API@/$(API)/g' debian/control.in > debian/control
+       cp -f debian/libx265N.install debian/libx265-$(API).install
+       unxz -fk debian/test.y4m.xz
+# build x265 8-bit
+       mkdir $(builddir)
+       cd $(builddir) && cmake $(8bit_confflags) ../source
+       $(x265-build)
+       $(x265-install)
+# test x265 8-bit
+       $(test-build)
+# build x265 10-bit
+       $(x265-clean)
+       cd $(builddir) && cmake $(10bit_confflags) ../source
+       $(x265-build)
+       $(x265-install)
+       sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' \
+               debian/x265-10bit.in > $(builddir)/x265-10bit
+       install -c -D -m755 $(builddir)/x265-10bit $(CURDIR)/debian/install/usr/bin
+# test x265 10-bit
+       $(test-build)
+# build x265 8-bit static
+       $(x265-clean)
+       rm -f $(LIB)/libx265.a
+       cd $(builddir) && cmake $(8bit_static_confflags) ../source
+       $(x265-build)
+       install -c -D -m644 $(builddir)/libx265.a $(LIB)
+# build x265 10-bit static
+       $(x265-clean)
+       rm -f $(LIB)/x265-10bit/libx265.a
+       cd $(builddir) && cmake $(10bit_static_confflags) ../source
+       $(x265-build)
+       install -c -D -m644 $(builddir)/libx265.a $(LIB)/x265-10bit
+# build documentation
+       $(MAKE) -C doc/reST pickle html
+
+override_dh_install:
+       dh_install --list-missing --sourcedir=$(CURDIR)/debian/install
+
+override_dh_installchangelogs:
+       dh_installchangelogs -px265-doc -plibx265-$(API) ChangeLog
+
+override_dh_installdocs:
+       dh_installdocs -plibx265-$(API) -px265-doc -X.buildinfo
+       dh_installdocs -px265 -px265-dbg -plibx265-dev --link-doc=libx265-$(API)
+
+override_dh_strip:
+       dh_strip --dbg-package=x265-dbg
+
+override_dh_builddeb:
+       dh_builddeb -- -Zxz -z9
+