Name x265
Description H.265/HEVC video stream encoder
Version 4.1-2
Package Base
Homepage https://bitbucket.org/multicoreware/x265_git
Maintainers ['Debian Multimedia Maintainers <debian-multimedia@lists.debian.org>']
Contributors ['Sebastian Ramacher <sramacher@debian.org>']
Distro-repo https://salsa.debian.org/multimedia-team/x265
Sources ['https://sources.debian.org/data/main/x/x265/4.1-2/debian/watch', 'https://sources.debian.org/src/x265/4.1-2/debian/patches/0001-Fix-arm-flags.patch', 'https://sources.debian.org/src/x265/4.1-2/debian/patches/0002-Detect-x32-handle-as-non-x86-and-no-ASM-for-now-but-.patch', 'https://sources.debian.org/src/x265/4.1-2/debian/patches/0003-Drop-dlopen-code-path-that-will-never-be-hit.patch', 'https://sources.debian.org/src/x265/4.1-2/debian/patches/0004-Do-not-build-with-assembly-support-on-arm.patch', 'https://sources.debian.org/src/x265/4.1-2/debian/patches/series']
Dependencies ['libc6', 'libstdc++6', 'libx265-215']
Optional-Dependencies []
Build-Dependencies ['debhelper-compat', 'cmake', 'git', 'libnuma-dev [amd64 arm64 i386 mips mips64 mips64el mipsel powerpc ppc64el]', 'nasm [amd64]', 'ninja-build']
Provides []
Builddate
Architecture amd64
Distro-Version trixie
Licenses []
Hash 3cb0814c4b777913705536f178d70200f36dee2b6a6c1b33281ccc1ee41a3a88
#! /usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed \
	-L$(CURDIR)/x265-10bit \
	-L$(CURDIR)/x265-12bit
# see #789111
export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions
# LFS support
export DEB_CPPFLAGS_MAINT_APPEND=$(shell getconf LFS_CFLAGS)

FLAGS  = -DENABLE_PIC=ON
# no shared libs are built if HDR10+ is enabled
# FLAGS += -DENABLE_HDR10_PLUS=ON
FLAGS_OTHERBIT  = -DENABLE_CLI=OFF
FLAGS_OTHERBIT += -DENABLE_SHARED=OFF
FLAGS_OTHERBIT += -DEXPORT_C_API=OFF
FLAGS_OTHERBIT += -DHIGH_BIT_DEPTH=ON

# enable assembly builds on amd64 and arm64
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64))
FLAGS += -DENABLE_ASSEMBLY=ON
else
FLAGS += -DENABLE_ASSEMBLY=OFF
endif

# disable altivec on ppc64 (see #923650)
ifneq (,$(filter $(DEB_HOST_ARCH),ppc64))
FLAGS += -DENABLE_ALTIVEC=OFF -DCPU_POWER8=OFF
endif
# disable altivec on ppc64el if building 10 bit and 12 bit versions
# see https://bitbucket.org/multicoreware/x265/issues/320/fail-to-build-on-power8-le
ifneq (,$(filter $(DEB_HOST_ARCH),ppc64el))
FLAGS_OTHERBIT += -DENABLE_ALTIVEC=OFF
endif

%:
	dh $@ --buildsystem=cmake+ninja \
		--sourcedirectory=source \
		--builddirectory=x265-8bit

override_dh_auto_clean:
	dh_auto_clean --builddirectory=x265-10bit
	dh_auto_clean --builddirectory=x265-12bit
	dh_auto_clean
	rm -rf doc/reST/build

# -arch bits

override_dh_auto_configure-arch:
	dh_auto_configure --builddirectory=x265-10bit -- \
		$(FLAGS) $(FLAGS_OTHERBIT)
	dh_auto_configure --builddirectory=x265-12bit -- \
		$(FLAGS) $(FLAGS_OTHERBIT) \
		-DMAIN12=ON
	dh_auto_configure -- \
		$(FLAGS) $(FLAGS_8BIT) \
		-DLIB_INSTALL_DIR=lib/$(DEB_HOST_MULTIARCH) \
		-DEXTRA_LIB="x265_main10.a;x265_main12.a" \
		-DLINKED_10BIT=ON \
		-DLINKED_12BIT=ON

execute_before_dh_auto_build-arch:
	dh_auto_build --builddirectory=x265-10bit
	dh_auto_build --builddirectory=x265-12bit
	mv x265-10bit/libx265.a x265-10bit/libx265_main10.a
	mv x265-12bit/libx265.a x265-12bit/libx265_main12.a

override_dh_auto_test-arch:
	# no tests

debian/arscript:
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/' debian/arscript.in > debian/arscript

execute_after_dh_auto_install-arch: debian/arscript
	rm debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libx265.a
	ar -M <debian/arscript

# -indep bits

# no configure, test and install for indep
override_dh_auto_configure-indep override_dh_auto_test-indep override_dh_auto_install-indep:

override_dh_auto_build-indep:
	$(MAKE) -C doc/reST html

override_dh_installchangelogs:
	dh_installchangelogs doc/reST/releasenotes.rst