Support Cabal 3. Man page no longer autobuilds.

This commit is contained in:
Vidar Holen 2019-11-16 10:44:48 -08:00
parent 874bdcb514
commit 2c026f1ec7
4 changed files with 9 additions and 47 deletions

View File

@ -1,5 +1,5 @@
# Build-only image # Build-only image
FROM ubuntu:18.04 AS build FROM ubuntu:19.10 AS build
USER root USER root
WORKDIR /opt/shellCheck WORKDIR /opt/shellCheck
@ -12,7 +12,7 @@ COPY ShellCheck.cabal ./
RUN cabal update && cabal install --dependencies-only --ghc-options="-optlo-Os -split-sections" RUN cabal update && cabal install --dependencies-only --ghc-options="-optlo-Os -split-sections"
# Copy source and build it # Copy source and build it
COPY LICENSE Setup.hs shellcheck.hs ./ COPY LICENSE shellcheck.hs ./
COPY src src COPY src src
RUN cabal build Paths_ShellCheck && \ RUN cabal build Paths_ShellCheck && \
ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck -split-sections -optc-Wl,--gc-sections -optlo-Os && \ ghc -optl-static -optl-pthread -isrc -idist/build/autogen --make shellcheck -split-sections -optc-Wl,--gc-sections -optlo-Os && \

View File

@ -1,36 +0,0 @@
import Distribution.PackageDescription (
HookedBuildInfo,
emptyHookedBuildInfo )
import Distribution.Simple (
Args,
UserHooks ( preSDist ),
defaultMainWithHooks,
simpleUserHooks )
import Distribution.Simple.Setup ( SDistFlags )
import System.Process ( system )
main = defaultMainWithHooks myHooks
where
myHooks = simpleUserHooks { preSDist = myPreSDist }
-- | This hook will be executed before e.g. @cabal sdist@. It runs
-- pandoc to create the man page from shellcheck.1.md. If the pandoc
-- command is not found, this will fail with an error message:
--
-- /bin/sh: pandoc: command not found
--
-- Since the man page is listed in the Extra-Source-Files section of
-- our cabal file, a failure here should result in a failure to
-- create the distribution tarball (that's a good thing).
--
myPreSDist :: Args -> SDistFlags -> IO HookedBuildInfo
myPreSDist _ _ = do
putStrLn "Building the man page (shellcheck.1) with pandoc..."
putStrLn pandoc_cmd
result <- system pandoc_cmd
putStrLn $ "pandoc exited with " ++ show result
return emptyHookedBuildInfo
where
pandoc_cmd = "pandoc -s -f markdown-smart -t man shellcheck.1.md -o shellcheck.1"

View File

@ -7,7 +7,7 @@ Category: Static Analysis
Author: Vidar Holen Author: Vidar Holen
Maintainer: vidar@vidarholen.net Maintainer: vidar@vidarholen.net
Homepage: https://www.shellcheck.net/ Homepage: https://www.shellcheck.net/
Build-Type: Custom Build-Type: Simple
Cabal-Version: >= 1.8 Cabal-Version: >= 1.8
Bug-reports: https://github.com/koalaman/shellcheck/issues Bug-reports: https://github.com/koalaman/shellcheck/issues
Description: Description:
@ -26,19 +26,13 @@ Extra-Source-Files:
-- documentation -- documentation
README.md README.md
shellcheck.1.md shellcheck.1.md
-- built with a cabal sdist hook -- A script to build the man page using pandoc
shellcheck.1 manpage
-- convenience script for stripping tests -- convenience script for stripping tests
striptests striptests
-- tests -- tests
test/shellcheck.hs test/shellcheck.hs
custom-setup
setup-depends:
base >= 4 && <5,
process >= 1.0 && <1.7,
Cabal >= 1.10 && <2.5
source-repository head source-repository head
type: git type: git
location: git://github.com/koalaman/shellcheck.git location: git://github.com/koalaman/shellcheck.git

4
manpage Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo >&2 "Generating man page using pandoc"
pandoc -s -f markdown-smart -t man shellcheck.1.md -o shellcheck.1 || exit
echo >&2 "Done. You can read it with: man ./shellcheck.1"