#!/usr/bin/make -f include /usr/share/dpkg/architecture.mk export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh $@ # only enable tcmalloc if: # 1. it's available on the given architecture (i.e., we haven't blacklisted # libgoogle-perftools-dev in Build-Depends d/control) HAVE_TCMALLOC := $(shell dpkg-query -W libgoogle-perftools-dev 2> /dev/null) # 2. it doesn't give us a "cannot allocate memory in static TLS block" error. # possibly related: https://bugzilla.redhat.com/1483558 NO_TCMALLOC_ERROR := $(filter-out \ arm64 armel armhf mips64el mipsel s390x riscv64 loong64, \ $(DEB_HOST_ARCH)) ENABLE_TCMALLOC := $(if $(and $(HAVE_TCMALLOC), $(NO_TCMALLOC_ERROR)), \ --enable-tcmalloc, --disable-tcmalloc) override_dh_auto_configure: dh_auto_configure -- $(ENABLE_TCMALLOC) # stash upstream's bsd yacc-generated files so bison regenerates them # and we don't get an implicit declaration compiler error # https://github.com/robol/MPSolve/issues/48 YACC_PARSER = src/libmps/monomial/yacc-parser execute_before_dh_auto_build: mv $(YACC_PARSER).c $(YACC_PARSER).c.bak mv $(YACC_PARSER).h $(YACC_PARSER).h.bak execute_after_dh_auto_test: mv $(YACC_PARSER).c.bak $(YACC_PARSER).c mv $(YACC_PARSER).h.bak $(YACC_PARSER).h