summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/Configure.hs21
-rw-r--r--Makefile10
2 files changed, 25 insertions, 6 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 6e12d19af..b6e852d48 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -7,6 +7,7 @@ import Data.List
import System.Process
import Control.Applicative
import System.FilePath
+import System.Environment
import Build.TestConfig
import Utility.SafeCommand
@@ -121,8 +122,26 @@ cleanup = removeDirectoryRecursive tmpDir
run :: [TestCase] -> IO ()
run ts = do
+ args <- getArgs
setup
config <- runTests ts
- writeSysConfig config
+ if args == ["Android"]
+ then writeSysConfig $ androidConfig config
+ else writeSysConfig config
cleanup
cabalSetup
+
+{- Hard codes some settings to cross-compile for Android. -}
+androidConfig :: [Config] -> [Config]
+androidConfig c = overrides ++ filter (not . overridden) c
+ where
+ overrides =
+ [ Config "cp_reflink_auto" $ BoolConfig False
+ , Config "curl" $ BoolConfig False
+ , Config "sshconnectioncaching" $ BoolConfig False
+ , Config "sha224" $ MaybeStringConfig Nothing
+ , Config "sha384" $ MaybeStringConfig Nothing
+ ]
+ overridden (Config k _) = k `elem` overridekeys
+ overridekeys = map (\(Config k _) -> k) overrides
+
diff --git a/Makefile b/Makefile
index 04eea2e28..d1248bdb9 100644
--- a/Makefile
+++ b/Makefile
@@ -13,8 +13,8 @@ mans=git-annex.1 git-annex-shell.1
sources=Build/SysConfig.hs Utility/Touch.hs Utility/Mounts.hs
all=$(bins) $(mans) docs
-OS:=$(shell uname | sed 's/[-_].*//')
-ifeq ($(ANDROID),1)
+OS?=$(shell uname | sed 's/[-_].*//')
+ifeq ($(OS),Android)
OPTFLAGS?=-DWITH_INOTIFY -DWITH_ANDROID
clibs=Utility/libdiskfree.o Utility/libmounts.o
CFLAGS:=-Wall -DWITH_ANDROID
@@ -77,7 +77,7 @@ fast: $(bins)
Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs
$(GHCMAKE) configure
- ./configure
+ ./configure $(OS)
%.hs: %.hsc
hsc2hs $<
@@ -231,11 +231,11 @@ osxapp:
# So the Android should have all the same stuff that configure probes for,
# including the same version of git.
android:
- $(MAKE) Build/SysConfig.hs
+ OS=Android $(MAKE) Build/SysConfig.hs
GHC=$$HOME/.ghc/android-14/arm-linux-androideabi-4.7/bin/arm-unknown-linux-androideabi-ghc \
CC=$$HOME/.ghc/android-14/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-gcc \
FEATURES="-DWITH_ANDROID -DWITH_ASSISTANT -DWITH_GLOB -DWITH_DNS" \
- ANDROID=1 $(MAKE) fast
+ OS=Android $(MAKE) fast
# used by ./ghci
getflags: