debian: rules: Fix FFmpeg linking issues on Ubuntu.
* packaging/rules/debian/rules (LDFLAGS): Filter out the
-Bsymbolic-functions linker option added by default on Ubuntu.
[ubuntu_21.04]: Do not force the bundling of FFmpeg.
Change-Id: Ia83c305808072a4e5923530421924eb85f9b5b5e
diff --git a/packaging/rules/debian/rules b/packaging/rules/debian/rules
index de15c8c..276f2f8 100755
--- a/packaging/rules/debian/rules
+++ b/packaging/rules/debian/rules
@@ -6,6 +6,15 @@
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
+# Ubuntu defaults to use -Bsymbolic-functions, which breaks linking
+# shared objects with static FFmpeg archives (see:
+# https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1942352).
+ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
+ifneq (,$(LDFLAGS))
+ LDFLAGS := $(filter-out %-Bsymbolic-functions,$(LDFLAGS))
+endif
+endif
+
# Number of CPUS
NO_CPUS=$(shell nproc)
ifeq ($(NO_CPUS),0)
@@ -30,10 +39,6 @@
-DCMAKE_CXX_COMPILER=${HOST_ARCH}-g++ \
-DCMAKE_FIND_ROOT_PATH=/usr/${HOST_ARCH} \
-DPKG_CONFIG_EXECUTABLE=/usr/bin/${HOST_ARCH}-pkg-config
-else
-ifneq (ubuntu_21.04,$(findstring ubuntu_21.04, $(DISTRIBUTION)))
-BUNDLED_PKGS="--enable-ffmpeg" # For ubuntu 21.04 it seems there is massive issues with linking for swscale
-endif
endif
# Qt-related variables