#!/usr/bin/make -f include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk # for SOURCE_DATE_EPOCH export DEB_BUILD_MAINT_OPTIONS=hardening=+all optimize=-lto ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS))) export VERBOSE=1 endif # needed for reproducible-version.patch export CURDIR VERSION := $(shell cat M2/VERSION) %: dh $@ --sourcedirectory=M2 --with linktree # use exec_prefix instead of prefix in libdir, as that's what's needed # to properly substitute paths in Layout#2 LIBDIR := \$${exec_prefix}/lib/$(DEB_HOST_MULTIARCH) # set emacs lisp file installation directory so that the documentation # matches where dh_elpa installs them EMACSDIR := \ \$${prefix}/share/emacs/site-lisp/elpa/macaulay2-$(VERSION) # fix TBB linking issue on armel (https://github.com/Macaulay2/M2/pull/2528) ifeq ($(DEB_HOST_ARCH),armel) LIBS = -latomic endif WITH_PYTHON := $(if $(filter nopython, $(DEB_BUILD_PROFILES)),, --with-python) ifneq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) DISABLE_DOCUMENTATION = --disable-documentation else DISABLE_DOCUMENTATION := $(if $(shell dh_listpackages -i),,\ --disable-documentation) endif override_dh_auto_configure: dh_auto_configure -- \ --libdir=$(LIBDIR) \ --with-emacsdir=$(EMACSDIR) \ --with-system-memtailor \ --with-system-mathic \ --with-system-mathicgb \ --with-system-gc \ LIBS="$(LIBS)" \ $(WITH_PYTHON) \ $(DISABLE_DOCUMENTATION) \ $(if $(DISABLE_DOCUMENTATION),,--enable-syntax-highlighting) ifeq ($(DISABLE_DOCUMENTATION),) dh_auto_configure --buildsystem=nodejs mv node_modules M2/Macaulay2/editors/prism endif # copy cached example output files (for examples known to fail on # various architectures) to source directory # see generateExamples in debian/scripts/Debian.m2 EXAMPLE_SRC := $(wildcard $(CURDIR)/debian/examples/*) EXAMPLE_DEST := $(patsubst $(CURDIR)/debian/examples/%, \ $(CURDIR)/M2/Macaulay2/packages/%/examples, $(EXAMPLE_SRC)) $(CURDIR)/M2/Macaulay2/packages/%/examples: $(CURDIR)/debian/examples/% mkdir -p $@ cp -v $ $@ # prevent dh_missing from failing when only building arch-dependent packages execute_before_dh_missing: if [ ! -f debian/macaulay2-pkg.el ]; \ then \ rm -rf debian/tmp/usr/share/emacs; \ fi override_dh_installdeb: dh_installdeb --define DEB_HOST_MULTIARCH=$(DEB_HOST_MULTIARCH) \ --define DB_FILENAME=$(DB_FILENAME) # we use uscan to check for the most recent version, but to create an # orig tarball, we also need the contents of the M2-emacs submodule, # so use this target instead of uscan directly get-orig-source: debian/scripts/m2-get-orig-source.sh