ngx-export-distribution 0.3.2.4 → 0.4.0.0
raw patch · 3 files changed
+36/−28 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- NgxExport.Distribution: ngxExportHooks :: Verbosity -> UserHooks
+ NgxExport.Distribution: ngxExportHooks :: UserHooks
Files
- Changelog.md +5/−0
- NgxExport/Distribution.hs +30/−27
- ngx-export-distribution.cabal +1/−1
Changelog.md view
@@ -1,3 +1,8 @@+### 0.4.0.0++- Get verbosity level for all program invocations from configuration and build+ flags.+ ### 0.3.2.4 - Improved docs.
NgxExport/Distribution.hs view
@@ -200,9 +200,9 @@ -- /deps.tar.gz/ respectively, and also define the /rpath/ directory without -- using option /--prefix/. ----- > $ runhaskell Setup.hs configure --user+-- > $ runhaskell Setup.hs configure --user --hslibdeps-options="-t/var/lib/nginx/deps -ddeps -adeps" ----- > $ runhaskell Setup.hs build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -threaded" --hslibdeps-options="-t/var/lib/nginx/deps -ddeps -adeps"+-- > $ runhaskell Setup.hs build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -threaded" -- $deps-cabal-v2 --@@ -214,17 +214,18 @@ -- -- > $ cabal v2-install --lib --only-dependencies --package-env . ----- > $ cabal v2-install --lib ngx-export-distribution --package-env .+-- > $ cabal v2-build ngx-export-distribution --+-- The second command is probably no-op because /ngx-export-distribution/ should+-- have been installed by the first command. At least in Cabal /3.10/, this is+-- the case.+-- -- > $ sed -i 's/\(^package-id \)/--\1/' .ghc.environment.x86_64-linux-$(ghc --numeric-version) -- -- This /sed/ command comments out all lines that start with word /package-id/ -- in file /.ghc.environment.x86_64-linux-9.4.1/ which has been created by the--- former commands. This prevents the target library from linking against--- libraries belonging to packages listed in those lines, thus making the--- overall number and the size of dependent libraries as small as possible. If--- this command breaks the following steps, some of the commented lines can be--- selectively uncommented.+-- first command. We will put all needed packages into this file after the next+-- step. -- -- > $ ADD_CABAL_STORE=$(sed -n 's/^\(package-db\)\s\+/--\1=/p' .ghc.environment.x86_64-linux-$(ghc --numeric-version)) -- > $ runhaskell --ghc-arg=-package=base --ghc-arg=-package=ngx-export-distribution Setup.hs configure --package-db=clear --package-db=global $ADD_CABAL_STORE --prefix=/var/lib/nginx@@ -252,7 +253,8 @@ -- > UNIT_ID="^UnitId\s\+\"" -- > while IFS= read -r pkg -- > do sed -n "/$UNIT_ID$pkg/s/$UNIT_ID\(.*\)\"\$/package-id \1/p" <<< "$CABAL_PLAN"--- > done < <(sed -n '/^CompNameLib$/,/^$/s/^\s\+//p' <<< "$CABAL_PLAN")+-- > done < <(sed -n '/^CompNameLib$/,/^$/s/^\s\+//p' <<< "$CABAL_PLAN") |+-- > awk '!x[$0]++' -- > unset CABAL_PLAN UNIT_ID -- -- After running this as@@ -272,8 +274,8 @@ -- > $ runhaskell --ghc-arg=-package=base --ghc-arg=-package=ngx-export-distribution Setup.hs build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -threaded" -- -- This should build library /ngx_distribution_test.so/ and link it against--- Haskell libraries found in the global package database and the Cabal's global--- package store.+-- Haskell libraries found in the global package database and the Cabal package+-- store. -- $drawbacks --@@ -394,28 +396,29 @@ -- -- Other hooks from /simpleUserHooks/ get derived as is. Running them is -- neither tested nor recommended.-ngxExportHooks :: Verbosity -- ^ Verbosity level- -> UserHooks-ngxExportHooks verbosity =- let hooks = simpleUserHooks- in hooks { hookedPrograms = [hslibdeps]- , confHook = \desc flags -> do- let pdb = configPrograms flags- _ <- requireProgram verbosity hslibdeps pdb >>=- requireProgram verbosity patchelf . snd- confHook simpleUserHooks desc flags- , buildHook = \desc lbi _ flags ->- buildSharedLib verbosity desc lbi flags >>= \lib ->- patchAndCollectDependentLibs verbosity lib desc lbi- }+ngxExportHooks :: UserHooks+ngxExportHooks =+ simpleUserHooks { hookedPrograms = [hslibdeps]+ , confHook = \desc flags -> do+ let verbosity = toVerbosity $ configVerbosity flags+ pdb = configPrograms flags+ _ <- requireProgram verbosity hslibdeps pdb >>=+ requireProgram verbosity patchelf . snd+ confHook simpleUserHooks desc flags+ , buildHook = \desc lbi _ flags -> do+ let verbosity = toVerbosity $ buildVerbosity flags+ buildSharedLib verbosity desc lbi flags >>= \lib ->+ patchAndCollectDependentLibs verbosity lib desc lbi+ }+ where toVerbosity = fromFlagOrDefault normal -- | A simple implementation of /main/ for a Cabal setup script. -- -- Implemented as -- -- @--- defaultMain = 'defaultMainWithHooks' $ 'ngxExportHooks' 'normal'+-- defaultMain = 'defaultMainWithHooks' 'ngxExportHooks' -- @ defaultMain :: IO ()-defaultMain = defaultMainWithHooks $ ngxExportHooks normal+defaultMain = defaultMainWithHooks ngxExportHooks
ngx-export-distribution.cabal view
@@ -1,5 +1,5 @@ name: ngx-export-distribution-version: 0.3.2.4+version: 0.4.0.0 synopsis: Build custom libraries for Nginx haskell module description: Build custom libraries for <https://github.com/lyokha/nginx-haskell-module Nginx haskell module>.