diff --git a/app/ghcup/BrickMain.hs b/app/ghcup/BrickMain.hs index 3640811..1c3b323 100644 --- a/app/ghcup/BrickMain.hs +++ b/app/ghcup/BrickMain.hs @@ -449,7 +449,7 @@ install' _ (_, ListResult {..}) = do case lTool of GHC -> do let vi = getVersionInfo lVer GHC dls - liftE $ installGHCBin lVer GHCupInternal False $> (vi, dirs, ce) + liftE $ installGHCBin lVer GHCupInternal False [] $> (vi, dirs, ce) Cabal -> do let vi = getVersionInfo lVer Cabal dls liftE $ installCabalBin lVer GHCupInternal False $> (vi, dirs, ce) diff --git a/app/ghcup/GHCup/OptParse/Compile.hs b/app/ghcup/GHCup/OptParse/Compile.hs index 5c2019a..ee0708a 100644 --- a/app/ghcup/GHCup/OptParse/Compile.hs +++ b/app/ghcup/GHCup/OptParse/Compile.hs @@ -232,7 +232,7 @@ ghcCompileOpts = "Build cross-compiler for this platform" ) ) - <*> many (argument str (metavar "CONFIGURE_ARGS" <> help "Additional arguments to configure, prefix with '-- ' (longopts)")) + <*> many (argument str (metavar "CONFIGURE_ARGS" <> help "Additional arguments to compile configure, prefix with '-- ' (longopts)")) <*> fmap (fromMaybe False) (invertableSwitch "set" Nothing False (help "Set as active version after install")) <*> optional (option diff --git a/app/ghcup/GHCup/OptParse/Install.hs b/app/ghcup/GHCup/OptParse/Install.hs index 4a22209..7c99d82 100644 --- a/app/ghcup/GHCup/OptParse/Install.hs +++ b/app/ghcup/GHCup/OptParse/Install.hs @@ -71,6 +71,7 @@ data InstallOptions = InstallOptions , instSet :: Bool , isolateDir :: Maybe FilePath , forceInstall :: Bool + , addConfArgs :: [T.Text] } @@ -213,6 +214,7 @@ installOpts tool = ) <*> switch (short 'f' <> long "force" <> help "Force install (THIS IS UNSAFE, only use it in Dockerfiles or CI)") + <*> many (argument str (metavar "CONFIGURE_ARGS" <> help "Additional arguments to bindist configure, prefix with '-- ' (longopts)")) where setDefault = case tool of Nothing -> False @@ -335,6 +337,7 @@ install installCommand settings getAppState' runLogger = case installCommand of (_tvVersion v) (maybe GHCupInternal IsolateDir isolateDir) forceInstall + addConfArgs ) $ when instSet $ when (isNothing isolateDir) $ liftE $ void $ setGHC v SetGHCOnly Nothing pure vi @@ -346,6 +349,7 @@ install installCommand settings getAppState' runLogger = case installCommand of (_tvVersion v) (maybe GHCupInternal IsolateDir isolateDir) forceInstall + addConfArgs ) $ when instSet $ when (isNothing isolateDir) $ liftE $ void $ setGHC v SetGHCOnly Nothing pure vi diff --git a/app/ghcup/GHCup/OptParse/Run.hs b/app/ghcup/GHCup/OptParse/Run.hs index 90938f6..b153c7a 100644 --- a/app/ghcup/GHCup/OptParse/Run.hs +++ b/app/ghcup/GHCup/OptParse/Run.hs @@ -355,6 +355,7 @@ run RunOptions{..} runAppState leanAppstate runLogger = do (_tvVersion v) GHCupInternal False + [] setTool GHC v tmp Just (Cabal, v) -> do unless isInstalled $ when runInstTool' $ void $ liftE $ installCabalBin diff --git a/lib/GHCup/GHC.hs b/lib/GHCup/GHC.hs index f3a3420..aad8b68 100644 --- a/lib/GHCup/GHC.hs +++ b/lib/GHCup/GHC.hs @@ -141,6 +141,7 @@ installGHCBindist :: ( MonadFail m -> Version -- ^ the version to install -> InstallDir -> Bool -- ^ Force install + -> [T.Text] -- ^ additional configure args for bindist -> Excepts '[ AlreadyInstalled , BuildFailed @@ -159,7 +160,7 @@ installGHCBindist :: ( MonadFail m ] m () -installGHCBindist dlinfo ver installDir forceInstall = do +installGHCBindist dlinfo ver installDir forceInstall addConfArgs = do let tver = mkTVer ver lift $ logDebug $ "Requested to install GHC with " <> prettyVer ver @@ -189,12 +190,12 @@ installGHCBindist dlinfo ver installDir forceInstall = do case installDir of IsolateDir isoDir -> do -- isolated install lift $ logInfo $ "isolated installing GHC to " <> T.pack isoDir - liftE $ installPackedGHC dl (view dlSubdir dlinfo) (IsolateDirResolved isoDir) ver forceInstall + liftE $ installPackedGHC dl (view dlSubdir dlinfo) (IsolateDirResolved isoDir) ver forceInstall addConfArgs GHCupInternal -> do -- regular install -- prepare paths ghcdir <- lift $ ghcupGHCDir tver - liftE $ installPackedGHC dl (view dlSubdir dlinfo) (GHCupDir ghcdir) ver forceInstall + liftE $ installPackedGHC dl (view dlSubdir dlinfo) (GHCupDir ghcdir) ver forceInstall addConfArgs -- make symlinks & stuff when regular install, liftE $ postGHCInstall tver @@ -230,6 +231,7 @@ installPackedGHC :: ( MonadMask m -> InstallDirResolved -> Version -- ^ The GHC version -> Bool -- ^ Force install + -> [T.Text] -- ^ additional configure args for bindist -> Excepts '[ BuildFailed , UnknownArchive @@ -239,7 +241,7 @@ installPackedGHC :: ( MonadMask m , ProcessError , MergeFileTreeError ] m () -installPackedGHC dl msubdir inst ver forceInstall = do +installPackedGHC dl msubdir inst ver forceInstall addConfArgs = do PlatformRequest {..} <- lift getPlatformReq unless forceInstall @@ -256,7 +258,7 @@ installPackedGHC dl msubdir inst ver forceInstall = do msubdir liftE $ runBuildAction tmpUnpack - (installUnpackedGHC workdir inst ver forceInstall) + (installUnpackedGHC workdir inst ver forceInstall addConfArgs) -- | Install an unpacked GHC distribution. This only deals with the GHC @@ -277,8 +279,9 @@ installUnpackedGHC :: ( MonadReader env m -> InstallDirResolved -- ^ Path to install to -> Version -- ^ The GHC version -> Bool -- ^ Force install + -> [T.Text] -- ^ additional configure args for bindist -> Excepts '[ProcessError, MergeFileTreeError] m () -installUnpackedGHC path inst ver forceInstall +installUnpackedGHC path inst ver forceInstall addConfArgs | isWindows = do lift $ logInfo "Installing GHC (this may take a while)" -- Windows bindists are relocatable and don't need @@ -301,7 +304,7 @@ installUnpackedGHC path inst ver forceInstall lift $ logInfo "Installing GHC (this may take a while)" lEM $ execLogged "sh" ("./configure" : ("--prefix=" <> fromInstallDir inst) - : alpineArgs + : (alpineArgs <> (T.unpack <$> addConfArgs)) ) (Just $ fromGHCupPath path) "ghc-configure" @@ -342,6 +345,7 @@ installGHCBin :: ( MonadFail m => Version -- ^ the version to install -> InstallDir -> Bool -- ^ force install + -> [T.Text] -- ^ additional configure args for bindist -> Excepts '[ AlreadyInstalled , BuildFailed @@ -360,9 +364,9 @@ installGHCBin :: ( MonadFail m ] m () -installGHCBin ver installDir forceInstall = do +installGHCBin ver installDir forceInstall addConfArgs = do dlinfo <- liftE $ getDownloadInfo GHC ver - liftE $ installGHCBindist dlinfo ver installDir forceInstall + liftE $ installGHCBindist dlinfo ver installDir forceInstall addConfArgs @@ -747,6 +751,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patches aargs buildFlavour hadr ghcdir (installVer ^. tvVersion) False -- not a force install, since we already overwrite when compiling. + [] liftIO $ B.writeFile (fromInstallDir ghcdir ghcUpSrcBuiltFile) bmk