diff options
-rw-r--r-- | INSTALL.md | 3 | ||||
-rw-r--r-- | Setup.hs | 28 | ||||
-rw-r--r-- | linux/Dockerfile | 1 | ||||
-rwxr-xr-x | macos/make_macos_package.sh | 3 | ||||
-rw-r--r-- | pandoc.cabal | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Data.hs (renamed from src/Text/Pandoc/Data.hsb) | 9 |
6 files changed, 8 insertions, 38 deletions
diff --git a/INSTALL.md b/INSTALL.md index ed34a95c9..902e98a9f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -226,9 +226,6 @@ assume that the pandoc source directory is your working directory. - `embed_data_files`: embed all data files into the binary (default no). This is helpful if you want to create a relocatable binary. - Note: if this option is selected, you need to install the - `hsb2hs` preprocessor: `cabal install hsb2hs` (version 0.3.1 or - higher is required). - `https`: enable support for downloading resources over https (using the `http-client` and `http-client-tls` libraries). @@ -20,41 +20,17 @@ import Distribution.Simple import Distribution.Simple.PreProcess import Distribution.Simple.Setup (ConfigFlags(..), CopyFlags(..), fromFlag) import Distribution.PackageDescription (PackageDescription(..), FlagName(..)) -import Distribution.Simple.Utils ( rawSystemExitCode, findProgramVersion ) import System.Exit -import Distribution.Simple.Utils (info, notice, installOrdinaryFiles) +import Distribution.Simple.Utils (notice, installOrdinaryFiles) import Distribution.Simple.Program (simpleProgram, Program(..)) import Distribution.Simple.LocalBuildInfo import Control.Monad (when) main :: IO () main = defaultMainWithHooks $ simpleUserHooks { - -- enable hsb2hs preprocessor for .hsb files - hookedPreProcessors = [ppBlobSuffixHandler] - , hookedPrograms = [(simpleProgram "hsb2hs"){ - programFindVersion = \verbosity fp -> - findProgramVersion "--version" id verbosity fp }] - , postCopy = installManPage + postCopy = installManPage } -ppBlobSuffixHandler :: PPSuffixHandler -ppBlobSuffixHandler = ("hsb", \_ lbi -> - PreProcessor { - platformIndependent = True, - runPreProcessor = mkSimplePreProcessor $ \infile outfile verbosity -> - do let embedData = case lookup (FlagName "embed_data_files") - (configConfigurationsFlags (configFlags lbi)) of - Just True -> True - _ -> False - when embedData $ - do info verbosity $ "Preprocessing " ++ infile ++ " to " ++ outfile - ec <- rawSystemExitCode verbosity "hsb2hs" - [infile, infile, outfile] - case ec of - ExitSuccess -> return () - ExitFailure _ -> error "hsb2hs is needed to build this program" - }) - installManPage :: Args -> CopyFlags -> PackageDescription -> LocalBuildInfo -> IO () installManPage _ flags pkg lbi = do diff --git a/linux/Dockerfile b/linux/Dockerfile index 630abc17e..b725bbaa5 100644 --- a/linux/Dockerfile +++ b/linux/Dockerfile @@ -14,7 +14,6 @@ RUN mkdir -p /usr/src/ WORKDIR /usr/src/ RUN git clone https://github.com/jgm/pandoc WORKDIR /usr/src/pandoc -RUN stack install --local-bin-path /usr/bin hsb2hs RUN stack install --stack-yaml stack.pkg.yaml --only-dependencies \ --flag 'pandoc:embed_data_files' \ --test --ghc-options '-O2 -optc-Os -optl-static -fPIC' \ diff --git a/macos/make_macos_package.sh b/macos/make_macos_package.sh index 911219f14..c5d073cdc 100755 --- a/macos/make_macos_package.sh +++ b/macos/make_macos_package.sh @@ -14,8 +14,6 @@ PACKAGEMAKER=/Applications/PackageMaker.app/Contents/MacOS/PackageMaker DEVELOPER_ID_APPLICATION=${DEVELOPER_ID_APPLICATION:-Developer ID Application: John Macfarlane} DEVELOPER_ID_INSTALLER=${DEVELOPER_ID_INSTALLER:-Developer ID Installer: John Macfarlane} -# We need this for hsb2hs: -PATH=$LOCALBIN:$PATH export MACMACOS_DEPLOYMENT_TARGET=10.7 # echo Removing old files... @@ -23,7 +21,6 @@ rm -rf $DIST mkdir -p $DIST mkdir -p $RESOURCES stack setup -which hsb2hs || stack install hsb2hs which cpphs || stack install cpphs echo Building pandoc... diff --git a/pandoc.cabal b/pandoc.cabal index 1588e532f..dfa63cd07 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -340,7 +340,7 @@ Library cpp-options: -DHTTP_CLIENT if flag(embed_data_files) cpp-options: -DEMBED_DATA_FILES - Build-Tools: hsb2hs >= 0.3.1 + build-depends: file-embed >= 0.0 && < 0.1 other-modules: Text.Pandoc.Data if os(darwin) Build-Tools: cpphs >= 1.19 diff --git a/src/Text/Pandoc/Data.hsb b/src/Text/Pandoc/Data.hs index 02c109816..df26f5412 100644 --- a/src/Text/Pandoc/Data.hsb +++ b/src/Text/Pandoc/Data.hs @@ -1,6 +1,8 @@ -{-# LANGUAGE OverloadedStrings #-} --- to be processed using hsb2hs +{-# LANGUAGE TemplateHaskell #-} + module Text.Pandoc.Data (dataFiles) where + +import Data.FileEmbed import qualified Data.ByteString as B import System.FilePath (splitDirectories) import qualified System.FilePath.Posix as Posix @@ -12,5 +14,4 @@ dataFiles = map (\(fp, contents) -> (Posix.joinPath (splitDirectories fp), contents)) dataFiles' dataFiles' :: [(FilePath, B.ByteString)] -dataFiles' = ("MANUAL.txt", %blob "MANUAL.txt") : %blobs "data" - +dataFiles' = ("MANUAL.txt", $(embedFile "MANUAL.txt")) : $(embedDir "data") |