File: rules

package info (click to toggle)
sagetex 3.2+ds-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 456 kB
  • sloc: makefile: 129; python: 32; sh: 7
file content (86 lines) | stat: -rwxr-xr-x 3,848 bytes parent folder | download
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
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
## the time-related TeX primitives are used in example.tex
## which served as test and whose PDF output is distributed
## -- see pdftex(1) for details.
export FORCE_SOURCE_DATE=1

DEB_PYTHON_VERSION ?= $(shell python2 -c "import sys; print '%d.%d'%(sys.version_info[0],sys.version_info[1])")

UPS_DOCSTRIP_INS ?= sagetex.ins
DEB_DTX_DOCSTRIP_CFG_IN ?= debian/docstrip.cfg.in

DEB_TDS_BASEDIRECTORY        := $(shell sed -n 's|^\\BaseDirectory{./\(.*\)}|\1|p' $(DEB_DTX_DOCSTRIP_CFG_IN))
DEB_DTX_LISTOF_DECLAREDIR_IN := $(shell sed -n 's|^\\DeclareDir\*{[A-Z]*DIR}{./\(.*\)}|\1|p' $(DEB_DTX_DOCSTRIP_CFG_IN))
DEB_DTX_LISTOF_TDS_USEDIR    := $(shell sed -n 's|^\\usedir{\([a-z]*\)/\(.*\)}|\1/\2|p' $(UPS_DOCSTRIP_INS))

DEB_DTX_DOCSTRIP_CFG = _build/$(patsubst %.in,%,$(notdir $(DEB_DTX_DOCSTRIP_CFG_IN)))
DEB_DTX_LISTOF_DECLAREDIR = $(subst @PYTHON@,python$(DEB_PYTHON_VERSION),$(DEB_DTX_LISTOF_DECLAREDIR_IN))
DEB_DTX_LISTOF_TDS_USEDIR_TEX = $(strip $(filter tex/%,$(DEB_DTX_LISTOF_TDS_USEDIR)))
DEB_DTX_LISTOF_TDS_USEDIR_SCRIPTS = $(strip $(filter scripts/%,$(DEB_DTX_LISTOF_TDS_USEDIR)))

DEB_TEX_OPTS = -interaction batchmode

default:
	@uscan --no-conf --dehs --report || true

%:
	dh $@ --with tex --with python2

override_dh_auto_build:
	$(MKDIR_P) $(dir $(DEB_DTX_DOCSTRIP_CFG))
	$(MKDIR_P) $(DEB_TDS_BASEDIRECTORY)
	$(MKDIR_P) $(DEB_DTX_LISTOF_DECLAREDIR)
	$(MKDIR_P) $(addprefix $(DEB_TDS_BASEDIRECTORY)/,$(DEB_DTX_LISTOF_TDS_USEDIR))
	sed -e 's|@PYTHON@|python'$(DEB_PYTHON_VERSION)'|g' $(DEB_DTX_DOCSTRIP_CFG_IN) > $(DEB_DTX_DOCSTRIP_CFG)
	echo "\PassOptionsToClass{a4paper}{article}" > $(dir $(DEB_DTX_DOCSTRIP_CFG))/ltxdoc.cfg
	TEXINPUTS=".:$(dir $(DEB_DTX_DOCSTRIP_CFG)):" $(INITEX) $(DEB_TEX_OPTS) $(UPS_DOCSTRIP_INS)
	$(if $(DEB_DTX_LISTOF_TDS_USEDIR_SCRIPTS),\
		chmod -vf 0755 $(addsuffix /*.py,$(addprefix $(DEB_TDS_BASEDIRECTORY)/,$(DEB_DTX_LISTOF_TDS_USEDIR_SCRIPTS))),@true)

DEB_DH_AUTO_TEST_MAXIMA_USERDIR = $(CURDIR)/_test/MAXIMA_USERDIR
DEB_DH_AUTO_TEST_MPLCONFIGDIR = $(CURDIR)/_test/MPLCONFIGDIR
DEB_DH_AUTO_TEST_DOT_SAGE = $(CURDIR)/_test/DOT_SAGE
DEB_DH_AUTO_TEST_PKG_TEXINPUTS = $(subst $(EMPTY),:,$(addprefix $(DEB_TDS_BASEDIRECTORY)/,$(DEB_DTX_LISTOF_TDS_USEDIR_TEX)))
DEB_DH_AUTO_TEST_PKG_PYTHONPATH = $(subst $(EMPTY),:,$(DEB_DTX_LISTOF_DECLAREDIR))
DEB_DH_AUTO_TEST_MAKEFLAGS = TEXOPTS="$(DEB_TEX_OPTS)" TEXINPUTS=".:$(DEB_DH_AUTO_TEST_PKG_TEXINPUTS):$(dir $(DEB_DTX_DOCSTRIP_CFG)):"
DEB_DH_AUTO_TEST_MAKEFLAGS += PYTHONPATH=$(DEB_DH_AUTO_TEST_PKG_PYTHONPATH)
DEB_DH_AUTO_TEST_MAKEFLAGS += VPATH=$(DEB_DH_AUTO_TEST_PKG_TEXINPUTS):$(DEB_DH_AUTO_TEST_PKG_PYTHONPATH)
DEB_DH_AUTO_TEST_MAKEFLAGS += DOT_SAGE=$(DEB_DH_AUTO_TEST_DOT_SAGE)
DEB_DH_AUTO_TEST_MAKEFLAGS += MPLCONFIGDIR=$(DEB_DH_AUTO_TEST_MPLCONFIGDIR)
DEB_DH_AUTO_TEST_MAKEFLAGS += MAXIMA_USERDIR=$(DEB_DH_AUTO_TEST_MAXIMA_USERDIR)
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(MKDIR_P) $(DEB_DH_AUTO_TEST_MAXIMA_USERDIR)
	$(MKDIR_P) $(DEB_DH_AUTO_TEST_MPLCONFIGDIR)
	$(MKDIR_P) $(DEB_DH_AUTO_TEST_DOT_SAGE)
	chmod -vf 0700 $(DEB_DH_AUTO_TEST_DOT_SAGE)
	$(MAKE) sagetex.pdf $(DEB_DH_AUTO_TEST_MAKEFLAGS)
	$(MAKE) example.pdf $(DEB_DH_AUTO_TEST_MAKEFLAGS)
endif

override_dh_auto_install:
	@true

override_dh_install:
	dh_install --sourcedir=_build/DEBIAN

override_dh_compress:
	dh_compress -X.pdf -Xexamples

override_dh_auto_clean:
	$(MAKE) clean

get-info:
	@echo "DEB_PYTHON_VERSION:         >$(DEB_PYTHON_VERSION)<"
	@echo "DEB_TDS_BASEDIRECTORY:      >$(DEB_TDS_BASEDIRECTORY)<"
	@echo "DEB_DTX_LISTOF_DECLAREDIR:  >$(DEB_DTX_LISTOF_DECLAREDIR)<"
	@echo "DEB_DTX_LISTOF_TDS_USEDIR:  >$(DEB_DTX_LISTOF_TDS_USEDIR)<"
	@echo "DEB_DTX_LISTOF_TDS_USEDIR_SCRIPTS: >$(DEB_DTX_LISTOF_TDS_USEDIR_SCRIPTS)<"


INITEX ?= /usr/bin/tex
MKDIR_P ?= /bin/mkdir -p

EMPTY :=
EMPTY +=