ngx-export-distribution 0.5.0.4 → 0.5.1.0
raw patch · 4 files changed
+34/−11 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Changelog.md +4/−0
- NgxExport/Distribution.hs +16/−6
- ngx-export-distribution.cabal +1/−1
- nhm-tool.hs +13/−4
Changelog.md view
@@ -1,3 +1,7 @@+### 0.5.1.0++- Collect *libffi* library if it was shipped with GHC.+ ### 0.5.0.4 - *nhm-tool*: use GHC option *-flink-rts* only in GHC *9.x*.
NgxExport/Distribution.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TupleSections #-}+{-# LANGUAGE TupleSections, TypeApplications #-} ----------------------------------------------------------------------------- -- |@@ -307,12 +307,15 @@ -- With all the building approaches shown above, the following list of drawbacks -- must be taken into account. ----- - Utility /nhm-tool/ collects only libraries prefixed with /libHS/,+-- - Utility /nhm-tool/ collects only libraries prefixed with /libHS/ (and+-- /libffi/ if it was shipped with GHC), -- - clean commands such as /cabal v1-clean/ do not delete build artifacts in -- the current working directory, -- - behavior of Cabal commands other than /configure/, /build/ and /clean/ is -- not well defined. +type GhcInfo = [(String, String)]+ nhmTool :: Program nhmTool = simpleProgram "nhm-tool" @@ -390,8 +393,8 @@ -- libraries in a /tar.gz/ file. -- -- All steps are performed by utility /nhm-tool/. It collects all libraries--- with prefix /libHS/ from the list returned by command /ldd/ applied to the--- shared library.+-- with prefix /libHS/ (and /libffi/ if it was shipped with GHC) from the list+-- returned by command /ldd/ applied to the shared library. patchAndCollectDependentLibs :: Verbosity -- ^ Verbosity level -> FilePath -- ^ Path to the library -> PackageDescription -- ^ Package description@@ -404,9 +407,16 @@ rpathArg = maybe [] (("-t" :) . pure . (</> dir) . fromPathTemplate) $ flagToMaybe $ prefix $ configInstallDirs $ configFlags lbi archiveArg = "-a" : [prettyShow $ package desc]+ ghcP <- fst <$> requireProgram verbosity ghcProgram (withPrograms lbi)+ let ghcR = programInvocation ghcP ["--info"]+ useLibFFI <- (Just "YES" ==) . lookup "Use LibFFI" . read @GhcInfo <$>+ getProgramInvocationOutput verbosity ghcR nhmToolP <- fst <$> requireProgram verbosity nhmTool (withPrograms lbi)- let nhmToolR = programInvocation nhmToolP $- "dist" : lib : "-v" : rpathArg ++ dirArg ++ archiveArg+ let nhmToolArgs = rpathArg ++ dirArg ++ archiveArg+ nhmToolR = programInvocation nhmToolP $+ "dist" : lib : "-v" : if useLibFFI+ then "-ffi" : nhmToolArgs+ else nhmToolArgs runProgramInvocation verbosity nhmToolR -- | Build hooks.
ngx-export-distribution.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-distribution-version: 0.5.0.4+version: 0.5.1.0 synopsis: Build custom libraries for Nginx haskell module description: Build custom libraries for <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.
nhm-tool.hs view
@@ -27,6 +27,7 @@ data DistData = DistData { distDataDir :: String , distDataArchive :: String , distDataTargetDir :: String+ , distDataCollectLibFFI :: Bool , distDataPatchOnly :: Bool , distDataTargetLib :: String , distDataWait :: Maybe ArgWait@@ -57,6 +58,7 @@ data ArgWait = ArgWaitA | ArgWaitD | ArgWaitT | ArgWaitP data LddRec = LibHS String (Maybe FilePath)+ | LibFFI String (Maybe FilePath) | LibOther String (Maybe FilePath) deriving Show @@ -71,19 +73,20 @@ putStrLn "Usage:" when (isNothing section || section == Just HelpDist) $ T.putStrLn $ T.concat ["\n\- \ * nhm-tool dist [-d dir -a ar | -p] [-t target_dir] [-v | -vv] \+ \ * nhm-tool dist [-d dir -a ar -ffi | -p] [-t target_dir] [-v | -vv] \ \lib\n\n\ \ collect Haskell libraries on which 'lib' depends,\n\ \ patch 'lib' to enable loading dependent libraries from \ \'target_dir'\n\n\- \ 'dir' is a directory where dependent libraries will be\n\- \ collected (default is ", T.pack defaultDistDataDir, ")\n\+ \ 'dir' is a directory where dependent libraries will be collected\n\+ \ (default is ", T.pack defaultDistDataDir, ")\n\ \ 'target_dir' is a directory where dependent libraries will be\n\ \ installed (no default, 'lib' will not be patched if omitted)\n\ \ 'ar' is the base name of the archive to contain 'lib' and\n\ \ 'dir' (no default, the archive will not be created if omitted)\n\ \ if '-p' (patch-only) is specified then dependent libraries will\n\ \ neither be collected nor archived\n\+ \ if '-ffi' is specified then libffi will also be collected\n\ \ use options '-v' and '-vv' to increase verbosity level\n\ \ special value '-' for 'dir', 'target_dir', and 'ar' resets them\n\ \ (with -d- being equivalent to -p)"@@ -120,7 +123,7 @@ case head args of "dist" -> do let distData = foldl parseDistArgs (Just defaultArgs) $ tail args- defaultArgs = DistData defaultDistDataDir "" "" False ""+ defaultArgs = DistData defaultDistDataDir "" "" False False "" Nothing normal normal False case distData of Nothing -> usage (Just HelpDist) False@@ -190,6 +193,8 @@ if optLong then Just dist' { distDataArchive = optValue } else Just dist { distDataWait = Just ArgWaitA }+ | "-ffi" == arg ->+ Just dist' { distDataCollectLibFFI = True } | "-p" == arg -> Just dist' { distDataPatchOnly = True } | "-v" == arg ->@@ -301,6 +306,9 @@ let recsLibHS = M.fromList $ mapMaybe (\case LibHS name path -> Just (name, path)+ LibFFI name path+ | distDataCollectLibFFI ->+ Just (name, path) _ -> Nothing ) recs if M.null recsLibHS@@ -362,6 +370,7 @@ <|> (`LibOther` Nothing) <$> right ) where toLddRec lib | "libHS" `isPrefixOf` lib = LibHS lib+ | "libffi.so" `isPrefixOf` lib = LibFFI lib | otherwise = LibOther lib right = manyTill anyChar' $ spaces1 *> addr *> newline addr = string "(0x" *> many1 hexDigit *> char ')'