diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -1,7 +1,7 @@
 The following license covers this documentation, and the source code, except
 where otherwise indicated.
 
-Copyright 2021, Alexey Radkov. All rights reserved.
+Copyright 2021-2022, Alexey Radkov. All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions are met:
diff --git a/NgxExport/Distribution.hs b/NgxExport/Distribution.hs
--- a/NgxExport/Distribution.hs
+++ b/NgxExport/Distribution.hs
@@ -3,7 +3,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  NgxExport.Distribution
--- Copyright   :  (c) Alexey Radkov 2021
+-- Copyright   :  (c) Alexey Radkov 2021-2022
 -- License     :  BSD-style
 --
 -- Maintainer  :  alexey.radkov@gmail.com
@@ -96,8 +96,8 @@
 -- @
 --
 -- All packages listed in /build-depends/ get also wrapped inside options
--- /-package/ in /ghc-options/: this is important for building them with
--- /cabal v2-build/ inside GHC /package environments/.
+-- /-package/ in /ghc-options/: this is important when building them with
+-- /cabal v2-build/ and then using inside GHC /package environments/.
 --
 -- ==== File /Setup.hs/
 -- @
@@ -130,7 +130,7 @@
 -- > Linking ./dist/setup/setup ...
 -- > Configuring ngx-distribution-test-0.1.0.0...
 --
--- > $ cabal v1-build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -lHSrts_thr-ghc$(ghc --numeric-version)"
+-- > $ cabal v1-build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -threaded"
 -- > [1 of 1] Compiling NgxDistributionTest ( ngx_distribution_test.hs, ngx_distribution_test.o )
 -- > Linking ngx_distribution_test.so ...
 -- > ---> Collecting libraries
@@ -164,9 +164,11 @@
 -- > x86_64-linux-ghc-8.10.5/libHSstrict-0.4.0.1-Bs4t4Fhsgeo8grcWS7WJTy-ghc8.10.5.so
 -- > x86_64-linux-ghc-8.10.5/libHSdlist-1.0-GVPedlNIGcrCE31hGMMV1G-ghc8.10.5.so
 --
--- Notice that in /ghc 8.10.6/ and newer, option
--- /-lHSrts_thr-ghc$(ghc --numeric-version)/ is not needed as it gets
--- effectively replaced with ghc option /-flink-rts/.
+-- Note that in ghc older than /8.10.6/, option /-threaded/ must be replaced
+-- with option /-lHSrts_thr-ghc$(ghc --numeric-version)/ because ghc option
+-- /-flink-rts/ which is passed by the module internally has first appeared in
+-- the said release. Note also that clause /ghc-options/ in the Cabal file is a
+-- better place for such a generic option as /-threaded/.
 --
 -- Now the current working directory contains new files
 -- /ngx_distribution_test.so/ and /ngx-distribution-test-0.1.0.0.tar.gz/ and a
@@ -185,7 +187,7 @@
 --
 -- > $ runhaskell Setup.hs configure --user
 --
--- > $ runhaskell Setup.hs build --ghc-options="ngx_distribution_test.hs -o ngx_distribution_test.so -lHSrts_thr-ghc$(ghc --numeric-version)" --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"
 --
 -- ==== Building dependencies with cabal v2-build
 --
@@ -199,7 +201,7 @@
 --
 -- > $ cabal v2-install --lib ngx-export-distribution --package-env .
 --
--- > $ sed -i 's/\(^package-id \)/--\1/' .ghc.environment.x86_64-linux-8.10.5
+-- > $ 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-8.10.5/ which has been created by the
@@ -214,13 +216,30 @@
 -- contains a GHC /package db/ with all packages built by /cabal v2-build/, it
 -- gets also listed in file /.ghc.environment.x86_64-linux-8.10.5/.
 --
--- > $ 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 -lHSrts_thr-ghc$(ghc --numeric-version)"
+-- > $ 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 db and
 -- /$HOME\/.cabal\/store\/ghc-$(ghc --numeric-version)\/package.db/.
 --
--- With all building approaches shown above, the following list of drawbacks
+-- ==== Collecting direct dependencies with cabal-plan
+--
+-- We listed build dependencies in both /build-depends/ and /ghc-options/
+-- clauses in the Cabal file to let ghc find dependencies built with
+-- /cabal v2-build/ at the /configure/ step. This approach is tedious and
+-- error-prone. Fortunately, there is package
+-- [cabal-plan](https://hackage.haskell.org/package/cabal-plan) which is aimed
+-- to figure out dependencies of built packages. Particularly, with /cabal-plan/
+-- we can remove those /--package=.../ lines from the /ghc-options/ clause in
+-- the Cabal file and, instead, collect them programmatically in a shell
+-- variable that will be put inside the /configure/ command.
+--
+-- > $ DIRECT_DEPS=$(cabal-plan info --ascii | sed -n -e '0,/^CompNameLib$/d' -e '/^$/,$d' -e 's/^\s\+/--package=/p')
+-- > $ runhaskell --ghc-arg=-package=base --ghc-arg=-package=ngx-export-distribution Setup.hs configure --package-db=clear --package-db=global --package-db="$HOME/.cabal/store/ghc-$(ghc --numeric-version)/package.db" $DIRECT_DEPS --prefix=/var/lib/nginx
+--
+-- ==== Drawbacks
+--
+-- With all the building approaches shown above, the following list of drawbacks
 -- must be taken into account.
 --
 -- - Utility /hslibdeps/ collects only libraries prefixed with /libHS/,
@@ -296,10 +315,12 @@
 --
 -- Performs the following steps.
 --
--- - Collects all dependent Haskell libraries in a directory whose name forms
---   as /arch-os-compiler/ (or that overridden in option /--hslibdeps-options/),
--- - adds the value of /prefix/ (or that overridden in option
---   /--hslibdeps-options/) to the list of /rpath/ in the shared library,
+-- - Collects all dependent Haskell libraries in a directory with the name equal
+--   to the value of /$abi/ which normally expands to /$arch-$os-$compiler/ (or
+--   with that overridden in option /--hslibdeps-options/),
+-- - adds value /$prefix\/$abi/ (or that overridden in option
+--   /--hslibdeps-options/) in the beginning of the list of /rpath/ in the
+--   shared library,
 -- - archives the shared library and the directory with the collected dependent
 --   libraries in a /tar.gz/ file.
 --
diff --git a/ngx-export-distribution.cabal b/ngx-export-distribution.cabal
--- a/ngx-export-distribution.cabal
+++ b/ngx-export-distribution.cabal
@@ -1,5 +1,5 @@
 name:                       ngx-export-distribution
-version:                    0.3.2.0
+version:                    0.3.2.1
 synopsis:                   Build custom libraries for Nginx haskell module
 description:                Build custom libraries for
         <http://github.com/lyokha/nginx-haskell-module Nginx haskell module>.
@@ -10,7 +10,7 @@
 author:                     Alexey Radkov <alexey.radkov@gmail.com>
 maintainer:                 Alexey Radkov <alexey.radkov@gmail.com>
 stability:                  experimental
-copyright:                  2021 Alexey Radkov
+copyright:                  2021-2022 Alexey Radkov
 category:                   Network
 build-type:                 Simple
 cabal-version:              1.20
