summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 58ad7e196d26cef24c467d9884707b19005db29a (plain)
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
#!/usr/bin/make -f
# debian/rules for coq

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export COQTEST_SKIPCOMPLEXITY = true
export CAML_LD_LIBRARY_PATH = $(shell pwd)/kernel/byterun

# We want to use dpatch
include /usr/share/dpatch/dpatch.make

HTMLDOC := doc/stdlib/html/index.html

COQPREF := $(CURDIR)/debian/tmp
ADDPREF := COQINSTALLPREFIX=$(COQPREF)

OFILES := $(patsubst %.in,%,$(wildcard debian/*.in))
OCAMLABI := $(shell ocamlc -version)

CONFIGUREOPTS := --arch Linux --prefix /usr --mandir /usr/share/man \
  --emacslib /usr/share/emacs/site-lisp/coq --reals all --fsets all \
  --browser "/usr/bin/x-www-browser %s &" \
  --with-doc no --coqrunbyteflags "-dllib -lcoqrun"

OCAMLINITSED := -e 's/@OCamlABI@/$(OCAMLABI)/g'

ifeq ($(shell test -e /usr/bin/ocamlopt && echo yes),yes)
  CONFIGUREOPTS += -opt
  OCAMLINITSED += -e 's/^OPT: //'
else
  OCAMLINITSED += -e '/^OPT: /d'
endif

ocamlinit: ocamlinit-stamp
ocamlinit-stamp:
	for f in $(OFILES); do sed $(OCAMLINITSED) $$f.in > $$f; done
	touch $@

configure: configure-stamp
configure-stamp: patch-stamp ocamlinit-stamp
	dh build --before dh_auto_configure
	./configure $(CONFIGUREOPTS)
	touch $@

build: build-stamp
build-stamp: configure-stamp
	dh_testdir
	$(MAKE) STRIP=true check
	if [ -f bin/coqtop.opt ]; then touch opt-stamp; fi
	$(MAKE) COQDOC="bin/coqdoc --coqlib_path `pwd`" \
	  DOC_TARGETS=$(HTMLDOC) $(HTMLDOC)
	dh build --after dh_auto_test
	touch $@

install: install-stamp
install-stamp: build-stamp
	dh install --before dh_auto_install
	$(MAKE) $(ADDPREF) install
	dh_install -XFAQ --list-missing
	mv debian/coq-libs/usr/lib/coq/contrib/micromega/csdpcert debian/coq/usr/lib/coq/contrib/micromega
	cp debian/coq.xpm debian/coq/usr/share/pixmaps
	cp debian/coq.xpm debian/coqide/usr/share/pixmaps/coqide.xpm
	cp debian/coqide.desktop debian/coqide/usr/share/applications
	cp -r doc/stdlib/html debian/coq-libs/usr/share/doc/coq-libs/
	dh install --after dh_install
	touch $@

clean: unpatch
	dh $@
	rm -f debian/substvars $(OFILES)

binary-indep: install-stamp
	dh $@

binary-arch: install-stamp
	for u in coq coqide; do echo 'F:OCamlABI=$(OCAMLABI)' >> debian/$$u.substvars; done
	dh $@

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure ocamlinit