diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | Annex/Branch.hs | 2 | ||||
-rw-r--r-- | Assistant/Pairing.hs | 2 | ||||
-rw-r--r-- | Assistant/Ssh.hs | 3 | ||||
-rw-r--r-- | Command/Add.hs | 4 | ||||
-rw-r--r-- | Makefile | 129 | ||||
-rw-r--r-- | Utility/Lsof.hs | 2 | ||||
-rw-r--r-- | Utility/SRV.hs | 6 | ||||
-rw-r--r-- | Utility/Shell.hs | 2 | ||||
-rw-r--r-- | Utility/ThreadScheduler.hs | 4 | ||||
-rw-r--r-- | Utility/UserInfo.hs | 2 | ||||
-rw-r--r-- | Utility/Yesod.hs | 6 | ||||
-rw-r--r-- | Utility/libdiskfree.c | 2 | ||||
-rw-r--r-- | Utility/libmounts.h | 2 | ||||
-rw-r--r-- | debian/changelog | 2 | ||||
-rwxr-xr-x | debian/rules | 13 |
16 files changed, 44 insertions, 141 deletions
diff --git a/.gitignore b/.gitignore index e4cb43383..69650caa1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ tmp test -configure build-stamp Build/SysConfig.hs git-annex @@ -11,9 +10,6 @@ doc/.ikiwiki html *.tix .hpc -Utility/Touch.hs -Utility/Mounts.hs -Utility/*.o dist # Sandboxed builds cabal-dev diff --git a/Annex/Branch.hs b/Annex/Branch.hs index 95ac49404..652ba6ff9 100644 --- a/Annex/Branch.hs +++ b/Annex/Branch.hs @@ -287,7 +287,7 @@ withIndex' :: Bool -> Annex a -> Annex a withIndex' bootstrapping a = do f <- fromRepo gitAnnexIndex g <- gitRepo -#ifdef WITH_ANDROID +#ifdef __ANDROID__ {- Work around for weird getEnvironment breakage on Android. See - https://github.com/neurocyte/ghc-android/issues/7 - Instead, use getEnv to get some key environment variables that diff --git a/Assistant/Pairing.hs b/Assistant/Pairing.hs index 2c1fcf0d0..4736c4396 100644 --- a/Assistant/Pairing.hs +++ b/Assistant/Pairing.hs @@ -75,7 +75,7 @@ data PairingInProgress = PairingInProgress data SomeAddr = IPv4Addr HostAddress {- My Android build of the Network library does not currently have IPV6 - support. -} -#ifndef WITH_ANDROID +#ifndef __ANDROID__ | IPv6Addr HostAddress6 #endif deriving (Ord, Eq, Read, Show) diff --git a/Assistant/Ssh.hs b/Assistant/Ssh.hs index 93d567ce4..4c8d8afbf 100644 --- a/Assistant/Ssh.hs +++ b/Assistant/Ssh.hs @@ -15,9 +15,6 @@ import Git.Remote import Data.Text (Text) import qualified Data.Text as T -import qualified Control.Exception as E -import System.Process (CreateProcess(..)) -import Control.Concurrent import Data.Char data SshData = SshData diff --git a/Command/Add.hs b/Command/Add.hs index 18dc65031..d41a0baea 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -21,7 +21,7 @@ import Annex.Perms import Annex.Link import qualified Annex import qualified Annex.Queue -#ifndef WITH_ANDROID +#ifndef __ANDROID__ import Utility.Touch #endif import Utility.FileMode @@ -166,7 +166,7 @@ link file key hascontent = handle (undo file key) $ do l <- calcGitLink file key makeAnnexLink l file -#ifndef WITH_ANDROID +#ifndef __ANDROID__ when hascontent $ do -- touch the symlink to have the same mtime as the -- file it points to @@ -1,91 +1,24 @@ -CFLAGS=-Wall -GIT_ANNEX_TMP_BUILD_DIR?=tmp -BASEFLAGS=-Wall -outputdir $(GIT_ANNEX_TMP_BUILD_DIR) -IUtility - -# If you get build failures due to missing haskell libraries, -# you can turn off some of these features. -# -# If you're using an old version of yesod, enable -DWITH_OLD_YESOD -FEATURES?=$(GIT_ANNEX_LOCAL_FEATURES) -DWITH_ASSISTANT -DWITH_S3 -DWITH_WEBDAV -DWITH_WEBAPP -DWITH_PAIRING -DWITH_XMPP -DWITH_DNS -DWITH_OLD_HTTP_CONDUIT - -bins=git-annex 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 ($(OS),Android) -OPTFLAGS?=-DWITH_INOTIFY -DWITH_ANDROID -clibs=Utility/libdiskfree.o Utility/libmounts.o -CFLAGS:=-Wall -DWITH_ANDROID -THREADFLAGS=-threaded -else -ifeq ($(OS),Linux) -OPTFLAGS?=-DWITH_INOTIFY -DWITH_DBUS -clibs=Utility/libdiskfree.o Utility/libmounts.o -THREADFLAGS=$(shell if test -e `ghc --print-libdir`/libHSrts_thr.a; then printf -- -threaded; fi) -else -ifeq ($(OS),SunOS) -# Solaris is not supported by the assistant or watch command. -FEATURES:=$(shell echo $(FEATURES) | sed -e 's/-DWITH_ASSISTANT//' -e 's/-DWITH_WEBAPP//') -else -# BSD system -THREADFLAGS=-threaded -ifeq ($(OS),Darwin) -# use fsevents for OSX -OPTFLAGS?=-DWITH_FSEVENTS -clibs=Utility/libdiskfree.o Utility/libmounts.o -# Ensure OSX compiler builds for 32 bit when using 32 bit ghc -GHCARCH:=$(shell ghc -e 'print System.Info.arch') -ifeq ($(GHCARCH),i386) -CFLAGS=-Wall -m32 -endif -else -# BSD system with kqueue -OPTFLAGS?=-DWITH_KQUEUE -clibs=Utility/libdiskfree.o Utility/libmounts.o Utility/libkqueue.o -endif -endif -endif -endif - -ALLFLAGS = $(BASEFLAGS) $(FEATURES) $(OPTFLAGS) $(THREADFLAGS) - -PREFIX=/usr -GHCFLAGS=-O2 $(ALLFLAGS) - -ifdef PROFILE -GHCFLAGS=-prof -auto-all -rtsopts -caf-all -fforce-recomp $(ALLFLAGS) -endif +all=git-annex $(mans) docs GHC?=ghc GHCMAKE=$(GHC) $(GHCFLAGS) --make - -# Am I typing :make in vim? Do a fast build. -ifdef VIM -all=fast -endif +PREFIX=/usr build: $(all) - touch build-stamp -sources: $(sources) - -# Disables optimisation. Not for production use. -fast: GHCFLAGS=$(ALLFLAGS) -fast: $(bins) +fast: + @if [ ! -e dist/setup-config ] || grep -- -O2 dist/setup-config; then \ + cabal configure -f-Production; \ + fi + $(MAKE) git-annex Build/SysConfig.hs: configure.hs Build/TestConfig.hs Build/Configure.hs - $(GHCMAKE) configure - ./configure $(OS) + cabal configure -%.hs: %.hsc - hsc2hs $< - -git-annex: $(sources) $(clibs) - install -d $(GIT_ANNEX_TMP_BUILD_DIR) - $(GHCMAKE) $@ -o $(GIT_ANNEX_TMP_BUILD_DIR)/git-annex $(clibs) - ln -sf $(GIT_ANNEX_TMP_BUILD_DIR)/git-annex git-annex +git-annex: Build/SysConfig.hs + cabal build + ln -sf dist/build/git-annex/git-annex git-annex git-annex.1: doc/git-annex.mdwn ./Build/mdwn2man git-annex 1 doc/git-annex.mdwn > git-annex.1 @@ -121,7 +54,7 @@ test: $(sources) $(clibs) testcoverage: rm -f test.tix test - $(GHC) $(GHCFLAGS) -outputdir $(GIT_ANNEX_TMP_BUILD_DIR)/testcoverage --make -fhpc test + $(GHC) $(GHCFLAGS) -outputdir tmp/testcoverage --make -fhpc test ./test @echo "" @hpc report test --exclude=Main --exclude=QC @@ -150,8 +83,8 @@ docs: $(mans) --exclude='bugs/*' --exclude='todo/*' --exclude='forum/*' clean: - rm -rf $(GIT_ANNEX_TMP_BUILD_DIR) $(bins) $(mans) test configure *.tix .hpc $(sources) \ - doc/.ikiwiki html dist $(clibs) build-stamp tags + rm -rf tmp dist git-annex $(mans) test configure *.tix .hpc \ + doc/.ikiwiki html dist build-stamp tags Build/SysConfig.hs sdist: clean $(mans) ./Build/make-sdist.sh @@ -160,7 +93,7 @@ sdist: clean $(mans) hackage: sdist @cabal upload dist/*.tar.gz -LINUXSTANDALONE_DEST=$(GIT_ANNEX_TMP_BUILD_DIR)/git-annex.linux +LINUXSTANDALONE_DEST=tmp/git-annex.linux linuxstandalone: $(MAKE) git-annex @@ -194,15 +127,15 @@ linuxstandalone: sort "$(LINUXSTANDALONE_DEST)/libdirs.tmp" | uniq > "$(LINUXSTANDALONE_DEST)/libdirs" rm -f "$(LINUXSTANDALONE_DEST)/libdirs.tmp" - cd $(GIT_ANNEX_TMP_BUILD_DIR) && tar czf git-annex-standalone-$(shell dpkg --print-architecture).tar.gz git-annex.linux + cd tmp && tar czf git-annex-standalone-$(shell dpkg --print-architecture).tar.gz git-annex.linux -OSXAPP_DEST=$(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg/git-annex.app +OSXAPP_DEST=tmp/build-dmg/git-annex.app OSXAPP_BASE=$(OSXAPP_DEST)/Contents/MacOS osxapp: $(MAKE) git-annex rm -rf "$(OSXAPP_DEST)" - install -d $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg + install -d tmp/build-dmg cp -R standalone/osx/git-annex.app "$(OSXAPP_DEST)" install -d "$(OSXAPP_BASE)" @@ -210,7 +143,7 @@ osxapp: strip "$(OSXAPP_BASE)/git-annex" ln -sf git-annex "$(OSXAPP_BASE)/git-annex-shell" gzcat standalone/licences.gz > $(OSXAPP_BASE)/LICENSE - cp $(OSXAPP_BASE)/LICENSE $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg/LICENSE.txt + cp $(OSXAPP_BASE)/LICENSE tmp/build-dmg/LICENSE.txt runghc Build/Standalone.hs $(OSXAPP_BASE) @@ -219,32 +152,20 @@ osxapp: runghc Build/OSXMkLibs.hs $(OSXAPP_BASE) rm -f tmp/git-annex.dmg - hdiutil create -size 640m -format UDRW -srcfolder $(GIT_ANNEX_TMP_BUILD_DIR)/build-dmg \ + hdiutil create -size 640m -format UDRW -srcfolder tmp/build-dmg \ -volname git-annex -o tmp/git-annex.dmg rm -f tmp/git-annex.dmg.bz2 bzip2 --fast tmp/git-annex.dmg -# Cross compile for Android binary. +# Cross compile for Android. # Uses https://github.com/neurocyte/ghc-android -# -# configure is run, probing the local system. -# So the Android should have all the same stuff that configure probes for, -# including the same version of git. android: - 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_DNS" \ - OS=Android $(MAKE) fast + $$HOME/.ghc/android-14/arm-linux-androideabi-4.7/arm-linux-androideabi/bin/cabal configure -f'Android Assistant DNS' + $(MAKE) git-annex -ANDROIDAPP_DEST=$(GIT_ANNEX_TMP_BUILD_DIR)/git-annex.android androidapp: $(MAKE) android $(MAKE) -C standalone/android - cp standalone/android/source/term/bin/Term-debug.apk $(GIT_ANNEX_TMP_BUILD_DIR)/git-annex.apk - -# used by ./ghci -getflags: - @echo $(ALLFLAGS) $(clibs) + cp standalone/android/source/term/bin/Term-debug.apk tmp/git-annex.apk -.PHONY: $(bins) test install tags +.PHONY: git-annex test install tags diff --git a/Utility/Lsof.hs b/Utility/Lsof.hs index 2c312a461..8db514d79 100644 --- a/Utility/Lsof.hs +++ b/Utility/Lsof.hs @@ -56,7 +56,7 @@ query opts = type LsofParser = String -> [(FilePath, LsofOpenMode, ProcessInfo)] parse :: LsofParser -#ifdef WITH_ANDROID +#ifdef __ANDROID__ parse = parseDefault #else parse = parseFormatted diff --git a/Utility/SRV.hs b/Utility/SRV.hs index 9a099089e..b39bf71b2 100644 --- a/Utility/SRV.hs +++ b/Utility/SRV.hs @@ -31,14 +31,12 @@ import Data.Maybe import ADNS.Resolver import Data.Either #else -#ifndef WITH_HOST #ifdef WITH_DNS import qualified Network.DNS.Lookup as DNS import Network.DNS.Resolver import qualified Data.ByteString.UTF8 as B8 #endif #endif -#endif newtype SRV = SRV String deriving (Show, Eq) @@ -64,9 +62,6 @@ lookupSRV (SRV srv) = initResolver [] $ \resolver -> do resolveSRV resolver srv return $ either (\_ -> []) id r #else -#ifdef WITH_HOST -lookupSRV = lookupSRVHost -#else #ifdef WITH_DNS lookupSRV (SRV srv) = do seed <- makeResolvSeed defaultResolvConf @@ -83,7 +78,6 @@ lookupSRV (SRV srv) = do lookupSRV = lookupSRVHost #endif #endif -#endif lookupSRVHost :: SRV -> IO [HostPort] lookupSRVHost (SRV srv) = catchDefaultIO [] $ diff --git a/Utility/Shell.hs b/Utility/Shell.hs index fecafe1a8..f3858af7f 100644 --- a/Utility/Shell.hs +++ b/Utility/Shell.hs @@ -10,7 +10,7 @@ module Utility.Shell where shellPath :: FilePath -#ifndef WITH_ANDROID +#ifndef __ANDROID__ shellPath = "/bin/sh" #else shellPath = "/system/bin/sh" diff --git a/Utility/ThreadScheduler.hs b/Utility/ThreadScheduler.hs index fdf40ab6d..a32606cfd 100644 --- a/Utility/ThreadScheduler.hs +++ b/Utility/ThreadScheduler.hs @@ -14,7 +14,7 @@ import Common import Control.Concurrent import System.Posix.Signals -#ifndef WITH_ANDROID +#ifndef __ANDROID__ import System.Posix.Terminal #endif @@ -53,7 +53,7 @@ waitForTermination :: IO () waitForTermination = do lock <- newEmptyMVar check softwareTermination lock -#ifndef WITH_ANDROID +#ifndef __ANDROID__ whenM (queryTerminal stdInput) $ check keyboardSignal lock #endif diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs index 00790f615..916ebb191 100644 --- a/Utility/UserInfo.hs +++ b/Utility/UserInfo.hs @@ -28,7 +28,7 @@ myUserName :: IO String myUserName = myVal ["USER", "LOGNAME"] userName myUserGecos :: IO String -#ifdef WITH_ANDROID +#ifdef __ANDROID__ myUserGecos = return "" -- userGecos crashes on Android #else myUserGecos = myVal [] userGecos diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs index b6748f240..93000587c 100644 --- a/Utility/Yesod.hs +++ b/Utility/Yesod.hs @@ -7,6 +7,12 @@ {-# LANGUAGE CPP #-} +#if defined VERSION_yesod_default +#if ! MIN_VERSION_yesod_default(1,1,0) +#define WITH_OLD_YESOD +#endif +#endif + module Utility.Yesod where import Yesod.Default.Util diff --git a/Utility/libdiskfree.c b/Utility/libdiskfree.c index a9ca90b41..d2843ed20 100644 --- a/Utility/libdiskfree.c +++ b/Utility/libdiskfree.c @@ -22,7 +22,7 @@ # define STATCALL statfs /* statfs64 not yet tested on a real FreeBSD machine */ # define STATSTRUCT statfs #else -#if defined WITH_ANDROID +#if defined __ANDROID__ # warning free space checking code not available for Android # define UNKNOWN #else diff --git a/Utility/libmounts.h b/Utility/libmounts.h index 76b2484d3..460fcc7ab 100644 --- a/Utility/libmounts.h +++ b/Utility/libmounts.h @@ -5,7 +5,7 @@ # include <sys/mount.h> # define GETMNTINFO #else -#if defined WITH_ANDROID +#if defined __ANDROID__ # warning mounts listing code not available for Android # define UNKNOWN #else diff --git a/debian/changelog b/debian/changelog index 091d16d1d..177da816a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,8 @@ git-annex (4.20130217) UNRELEASED; urgency=low the Glob library. * copy: Update location log when no copy was performed, if the location log was out of date. + * Makefile now builds using cabal, taking advantage of cabal's automatic + detection of appropriate build flags. -- Joey Hess <joeyh@debian.org> Sun, 17 Feb 2013 16:42:16 -0400 diff --git a/debian/rules b/debian/rules index 8b68a8cf8..7a1b08879 100755 --- a/debian/rules +++ b/debian/rules @@ -1,21 +1,8 @@ #!/usr/bin/make -f -ifeq (install ok installed,$(shell dpkg-query -W -f '$${Status}' libghc-yesod-dev 2>/dev/null)) -export FEATURES=-DWITH_ASSISTANT -DWITH_S3 -DWITH_HOST -DWITH_PAIRING -DWITH_XMPP -DWITH_OLD_HTTP_CONDUIT -DWITH_WEBAPP -DWITH_OLD_YESOD -else -export FEATURES=-DWITH_ASSISTANT -DWITH_S3 -DWITH_HOST -DWITH_PAIRING -DWITH_XMPP -DWITH_OLD_HTTP_CONDUIT -endif -ifeq (install ok installed,$(shell dpkg-query -W -f '$${Status}' libghc-dav-dev 2>/dev/null)) -export FEATURES:=${FEATURES} -DWITH_WEBDAV -endif - %: dh $@ -# Builds standalone tarball with the same FEATURES as debian package. -standalone: - $(MAKE) linuxstandalone - # Not intended for use by anyone except the author. announcedir: @echo ${HOME}/src/git-annex/doc/news |