Skip to content
Snippets Groups Projects
Commit 2ef5caea authored by Cheng Shao's avatar Cheng Shao
Browse files

hadrian: so-mutex

parent 4a874fe5
No related branches found
No related tags found
No related merge requests found
...@@ -24,10 +24,11 @@ import Oracles.Flag ...@@ -24,10 +24,11 @@ import Oracles.Flag
libraryRules :: Rules () libraryRules :: Rules ()
libraryRules = do libraryRules = do
soMutex <- newResource "so-mutex" 1
root <- buildRootRules root <- buildRootRules
root -/- "**/libHS*-*.dylib" %> buildDynamicLib root "dylib" root -/- "**/libHS*-*.dylib" %> buildDynamicLib [(soMutex, 1)] root "dylib"
root -/- "**/libHS*-*.so" %> buildDynamicLib root "so" root -/- "**/libHS*-*.so" %> buildDynamicLib [(soMutex, 1)] root "so"
root -/- "**/libHS*-*.dll" %> buildDynamicLib root "dll" root -/- "**/libHS*-*.dll" %> buildDynamicLib [(soMutex, 1)] root "dll"
root -/- "**/*.a" %> buildStaticLib root root -/- "**/*.a" %> buildStaticLib root
root -/- "**/stamp-*" %> buildPackage root root -/- "**/stamp-*" %> buildPackage root
priority 2 $ do priority 2 $ do
...@@ -85,8 +86,8 @@ registerDynamicLib root suffix dynlibpath = do ...@@ -85,8 +86,8 @@ registerDynamicLib root suffix dynlibpath = do
-- | Build a dynamic library ('LibDyn') under the given build root, with the -- | Build a dynamic library ('LibDyn') under the given build root, with the
-- given suffix (@.so@ or @.dylib@, @.dll@), where the complete path of the -- given suffix (@.so@ or @.dylib@, @.dll@), where the complete path of the
-- archive to build is given as the third argument. -- archive to build is given as the third argument.
buildDynamicLib :: FilePath -> String -> FilePath -> Action () buildDynamicLib :: [(Resource, Int)] -> FilePath -> String -> FilePath -> Action ()
buildDynamicLib root suffix dynlibpath = do buildDynamicLib rs root suffix dynlibpath = do
dynlib@(BuildPath _ stage _ (LibDyn pkgname _ _ way _)) dynlib@(BuildPath _ stage _ (LibDyn pkgname _ _ way _))
<- parsePath (parseBuildLibDyn root suffix) "<dyn lib parser>" dynlibpath <- parsePath (parseBuildLibDyn root suffix) "<dyn lib parser>" dynlibpath
let context = libDynContext dynlib let context = libDynContext dynlib
...@@ -94,7 +95,7 @@ buildDynamicLib root suffix dynlibpath = do ...@@ -94,7 +95,7 @@ buildDynamicLib root suffix dynlibpath = do
deps <- contextDependencies context deps <- contextDependencies context
registerPackages deps registerPackages deps
objs <- libraryObjects context objs <- libraryObjects context
build $ target context (Ghc LinkHs $ Context.stage context) objs [dynlibpath] buildWithResources rs $ target context (Ghc LinkHs $ Context.stage context) objs [dynlibpath]
putSuccess $ putSuccess $
renderLibrary renderLibrary
(quote pkgname ++ " (" ++ show stage ++ ", way " ++ show way ++ ").") (quote pkgname ++ " (" ++ show stage ++ ", way " ++ show way ++ ").")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment