summaryrefslogtreecommitdiff
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..2ad9fe75
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,50 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Build for multiarch.
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+# Avoid overlinking and reduce library dependencies.
+export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+# Disable GCC code hoisting to work around either a GCC bug or a MLton bug on
+# arm64 and mips64el. See https://bugs.debian.org/871572 for details.
+export DEB_CFLAGS_MAINT_APPEND := -fno-code-hoisting
+
+# Use -D_FORTIFY_SOURCE=1 instead of -D_FORTIFY_SOURCE=2 to prevent performance
+# problems with %n specifiers. See https://bugs.debian.org/934722 for details.
+export DEB_CPPFLAGS_MAINT_APPEND := -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
+
+# Harden SML executables.
+export DEB_BUILD_MAINT_OPTIONS := hardening=+all
+export MLTONARGS := \
+ -cc-opt "$(shell dpkg-buildflags --get CPPFLAGS) \
+ $(shell dpkg-buildflags --get CFLAGS)" \
+ -link-opt "$(shell dpkg-buildflags --get LDFLAGS)"
+
+%:
+ dh $@ --with autoreconf
+
+.PHONY: override_dh_auto_configure
+override_dh_auto_configure:
+ LIB=/usr/lib/$(DEB_HOST_MULTIARCH) \
+ SRCLIB=/usr/share/urweb dh_auto_configure --
+
+.PHONY: override_dh_auto_build-indep
+override_dh_auto_build-indep:
+ cd doc && make manual.pdf
+
+# Tests require a working urweb binary, so don't run them on
+# architecture-independent builds.
+.PHONY: override_dh_auto_test-indep
+override_dh_auto_test-indep:
+ :
+
+.PHONY: override_dh_auto_install-indep
+override_dh_auto_install-indep:
+ DESTDIR=${CURDIR}/debian/tmp make install-exec-emacs
+
+.PHONY: override_dh_auto_install
+override_dh_auto_install:
+ dh_auto_install
+ find debian/tmp -name \*.la -delete