Commit 7b1964ef authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add link rule.

parent 0ad3af27
......@@ -54,14 +54,20 @@ echo >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0
# Done:
"/usr/bin/ar" q libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a @libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a.contents
/usr/bin/ar: creating libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
# Skipping:
"rm" -f libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a.contents
# Done:
"inplace/bin/ghc-stage1.exe" -hisuf p_hi -osuf p_o -hcsuf p_hc -static -prof -H32m -O -this-package-key deeps_FT5iVCELxOr62eHY0nbvnU -hide-all-packages -i -ilibraries/deepseq/. -ilibraries/deepseq/dist-install/build -ilibraries/deepseq/dist-install/build/autogen -Ilibraries/deepseq/dist-install/build -Ilibraries/deepseq/dist-install/build/autogen -Ilibraries/deepseq/. -optP-include -optPlibraries/deepseq/dist-install/build/autogen/cabal_macros.h -package-key array_3w0nMK0JfaFJPpLFn2yWAJ -package-key base_469rOtLAqwTGFEOGWxSUiQ -package-key ghcpr_FgrV6cgh2JHBlbcx1OSlwt -Wall -XHaskell2010 -O2 -no-user-package-db -rtsopts -odir libraries/deepseq/dist-install/build -hidir libraries/deepseq/dist-install/build -stubdir libraries/deepseq/dist-install/build -split-objs -c libraries/deepseq/./Control/DeepSeq.hs -o libraries/deepseq/dist-install/build/Control/DeepSeq.p_o
# Done:
"C:/msys/home/chEEtah/ghc/inplace/mingw/bin/ld.exe" -r -o libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o libraries/deepseq/dist-install/build/Control/DeepSeq.o
# Done:
"rm" -f libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
# Skipping:
/usr/bin/find libraries/deepseq/dist-install/build/Control/DeepSeq_p_o_split -name '*.p_o' -print >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
echo >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
"/usr/bin/ar" q libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a @libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
......
......@@ -2,8 +2,7 @@
module Oracles.Builder (
Builder (..),
with, run, terseRun, specified,
arArgs
with, run, terseRun, specified
) where
import Data.Char
......@@ -115,11 +114,13 @@ terseRun builder args = do
interestingInfo :: Builder -> [String] -> [String]
interestingInfo builder ss = case builder of
Ar -> prefixAndSuffix 3 1 ss
Ld -> prefixAndSuffix 4 0 ss
Ghc _ -> if head ss == "-M"
then prefixAndSuffix 1 1 ss
else prefixAndSuffix 0 4 ss
GhcPkg _ -> prefixAndSuffix 2 0 ss
GhcCabal -> prefixAndSuffix 3 0 ss
_ -> ss
where
prefixAndSuffix n m ss =
if length ss <= n + m + 1
......@@ -138,6 +139,3 @@ specified builder = do
[_] -> True
_ -> False
-- TODO: generalise for other builders
arArgs :: Args
arArgs = arg "q"
......@@ -23,7 +23,8 @@ packageRules :: Rules ()
packageRules = do
-- TODO: control targets from commang line arguments
want [ "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a"
, "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.p_a" ]
, "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.p_a"
, "libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o" ]
forM_ packages $ \pkg -> do
forM_ (pkgTodo pkg) $ \todoItem -> do
buildPackage pkg todoItem
......@@ -3,18 +3,8 @@ module Package.Library (buildPackageLibrary) where
import Package.Base
{- "/usr/bin/ar" q
libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
@libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
.contents
-}
-- "$$(XARGS)" $$(XARGS_OPTS) "$$($1_$2_AR)" $$($1_$2_AR_OPTS)
-- $$($1_$2_EXTRA_AR_ARGS) $$@ < $$@.contents
-- AR_OPTS = $(SRC_AR_OPTS) $(WAY$(_way)_AR_OPTS) $(EXTRA_AR_OPTS)
buildPackageLibrary :: Package -> TodoItem -> Rules ()
buildPackageLibrary (Package name path _) (stage, dist, _) =
arRule :: Package -> TodoItem -> Rules ()
arRule (Package _ path _) (stage, dist, _) =
let buildDir = path </> dist </> "build"
pkgData = path </> dist </> "package-data.mk"
in
......@@ -25,10 +15,28 @@ buildPackageLibrary (Package name path _) (stage, dist, _) =
need depObjs
libObjs <- pkgLibObjects path dist stage way
liftIO $ removeFiles "." [out]
terseRun Ar $ arArgs <+> out <+> libObjs
when (way == vanilla) $ do
synopsis <- unwords <$> arg (Synopsis pkgData)
putNormal $ "Successfully built library for package "
++ name ++ "."
putNormal $ "Synopsis: " ++ synopsis ++ "."
terseRun Ar $ "q" <+> out <+> libObjs
{- "C:/msys/home/chEEtah/ghc/inplace/mingw/bin/ld.exe" -r -o
libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o
libraries/deepseq/dist-install/build/Control/DeepSeq.o
-}
ldRule :: Package -> TodoItem -> Rules ()
ldRule (Package name path _) (stage, dist, _) =
let buildDir = path </> dist </> "build"
pkgData = path </> dist </> "package-data.mk"
in
priority 2 $ (buildDir </> "*.o") %> \out -> do
need ["shake/src/Package/Library.hs"]
depObjs <- pkgDepObjects path dist vanilla
need depObjs
terseRun Ld $ arg (ConfLdLinkerArgs stage)
<> arg ["-r", "-o", out]
<> arg depObjs
synopsis <- unwords <$> arg (Synopsis pkgData)
putNormal $ "Successfully built package " ++ name ++ "."
putNormal $ "Package synopsis: " ++ synopsis ++ "."
buildPackageLibrary :: Package -> TodoItem -> Rules ()
buildPackageLibrary = arRule <> ldRule
\ No newline at end of file
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