summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 13:53:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-08-19 13:53:57 -0400
commit7b029b9a5316bac78fce24876cdae3fb9abddbaa (patch)
treea6a3530b2ccbd6ea81265ce9b02675bcef57ba20
parent7b2667698061f27898092e7e53f6f2cf316b8036 (diff)
Makefile: Pass LDFLAGS, CFLAGS, and CPPFLAGS through ghc and on to ld, cc, and cpp.
As a result of the Makefile changes, the Debian package is built with various hardening options. Although their benefit to a largely haskell program is unknown.
-rwxr-xr-xBuild/collect-ghc-options.sh12
-rw-r--r--Makefile2
-rw-r--r--debian/changelog5
3 files changed, 18 insertions, 1 deletions
diff --git a/Build/collect-ghc-options.sh b/Build/collect-ghc-options.sh
new file mode 100755
index 000000000..4f75a7202
--- /dev/null
+++ b/Build/collect-ghc-options.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Generate --ghc-options to pass LDFLAGS, CFLAGS, and CPPFLAGS through ghc
+# and on to ld, cc, and cpp.
+for w in $LDFLAGS; do
+ printf -- "-optl%s\n" "$w"
+done
+for w in $CFLAGS; do
+ printf -- "-optc%s\n" "$w"
+done
+for w in $CPPFLAGS; do
+ printf -- "-optc-Wp,%s\n" "$w"
+done
diff --git a/Makefile b/Makefile
index bc027fc89..1e657d0da 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ build: $(all)
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
if [ "$(CABAL)" = ./Setup ]; then ghc --make Setup; fi
- $(CABAL) configure
+ $(CABAL) configure --ghc-options="$(shell Build/collect-ghc-options.sh)"
git-annex: Build/SysConfig.hs
$(CABAL) build
diff --git a/debian/changelog b/debian/changelog
index faf89f96c..307efde1c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,11 @@ git-annex (5.20150813) UNRELEASED; urgency=medium
is not yet implemented in git-annex for the hurd.
* importfeed --relaxed: Avoid hitting the urls of items in the feed.
* Fix reversion in init when ran as root, introduced in version 5.20150731.
+ * Makefile: Pass LDFLAGS, CFLAGS, and CPPFLAGS through ghc and on to
+ ld, cc, and cpp.
+ * As a result of the Makefile changes, the Debian package is built
+ with various hardening options. Although their benefit to a largely
+ haskell program is unknown.
-- Joey Hess <id@joeyh.name> Wed, 12 Aug 2015 14:31:01 -0400