summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-11 14:08:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-11 14:08:23 -0400
commitb519f35e0878b37acc260493902aecfb65128e76 (patch)
treef0e0d9faaa1ab6a4f5827fe5db00e9d3a0f080d4
parent25ed918f75ed69175f1b3d5e7beec619160af8ce (diff)
Makefile: Avoid building with -threaded if the ghc threaded runtime does not exist.
This should fix build on mips, mipsel, s390, s390x, and sparc. cabal doesn't test this yet.
-rw-r--r--Makefile12
-rw-r--r--debian/changelog2
2 files changed, 10 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 5bd4401b6..9acdd1a49 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
CFLAGS=-Wall
GIT_ANNEX_TMP_BUILD_DIR?=tmp
IGNORE=-ignore-package monads-fd -ignore-package monads-tf
-BASEFLAGS=-threaded -Wall $(IGNORE) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR) -IUtility
+BASEFLAGS=-Wall $(IGNORE) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR) -IUtility
# If you get build failures due to missing haskell libraries,
# you can turn off some of these features.
@@ -18,8 +18,10 @@ OS:=$(shell uname | sed 's/[-_].*//')
ifeq ($(OS),Linux)
OPTFLAGS=-DWITH_INOTIFY -DWITH_DBUS
clibs=Utility/libdiskfree.o Utility/libmounts.o
+THREADFLAGS=$(shell if test -e `ghc --print-libdir`/libHSrts_thr.a; then printf -- -threaded; fi)
else
# BSD system
+THREADFLAGS=-threaded
OPTFLAGS=-DWITH_KQUEUE
clibs=Utility/libdiskfree.o Utility/libmounts.o Utility/libkqueue.o
ifeq ($(OS),Darwin)
@@ -31,11 +33,13 @@ endif
endif
endif
+ALLFLAGS = $(BASEFLAGS) $(FEATURES) $(OPTFLAGS) $(THREADFLAGS)
+
PREFIX=/usr
-GHCFLAGS=-O2 $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
+GHCFLAGS=-O2 $(ALLFLAGS)
ifdef PROFILE
-GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
+GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(ALLFLAGS)
endif
GHCMAKE=ghc $(GHCFLAGS) --make
@@ -51,7 +55,7 @@ build: $(all)
sources: $(sources)
# Disables optimisation. Not for production use.
-fast: GHCFLAGS=$(BASEFLAGS) $(FEATURES) $(OPTFLAGS)
+fast: GHCFLAGS=$(ALLFLAGS)
fast: $(bins)
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
diff --git a/debian/changelog b/debian/changelog
index 4ee022a7e..b9e33af97 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,8 @@ git-annex (3.20121010) UNRELEASED; urgency=low
* dead: Remove dead repository from all groups.
* Avoid unsetting HOME when running certian git commands. Closes: #690193
* test: Fix threaded runtime hang.
+ * Makefile: Avoid building with -threaded if the ghc threaded runtime does
+ not exist.
-- Joey Hess <joeyh@debian.org> Wed, 10 Oct 2012 12:59:25 -0400