diff --git a/avro.cabal b/avro.cabal
--- a/avro.cabal
+++ b/avro.cabal
@@ -1,7 +1,7 @@
-cabal-version: 1.12
+cabal-version:  2.2
 
 name:           avro
-version:        0.4.5.1
+version:        0.4.5.2
 synopsis:       Avro serialization support for Haskell
 description:    Avro serialization and deserialization support for Haskell
 category:       Data
@@ -9,7 +9,7 @@
 bug-reports:    https://github.com/haskell-works/avro/issues
 author:         Thomas M. DuBuisson
 maintainer:     Alexey Raga <alexey.raga@gmail.com>
-license:        BSD3
+license:        BSD-3-Clause
 license-file:   LICENSE
 build-type:     Simple
 extra-source-files:
@@ -49,7 +49,73 @@
   manual: False
   default: True
 
+common base                     { build-depends: base                     >= 4          && < 5      }
+
+common aeson                    { build-depends: aeson                                              }
+common array                    { build-depends: array                                              }
+common avro                     { build-depends: avro                                               }
+common base16-bytestring        { build-depends: base16-bytestring                                  }
+common bifunctors               { build-depends: bifunctors                                         }
+common binary                   { build-depends: binary                                             }
+common bytestring               { build-depends: bytestring                                         }
+common containers               { build-depends: containers                                         }
+common data-binary-ieee754      { build-depends: data-binary-ieee754                                }
+common deepseq                  { build-depends: deepseq                                            }
+common directory                { build-depends: directory                                          }
+common extra                    { build-depends: extra                                              }
+common fail                     { build-depends: fail                                               }
+common gauge                    { build-depends: gauge                                              }
+common hashable                 { build-depends: hashable                                           }
+common hspec                    { build-depends: hspec                                              }
+common lens                     { build-depends: lens                                               }
+common lens-aeson               { build-depends: lens-aeson                                         }
+common mtl                      { build-depends: mtl                                                }
+common pure-zlib                { build-depends: pure-zlib                                          }
+common QuickCheck               { build-depends: QuickCheck                                         }
+common random                   { build-depends: random                                             }
+common raw-strings-qq           { build-depends: raw-strings-qq                                     }
+common scientific               { build-depends: scientific                                         }
+common semigroups               { build-depends: semigroups                                         }
+common tagged                   { build-depends: tagged                                             }
+common text                     { build-depends: text                     >= 1.2.3      && < 1.3    }
+common tf-random                { build-depends: tf-random                                          }
+common transformers             { build-depends: transformers                                       }
+common unordered-containers     { build-depends: unordered-containers                               }
+common vector                   { build-depends: vector                                             }
+common zlib                     { build-depends: zlib                                               }
+
+common config
+  default-language: Haskell2010
+  if flag(templatehaskell)
+    other-extensions: TemplateHaskell
+    build-depends:
+        template-haskell >=2.4
+  if flag(dev)
+    ghc-options: -Wall -Werror
+
 library
+  import:   base
+          , aeson
+          , array
+          , base16-bytestring
+          , bifunctors
+          , binary
+          , bytestring
+          , containers
+          , config
+          , data-binary-ieee754
+          , deepseq
+          , fail
+          , hashable
+          , mtl
+          , scientific
+          , semigroups
+          , tagged
+          , text
+          , tf-random
+          , unordered-containers
+          , vector
+          , zlib
   exposed-modules:
       Data.Avro
       Data.Avro.Codec
@@ -81,37 +147,36 @@
       Data.Avro.Zig
   hs-source-dirs: src
   other-extensions: OverloadedStrings
-  default-language: Haskell2010
-  build-depends:
-      aeson
-    , array
-    , base >=4.8 && <5.0
-    , base16-bytestring
-    , bifunctors
-    , binary
-    , bytestring
-    , containers
-    , data-binary-ieee754
-    , deepseq
-    , fail
-    , hashable
-    , mtl
-    , scientific
-    , semigroups
-    , tagged
-    , text
-    , tf-random
-    , unordered-containers
-    , vector
-    , zlib
-  if flag(templatehaskell)
-    other-extensions: TemplateHaskell
-    build-depends:
-        template-haskell >=2.4
-  if flag(dev)
-    ghc-options: -Wall -Werror
 
 test-suite test
