make inotify a build flag etc
This commit is contained in:
parent
bf3339e5b7
commit
91567ab8f6
5 changed files with 21 additions and 12 deletions
|
@ -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"
|
||||
|
|
2
Makefile
2
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
|
||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -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,
|
||||
|
|
|
@ -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/)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue