mkvtoolnix/packaging/debian/rules
Moritz Bunkus 4342cc89c3
Debian packaging: compile with clang on Debian 11 Bullseye
The next stable release of Debian, version 11 "Bullseye", will ship
with a gcc version that produces an "internal compiler error"
segmentation fault when compiling current versions of MKVToolNix. This
error has been fixed in gcc upstream as well as the gcc in Debian
testing, but it won't be backported to the one in Bullseye.

There are two possible workarounds:

1. Compile with clang instead (this is what this commit does)
2. Compile with gcc 9 which Bullseye also ships

As I've been using clang in parallel to gcc for years, I've opted to
compile with it instead of the older gcc 9 for Bullseye.

Ubuntu releases don't suffer from this issue:

* 20.04 comes with gcc 9.3.0
* 20.10 & 21.04 come with gcc 10.3
2021-07-10 11:40:42 +02:00

69 lines
1.8 KiB
Makefile
Executable File

#!/usr/bin/make -f
.PHONY: override_dh_clean override_dh_auto_configure override_dh_auto_build override_dh_install override_dh_strip override_dh_installchangelogs override_dh_builddeb
LDFLAGS += -Wl,-z,defs -Wl,--as-needed
# uncomment line to turn verbose mode on
#export V=1
%:
dh $@ --parallel
override_dh_clean:
[ ! -f build-config ] || rake clean:dist
dh_clean config.status config.log \
rake.d/dependecy.d/*.rb src/input/*.d config.h build-config
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
rm -rf lib/gtest
endif
override_dh_auto_configure:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
mkdir -p lib/gtest
cp -R /usr/include/gtest lib/gtest/
mv lib/gtest/gtest lib/gtest/include
cp -R /usr/src/gtest/src lib/gtest/
endif
# gcc 10 in Debian 11 Bullseye contains a bug that causes an
# "internal compiler error" segfault. Workaround: compile with
# clang.
if grep -qr bullseye /etc/apt/sources.list*; then \
dh_auto_configure -- CC=/usr/bin/clang CXX=/usr/bin/clang++ \
--docdir='$${datarootdir}/doc/mkvtoolnix-gui' \
--enable-debug --enable-optimization ; \
else \
dh_auto_configure -- --docdir='$${datarootdir}/doc/mkvtoolnix-gui' \
--enable-debug --enable-optimization ; \
fi
override_dh_auto_build:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
LC_ALL=C rake tests:run_unit
endif
rake
override_dh_install:
rake install DESTDIR=$(CURDIR)/debian/tmp
dh_install -Xorg.bunkus.mkvtoolnix-gui.xml
dh_missing --fail-missing -Xorg.bunkus.mkvtoolnix-gui.xml
override_dh_strip:
dh_strip -pmkvtoolnix --dbg-package=mkvtoolnix-dbg
dh_strip -pmkvtoolnix-gui --dbg-package=mkvtoolnix-gui-dbg
override_dh_installchangelogs:
dh_installchangelogs NEWS.md
override_dh_builddeb:
case $(shell uname -m) in \
i*86) dh_builddeb -- -Zxz ;; \
*) dh_builddeb -- -Zxz -z9 ;; \
esac