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 ecabal update
if [ "${OS}" = "LINUX" ] ; then 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 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 else
ecabal build -w ghc-${GHC_VERSION} -fcurl ecabal build -w ghc-${GHC_VERSION}
fi fi
mkdir out mkdir out

View File

@ -20,9 +20,9 @@ eghcup() {
ecabal update ecabal update
if [ "${OS}" = "DARWIN" ] ; then if [ "${OS}" = "DARWIN" ] ; then
ecabal build -w ghc-${GHC_VERSION} -fcurl
else
ecabal build -w ghc-${GHC_VERSION} ecabal build -w ghc-${GHC_VERSION}
else
ecabal build -w ghc-${GHC_VERSION} -finternal-downloader
fi fi
cp "$(ecabal new-exec --enable-tests --verbose=0 --offline sh -- -c 'command -v ghcup')" . 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 type: git
location: https://gitlab.haskell.org/haskell/ghcup-hs.git location: https://gitlab.haskell.org/haskell/ghcup-hs.git
flag Curl flag internal-downloader
description: Use curl instead of http-io-streams for download description: Compile the internal downloader, which links against OpenSSL
default: False default: False
manual: True manual: True
@ -304,15 +304,14 @@ library
-- other-extensions: -- other-extensions:
hs-source-dirs: lib hs-source-dirs: lib
if !flag(curl) if flag(internal-downloader)
import: import:
, HsOpenSSL , HsOpenSSL
, http-io-streams , http-io-streams
, io-streams , io-streams
, terminal-progress-bar , terminal-progress-bar
exposed-modules: GHCup.Download.IOStreams exposed-modules: GHCup.Download.IOStreams
else cpp-options: -DINTERNAL_DOWNLOADER
cpp-options: -DCURL
executable ghcup executable ghcup
import: import:

View File

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