+  import:   base
+          , aeson
+          , array
+          , avro
+          , base16-bytestring
+          , bifunctors
+          , binary
+          , bytestring
+          , containers
+          , directory
+          , extra
+          , fail
+          , hashable
+          , hspec
+          , lens
+          , lens-aeson
+          , mtl
+          , pure-zlib
+          , QuickCheck
+          , raw-strings-qq
+          , scientific
+          , semigroups
+          , tagged
+          , text
+          , tf-random
+          , transformers
+          , unordered-containers
+          , vector
   type: exitcode-stdio-1.0
   ghc-options: -threaded
   default-language: Haskell2010
@@ -156,45 +221,25 @@
       DecodeContainer
       Example1
       Paths_avro
-  hs-source-dirs: test
-  build-depends:
-      QuickCheck
-    , aeson
-    , array
-    , avro
-    , base >=4.6 && <5
-    , base16-bytestring
-    , bifunctors
-    , binary
-    , bytestring
-    , containers
-    , directory
-    , extra
-    , fail
-    , hashable
-    , hspec
-    , lens
-    , lens-aeson
-    , mtl
-    , pure-zlib
-    , raw-strings-qq
-    , scientific
-    , semigroups
-    , tagged
-    , text
-    , tf-random
-    , transformers
-    , unordered-containers
-    , vector
-  if flag(templatehaskell)
-    other-extensions: TemplateHaskell
-    build-depends:
-        template-haskell
-  if flag(dev)
-    ghc-options: -Wall -Werror
+  autogen-modules:    Paths_avro
+  hs-source-dirs:     test
 
 
 benchmark bench-time
+  import:   base, config
+          , avro
+          , aeson
+          , bytestring
+          , containers
+          , gauge
+          , hashable
+          , mtl
+          , random
+          , raw-strings-qq
+          , text
+          , transformers
+          , unordered-containers
+          , vector
   default-language: Haskell2010
   type: exitcode-stdio-1.0
   main-is: Main.hs
@@ -204,21 +249,3 @@
     Bench.Deconflict.Writer
     Bench.Time
   hs-source-dirs: bench
-  build-depends:
-      avro
-    , base >=4.6 && <5
-
-    , aeson
-    , bytestring
-    , containers
-    , hashable
-    , mtl
-    , text
-    , random
-    , raw-strings-qq
-    , transformers
-    , unordered-containers
-    , vector
-
-    -- benchmarking-specific libraries
-    , gauge
diff --git a/src/Data/Avro/Deriving/Lift.hs b/src/Data/Avro/Deriving/Lift.hs
--- a/src/Data/Avro/Deriving/Lift.hs
+++ b/src/Data/Avro/Deriving/Lift.hs
@@ -1,10 +1,12 @@
+{-# LANGUAGE CPP                #-}
 {-# LANGUAGE DeriveLift         #-}
 {-# LANGUAGE StandaloneDeriving #-}
 {-# LANGUAGE TemplateHaskell    #-}
+
 {-# OPTIONS_GHC -fno-warn-orphans #-}
-module Data.Avro.Deriving.Lift
-where
 
+module Data.Avro.Deriving.Lift where
+
 import qualified Data.Avro.Schema           as Schema
 import qualified Data.Avro.Types.Value      as Avro
 import qualified Data.ByteString            as ByteString
@@ -16,8 +18,11 @@
 instance Lift ByteString.ByteString where
   lift b = [| ByteString.pack $(lift $ ByteString.unpack b) |]
 
+#if MIN_VERSION_text(1,2,4)
+#else
 instance Lift Text.Text where
   lift t = [| Text.pack $(lift $ Text.unpack t) |]
+#endif
 
 instance Lift a => Lift (Vector.Vector a) where
   lift v = [| Vector.fromList $(lift $ Vector.toList v) |]
