|
1 |
| -import Distribution.PackageDescription ( PackageDescription ) |
2 |
| -import Distribution.Simple ( defaultMainWithHooks |
3 |
| - , simpleUserHooks |
4 |
| - , postBuild |
5 |
| - , postCopy |
6 |
| - , postInst |
7 |
| - ) |
8 |
| -import Distribution.Simple.InstallDirs ( mandir |
9 |
| - , CopyDest (NoCopyDest) |
10 |
| - ) |
11 |
| -import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(..) |
12 |
| - , absoluteInstallDirs |
13 |
| - ) |
14 |
| -import Distribution.Simple.Utils ( installOrdinaryFiles |
15 |
| - , notice ) |
16 |
| -import Distribution.Simple.Setup ( buildVerbosity |
17 |
| - , copyDest |
18 |
| - , copyVerbosity |
19 |
| - , fromFlag |
20 |
| - , installVerbosity |
21 |
| - ) |
22 |
| -import Distribution.Verbosity ( Verbosity ) |
23 |
| - |
24 |
| -import System.IO ( openFile |
25 |
| - , IOMode (WriteMode) |
26 |
| - ) |
27 |
| -import System.Process ( runProcess ) |
28 |
| -import System.FilePath ( (</>) ) |
29 |
| - |
30 |
| --- WARNING to editors of this file: |
31 |
| --- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
32 |
| --- At this moment (Cabal 1.23), whatever you write here must be |
33 |
| --- compatible with ALL Cabal libraries which we support bootstrapping |
34 |
| --- with. This is because pre-setup-depends versions of cabal-install will |
35 |
| --- build Setup.hs against the version of Cabal which MATCHES the library |
36 |
| --- that cabal-install was built against. There is no way of overriding |
37 |
| --- this behavior without bumping the required 'cabal-version' in our |
38 |
| --- Cabal file. Travis will let you know if we fail to install from |
39 |
| --- tarball! |
40 |
| - |
| 1 | +import Distribution.Simple |
41 | 2 | main :: IO ()
|
42 |
| -main = defaultMainWithHooks $ simpleUserHooks |
43 |
| - { postBuild = \ _ flags _ lbi -> |
44 |
| - buildManpage lbi (fromFlag $ buildVerbosity flags) |
45 |
| - , postCopy = \ _ flags pkg lbi -> |
46 |
| - installManpage pkg lbi (fromFlag $ copyVerbosity flags) (fromFlag $ copyDest flags) |
47 |
| - , postInst = \ _ flags pkg lbi -> |
48 |
| - installManpage pkg lbi (fromFlag $ installVerbosity flags) NoCopyDest |
49 |
| - } |
50 |
| - |
51 |
| -buildManpage :: LocalBuildInfo -> Verbosity -> IO () |
52 |
| -buildManpage lbi verbosity = do |
53 |
| - let cabal = buildDir lbi </> "cabal/cabal" |
54 |
| - manpage = buildDir lbi </> "cabal/cabal.1" |
55 |
| - manpageHandle <- openFile manpage WriteMode |
56 |
| - notice verbosity ("Generating manual page " ++ manpage ++ " ...") |
57 |
| - _ <- runProcess cabal ["man","--raw"] Nothing Nothing Nothing (Just manpageHandle) Nothing |
58 |
| - return () |
59 |
| - |
60 |
| -installManpage :: PackageDescription -> LocalBuildInfo -> Verbosity -> CopyDest -> IO () |
61 |
| -installManpage pkg lbi verbosity copy = do |
62 |
| - let destDir = mandir (absoluteInstallDirs pkg lbi copy) </> "man1" |
63 |
| - installOrdinaryFiles verbosity destDir [(buildDir lbi </> "cabal", "cabal.1")] |
| 3 | +main = defaultMain |
0 commit comments