summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-12 13:37:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-12 13:37:17 -0400
commit2e5ea30981251fbdce38e18f3521917742c892a3 (patch)
treed7c94a33061949007dada9d7cda5b0b748a4e8b4
parent942d8f72984377c4e69d7c55877621d434e5d687 (diff)
parent4ebb0b51d77484fcee12fd92a71b737b1aaca283 (diff)
Merge branch 'master' into watch
Conflicts: debian/changelog git-annex.cabal
-rw-r--r--.gitignore4
l---------CONTRIBUTING1
l---------COPYRIGHT1
-rw-r--r--Makefile25
-rw-r--r--Setup.hs40
-rw-r--r--debian/changelog4
-rw-r--r--doc/contributing.mdwn7
-rw-r--r--git-annex.cabal3
-rwxr-xr-xmake-sdist.sh13
9 files changed, 75 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index b6b8d606d..d628f23b7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,7 @@ html
Utility/Touch.hs
Utility/libdiskfree.o
dist
+# Sandboxed builds
+cabal-dev
+# Project-local emacs configuration
+.dir-locals.el
diff --git a/CONTRIBUTING b/CONTRIBUTING
new file mode 120000
index 000000000..8ad193e22
--- /dev/null
+++ b/CONTRIBUTING
@@ -0,0 +1 @@
+doc/contributing.mdwn \ No newline at end of file
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 120000
index 000000000..9060ce820
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1 @@
+debian/copyright \ No newline at end of file
diff --git a/Makefile b/Makefile
index 2d8146c85..d23f08a7d 100644
--- a/Makefile
+++ b/Makefile
@@ -47,18 +47,22 @@ git-annex-shell.1: doc/git-annex-shell.mdwn
git-union-merge.1: doc/git-union-merge.mdwn
./mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1
-install: all
- install -d $(DESTDIR)$(PREFIX)/bin
- install $(bins) $(DESTDIR)$(PREFIX)/bin
- ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
+install-mans: $(mans)
install -d $(DESTDIR)$(PREFIX)/share/man/man1
install -m 0644 $(mans) $(DESTDIR)$(PREFIX)/share/man/man1
+
+install-docs: docs install-mans
install -d $(DESTDIR)$(PREFIX)/share/doc/git-annex
if [ -d html ]; then \
rsync -a --delete html/ $(DESTDIR)$(PREFIX)/share/doc/git-annex/html/; \
fi
-test:
+install: all install-docs
+ install -d $(DESTDIR)$(PREFIX)/bin
+ install $(bins) $(DESTDIR)$(PREFIX)/bin
+ ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
+
+test: $(sources) $(clibs)
@if ! $(GHCMAKE) -O0 test $(clibs); then \
echo "** failed to build the test suite" >&2; \
exit 1; \
@@ -96,13 +100,10 @@ clean:
rm -rf tmp $(bins) $(mans) test configure *.tix .hpc $(sources) \
doc/.ikiwiki html dist $(clibs)
-# Workaround for cabal sdist not running Setup hooks, so I cannot
-# generate a file list there.
-sdist: clean
- @if [ ! -e git-annex.cabal.orig ]; then cp git-annex.cabal git-annex.cabal.orig; fi
- @sed -e "s!\(Extra-Source-Files: \).*!\1$(shell find . -name .git -prune -or -not -name \\*.orig -not -type d -print | perl -ne 'print unless length >= 100')!i" < git-annex.cabal.orig > git-annex.cabal
- @cabal sdist
- @mv git-annex.cabal.orig git-annex.cabal
+# Workaround for `cabal sdist` requiring all included files to be listed
+# in .cabal.
+sdist: clean $(mans)
+ ./make-sdist.sh
# Upload to hackage.
hackage: sdist
diff --git a/Setup.hs b/Setup.hs
index c36d6e4fe..80d23cc87 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,27 +1,49 @@
+{-# LANGUAGE NamedFieldPuns #-}
+
{- cabal setup file -}
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
-import System.Cmd
+import Distribution.Simple.Utils (installOrdinaryFiles, rawSystemExit)
+import Distribution.PackageDescription (PackageDescription(..))
+import Distribution.Verbosity (Verbosity)
import System.FilePath
import qualified Build.Configure as Configure
main = defaultMainWithHooks simpleUserHooks
{ preConf = configure
- , instHook = install
+ , postInst = myPostInst
}
configure _ _ = do
Configure.run Configure.tests
return (Nothing, [])
-install pkg_descr lbi userhooks flags = do
- r <- (instHook simpleUserHooks) pkg_descr lbi userhooks flags
- _ <- rawSystem "ln" ["-sf", "git-annex",
- bindir installDirs </> "git-annex-shell"]
- return r
+myPostInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO ()
+myPostInst _ (InstallFlags { installVerbosity }) pkg lbi = do
+ installGitAnnexShell dest verbosity pkg lbi
+ installManpages dest verbosity pkg lbi
+ where
+ dest = NoCopyDest
+ verbosity = fromFlag installVerbosity
+
+installGitAnnexShell :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
+installGitAnnexShell copyDest verbosity pkg lbi =
+ rawSystemExit verbosity "ln"
+ ["-sf", "git-annex", dstBinDir </> "git-annex-shell"]
+ where
+ dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest
+
+-- See http://www.haskell.org/haskellwiki/Cabal/Developer-FAQ#Installing_manpages.
+--
+-- Based on pandoc's Setup.hs.
+installManpages :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
+installManpages copyDest verbosity pkg lbi =
+ installOrdinaryFiles verbosity dstManDir srcManpages
where
- installDirs = absoluteInstallDirs pkg_descr lbi $
- fromFlag (copyDest defaultCopyFlags)
+ dstManDir = mandir (absoluteInstallDirs pkg lbi copyDest) </> "man1"
+ srcManpages = zip (repeat srcManDir) manpages
+ srcManDir = ""
+ manpages = ["git-annex.1", "git-annex-shell.1"]
diff --git a/debian/changelog b/debian/changelog
index 4ea0f46ac..60a42dcde 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,8 +3,10 @@ git-annex (3.20120612) UNRELEASED; urgency=low
* watch: New subcommand, which uses inotify to watch for changes to
files and automatically annexes new files, etc, so you don't need
to manually run git commands when manipulating files.
+ * Install man page when run by cabal, in a location where man will
+ find it, even when installing under $HOME. Thanks, Nathan Collins
- -- Joey Hess <joeyh@debian.org> Tue, 05 Jun 2012 20:25:51 -0400
+ -- Joey Hess <joeyh@debian.org> Tue, 12 Jun 2012 11:35:59 -0400
git-annex (3.20120611) unstable; urgency=medium
diff --git a/doc/contributing.mdwn b/doc/contributing.mdwn
new file mode 100644
index 000000000..c3ab3d69d
--- /dev/null
+++ b/doc/contributing.mdwn
@@ -0,0 +1,7 @@
+## Style
+
+This project uses tabs for indentation and the code looks fine with
+any tab width. If you are using Emacs, and have it configured to use
+spaces for indentation, then you can add a `./.dir-locals.el` to use
+tabs for files in this project. See
+<http://www.emacswiki.org/emacs/DirectoryVariables>.
diff --git a/git-annex.cabal b/git-annex.cabal
index 5f94392f5..7556f7541 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -7,7 +7,6 @@ Author: Joey Hess
Stability: Stable
Copyright: 2010-2012 Joey Hess
License-File: GPL
-Extra-Source-Files: use-make-sdist-instead
Homepage: http://git-annex.branchable.com/
Build-type: Custom
Category: Utility
@@ -37,6 +36,7 @@ Executable git-annex
base == 4.5.*, monad-control, transformers-base, lifted-base,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance,
hinotify, STM
+ -- Need to list this because it's generated from a .hsc file.
Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
Extensions: CPP
@@ -54,6 +54,7 @@ Test-Suite test
base == 4.5.*, monad-control, transformers-base, lifted-base,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance,
hinotify, STM
+ Other-Modules: Utility.Touch
C-Sources: Utility/libdiskfree.c
Extensions: CPP
diff --git a/make-sdist.sh b/make-sdist.sh
new file mode 100755
index 000000000..409871916
--- /dev/null
+++ b/make-sdist.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Create target directory
+sdist_dir=git-annex-$(grep '^Version:' git-annex.cabal | sed -re 's/Version: *//')
+mkdir --parents dist/$sdist_dir
+
+find . \( -name .git -or -name dist -or -name cabal-dev \) -prune \
+ -or -not -name \\*.orig -not -type d -print \
+| perl -ne 'print unless length >= 100' \
+| xargs cp --parents --target-directory dist/$sdist_dir
+
+cd dist
+tar -caf $sdist_dir.tar.gz $sdist_dir