ats-pkg 3.3.0.7 → 3.4.0.0
raw patch · 6 files changed
+53/−31 lines, 6 files
Files
- CHANGELOG.md +4/−0
- app/Main.hs +28/−19
- ats-pkg.cabal +1/−1
- man/atspkg.1 +3/−0
- src/Distribution/ATS/Build.hs +1/−1
- src/Language/ATS/Package/Build.hs +16/−10
CHANGELOG.md view
@@ -1,5 +1,9 @@ # ats-pkg +## 3.4.0.0++ * Add `--debug` flag to `test` and `build` subcommands+ ## 3.3.0.6 * Only run `./autogen.sh` when installing the compiler if
app/Main.hs view
@@ -41,6 +41,7 @@ , _rebuildAll :: Bool , _verbosity :: Int , _lint :: Bool+ , _dbg :: Bool , _prof :: Bool } | Clean@@ -50,6 +51,7 @@ , _rebuildAll :: Bool , _verbosity :: Int , _lint :: Bool+ , _dbg :: Bool , _prof :: Bool } | Bench { _targets :: [String]@@ -163,6 +165,7 @@ <*> rebuild <*> verbosity <*> noLint+ <*> debug <*> profile valgrind :: Parser Command@@ -180,6 +183,11 @@ <> help ("Targets to " <> s) <> completions')) +debug :: Parser Bool+debug = switch+ (long "debug"+ <> help "Don't strip generated executables and pass -g to targets")+ profile :: Parser Bool profile = switch (long "profile"@@ -217,6 +225,7 @@ <*> rebuild <*> verbosity <*> noLint+ <*> debug <*> profile noLint :: Parser Bool@@ -241,35 +250,35 @@ ps <- getSubdirs p pkgDir <- fromMaybe p <$> findFile (p:ps) "atspkg.dhall" let setup = [buildAll v mStr Nothing (Just pkgDir)]- withCurrentDirectory (takeDirectory pkgDir) (mkPkg mStr False False False setup ["install"] Nothing 0)+ withCurrentDirectory (takeDirectory pkgDir) (mkPkg mStr False False False setup ["install"] Nothing False 0) stopGlobalPool main :: IO () main = setLocaleEncoding utf8 *> execParser wrapper >>= run -runHelper :: Bool -> Bool -> Bool -> [String] -> Maybe String -> Maybe String -> Int -> IO ()-runHelper rba lint tim rs mStr tgt v = g . bool x y . (&& isNothing tgt) =<< check mStr Nothing- where g xs = mkPkg mStr rba lint tim xs rs tgt v *> stopGlobalPool+runHelper :: Bool -> Bool -> Bool -> [String] -> Maybe String -> Maybe String -> Bool -> Int -> IO ()+runHelper rba lint tim rs mStr tgt dbg v = g . bool x y . (&& isNothing tgt) =<< check mStr Nothing+ where g xs = mkPkg mStr rba lint tim xs rs tgt dbg v *> stopGlobalPool y = mempty x = [buildAll v mStr tgt Nothing] run :: Command -> IO ()-run List = displayList "https://raw.githubusercontent.com/vmchale/atspkg/master/ats-pkg/pkgs/pkg-set.dhall"-run (Check p b) = void $ ($ Version [0,1,0]) <$> checkPkg p b-run (CheckSet p b) = void $ checkPkgSet p b-run Upgrade = upgradeBin "vmchale" "atspkg"-run Nuke = cleanAll-run (Fetch u mArg v) = fetchPkg mArg u v-run Clean = mkPkg Nothing False True False mempty ["clean"] Nothing 0-run (Build rs mArg tgt rba v lint tim) = runHelper rba lint tim rs mArg tgt v-run (Test ts mArg rba v lint tim) = runHelper rba lint tim ("test" : ts) mArg Nothing v-run (Bench ts mArg rba v lint tim) = runHelper rba lint tim ("bench" : ts) mArg Nothing v-run (Run ts mArg rba v lint tim) = runHelper rba lint tim ("run" : ts) mArg Nothing v-run (Install tgt mArg) = runHelper False True False ["install"] mArg tgt 0-run (Valgrind ts mArg) = runHelper False True False ("valgrind" : ts) mArg Nothing 0-run (Pack dir') = packageCompiler dir'-run Setup = installActions+run List = displayList "https://raw.githubusercontent.com/vmchale/atspkg/master/ats-pkg/pkgs/pkg-set.dhall"+run (Check p b) = void $ ($ Version [0,1,0]) <$> checkPkg p b+run (CheckSet p b) = void $ checkPkgSet p b+run Upgrade = upgradeBin "vmchale" "atspkg"+run Nuke = cleanAll+run (Fetch u mArg v) = fetchPkg mArg u v+run Clean = mkPkg Nothing False True False mempty ["clean"] Nothing False 0+run (Build rs mArg tgt rba v lint dbg tim) = runHelper rba lint tim rs mArg tgt dbg v+run (Test ts mArg rba v lint dbg tim) = runHelper rba lint tim ("test" : ts) mArg Nothing dbg v+run (Bench ts mArg rba v lint tim) = runHelper rba lint tim ("bench" : ts) mArg Nothing False v+run (Run ts mArg rba v lint tim) = runHelper rba lint tim ("run" : ts) mArg Nothing False v+run (Install tgt mArg) = runHelper False True False ["install"] mArg tgt False 0+run (Valgrind ts mArg) = runHelper False True False ("valgrind" : ts) mArg Nothing False 0+run (Pack dir') = packageCompiler dir'+run Setup = installActions installActions :: IO () installActions = do
ats-pkg.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: ats-pkg-version: 3.3.0.7+version: 3.4.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2018-2019 Vanessa McHale
man/atspkg.1 view
@@ -81,6 +81,9 @@ .TP .B \f[B]-d\f[R], \f[B]--detailed\f[R] Enable detailed error messages when checking configuration files+.TP+.B \f[B]--debug\f[R]+Disable binary stripping and pass -g to the C compiler .SH CONFIGURATION .PP \f[B]atspkg\f[R] is configured with Dhall, in an atspkg.dhall file.
src/Distribution/ATS/Build.hs view
@@ -20,7 +20,7 @@ configureCabal :: IO LocalBuildInfo -> IO LocalBuildInfo configureCabal = (<*>) $ do -- TODO get host triple from Platform of LocalBuildInfo- build 1 mempty+ build 1 False mempty libDir <- (<> [pathSeparator]) <$> getCurrentDirectory pure (modifyConf libDir)
src/Language/ATS/Package/Build.hs view
@@ -50,17 +50,19 @@ build' :: FilePath -- ^ Directory -> Maybe String -- ^ Target triple+ -> Bool -- ^ Debug build? -> [String] -- ^ Targets -> IO ()-build' dir tgt' rs = withCurrentDirectory dir (mkPkgEmpty mempty)- where mkPkgEmpty ts = mkPkg Nothing False True False ts rs tgt' 1+build' dir tgt' dbg rs = withCurrentDirectory dir (mkPkgEmpty mempty)+ where mkPkgEmpty ts = mkPkg Nothing False True False ts rs tgt' dbg 1 -- | Build a set of targets build :: Int+ -> Bool -- ^ Debug? -> [String] -- ^ Targets -> IO ()-build v rs = bool (mkPkgEmpty [buildAll v Nothing Nothing Nothing]) (mkPkgEmpty mempty) =<< check Nothing Nothing- where mkPkgEmpty ts = mkPkg Nothing False True False ts rs Nothing 1+build v dbg rs = bool (mkPkgEmpty [buildAll v Nothing Nothing Nothing]) (mkPkgEmpty mempty) =<< check Nothing Nothing+ where mkPkgEmpty ts = mkPkg Nothing False True False ts rs Nothing dbg 1 -- TODO clean generated ATS mkClean :: Rules ()@@ -205,9 +207,10 @@ -> [IO ()] -- ^ Setup -> [String] -- ^ Targets -> Maybe String -- ^ Target triple+ -> Bool -- ^ Debug build? -> Int -- ^ Verbosity -> IO ()-mkPkg mStr rba lint tim setup rs tgt v = do+mkPkg mStr rba lint tim setup rs tgt dbg v = do cfg <- cleanConfig mStr rs setNumCapabilities =<< getNumProcessors cpus <- getNumCapabilities@@ -216,7 +219,7 @@ sequence_ [ want (pkgToTargets cfg tgt rs) , mkClean- , pkgToAction mStr setup rs tgt cfg+ , pkgToAction mStr setup rs tgt dbg cfg ] mkConfig :: Maybe String -> Rules ()@@ -266,7 +269,7 @@ let installDir = takeDirectory pkgPath - build' installDir tgt' ["install"]+ build' installDir tgt' False ["install"] -- | The directory @~/.atspkg@ pkgHome :: MonadIO m => CCompiler -> m String@@ -300,9 +303,10 @@ -> [IO ()] -- ^ Setup actions to be performed -> [String] -- ^ Targets -> Maybe String -- ^ Optional compiler triple (overrides 'ccompiler')+ -> Bool -- ^ Debug build? -> Pkg -- ^ Package data type -> Rules ()-pkgToAction mStr setup rs tgt ~(Pkg bs ts bnchs lbs mt _ v v' ds cds bdeps ccLocal cf af as dl slv deb al) =+pkgToAction mStr setup rs tgt dbg ~(Pkg bs ts bnchs lbs mt _ v v' ds cds bdeps ccLocal cf af as dl slv deb al) = unless (rs == ["clean"]) $ do @@ -341,10 +345,12 @@ fold (debRules <$> deb) where g ph (Bin s t ls hs' atg gc' extra) =- atsBin (ATSTarget (unpack <$> cf) (atsToolConfig ph) gc' (unpack <$> ls) [unpack s] hs' (unpackTgt <$> atg) mempty (toTgt tgt t) (deps extra) Executable True)+ atsBin (ATSTarget (dbgFlags (unpack <$> cf)) (atsToolConfig ph) gc' (unpack <$> ls) [unpack s] hs' (unpackTgt <$> atg) mempty (toTgt tgt t) (deps extra) Executable (not dbg)) h ph (Lib _ s t ls _ hs' lnk atg extra sta) =- atsBin (ATSTarget (unpack <$> cf) (atsToolConfig ph) False (unpack <$> ls) (unpack <$> s) hs' (unpackTgt <$> atg) (unpackLinks <$> lnk) (unpack t) (deps extra) (k sta) False)+ atsBin (ATSTarget (dbgFlags (unpack <$> cf)) (atsToolConfig ph) False (unpack <$> ls) (unpack <$> s) hs' (unpackTgt <$> atg) (unpackLinks <$> lnk) (unpack t) (deps extra) (k sta) False)++ dbgFlags = if dbg then ("-g":) else id k False = SharedLibrary k True = StaticLibrary