diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-05-31 13:58:13 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-05-31 13:58:13 -0400 |
commit | 555bd5d6b8f805cf5921bb67466c632c9db005e9 (patch) | |
tree | 09d3f39006e35f0bbeb9c8959470efcef2e7f6f6 | |
parent | a209897585b11bb93c2d56fab65a3b09e242d341 (diff) |
Remove Makefile from cabal tarball; man page building is now handled by a small haskell program.
This actually runs faster than building the man pages from the makefile
did. But the main purpose is to let Setup.hs import Build.Mans and so not
need the makefile.
-rw-r--r-- | Build/Mans.hs | 58 | ||||
-rwxr-xr-x | Build/mdwn2man | 2 | ||||
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Makefile | 38 | ||||
-rw-r--r-- | Setup.hs | 13 | ||||
-rw-r--r-- | doc/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/comment_3_d6702813e04cd78c9ac04c5d0fbca187._comment | 13 | ||||
-rw-r--r-- | git-annex.cabal | 2 |
7 files changed, 95 insertions, 33 deletions
diff --git a/Build/Mans.hs b/Build/Mans.hs new file mode 100644 index 000000000..a50396e5e --- /dev/null +++ b/Build/Mans.hs @@ -0,0 +1,58 @@ +{- Build man pages. + - + - Copyright 2016 Joey Hess <id@joeyh.name> + - + - Licensed under the GNU GPL version 3 or higher. + -} + +{-# OPTIONS_GHC -fno-warn-tabs #-} + +module Build.Mans where + +import System.Directory +import System.FilePath +import Data.List +import Control.Monad +import System.Process +import System.Exit +import Data.Maybe +import Utility.Exception + +main :: IO () +main = do + mans <- buildMans + when (any isNothing mans) $ + error "mdwn2man failed" + +buildMans :: IO [Maybe FilePath] +buildMans = do + mansrc <- filter isManSrc <$> getDirectoryContents "doc" + createDirectoryIfMissing False "man" + forM mansrc $ \f -> do + let src = "doc" </> f + let dest = srcToDest src + srcm <- getModificationTime src + destm <- catchMaybeIO $ getModificationTime dest + if (Just srcm > destm) + then do + r <- system $ unwords + [ "./Build/mdwn2man" + , progName src + , "1" + , src + , "> " ++ dest + ] + if r == ExitSuccess + then return (Just dest) + else return Nothing + else return (Just dest) + +isManSrc :: FilePath -> Bool +isManSrc s = "git-annex" `isPrefixOf` (takeFileName s) + && takeExtension s == ".mdwn" + +srcToDest :: FilePath -> FilePath +srcToDest s = "man" </> progName s ++ ".1" + +progName :: FilePath -> FilePath +progName = dropExtension . takeFileName diff --git a/Build/mdwn2man b/Build/mdwn2man index f56d9b0c7..09b684a07 100755 --- a/Build/mdwn2man +++ b/Build/mdwn2man @@ -2,8 +2,6 @@ # Warning: hack my $prog=shift; -$prog=~s/\.\d+$//; -$prog=~s/man\///; my $section=shift; print ".TH $prog $section\n"; @@ -3,6 +3,8 @@ git-annex (6.20160528) UNRELEASED; urgency=medium * Improve SHA*E extension extraction code. * Windows: Avoid terminating git-annex branch lines with \r\n when union merging and performing transitions. + * Remove Makefile from cabal tarball; man page building is now handled by + a small haskell program. -- Joey Hess <id@joeyh.name> Fri, 27 May 2016 13:12:48 -0400 @@ -1,4 +1,3 @@ -mans=$(shell find doc -maxdepth 1 -name git-annex*.mdwn | sed -e 's/^doc/man/' -e 's/\.mdwn/\.1/') all=git-annex mans docs # set to "./Setup" if you lack a cabal program. Or can be set to "stack" @@ -31,9 +30,6 @@ git-annex: Build/SysConfig.hs ln -sf dist/build/git-annex/git-annex git-annex; \ fi -man/%.1: doc/%.mdwn - ./Build/mdwn2man $@ 1 $< > $@ - # These are not built normally. git-union-merge.1: doc/git-union-merge.mdwn ./Build/mdwn2man git-union-merge 1 doc/git-union-merge.mdwn > git-union-merge.1 @@ -42,7 +38,7 @@ git-union-merge: install-mans: mans install -d $(DESTDIR)$(PREFIX)/$(SHAREDIR)/man/man1 - install -m 0644 $(mans) $(DESTDIR)$(PREFIX)/$(SHAREDIR)/man/man1 + install -m 0644 man/*.1 $(DESTDIR)$(PREFIX)/$(SHAREDIR)/man/man1 install-docs: docs install-mans install -d $(DESTDIR)$(PREFIX)/$(SHAREDIR)/doc/git-annex @@ -80,25 +76,19 @@ else IKIWIKI=ikiwiki endif -mans: man $(mans) - -man: - mkdir -p man +mans: Build/Mans + ./Build/Mans docs: mans - @if [ ! -e doc/index.mdwn ]; then \ - echo "** doc/index.mdwn does not exist, skipping building docs (clone git-annex source to enable full docs build)" >&2; \ - else \ - LC_ALL=C TZ=UTC $(IKIWIKI) doc html -v --wikiname git-annex \ - --plugin=goodstuff \ - --no-usedirs --disable-plugin=openid --plugin=sidebar \ - --underlaydir=/dev/null --set deterministic=1 \ - --disable-plugin=shortcut --disable-plugin=smiley \ - --plugin=comments --set comments_pagespec="*" \ - --exclude='news/.*' --exclude='design/assistant/blog/*' \ - --exclude='bugs/*' --exclude='todo/*' --exclude='forum/*' \ - --exclude='users/*' --exclude='devblog/*' --exclude='thanks'; \ - fi + LC_ALL=C TZ=UTC $(IKIWIKI) doc html -v --wikiname git-annex \ + --plugin=goodstuff \ + --no-usedirs --disable-plugin=openid --plugin=sidebar \ + --underlaydir=/dev/null --set deterministic=1 \ + --disable-plugin=shortcut --disable-plugin=smiley \ + --plugin=comments --set comments_pagespec="*" \ + --exclude='news/.*' --exclude='design/assistant/blog/*' \ + --exclude='bugs/*' --exclude='todo/*' --exclude='forum/*' \ + --exclude='users/*' --exclude='devblog/*' --exclude='thanks' clean: if [ "$(BUILDER)" != ./Setup ] && [ "$(BUILDER)" != cabal ]; then $(BUILDER) clean; fi @@ -106,7 +96,7 @@ clean: doc/.ikiwiki html dist tags Build/SysConfig.hs \ Setup Build/InstallDesktopFile Build/EvilSplicer \ Build/Standalone Build/OSXMkLibs Build/LinuxMkLibs \ - Build/DistributionUpdate Build/BuildVersion \ + Build/DistributionUpdate Build/BuildVersion Build/Mans \ git-union-merge .tasty-rerun-log find . -name \*.o -exec rm {} \; find . -name \*.hi -exec rm {} \; @@ -121,6 +111,8 @@ Build/OSXMkLibs: Build/OSXMkLibs.hs $(GHC) --make $@ -Wall -fno-warn-tabs Build/LinuxMkLibs: Build/LinuxMkLibs.hs $(GHC) --make $@ -Wall -fno-warn-tabs +Build/Mans: Build/Mans.hs + $(GHC) --make $@ -Wall -fno-warn-tabs # Upload to hackage. hackage: @@ -14,11 +14,13 @@ import Control.Applicative import Control.Monad import System.Directory import Data.List +import Data.Maybe import Control.Exception import qualified System.Info import qualified Build.DesktopFile as DesktopFile import qualified Build.Configure as Configure +import Build.Mans (buildMans) import Utility.SafeCommand main :: IO () @@ -51,13 +53,10 @@ installManpages copyDest verbosity pkg lbi = installOrdinaryFiles verbosity dstManDir =<< srcManpages where dstManDir = mandir (absoluteInstallDirs pkg lbi copyDest) </> "man1" - srcManpages = do - havemans <- boolSystem "make" [Param "mans"] - if havemans - then zip (repeat "man") - . filter (".1" `isSuffixOf`) - <$> getDirectoryContents "man" - else return [] + -- If mdwn2man fails, perhaps because perl is not available, + -- we just skip installing man pages. + srcManpages = zip (repeat "man") . map takeFileName . catMaybes + <$> buildMans installDesktopFile :: CopyDest -> Verbosity -> PackageDescription -> LocalBuildInfo -> IO () installDesktopFile copyDest _verbosity pkg lbi diff --git a/doc/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/comment_3_d6702813e04cd78c9ac04c5d0fbca187._comment b/doc/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/comment_3_d6702813e04cd78c9ac04c5d0fbca187._comment new file mode 100644 index 000000000..f911a5dac --- /dev/null +++ b/doc/bugs/bash_completion_file_is_missing_in_the_6.20160527_tarball_on_hackage/comment_3_d6702813e04cd78c9ac04c5d0fbca187._comment @@ -0,0 +1,13 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 3""" + date="2016-05-31T17:18:09Z" + content=""" +It could be that I made the wrong decision, but the tarball was being built +with hacks to include all those files before, and was still not complete +due to limits in what's allowed in tarballs on hackage. + +The Makefile will be removed from the tarball in the next release, +which should I think make it clearer that the tarball is not intended for a +`make install` situation. +"""]] diff --git a/git-annex.cabal b/git-annex.cabal index c8d33b2be..f9c665a5f 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -139,7 +139,6 @@ Extra-Source-Files: doc/git-annex-xmppgit.mdwn doc/logo.svg doc/logo_16x16.png - Makefile Build/mdwn2man Assistant/WebApp/routes static/activityicon.gif @@ -663,6 +662,7 @@ Executable git-annex Build.EvilSplicer Build.InstallDesktopFile Build.LinuxMkLibs + Build.Mans Build.NullSoftInstaller Build.OSXMkLibs Build.Standalone |