hook desktop menu file installation into makefile and cabal

This commit is contained in:
Joey Hess 2012-08-01 21:04:25 -04:00
parent ed07546288
commit e78b13c428
3 changed files with 15 additions and 1 deletions

View file

@ -5,7 +5,7 @@
- Licensed under the GNU GPL version 3 or higher.
-}
module Build.Desktop where
module Build.InstallDesktopFile where
import Utility.Exception
import Utility.FreeDesktop
@ -32,3 +32,8 @@ writeDesktop d = do
then userDesktopMenuFilePath "git-annex"
else return $ systemDesktopMenuFilePath "git-annex"
writeDesktopMenuFile d dest
main = getArgs >>= go
where
go [] = error "specify git-annex command"
go (command:_) = writeDesktop $ desktop command

View file

@ -86,6 +86,7 @@ install: all install-docs
install -d $(DESTDIR)$(PREFIX)/bin
install $(bins) $(DESTDIR)$(PREFIX)/bin
ln -sf git-annex $(DESTDIR)$(PREFIX)/bin/git-annex-shell
runghc Build/InstallDesktopFile.hs $(PREFIX)/bin/git-annex || true
test: $(sources) $(clibs)
@if ! $(GHCMAKE) -O0 test $(clibs); then \

View file

@ -10,6 +10,7 @@ import Distribution.PackageDescription (PackageDescription(..))
import Distribution.Verbosity (Verbosity)
import System.FilePath
import qualified Build.InstallDesktopFile as InstallDesktopFile
import qualified Build.Configure as Configure
main = defaultMainWithHooks simpleUserHooks
@ -25,6 +26,7 @@ myPostInst :: Args -> InstallFlags -> PackageDescription -> LocalBuildInfo -> IO
myPostInst _ (InstallFlags { installVerbosity }) pkg lbi = do
installGitAnnexShell dest verbosity pkg lbi
installManpages dest verbosity pkg lbi
installDesktopFile dest verbosity pkg lbi
where
dest = NoCopyDest
verbosity = fromFlag installVerbosity
@ -47,3 +49,9 @@ installManpages copyDest verbosity pkg lbi =
srcManpages = zip (repeat srcManDir) manpages
srcManDir = ""
manpages = ["git-annex.1", "git-annex-shell.1"]
installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
installDesktopFile copyDest verbosity pkg lbi =
InstallDesktopFile.writeDesktop $ InstallDesktopFile.desktop $ dstBinDir </> "git-annex"
where
dstBinDir = bindir $ absoluteInstallDirs pkg lbi copyDest