diff --git a/ChangeLog b/ChangeLog
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-04-26  Vladimir Shabanov  <vshabanoff@gmail.com>
+
+	* HsOpenSSL.cabal (Version): Bump version to 0.11.4.8
+
+	* Setup.hs: Updated for Cabal-2.0
+	by Eric Mertens @glguy (#24)
+
 2017-04-17  Vladimir Shabanov  <vshabanoff@gmail.com>
 
 	* HsOpenSSL.cabal (Version): Bump version to 0.11.4.7
diff --git a/HsOpenSSL.cabal b/HsOpenSSL.cabal
--- a/HsOpenSSL.cabal
+++ b/HsOpenSSL.cabal
@@ -12,7 +12,7 @@
     <http://hackage.haskell.org/package/tls>, which is a pure Haskell
     implementation of SSL.
     .
-Version:       0.11.4.7
+Version:       0.11.4.8
 License:       PublicDomain
 License-File:  COPYING
 Author:        Adam Langley, Mikhail Vorozhtsov, PHO, Taru Karttunen
@@ -60,6 +60,10 @@
         Use MacPorts version of OpenSSL (macOS only).
     Default:
         False
+
+Custom-setup
+    setup-depends: Cabal >=1.12 && <2.1,
+                   base  >=4.4  && <5
 
 Library
     Build-Depends:
diff --git a/Setup.hs b/Setup.hs
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,11 +1,18 @@
 {-# LANGUAGE CPP #-}
 {-# LANGUAGE TupleSections #-}
 
+#ifndef MIN_VERSION_Cabal
+-- MIN_VERSION_Cabal is defined and available to custom Setup.hs scripts
+-- if either GHC >= 8.0 or cabal-install >= 1.24 is used.
+-- So if it isn't defined, it's very likely we don't have Cabal >= 2.0.
+#define MIN_VERSION_Cabal(x,y,z) 0
+#endif
+
 import Distribution.Simple
 import Distribution.Simple.Setup (ConfigFlags(..), toFlag)
 import Distribution.Simple.LocalBuildInfo (localPkgDescr)
 
-#if __GLASGOW_HASKELL__ >= 802
+#if MIN_VERSION_Cabal(2,0,0)
 import Distribution.PackageDescription (FlagName(..), mkFlagName)
 #else
 import Distribution.PackageDescription (FlagName(..))
@@ -18,6 +25,10 @@
 import Control.Monad (forM)
 import Data.List
 
+#if !(MIN_VERSION_Cabal(2,0,0))
+mkFlagName = FlagName
+#endif
+
 -- On macOS we're checking whether OpenSSL library is avaiable
 -- and if not, we're trying to find Homebrew or MacPorts OpenSSL installations.
 --
@@ -97,8 +108,3 @@
 
     where ue e | isUserError e = Just e
                | otherwise = Nothing
-
-#if __GLASGOW_HASKELL__ < 802
-mkFlagName = FlagName
-#endif
-
