summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Assistant/Watcher.hs11
-rw-r--r--Makefile2
-rw-r--r--debian/control2
-rw-r--r--doc/install.mdwn3
-rw-r--r--git-annex.cabal15
5 files changed, 21 insertions, 12 deletions
diff --git a/Assistant/Watcher.hs b/Assistant/Watcher.hs
index 5af39ea88..1d35b5c1e 100644
--- a/Assistant/Watcher.hs
+++ b/Assistant/Watcher.hs
@@ -29,7 +29,7 @@ import Control.Concurrent.STM
import Data.Bits.Utils
import qualified Data.ByteString.Lazy as L
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
import Utility.Inotify
import System.INotify
#endif
@@ -38,11 +38,14 @@ type Handler = FilePath -> Maybe FileStatus -> DaemonStatusHandle -> Annex (Mayb
checkCanWatch :: Annex ()
checkCanWatch = do
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
unlessM (liftIO (inPath "lsof") <||> Annex.getState Annex.force) $
needLsof
#else
- error "watch mode is currently only available in Linux"
+#if defined linux_HOST_OS
+#warning "Building without inotify support; watch mode will be disabled."
+#endif
+ error "watch mode is not available on this system"
#endif
needLsof :: Annex ()
@@ -54,7 +57,7 @@ needLsof = error $ unlines
]
watchThread :: ThreadState -> DaemonStatusHandle -> ChangeChan -> IO ()
-#if defined linux_HOST_OS
+#ifdef WITH_INOTIFY
watchThread st dstatus changechan = withINotify $ \i -> do
runThreadState st $
showAction "scanning"
diff --git a/Makefile b/Makefile
index 023ea5d5e..6d36e8b8b 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
PREFIX=/usr
IGNORE=-ignore-package monads-fd -ignore-package monads-tf
-BASEFLAGS=-Wall $(IGNORE) -outputdir tmp -IUtility -DWITH_S3
+BASEFLAGS=-Wall $(IGNORE) -outputdir tmp -IUtility -DWITH_S3 -DWITH_INOTIFY
GHCFLAGS=-O2 $(BASEFLAGS)
ifdef PROFILE
diff --git a/debian/control b/debian/control
index 6741ef943..3b142dc5f 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,7 @@ Build-Depends:
libghc-ifelse-dev,
libghc-bloomfilter-dev,
libghc-edit-distance-dev,
- libghc-hinotify-dev,
+ libghc-hinotify-dev [linux-any],
libghc-stm-dev,
ikiwiki,
perlmagick,
diff --git a/doc/install.mdwn b/doc/install.mdwn
index 54b52d416..a009ee00d 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -43,7 +43,8 @@ To build and use git-annex, you will need:
* [bloomfilter](http://hackage.haskell.org/package/bloomfilter)
* [edit-distance](http://hackage.haskell.org/package/edit-distance)
* [stm](http://hackage.haskell.org/package/stm)
- * [hinotify](http://hackage.haskell.org/package/hinotify) (on Linux only)
+ * [hinotify](http://hackage.haskell.org/package/hinotify)
+ (optional; Linux only)
* Shell commands
* [git](http://git-scm.com/)
* [uuid](http://www.ossp.org/pkg/lib/uuid/)
diff --git a/git-annex.cabal b/git-annex.cabal
index 0fc4abaeb..1416a381d 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -1,5 +1,5 @@
Name: git-annex
-Version: 3.20120614
+Version: 3.20120616
Cabal-Version: >= 1.8
License: GPL
Maintainer: Joey Hess <joey@kitenet.net>
@@ -28,14 +28,16 @@ Description:
Flag S3
Description: Enable S3 support
+Flag Inotify
+ Description: Enable inotify support
+
Executable git-annex
Main-Is: git-annex.hs
Build-Depends: MissingH, hslogger, directory, filepath,
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
pcre-light, extensible-exceptions, dataenc, SHA, process, json, HTTP,
base == 4.5.*, monad-control, transformers-base, lifted-base,
- IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance,
- hinotify, stm
+ IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance, stm
-- Need to list this because it's generated from a .hsc file.
Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
@@ -45,6 +47,10 @@ Executable git-annex
Build-Depends: hS3
CPP-Options: -DWITH_S3
+ if flag(Inotify)
+ Build-Depends: hinotify
+ CPP-Options: -DWITH_INOTIFY
+
Test-Suite test
Type: exitcode-stdio-1.0
Main-Is: test.hs
@@ -52,8 +58,7 @@ Test-Suite test
unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
pcre-light, extensible-exceptions, dataenc, SHA, process, json, HTTP,
base == 4.5.*, monad-control, transformers-base, lifted-base,
- IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance,
- hinotify, stm
+ IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance, stm
Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
Extensions: CPP