Commit 1057ef38 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Build hp2ps utility.

parent 6f2b78bb
module GHC (
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
compareSizes, deepseq, deriveConstants, directory, dllSplit, filepath,
genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim,
ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
mkUserGuidePart, parallel, pretty,
primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
unix, win32, xhtml,
genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim, ghcPwd, ghcTags,
haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
integerSimple, mkUserGuidePart, parallel, pretty, primitive, process,
runghc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml,
defaultKnownPackages, defaultTargetDirectory, defaultProgramPath
) where
......@@ -24,18 +23,18 @@ defaultKnownPackages =
[ array, base, binPackageDb, binary, bytestring, cabal, compiler
, containers, compareSizes, deepseq, deriveConstants, directory, dllSplit
, filepath, genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim
, ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple
, mkUserGuidePart, parallel, pretty, primitive, process, runghc, stm, templateHaskell, terminfo
, time, transformers, unix, win32, xhtml ]
, ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin
, integerGmp, integerSimple, mkUserGuidePart, parallel, pretty, primitive
, process, runghc, stm, templateHaskell, terminfo, time, transformers, unix
, win32, xhtml ]
-- Package definitions
array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
compareSizes, deepseq, deriveConstants, directory, dllSplit, filepath,
genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim, ghcPwd,
ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
mkUserGuidePart, parallel, pretty,
primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
unix, win32, xhtml :: Package
ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
integerSimple, mkUserGuidePart, parallel, pretty, primitive, process,
runghc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml :: Package
array = library "array"
base = library "base"
......@@ -63,6 +62,7 @@ haddock = utility "haddock"
haskeline = library "haskeline"
hsc2hs = utility "hsc2hs"
hoopl = library "hoopl"
hp2ps = utility "hp2ps"
hpc = library "hpc"
hpcBin = utility "hpc-bin" `setPath` "utils/hpc"
integerGmp = library "integer-gmp"
......@@ -82,8 +82,6 @@ unix = library "unix"
win32 = library "Win32"
xhtml = library "xhtml"
-- TODO: hp2ps
-- TODO: The following utils are not included into the build system because
-- they seem to be unused or unrelated to the build process: chechUniques,
-- completion, count_lines, coverity, debugNGC, describe-unexpected, genargs,
......@@ -119,6 +117,7 @@ defaultProgramPath stage pkg
| pkg == ghcTags = program $ pkgName pkg
| pkg == haddock = program $ pkgName pkg
| pkg == hsc2hs = program $ pkgName pkg
| pkg == hp2ps = program $ pkgName pkg
| pkg == hpcBin = program $ pkgName pkg
| pkg == mkUserGuidePart = program $ pkgName pkg
| pkg == runghc = program $ pkgName pkg
......
module Rules.Data (buildPackageData) where
import Expression
import GHC (deriveConstants, genapply, genprimopcode)
import GHC (deriveConstants, genapply, genprimopcode, hp2ps)
import Oracles
import Predicates (registerPackage)
import Rules.Actions
import Rules.Resources
import Settings
import Settings.Builders.GhcCabal
-- Build package-data.mk by using GhcCabal to process pkgCabal file
buildPackageData :: Resources -> PartialTarget -> Rules ()
......@@ -80,6 +81,25 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
, "utils_genprimopcode_dist-boot_HC_OPTS = -package array" ]
writeFileChanged mk contents
-- TODO: PROGNAME was $(CrossCompilePrefix)hp2ps
-- TODO: code duplication around ghcIncludeDirs
-- TODO: now using DEP_EXTRA_LIBS instead of EXTRA_LIBRARIES
priority 2.0 $
when (pkg == hp2ps) $ path -/- "package-data.mk" %> \mk -> do
let cSrcs = [ "AreaBelow.c", "Curves.c", "Error.c", "Main.c"
, "Reorder.c", "TopTwenty.c", "AuxFile.c", "Deviation.c"
, "HpFile.c", "Marks.c", "Scale.c", "TraceElement.c"
, "Axes.c", "Dimensions.c", "Key.c", "PsFile.c", "Shade.c"
, "Utilities.c" ]
contents = unlines
[ "utils_hp2ps_dist-boot_PROGNAME = hp2ps"
, "utils_hp2ps_dist-boot_C_SRCS = " ++ unwords cSrcs
, "utils_hp2ps_dist-boot_INSTALL = YES"
, "utils_hp2ps_dist-boot_INSTALL_INPLACE = YES"
, "utils_hp2ps_dist-boot_DEP_EXTRA_LIBS = m"
, "utils_hp2ps_dist-boot_CC_OPTS = " ++ unwords (map ("-I"++) ghcIncludeDirs) ]
writeFileChanged mk contents
-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
-- 1) Drop lines containing '$'
-- For example, get rid of
......
......@@ -24,8 +24,11 @@ buildPackageDependencies _ target @ (PartialTarget stage pkg) =
hDepFile %> \file -> do
srcs <- interpretPartial target getPackageSources
when (pkg == compiler) $ need [platformH]
putBuild $ "srcs = " ++ show srcs
need srcs
build $ fullTarget target (GhcM stage) srcs [file]
if srcs == []
then writeFileChanged file ""
else build $ fullTarget target (GhcM stage) srcs [file]
removeFileIfExists $ file <.> "bak"
(buildPath -/- ".dependencies") %> \file -> do
......@@ -34,7 +37,7 @@ buildPackageDependencies _ target @ (PartialTarget stage pkg) =
need $ hDepFile : cDepFiles -- need all for more parallelism
cDeps <- fmap concat $ mapM readFile' cDepFiles
hDeps <- readFile' hDepFile
-- TODO: very ugly and fragile
-- TODO: very ugly and fragile; use gcc -MM instead?
let hsIncl hs incl = buildPath -/- hs <.> "o" ++ " : "
++ buildPath -/- incl ++ "\n"
extraDeps = if pkg /= compiler then [] else
......
......@@ -23,6 +23,7 @@ buildProgram _ target @ (PartialTarget stage pkg) = do
++ [ buildPath -/- "Paths_hsc2hs.o" | pkg == hsc2hs ]
++ [ buildPath -/- "Paths_haddock.o" | pkg == haddock ]
objs = cObjs ++ hObjs
putBuild $ "objs = " ++ show objs
need objs
build $ fullTargetWithWay target (Ghc stage) vanilla objs [bin]
synopsis <- interpretPartial target $ getPkgData Synopsis
......
......@@ -30,7 +30,8 @@ ghcArgs = stagedBuilder Ghc ? do
, arg "-Wall"
, arg "-fwarn-tabs"
, isLibrary pkg ? splitObjects ? arg "-split-objs"
, package ghc ? arg "-no-hs-main"
, package ghc ? arg "-no-hs-main" -- TODO: simplify
, package hp2ps ? arg "-no-hs-main"
, not buildObj ? arg "-no-auto-link-packages"
, package runghc ? file "//Main.o" ?
append ["-cpp", "-DVERSION=\"" ++ version ++ "\""]
......@@ -96,7 +97,8 @@ packageGhcArgs = do
pkgKey <- getPkgData PackageKey
pkgDepIds <- getPkgDataList DepIds
mconcat
[ not (pkg == deriveConstants || pkg == genapply || pkg == genprimopcode) ?
[ not (pkg == deriveConstants || pkg == genapply
|| pkg == genprimopcode || pkg == hp2ps) ?
arg "-hide-all-packages"
, arg "-no-user-package-db"
, stage0 ? arg "-package-db libraries/bootstrapping.conf"
......@@ -122,7 +124,8 @@ includeGhcArgs = do
, arg $ "-I" ++ autogenPath
, append [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
, append [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
, not (pkg == deriveConstants || pkg == genapply || pkg == genprimopcode) ?
, not (pkg == deriveConstants || pkg == genapply
|| pkg == genprimopcode || pkg == hp2ps) ?
append [ "-optP-include"
, "-optP" ++ autogenPath -/- "cabal_macros.h" ] ]
......
module Settings.Builders.GhcCabal (
cabalArgs, ghcCabalHsColourArgs, bootPackageDbArgs, customPackageArgs,
ccArgs, cppArgs, ccWarnings, argStagedSettingList, needDll0
cabalArgs, ghcCabalHsColourArgs, ghcIncludeDirs, bootPackageDbArgs,
customPackageArgs, ccArgs, cppArgs, ccWarnings, argStagedSettingList, needDll0
) where
import Expression
......
......@@ -20,7 +20,7 @@ packagesStage0 :: Packages
packagesStage0 = mconcat
[ append [ binPackageDb, binary, cabal, compiler, ghc, ghcCabal, ghcPkg
, hsc2hs, hoopl, hpc, templateHaskell, transformers ]
, stage0 ? append [deriveConstants, genapply, genprimopcode]
, stage0 ? append [deriveConstants, genapply, genprimopcode, hp2ps]
, notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
-- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment