summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules88
1 files changed, 88 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..014134a7
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,88 @@
+#!/usr/bin/make -f
+# debian/rules for coq
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# Build cache (for accelerating Debian debugging)
+BUILDCACHE := $(wildcard ../coq.cache)
+
+# This has to be exported to make some magic below work.
+export COQTEST_SKIPCOMPLEXITY = true
+export CAML_LD_LIBRARY_PATH = $(shell pwd)/kernel/byterun
+
+# Show full commands when building Coq
+export VERBOSE=1
+
+include /usr/share/ocaml/ocamlinit.mk
+
+HTMLDOC := doc/stdlib/html/index.html
+
+COQPREF := $(CURDIR)/debian/tmp
+ADDPREF := COQINSTALLPREFIX=$(COQPREF)
+
+PACKAGES := $(shell awk '/Package:/{print $$2}' debian/control)
+
+COQ_VERSION := $(shell head -n1 debian/changelog | awk -F'[+() ]' '{print $$3}')
+COQ_ABI := $(COQ_VERSION)+$(OCAML_ABI)
+
+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"
+
+OCAMLINIT_SED += \
+ -e 's%@CoqVersion@%$(COQ_VERSION)%' \
+ -e 's%@CoqABI@%$(COQ_ABI)%'
+
+configure: configure-stamp
+configure-stamp: ocamlinit-stamp
+ dh build --before dh_auto_configure
+ ./configure $(CONFIGUREOPTS)
+ touch $@
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+ifeq ($(BUILDCACHE),)
+ $(MAKE) STRIP=true check
+ $(MAKE) DOC_TARGETS=$(HTMLDOC) $(HTMLDOC)
+else
+ rsync -a --exclude=debian --exclude=.git $(BUILDCACHE)/ .
+endif
+ dh build --after dh_auto_test
+ touch $@
+
+install: install-stamp
+install-stamp: build-stamp
+ dh install --before dh_auto_install
+ $(MAKE) $(ADDPREF) install
+ find debian/tmp -regextype posix-awk \
+ -regex '.*\.(cm[aoxi]|cmxa|[ao])$$' \
+ >> debian/libcoq-ocaml-dev.install
+ find debian/tmp -name '*.vo' -printf '%P\n' \
+ >> debian/coq-theories.install
+ dh_install --list-missing
+ 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-theories/usr/share/doc/coq-theories/
+ cp debian/coqvars.mk debian/coq/usr/share/coq/
+ dh install --after dh_install
+ for u in $(PACKAGES); do \
+ echo 'F:OCamlABI=$(OCAML_ABI)' >> debian/$$u.substvars; \
+ echo 'F:CoqABI=$(COQ_ABI)' >> debian/$$u.substvars; \
+ done
+ touch $@
+
+clean: ocamlinit-clean
+ dh $@
+
+binary-indep: install-stamp
+ dh $@
+
+binary-arch: install-stamp
+ dh $@
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure ocamlinit