Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / debian / rules
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..2b8f33e
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/make -f
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/makefile.mk
+include /usr/share/cdbs/1/rules/patchsys-quilt.mk
+
+# MLton compiles optimized, debug, and pic versions on its own.
+DEB_MAKE_INVOKE = $(DEB_MAKE_ENVVARS) make -C $(DEB_BUILDDIR)
+
+# The MLton guide is html. Don't compress example .sml files.
+DEB_COMPRESS_EXCLUDE_ALL = mlton/guide .sml
+
+DEB_MAKE_CLEAN_TARGET   = clean
+DEB_MAKE_BUILD_TARGET   = all docs
+DEB_MAKE_INSTALL_TARGET = install DESTDIR=$(CURDIR)/debian/tmp/ PREFIX=/usr
+DEB_MAKE_CHECK_TARGET   = check
+
+DEB_DH_STRIP_ARGS_DEFAULT = --no-automatic-dbgsym
+
+# Useful when inspecting build logs
+common-configure-arch::
+       free
+
+# Move MLton target to per-architecture path
+common-install-arch::
+       mv $(CURDIR)/debian/tmp/usr/lib/mlton/targets/self $(CURDIR)/debian/tmp/usr/lib/mlton/targets/$(DEB_HOST_MULTIARCH)
+       ln -s $(DEB_HOST_MULTIARCH) $(CURDIR)/debian/tmp/usr/lib/mlton/targets/self
+
+# Remove licenses and empty directories to appease lintian
+common-install-indep::
+       cp README.adoc README
+       rm -f $(CURDIR)/debian/tmp/usr/lib/mlton/sml/smlnj-lib/HTML4/helper.py # we don't need a python dependency for an unrelated helper script
+       rm -f $(CURDIR)/debian/tmp/usr/lib/mlton/sml/smlnj-lib/HTML4/tests/test001.html # would reveal user IP if loaded due to external validation image
+       find $(CURDIR)/debian/tmp -type d -empty -delete
+       if test -n "$(DEB_ISNATIVE)"; then mv \
+               $(CURDIR)/debian/tmp/usr/share/doc/mlton/changelog \
+               $(CURDIR)/debian/tmp/usr/share/doc/mlton/changelog.PreviousRelease; \
+       fi