aboutsummaryrefslogtreecommitdiff
path: root/Limit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-10 15:48:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-10 15:48:38 -0400
commit4e14ef3660924e7c005c42d4d58716ee0beb2d31 (patch)
tree4691e44203ded56f77bf2c4abf5de9a6acdac462 /Limit.hs
parent516d4899d3ea7e12ee9b408160b36190b8c2d3f2 (diff)
can now build Android targeted binary
Various things that don't work on Android are just ifdefed out. * the webapp (needs template haskell for arm) * --include and --exclude globbing (needs libpcre, which is not ported; probably I'll make it use the pure haskell glob library instead) * annex.diskreserve checking (missing sys/statvfs.h) * timestamp preservation support (yawn) * S3 * WebDAV * XMPP The resulting 17mb binary has been tested on Android, and it is able to, at least, print its usage message.
Diffstat (limited to 'Limit.hs')
-rw-r--r--Limit.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Limit.hs b/Limit.hs
index 80608bcc6..85cce4f44 100644
--- a/Limit.hs
+++ b/Limit.hs
@@ -5,13 +5,17 @@
- Licensed under the GNU GPL version 3 or higher.
-}
+{-# LANGUAGE CPP #-}
+
module Limit where
-import Text.Regex.PCRE.Light.Char8
-import System.Path.WildMatch
import Data.Time.Clock.POSIX
import qualified Data.Set as S
import qualified Data.Map as M
+#ifndef WITH_ANDROID
+import Text.Regex.PCRE.Light.Char8
+import System.Path.WildMatch
+#endif
import Common.Annex
import qualified Annex
@@ -81,11 +85,15 @@ limitExclude :: MkLimit
limitExclude glob = Right $ const $ return . not . matchglob glob
matchglob :: String -> Annex.FileInfo -> Bool
+#ifdef WITH_ANDROID
+matchglob _ _ = error "glob matching not supported"
+#else
matchglob glob (Annex.FileInfo { Annex.matchFile = f }) =
isJust $ match cregex f []
where
cregex = compile regex []
regex = '^':wildToRegex glob
+#endif
{- Adds a limit to skip files not believed to be present
- in a specfied repository. -}