Commit 6e52cea6 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

Extend native DNS to support os(windows)

...via the new @windns@ package (which provides a compatible subset
of the @resolv@ API)

The flag is renamed from `resolv` to `native-dns`
parent 1cfa49c5
......@@ -14,7 +14,7 @@ import Control.Exception (SomeException, evaluate, try)
import Distribution.Simple.Utils
import Distribution.Compat.Exception (displayException)
#if defined(MIN_VERSION_resolv)
#if defined(MIN_VERSION_resolv) || defined(MIN_VERSION_windns)
import Network.DNS (queryTXT, Name(..), CharStr(..))
import qualified Data.ByteString.Char8 as BS.Char8
#else
......@@ -49,7 +49,7 @@ import Distribution.Simple.Program
--
queryBootstrapMirrors :: Verbosity -> URI -> IO [URI]
#if defined(MIN_VERSION_resolv)
#if defined(MIN_VERSION_resolv) || defined(MIN_VERSION_windns)
-- use @resolv@ package for performing DNS queries
queryBootstrapMirrors verbosity repoUri
| Just auth <- uriAuthority repoUri = do
......
......@@ -105,8 +105,8 @@ Flag network-uri
description: Get Network.URI from the network-uri package
default: True
Flag resolv
description: Enable use of the [resolv](https://hackage.haskell.org/package/resolv) package for performing DNS lookups
Flag native-dns
description: Enable use of the [resolv](https://hackage.haskell.org/package/resolv) & [windns](https://hackage.haskell.org/package/windns) packages for performing DNS lookups
default: False
manual: True
......@@ -341,7 +341,10 @@ library
else
build-depends: network >= 2.4 && < 2.6
if flag(resolv)
if flag(native-dns)
if os(windows)
build-depends: windns >= 0.1.0 && < 0.2
else
build-depends: resolv >= 0.1.1 && < 0.2
-- Needed for GHC.Generics before GHC 7.6
......@@ -578,8 +581,11 @@ executable cabal
else
build-depends: network >= 2.4 && < 2.6
if flag(resolv)
build-depends: resolv >= 0.1 && < 0.2
if flag(native-dns)
if os(windows)
build-depends: windns >= 0.1.0 && < 0.2
else
build-depends: resolv >= 0.1.1 && < 0.2
-- Needed for GHC.Generics before GHC 7.6
if impl(ghc < 7.6)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment