diff --git a/Changelog.md b/Changelog.md
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,5 +1,9 @@
 # Changelog for `proto-lens-protoc`
 
+## v0.3.1.2
+- Bump the upper bound to `temporary-1.3`.
+- Fix warnings.
+
 ## v0.3.1.1
 - Fix management of generated files between Cabal components (#171).
 - Bump the lower bound on `base` to indicate we require `ghc>=8.0`.
diff --git a/proto-lens-protoc.cabal b/proto-lens-protoc.cabal
--- a/proto-lens-protoc.cabal
+++ b/proto-lens-protoc.cabal
@@ -2,10 +2,10 @@
 --
 -- see: https://github.com/sol/hpack
 --
--- hash: a69cd6e6704df4e3fa208607e7488ad6ff71860a2b10efeb7d46ab1e5e645c63
+-- hash: e036645bce6a403901857a20fdb899cc2cdd7538d89dad0b5313729d1848d18f
 
 name:           proto-lens-protoc
-version:        0.3.1.1
+version:        0.3.1.2
 synopsis:       Protocol buffer compiler for the proto-lens library.
 description:    Turn protocol buffer files (.proto) into Haskell files (.hs) which can be used with the proto-lens package.
                 The library component of this package contains compiler code (namely Data.ProtoLens.Compiler.*) is not guaranteed to have stable APIs.'
@@ -75,7 +75,7 @@
     , pretty ==1.1.*
     , process >=1.2 && <1.7
     , proto-lens ==0.3.*
-    , temporary ==1.2.*
+    , temporary >=1.2 && <1.4
     , text ==1.2.*
   default-language: Haskell2010
 
diff --git a/src/Data/ProtoLens/Compiler/Definitions.hs b/src/Data/ProtoLens/Compiler/Definitions.hs
--- a/src/Data/ProtoLens/Compiler/Definitions.hs
+++ b/src/Data/ProtoLens/Compiler/Definitions.hs
@@ -7,6 +7,7 @@
 -- | This module takes care of collecting all the definitions in a .proto file
 -- and assigning Haskell names to all of the defined things (messages, enums
 -- and field names).
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE OverloadedStrings #-}
@@ -39,7 +40,9 @@
 import Data.List (mapAccumL)
 import qualified Data.Map as Map
 import Data.Maybe (fromMaybe)
-import Data.Monoid
+#if !MIN_VERSION_base(4,11,0)
+import Data.Monoid ((<>))
+#endif
 import qualified Data.Semigroup as Semigroup
 import qualified Data.Set as Set
 import Data.String (IsString(..))
diff --git a/src/Data/ProtoLens/Setup.hs b/src/Data/ProtoLens/Setup.hs
--- a/src/Data/ProtoLens/Setup.hs
+++ b/src/Data/ProtoLens/Setup.hs
@@ -24,8 +24,7 @@
     , generateProtos
     ) where
 
-import Control.DeepSeq (force)
-import Control.Monad (filterM, forM_, guard, when)
+import Control.Monad (filterM, forM_, when)
 import qualified Data.ByteString as BS
 import qualified Data.Map as Map
 import Data.Maybe (maybeToList)
@@ -42,7 +41,9 @@
     , exeName
     , exposedModules
     , extraSrcFiles
+#if !MIN_VERSION_Cabal(2,0,0)
     , hsSourceDirs
+#endif
     , libBuildInfo
     , otherModules
     , testBuildInfo
@@ -66,7 +67,6 @@
 import Distribution.Simple.Setup (fromFlag, copyDest, copyVerbosity)
 import Distribution.Simple.Utils
     ( createDirectoryIfMissingVerbose
-    , getDirectoryContentsRecursive
     , installOrdinaryFile
     , matchFileGlob
     )
@@ -78,7 +78,6 @@
 import Distribution.Verbosity (Verbosity)
 import System.FilePath
     ( (</>)
-    , (<.>)
     , equalFilePath
     , isRelative
     , makeRelative
@@ -296,6 +295,7 @@
 protoLensImportsPrefix :: FilePath
 protoLensImportsPrefix = "proto-lens-imports"
 
+#if !MIN_VERSION_Cabal(2,0,0)
 -- | Add the autogen directory to the hs-source-dirs of all the targets in the
 -- .cabal file.  Used to fool 'sdist' by pointing it to the generated source
 -- files.
@@ -326,6 +326,7 @@
                                     : hsSourceDirs bi }
         | otherwise = bi -- Could happen if a component isn't active; try
                          -- anyway and see whether Cabal complains later on.
+#endif
 
 -- | Returns whether the @root@ is a parent folder of @f@.
 isSubdirectoryOf :: FilePath -> FilePath -> Bool
@@ -398,11 +399,12 @@
 -- (e.g., `stack test` vs `stack build`).
 collectActiveModules
     :: LocalBuildInfo -> [(ComponentLocalBuildInfo, [ModuleName])]
-collectActiveModules l = map (\(n, l) -> (l, f n)) $ Map.toList $ allComponents l
+collectActiveModules l = map (\(n, c) -> (c, f n)) $ Map.toList $ allComponents l
   where
     p = localPkgDescr l
-    f CLibName = maybeToList (library p) >>= \l -> exposedModules l
-                                                    ++ otherModules (libBuildInfo l)
+    f CLibName = maybeToList (library p) >>=
+                    \lib -> exposedModules lib
+                                ++ otherModules (libBuildInfo lib)
     f (CExeName n) = otherModules . buildInfo $ exes Map.! n
     f (CTestName n) = otherModules . testBuildInfo $ tests Map.! n
     f (CBenchName n) = otherModules . benchmarkBuildInfo $ benchs Map.! n
