Invert curl flag to internal-downloader

This commit is contained in:
Julian Ospald 2020-04-28 17:56:39 +02:00
parent ee9b2ec30d
commit 56e4a6b15f
No known key found for this signature in database
GPG Key ID: 511B62C09D50CD28
4 changed files with 16 additions and 17 deletions

View File

@ -14,11 +14,11 @@ ecabal() {
ecabal update
if [ "${OS}" = "LINUX" ] ; then
ecabal build -w ghc-${GHC_VERSION} -fcurl --ghc-options='-split-sections -optl-static'
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections -optl-static'
elif [ "${OS}" = "FREEBSD" ] ; then
ecabal build -w ghc-${GHC_VERSION} -fcurl --ghc-options='-split-sections'
ecabal build -w ghc-${GHC_VERSION} --ghc-options='-split-sections'
else
ecabal build -w ghc-${GHC_VERSION} -fcurl
ecabal build -w ghc-${GHC_VERSION}
fi
mkdir out

View File

@ -20,9 +20,9 @@ eghcup() {
ecabal update
if [ "${OS}" = "DARWIN" ] ; then
ecabal build -w ghc-${GHC_VERSION} -fcurl
else
ecabal build -w ghc-${GHC_VERSION}
else
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader
fi
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" .

View File

@ -21,8 +21,8 @@ source-repository head
type: git
location: https://gitlab.haskell.org/haskell/ghcup-hs.git
flag Curl
description: Use curl instead of http-io-streams for download
flag internal-downloader
description: Compile the internal downloader, which links against OpenSSL
default: False
manual: True
@ -304,15 +304,14 @@ library
-- other-extensions:
hs-source-dirs: lib
if !flag(curl)
if flag(internal-downloader)
import:
, HsOpenSSL
, http-io-streams
, io-streams
, terminal-progress-bar
exposed-modules: GHCup.Download.IOStreams
else
cpp-options: -DCURL
cpp-options: -DINTERNAL_DOWNLOADER
executable ghcup
import:

View File

@ -11,7 +11,7 @@
module GHCup.Download where
#if !defined(CURL)
#if defined(INTERNAL_DOWNLOADER)
import GHCup.Download.IOStreams
import GHCup.Download.Utils
#endif
@ -35,7 +35,7 @@ import Control.Monad.Reader
import Control.Monad.Trans.Resource
hiding ( throwM )
import Data.Aeson
#if !defined(CURL)
#if defined(INTERNAL_DOWNLOADER)
import Data.ByteString ( ByteString )
import Data.CaseInsensitive ( CI )
#endif
@ -43,7 +43,7 @@ import Data.Maybe
import Data.String.Interpolate
import Data.Time.Clock
import Data.Time.Clock.POSIX
#if !defined(CURL)
#if defined(INTERNAL_DOWNLOADER)
import Data.Time.Format
#endif
import Data.Versions
@ -62,7 +62,7 @@ import URI.ByteString
import qualified Crypto.Hash.SHA256 as SHA256
import qualified Data.ByteString.Base16 as B16
import qualified Data.ByteString.Lazy as L
#if !defined(CURL)
#if defined(INTERNAL_DOWNLOADER)
import qualified Data.CaseInsensitive as CI
import qualified Data.Map.Strict as M
import qualified Data.Text as T
@ -220,7 +220,7 @@ getDownloads urlSource = do
getModTime = do
#if defined(CURL)
#if !defined(INTERNAL_DOWNLOADER)
pure Nothing
#else
headers <-
@ -319,7 +319,7 @@ download dli dest mfn
(liftIO $ hideError doesNotExistErrorType $ deleteFile destFile)
>> (throwE . DownloadFailed $ e)
) $ do
#if defined(CURL)
#if !defined(INTERNAL_DOWNLOADER)
liftE $ lEM @_ @'[ProcessError] $ liftIO $ exec "curl" True
["-fL", "-o", toFilePath destFile , serializeURIRef' $ view dlUri dli] Nothing Nothing
#else
@ -404,7 +404,7 @@ downloadBS uri'
where
scheme = view (uriSchemeL' % schemeBSL') uri'
path = view pathL' uri'
#if defined(CURL)
#if !defined(INTERNAL_DOWNLOADER)
dl _ = do
lift $ $(logDebug) [i|downloading: #{serializeURIRef' uri'}|]
let exe = [rel|curl|]