diff -pruN 3.1.7.1-1/ChangeLog.md 3.1.7.4-1/ChangeLog.md
--- 3.1.7.1-1/ChangeLog.md	2020-01-15 05:48:44.000000000 +0000
+++ 3.1.7.4-1/ChangeLog.md	2022-03-20 09:09:31.000000000 +0000
@@ -1,5 +1,17 @@
 # wai-app-static changelog
 
+## 3.1.7.4
+
+* Fix a bug when the cryptonite flag is disabled. [#874](https://github.com/yesodweb/wai/pull/874)
+
+## 3.1.7.3
+
+* Introduce a flag to avoid the cryptonite dependency. [#871](https://github.com/yesodweb/wai/pull/871)
+
+## 3.1.7.2
+
+* optparse-applicative 0.16.0.0 support
+
 ## 3.1.7.1
 
 * Update the test suite too
diff -pruN 3.1.7.1-1/debian/changelog 3.1.7.4-1/debian/changelog
--- 3.1.7.1-1/debian/changelog	2020-06-17 01:15:15.000000000 +0000
+++ 3.1.7.4-1/debian/changelog	2022-07-31 22:51:33.000000000 +0000
@@ -1,3 +1,13 @@
+haskell-wai-app-static (3.1.7.4-1) unstable; urgency=medium
+
+  [ Ilias Tsitsimpis ]
+  * Declare compliance with Debian policy 4.6.1
+
+  [ Clint Adams ]
+  * New upstream version.
+
+ -- Clint Adams <clint@debian.org>  Sun, 31 Jul 2022 18:51:33 -0400
+
 haskell-wai-app-static (3.1.7.1-1) unstable; urgency=medium
 
   * New upstream version.
diff -pruN 3.1.7.1-1/debian/control 3.1.7.4-1/debian/control
--- 3.1.7.1-1/debian/control	2020-06-17 01:15:15.000000000 +0000
+++ 3.1.7.4-1/debian/control	2022-07-31 22:51:33.000000000 +0000
@@ -43,10 +43,9 @@ Build-Depends:
  libghc-unordered-containers-prof,
  libghc-wai-dev,
  libghc-wai-dev (<< 3.3),
- libghc-wai-dev (>= 3.0),
- libghc-wai-extra-dev,
- libghc-wai-extra-dev (<< 3.1),
+ libghc-wai-prof,
  libghc-wai-extra-dev (>= 3.0),
+ libghc-wai-extra-dev (<< 3.2),
  libghc-wai-extra-prof,
  libghc-warp-dev (>= 3.0.11),
  libghc-warp-dev (<< 3.4),
@@ -81,7 +80,7 @@ Build-Depends-Indep: ghc-doc,
  libghc-wai-extra-doc,
  libghc-warp-doc,
  libghc-zlib-doc,
-Standards-Version: 4.5.0
+Standards-Version: 4.6.1
 Homepage: http://www.yesodweb.com/book/web-application-interface
 Vcs-Browser: https://salsa.debian.org/haskell-team/DHG_packages/tree/master/p/haskell-wai-app-static
 Vcs-Git: https://salsa.debian.org/haskell-team/DHG_packages.git [p/haskell-wai-app-static]
diff -pruN 3.1.7.1-1/Network/Wai/Application/Static.hs 3.1.7.4-1/Network/Wai/Application/Static.hs
--- 3.1.7.1-1/Network/Wai/Application/Static.hs	2020-01-15 05:44:52.000000000 +0000
+++ 3.1.7.4-1/Network/Wai/Application/Static.hs	2022-01-03 10:40:57.000000000 +0000
@@ -164,11 +164,13 @@ serveFile StaticSettings {..} req file
             -- Didn't match, but we have a hash value. Send the file contents
             -- with an ETag header.
             --
-            -- Note: It would be arguably better to next check
-            -- if-modified-since and return a 304 if that indicates a match as
-            -- well. However, the circumstances under which such a situation
-            -- could arise would be very anomalous, and should likely warrant a
-            -- new file being sent anyway.
+            -- RFC7232 (HTTP 1.1):
+            -- > A recipient MUST ignore If-Modified-Since if the request contains an
+            -- > If-None-Match header field; the condition in If-None-Match is
+            -- > considered to be a more accurate replacement for the condition in
+            -- > If-Modified-Since, and the two are only combined for the sake of
+            -- > interoperating with older intermediaries that might not implement
+            -- > If-None-Match.
             (Just hash, _) -> respond [("ETag", hash)]
 
             -- No hash value available, fall back to last modified support.
@@ -243,7 +245,7 @@ staticAppPieces ss rawPieces req sendRes
     response :: StaticResponse -> IO W.ResponseReceived
     response (FileResponse file ch) = do
         mimetype <- ssGetMimeType ss file
-        let filesize = fileGetSize file
+        -- let filesize = fileGetSize file
         let headers = ("Content-Type", mimetype)
                     -- Let Warp provide the content-length, since it takes
                     -- range requests into account
diff -pruN 3.1.7.1-1/WaiAppStatic/CmdLine.hs 3.1.7.4-1/WaiAppStatic/CmdLine.hs
--- 3.1.7.1-1/WaiAppStatic/CmdLine.hs	2019-02-17 10:29:36.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/CmdLine.hs	2022-01-03 10:40:57.000000000 +0000
@@ -1,4 +1,4 @@
-{-# LANGUAGE DeriveDataTypeable, RecordWildCards #-}
+{-# LANGUAGE DeriveDataTypeable, RecordWildCards, CPP #-}
 -- | Command line version of wai-app-static, used for the warp-static server.
 module WaiAppStatic.CmdLine
     ( runCommandLine
@@ -39,6 +39,7 @@ data Args = Args
     }
 
 #if MIN_VERSION_optparse_applicative(0, 10, 0)
+option' :: Mod OptionFields Int -> Parser Int
 option' = option auto
 #else
 option' = option
@@ -113,5 +114,9 @@ runCommandLine middleware = do
     where
       helperOption :: Parser (a -> a)
       helperOption =
+#if MIN_VERSION_optparse_applicative(0,16,0)
+        abortOption (ShowHelpText Nothing) $
+#else
         abortOption ShowHelpText $
+#endif
         mconcat [long "help", help "Show this help text", hidden]
diff -pruN 3.1.7.1-1/WaiAppStatic/Listing.hs 3.1.7.4-1/WaiAppStatic/Listing.hs
--- 3.1.7.1-1/WaiAppStatic/Listing.hs	2017-06-01 12:48:32.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/Listing.hs	2022-01-03 10:40:57.000000000 +0000
@@ -64,7 +64,7 @@ defaultListing pieces (Folder contents)
 
     -- Add a link to the root of the tree
     showFolder' :: Bool -> Pieces -> H.Html
-    showFolder' hasTrailingSlash pieces  = showFolder hasTrailingSlash (unsafeToPiece "root" : pieces)
+    showFolder' hasTrailingSlash pieces' = showFolder hasTrailingSlash (unsafeToPiece "root" : pieces')
 
     showFolder :: Bool -> Pieces -> H.Html
     showFolder _ [] = "/" -- won't happen
diff -pruN 3.1.7.1-1/WaiAppStatic/Storage/Embedded/Runtime.hs 3.1.7.4-1/WaiAppStatic/Storage/Embedded/Runtime.hs
--- 3.1.7.1-1/WaiAppStatic/Storage/Embedded/Runtime.hs	2018-03-19 12:30:17.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/Storage/Embedded/Runtime.hs	2022-02-28 02:27:03.000000000 +0000
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 -- | Lookup files stored in memory instead of from the filesystem.
 module WaiAppStatic.Storage.Embedded.Runtime
     ( -- * Settings
@@ -15,8 +16,13 @@ import Data.Function (on)
 import qualified Data.Text as T
 import Data.Ord
 import qualified Data.ByteString as S
+#ifdef MIN_VERSION_cryptonite
 import Crypto.Hash (hash, MD5, Digest)
 import Data.ByteArray.Encoding
+#else
+import Crypto.Hash.MD5 (hash)
+import Data.ByteString.Base64 (encode)
+#endif
 import WaiAppStatic.Storage.Filesystem (defaultFileServerSettings)
 import System.FilePath (isPathSeparator)
 
@@ -94,4 +100,8 @@ bsToFile name bs = File
     }
 
 runHash :: ByteString -> ByteString
+#ifdef MIN_VERSION_cryptonite
 runHash = convertToBase Base64 . (hash :: S.ByteString -> Digest MD5)
+#else
+runHash = encode . hash
+#endif
diff -pruN 3.1.7.1-1/WaiAppStatic/Storage/Embedded/TH.hs 3.1.7.4-1/WaiAppStatic/Storage/Embedded/TH.hs
--- 3.1.7.1-1/WaiAppStatic/Storage/Embedded/TH.hs	2018-03-19 12:30:17.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/Storage/Embedded/TH.hs	2022-01-03 10:40:57.000000000 +0000
@@ -1,4 +1,4 @@
-{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings, MagicHash #-}
+{-# LANGUAGE TemplateHaskell, QuasiQuotes, OverloadedStrings, MagicHash, CPP #-}
 module WaiAppStatic.Storage.Embedded.TH(
     Etag
   , EmbeddableEntry(..)
@@ -7,7 +7,6 @@ module WaiAppStatic.Storage.Embedded.TH(
 
 import Data.ByteString.Builder.Extra (byteStringInsert)
 import Codec.Compression.GZip (compress)
-import Control.Applicative
 import Data.ByteString.Unsafe (unsafePackAddressLen)
 import Data.Either (lefts, rights)
 import GHC.Exts (Int(..))
diff -pruN 3.1.7.1-1/WaiAppStatic/Storage/Filesystem.hs 3.1.7.4-1/WaiAppStatic/Storage/Filesystem.hs
--- 3.1.7.1-1/WaiAppStatic/Storage/Filesystem.hs	2017-06-01 12:48:32.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/Storage/Filesystem.hs	2022-03-20 09:09:31.000000000 +0000
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE OverloadedStrings #-}
 {-# LANGUAGE BangPatterns #-}
@@ -25,8 +26,13 @@ import WaiAppStatic.Listing
 import Network.Mime
 import System.PosixCompat.Files (fileSize, getFileStatus, modificationTime, isRegularFile)
 import Data.Maybe (catMaybes)
+#ifdef MIN_VERSION_cryptonite
 import Data.ByteArray.Encoding
 import Crypto.Hash (hashlazy, MD5, Digest)
+#else
+import Data.ByteString.Base64 (encode)
+import Crypto.Hash.MD5 (hashlazy)
+#endif
 import qualified Data.ByteString.Lazy as BL (hGetContents)
 import qualified Data.Text as T
 
@@ -122,8 +128,13 @@ webAppLookup hashFunc prefix pieces =
 hashFile :: FilePath -> IO ByteString
 hashFile fp = withBinaryFile fp ReadMode $ \h -> do
     f <- BL.hGetContents h
+#ifdef MIN_VERSION_cryptonite
     let !hash = hashlazy f :: Digest MD5
     return $ convertToBase Base64 hash
+#else
+    let !hash = hashlazy f
+    return . encode $ hash
+#endif
 
 hashFileIfExists :: ETagLookup
 hashFileIfExists fp = do
diff -pruN 3.1.7.1-1/WaiAppStatic/Types.hs 3.1.7.4-1/WaiAppStatic/Types.hs
--- 3.1.7.1-1/WaiAppStatic/Types.hs	2018-03-19 12:30:17.000000000 +0000
+++ 3.1.7.4-1/WaiAppStatic/Types.hs	2022-01-03 10:40:57.000000000 +0000
@@ -59,6 +59,8 @@ toPieces :: [Text] -> Maybe Pieces
 toPieces = mapM toPiece
 
 -- | Request coming from a user. Corresponds to @pathInfo@.
+--
+-- The root path is the empty list.
 type Pieces = [Piece]
 
 -- | Values for the max-age component of the cache-control response header.
diff -pruN 3.1.7.1-1/wai-app-static.cabal 3.1.7.4-1/wai-app-static.cabal
--- 3.1.7.1-1/wai-app-static.cabal	2020-01-15 05:48:37.000000000 +0000
+++ 3.1.7.4-1/wai-app-static.cabal	2022-03-20 09:09:31.000000000 +0000
@@ -1,5 +1,5 @@
 name:            wai-app-static
-version:         3.1.7.1
+version:         3.1.7.4
 license:         MIT
 license-file:    LICENSE
 author:          Michael Snoyman <michael@snoyman.com>
@@ -8,7 +8,7 @@ synopsis:        WAI application for sta
 description:     API docs and the README are available at <http://www.stackage.org/package/wai-app-static>.
 category:        Web, Yesod
 stability:       Stable
-cabal-version:   >= 1.8
+cabal-version:   >= 1.10
 build-type:      Simple
 homepage:        http://www.yesodweb.com/book/web-application-interface
 Extra-source-files:
@@ -24,8 +24,13 @@ Flag print
     Description:   print debug info
     Default:       False
 
+Flag cryptonite
+    Description:   Use the cryptonite library for MD5 computation
+    Default:       True
+
 library
-    build-depends:   base                      >= 4        && < 5
+    default-language: Haskell2010
+    build-depends:   base                      >= 4.12     && < 5
                    , wai                       >= 3.0      && < 3.3
                    , bytestring                >= 0.10.4
                    , http-types                >= 0.7
@@ -37,8 +42,6 @@ library
                    , old-locale                >= 1.0.0.2
                    , file-embed                >= 0.0.3.1
                    , text                      >= 0.7
-                   , cryptonite                >= 0.6
-                   , memory                    >= 0.7
                    , http-date
                    , blaze-html                >= 0.5
                    , blaze-markup              >= 0.5.1
@@ -47,9 +50,15 @@ library
                    , template-haskell          >= 2.7
                    , zlib                      >= 0.5
                    , filepath
-                   , wai-extra                 >= 3.0      && < 3.1
+                   , wai-extra                 >= 3.0      && < 3.2
                    , optparse-applicative      >= 0.7
                    , warp                      >= 3.0.11   && < 3.4
+    if flag(cryptonite)
+      build-depends: cryptonite                >= 0.6
+                   , memory                    >= 0.7
+    else
+      build-depends: base64-bytestring         >= 0.1
+                   , cryptohash-md5            >= 0.11.101
 
     exposed-modules: Network.Wai.Application.Static
                      WaiAppStatic.Storage.Filesystem
@@ -61,12 +70,12 @@ library
                      WaiAppStatic.Storage.Embedded.Runtime
                      WaiAppStatic.Storage.Embedded.TH
     ghc-options:     -Wall
-    extensions:     CPP
 
     if flag(print)
       cpp-options:  -DPRINT
 
 Executable warp
+  default-language: Haskell2010
   Main-is:        warp-static.hs
   hs-source-dirs: app
   Build-depends: base            >= 4                  && < 5
@@ -78,6 +87,7 @@ Executable warp
                , mime-types      >= 0.1                && < 0.2
 
 test-suite runtests
+    default-language: Haskell2010
     hs-source-dirs: test
     main-is: ../tests.hs
     type: exitcode-stdio-1.0
