diff --git a/Assistant.hs b/Assistant.hs index 63a5dafae1..98e1561755 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -133,7 +133,9 @@ import Assistant.Threads.Merger import Assistant.Threads.TransferWatcher import Assistant.Threads.Transferrer import Assistant.Threads.SanityChecker +#ifdef WITH_CLIBS import Assistant.Threads.MountWatcher +#endif import Assistant.Threads.NetWatcher import Assistant.Threads.TransferScanner import Assistant.Threads.TransferPoller @@ -219,7 +221,9 @@ startDaemon assistant foreground startbrowser = do , assist $ daemonStatusThread , assist $ sanityCheckerDailyThread , assist $ sanityCheckerHourlyThread +#ifdef WITH_CLIBS , assist $ mountWatcherThread +#endif , assist $ netWatcherThread , assist $ netWatcherFallbackThread , assist $ transferScannerThread diff --git a/Assistant/WebApp/Configurators/Local.hs b/Assistant/WebApp/Configurators/Local.hs index 1bf035a69f..e4b2c1cc25 100644 --- a/Assistant/WebApp/Configurators/Local.hs +++ b/Assistant/WebApp/Configurators/Local.hs @@ -21,7 +21,9 @@ import qualified Git.Command import qualified Annex import Locations.UserConfig import Utility.FreeDesktop +#ifdef WITH_CLIBS import Utility.Mounts +#endif import Utility.DiskFree import Utility.DataUnits import Utility.Network @@ -236,6 +238,7 @@ getEnableDirectoryR uuid = page "Enable a repository" (Just Configuration) $ do {- List of removable drives. -} driveList :: IO [RemovableDrive] +#ifdef WITH_CLIBS driveList = mapM (gen . mnt_dir) =<< filter sane <$> getMounts where gen dir = RemovableDrive @@ -254,6 +257,9 @@ driveList = mapM (gen . mnt_dir) =<< filter sane <$> getMounts | dir == "/run/shm" = False | dir == "/run/lock" = False | otherwise = True +#else +driveList = return [] +#endif {- Bootstraps from first run mode to a fully running assistant in a - repository, by running the postFirstRun callback, which returns the diff --git a/Makefile b/Makefile index ced1e2c9a5..c26890af7f 100644 --- a/Makefile +++ b/Makefile @@ -13,17 +13,6 @@ endif build: $(all) -# We bypass cabal, and only run the main ghc --make command for a -# fast development built. Note: Does not rebuild C libraries. -fast: dist/caballog - @$$(grep 'ghc --make' dist/caballog | head -n 1) - @ln -sf dist/build/git-annex/git-annex git-annex - @$(MAKE) tags >/dev/null 2>&1 - -dist/caballog: git-annex.cabal - $(CABAL) configure -f"-Production" -O0 - $(CABAL) build -v2 | tee $@ - Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs $(CABAL) configure @@ -167,4 +156,23 @@ androidapp: $(MAKE) android $(MAKE) -C standalone/android +# We bypass cabal, and only run the main ghc --make command for a +# fast development built. Note: Does not rebuild C libraries. +fast: dist/caballog + @$$(grep 'ghc --make' dist/caballog | head -n 1) + @ln -sf dist/build/git-annex/git-annex git-annex + @$(MAKE) tags >/dev/null 2>&1 + +dist/caballog: git-annex.cabal + $(CABAL) configure -f"-Production" -O0 + $(CABAL) build -v2 | tee $@ + +# Hardcoded command line to make hdevtools start up and work. +# You will need some memory. It's worth it. +# Note: Don't include WebDAV or Webapp. TH use bloats memory > 500 mb! +# TODO should be possible to derive this from caballog. +hdevtools: + hdevtools --stop-server || true + hdevtools check git-annex.hs -g -cpp -g -i -g -idist/build/git-annex/git-annex-tmp -g -i. -g -idist/build/autogen -g -Idist/build/autogen -g -Idist/build/git-annex/git-annex-tmp -g -IUtility -g -DWITH_TESTSUITE -g -DWITH_S3 -g -DWITH_ASSISTANT -g -DWITH_INOTIFY -g -DWITH_DBUS -g -DWITH_PAIRING -g -DWITH_XMPP -g -optP-include -g -optPdist/build/autogen/cabal_macros.h -g -odir -g dist/build/git-annex/git-annex-tmp -g -hidir -g dist/build/git-annex/git-annex-tmp -g -stubdir -g dist/build/git-annex/git-annex-tmp -g -threaded -g -Wall -g -XHaskell98 + .PHONY: git-annex tags diff --git a/Utility/DiskFree.hs b/Utility/DiskFree.hs index 4532441752..20911dd06b 100644 --- a/Utility/DiskFree.hs +++ b/Utility/DiskFree.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -{-# LANGUAGE ForeignFunctionInterface #-} +{-# LANGUAGE ForeignFunctionInterface, CPP #-} module Utility.DiskFree ( getDiskFree ) where @@ -15,6 +15,8 @@ import Foreign.C.Types import Foreign.C.String import Foreign.C.Error +#ifdef WITH_CLIBS + foreign import ccall safe "libdiskfree.h diskfree" c_diskfree :: CString -> IO CULLong @@ -27,3 +29,10 @@ getDiskFree path = withFilePath path $ \c_path -> do ) where safeErrno (Errno v) = v == 0 + +#else + +getDiskFree :: FilePath -> IO (Maybe Integer) +getDiskFree _ = return Nothing + +#endif diff --git a/git-annex.cabal b/git-annex.cabal index e113164fb5..18154c4d42 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -77,6 +77,7 @@ Executable git-annex C-Sources: Utility/libdiskfree.c Utility/libmounts.c CC-Options: -Wall GHC-Options: -threaded -Wall + CPP-Options: -DWITH_CLIBS if flag(Production) GHC-Options: -O2