1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS=hardening=+all optimize=-lto
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
export VERBOSE=1
endif
export CURDIR
VERSION := $(shell cat M2/VERSION)
%:
dh $@ --sourcedirectory=M2 --with linktree
LIBDIR := \$${exec_prefix}/lib/$(DEB_HOST_MULTIARCH)
ELPA_VERSION := $(shell emacs --batch \
--eval '(require (quote package))' \
--eval '(princ (package-version-join (version-to-list "$(VERSION)")))' \
2> /dev/null)
EMACSDIR := \
\$${prefix}/share/emacs/site-lisp/elpa-src/macaulay2-$(ELPA_VERSION)
WITH_PYTHON := $(if $(filter nopython, $(DEB_BUILD_PROFILES)), --without-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
KATEX_DIR := $(CURDIR)/M2/Macaulay2/packages/Style/katex
KATEX_FILES := $(patsubst %, $(KATEX_DIR)/%, \
katex.min.css katex.min.js contrib/auto-render.min.js \
contrib/copy-tex.min.js contrib/render-a11y-string.min.js)
$(KATEX_DIR):
mkdir -p $@/contrib
$(KATEX_DIR)/%: $(KATEX_DIR)
touch $@
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 $</*.out $@
execute_before_dh_auto_build: $(KATEX_FILES) $(EXAMPLE_DEST)
touch M2/Macaulay2/packages/Style/prism.js
override_dh_auto_test-arch:
$(MAKE) -C M2 check ArgumentMode="defaultMode - SetUlimit" \
TLIMIT=unlimited
PKGLIBDIR := debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/Macaulay2
PKGDOCDIR := debian/tmp/usr/share/doc/Macaulay2
DB_FILENAME := rawdocumentation-$(if \
$(filter little, $(DEB_HOST_ARCH_ENDIAN)),dcba,abcd)-$(if \
$(filter 64, $(DEB_HOST_ARCH_BITS)),8,4).db
DB_FILES = $(wildcard $(PKGLIBDIR)/*/cache/$(DB_FILENAME))
DUMP_FILES = $(DB_FILES:$(PKGLIBDIR)/%/cache/$(DB_FILENAME)=\
$(PKGDOCDIR)/%/dump/rawdocumentation.dump)
$(PKGDOCDIR)/%/dump/rawdocumentation.dump: $(PKGLIBDIR)/%/cache/$(DB_FILENAME)
mkdir -p $(dir $@)
cd $(dir $<) && \
faketime '@$(SOURCE_DATE_EPOCH)' \
gdbm_dump $(notdir $<) $(CURDIR)/$@
execute_after_dh_auto_install-indep: $(DUMP_FILES)
rm -rf $(EXAMPLE_DEST)
for DIR in $(subst /examples,,$(EXAMPLE_DEST)); \
do if [ -z "$$(ls -A $$DIR)" ]; then rm -rf $$DIR; fi; \
done
rm -rf $(PKGLIBDIR)
$(MAKE) -C M2/Macaulay2/editors prism/prism.js
cp M2/Macaulay2/editors/prism/prism.js \
debian/tmp/usr/share/Macaulay2/Style
execute_before_dh_link-indep:
jdupes -rl debian/macaulay2-common/usr/share/doc/Macaulay2
override_dh_linktree-indep:
dh_linktree -X.uuid
override_dh_compress:
dh_compress -Xexample-output -X.m2 -X.dump
execute_before_dh_elpa: debian/macaulay2-pkg.el
debian/macaulay2-pkg.el: debian/macaulay2-pkg.el.in
sed -e 's|@VERSION@|$(ELPA_VERSION)|g' $< > $@
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)
get-orig-source:
debian/scripts/m2-get-orig-source.sh
|