summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-30 14:55:03 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-30 14:55:03 -0400
commit56aeeb4565dd419c315d370f6e648abfe009a7d3 (patch)
tree224bbf233bc99bd1ac8584dd0ec1b3838de8e920
parentb3aaf980e460c2287fc1ef2b262685b1879e6ed0 (diff)
cabal can now be used to build git-annex.
This is substantially slower than using make, does not build or install documentation, does not run the test suite, and is not particularly recommended, but could be useful to some.
-rw-r--r--.gitignore1
-rw-r--r--Makefile6
-rw-r--r--Setup.hs17
-rw-r--r--configure.hs14
-rw-r--r--debian/changelog4
-rw-r--r--doc/install.mdwn7
-rw-r--r--doc/install/comment_1_d9f7b851567445c7aa7ebbb440781819._comment8
-rw-r--r--doc/install/comment_2_cf0f829536744098d6846500db998b6a._comment17
-rw-r--r--git-annex.cabal49
9 files changed, 96 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index 9a4bc80de..d5bf54c81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ html
Touch.hs
StatFS.hs
Remote/S3.hs
+dist
diff --git a/Makefile b/Makefile
index 915b0bf0b..2f72cdbf9 100644
--- a/Makefile
+++ b/Makefile
@@ -11,6 +11,8 @@ mans=git-annex.1 git-annex-shell.1 git-union-merge.1
all: $(bins) $(mans) docs
+sources: SysConfig.hs StatFS.hs Touch.hs Remote/S3.hs
+
SysConfig.hs: configure.hs TestConfig.hs
$(GHCMAKE) configure
./configure
@@ -19,8 +21,10 @@ SysConfig.hs: configure.hs TestConfig.hs
hsc2hs $<
perl -i -pe 's/^{-# INCLUDE.*//' $@
-Remote/S3.o:
+Remote/S3.hs:
@ln -sf S3real.hs Remote/S3.hs
+
+Remote/S3.o: Remote/S3.hs
@if ! $(GHCMAKE) Remote/S3.hs; then \
ln -sf S3stub.hs Remote/S3.hs; \
echo "** building without S3 support"; \
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
index 000000000..547d6a156
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,17 @@
+{- cabal setup file -}
+
+import Distribution.Simple
+import System.Cmd
+
+main = defaultMainWithHooks simpleUserHooks {
+ preConf = makeSources,
+ postClean = makeClean
+}
+
+makeSources _ _ = do
+ system "make sources"
+ return (Nothing, [])
+
+makeClean _ _ _ _ = do
+ system "make clean"
+ return ()
diff --git a/configure.hs b/configure.hs
index c81aa17e6..2e39feb16 100644
--- a/configure.hs
+++ b/configure.hs
@@ -56,12 +56,24 @@ unicodeFilePath = do
{- Pulls package version out of the changelog. -}
getVersion :: Test
getVersion = do
- changelog <- readFile "debian/changelog"
+ changelog <- readFile "CHANGELOG"
let verline = head $ lines changelog
let version = middle (words verline !! 1)
+
+ -- Replace Version field in cabal file, so I don't have to maintain
+ -- the version there too.
+ cabal <- readFile cabalfile
+ writeFile tmpcabalfile $ unlines $ map (setversion version) $ lines cabal
+ renameFile tmpcabalfile cabalfile
+
return $ Config "packageversion" (StringConfig version)
where
middle s = drop 1 $ take (length s - 1) s
+ cabalfile = "git-annex.cabal"
+ tmpcabalfile = cabalfile++".tmp"
+ setversion version s
+ | "Version:" `isPrefixOf` s = "Version: " ++ version
+ | otherwise = s
setup :: IO ()
setup = do
diff --git a/debian/changelog b/debian/changelog
index 8848cf861..277b54259 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,10 @@ git-annex (0.20110611) UNRELEASED; urgency=low
* git-union-merge: New git subcommand, that does a generic union merge
operation, and operates efficiently without touching the working tree.
* --force will cause add, etc, to operate on ignored files.
+ * cabal can now be used to build git-annex. This is substantially
+ slower than using make, does not build or install documentation,
+ does not run the test suite, and is not particularly recommended,
+ but could be useful to some.
-- Joey Hess <joeyh@debian.org> Mon, 13 Jun 2011 19:53:24 -0400
diff --git a/doc/install.mdwn b/doc/install.mdwn
index 7818aaf15..8a3edcb64 100644
--- a/doc/install.mdwn
+++ b/doc/install.mdwn
@@ -32,3 +32,10 @@ To build and use git-annex, you will need:
* [ikiwiki](http://ikiwiki.info) (optional; used to build the docs)
Then just [[download]] git-annex and run: `make; make install`
+
+## Using cabal
+
+As a haskell package, git-annex can be built using cabal. For example:
+
+ cabal configure
+ cabal install --bindir=$HOME/bin
diff --git a/doc/install/comment_1_d9f7b851567445c7aa7ebbb440781819._comment b/doc/install/comment_1_d9f7b851567445c7aa7ebbb440781819._comment
deleted file mode 100644
index 616b3c4dd..000000000
--- a/doc/install/comment_1_d9f7b851567445c7aa7ebbb440781819._comment
+++ /dev/null
@@ -1,8 +0,0 @@
-[[!comment format=mdwn
- username="http://peter-simons.myopenid.com/"
- ip="84.189.1.247"
- subject="Why isn't this package built with Cabal?"
- date="2011-03-23T11:31:06Z"
- content="""
-It would be a lot easier to compile this package, if it had a Cabal file to describe the build; especially the build-time dependencies. Why isn't Cabal used?
-"""]]
diff --git a/doc/install/comment_2_cf0f829536744098d6846500db998b6a._comment b/doc/install/comment_2_cf0f829536744098d6846500db998b6a._comment
deleted file mode 100644
index 81d5a2c62..000000000
--- a/doc/install/comment_2_cf0f829536744098d6846500db998b6a._comment
+++ /dev/null
@@ -1,17 +0,0 @@
-[[!comment format=mdwn
- username="http://joey.kitenet.net/"
- nickname="joey"
- subject="comment 2"
- date="2011-03-23T15:18:29Z"
- content="""
-Because I haven't learned Cabal yet.
-
-But also because I've had bad experiences with both a) tying a particular program to a particular language's pet build system and then having to add ugliness when I later need to do something in the build that has nothing to do with that language and b) as a user, needing to deal with the pet build systems of languages when I just need to make some small change to the build process that is trivial in a Makefile.
-
-With that said, I do have a configure program written in Haskell, so at least it doesn't use autotools. :)
-
-Update: I did try using cabal, but git-annex includes 3 programs, and they
-all link to a lot of git-annex modules, and cabal wanted to build nearly
-every module 3 times, which was too slow for me and I could not find a way
-around.
-"""]]
diff --git a/git-annex.cabal b/git-annex.cabal
new file mode 100644
index 000000000..a3b04b60e
--- /dev/null
+++ b/git-annex.cabal
@@ -0,0 +1,49 @@
+Name: git-annex
+Version: 0.20110611
+Cabal-Version: >= 1.2
+License: GPL
+Maintainer: Joey Hess <joey@kitenet.net>
+Author: Joey Hess
+Stability: Stable
+Copyright: 2010-2011 Joey Hess
+License-File: GPL
+Extra-Source-Files:
+Homepage: http://git-annex.branchable.com/
+Build-type: Custom
+Category: Utility
+Synopsis: manage files with git, without checking their contents into git
+Description:
+ git-annex allows managing files with git, without checking the file
+ contents into git. While that may seem paradoxical, it is useful when
+ dealing with files larger than git can currently easily handle, whether due
+ to limitations in memory, checksumming time, or disk space.
+ .
+ Even without file content tracking, being able to manage files with git,
+ move files around and delete files with versioned directory trees, and use
+ branches and distributed clones, are all very handy reasons to use git. And
+ annexed files can co-exist in the same git repository with regularly
+ versioned files, which is convenient for maintaining documents, Makefiles,
+ etc that are associated with annexed files but that benefit from full
+ revision control.
+
+Executable git-annex
+ Main-Is: git-annex.hs
+ GHC-Options: -O2
+ Build-Depends: haskell98, base, MissingH, hslogger, directory, filepath,
+ unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
+ pcre-light, extensible-exceptions, dataenc, SHA, process, hS3
+
+Executable git-annex-shell
+ Main-Is: git-annex-shell.hs
+ GHC-Options: -O2
+ Build-Depends: haskell98, base, MissingH, hslogger, directory, filepath,
+ unix, containers, utf8-string, network, mtl, bytestring, old-locale, time,
+ pcre-light, extensible-exceptions, dataenc, SHA, process, hS3
+
+Executable git-union-merge
+ Main-Is: git-union-merge.hs
+ GHC-Options: -O2
+
+source-repository head
+ type: git
+ location: git://git-annex.branchable.com/