From 9bdf6bde1735c6f9279034caa08111fd8b8be28c Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 14:25:24 +0200 Subject: [PATCH 1/9] Only consider .diff/.patch for patch files wrt #226 --- lib/GHCup/Utils.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index f4dfb4e..c889285 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -791,7 +791,12 @@ applyPatches :: (MonadReader env m, HasDirs env, HasLog env, MonadIO m) -> FilePath -- ^ dir to apply patches in -> Excepts '[PatchFailed] m () applyPatches pdir ddir = do - patches <- (fmap . fmap) (pdir ) $ liftIO $ listDirectory pdir + patches <- (fmap . fmap) (pdir ) $ liftIO $ findFiles + pdir + (makeRegexOpts compExtended + execBlank + ([s|.+\.(patch|diff)$|] :: ByteString) + ) forM_ (sort patches) $ \patch' -> do lift $ logInfo $ "Applying patch " <> T.pack patch' fmap (either (const Nothing) Just) From cc8cf3d12a6e45340b983dfc2ecb8916b4fb1d33 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 14:31:05 +0200 Subject: [PATCH 2/9] Improve --patchdir documentation wrt #226 --- app/ghcup/Main.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 6f9f36d..e12d3dd 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1045,7 +1045,7 @@ ghcCompileOpts = (option str (short 'p' <> long "patchdir" <> metavar "PATCH_DIR" <> help - "Absolute path to patch directory (applied in order, uses -p1)" + "Absolute path to patch directory (applies all .patch and .diff files in order using -p1)" ) ) <*> optional From 8c72bf697ea27c5a265877652aceb386e7747533 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:07:22 +0200 Subject: [PATCH 3/9] Move files into nicer subdirectories --- README.md | 4 ++-- data/build_mk/cross | 9 +++++++++ data/build_mk/default | 8 ++++++++ config.yaml => data/config.yaml | 0 .../metadata/ghcup-0.0.1.json | 0 .../metadata/ghcup-0.0.2.json | 0 .../metadata/ghcup-0.0.2.yaml | 0 .../metadata/ghcup-0.0.3.yaml | 0 .../metadata/ghcup-0.0.4.yaml | 0 .../metadata/ghcup-0.0.5.yaml | 0 .../metadata/ghcup-0.0.6.yaml | 0 .../metadata/ghcup-0.0.7.yaml | 0 CHANGELOG.md => docs/CHANGELOG.md | 0 HACKING.md => docs/HACKING.md | 0 RELEASING.md => docs/RELEASING.md | 2 +- TODO.md => docs/TODO.md | 0 ghcup.cabal | 16 ++++++++-------- .../bootstrap/bootstrap-haskell | 0 .../bootstrap/bootstrap-haskell.ps1 | 0 refreeze.sh => scripts/dev/refreeze.sh | 0 .../shell-completions}/bash | 0 .../shell-completions}/fish | 0 .../shell-completions}/zsh | 0 23 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 data/build_mk/cross create mode 100644 data/build_mk/default rename config.yaml => data/config.yaml (100%) rename ghcup-0.0.1.json => data/metadata/ghcup-0.0.1.json (100%) rename ghcup-0.0.2.json => data/metadata/ghcup-0.0.2.json (100%) rename ghcup-0.0.2.yaml => data/metadata/ghcup-0.0.2.yaml (100%) rename ghcup-0.0.3.yaml => data/metadata/ghcup-0.0.3.yaml (100%) rename ghcup-0.0.4.yaml => data/metadata/ghcup-0.0.4.yaml (100%) rename ghcup-0.0.5.yaml => data/metadata/ghcup-0.0.5.yaml (100%) rename ghcup-0.0.6.yaml => data/metadata/ghcup-0.0.6.yaml (100%) rename ghcup-0.0.7.yaml => data/metadata/ghcup-0.0.7.yaml (100%) rename CHANGELOG.md => docs/CHANGELOG.md (100%) rename HACKING.md => docs/HACKING.md (100%) rename RELEASING.md => docs/RELEASING.md (68%) rename TODO.md => docs/TODO.md (100%) rename bootstrap-haskell => scripts/bootstrap/bootstrap-haskell (100%) rename bootstrap-haskell.ps1 => scripts/bootstrap/bootstrap-haskell.ps1 (100%) rename refreeze.sh => scripts/dev/refreeze.sh (100%) rename {shell-completions => scripts/shell-completions}/bash (100%) rename {shell-completions => scripts/shell-completions}/fish (100%) rename {shell-completions => scripts/shell-completions}/zsh (100%) diff --git a/README.md b/README.md index 97acece..514912e 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ handles your haskell packages and can demand that [a specific version](https://c ### Configuration A configuration file can be put in `~/.ghcup/config.yaml`. The default config file -explaining all possible configurations can be found in this repo: [config.yaml](./config.yaml). +explaining all possible configurations can be found in this repo: [config.yaml](./data/config.yaml). Partial configuration is fine. Command line options always override the config file settings. @@ -102,7 +102,7 @@ For man pages to work you need [man-db](http://man-db.nongnu.org/) as your `man` ### Shell-completion -Shell completions are in `shell-completions`. +Shell completions are in [scripts/shell-completions](./scripts/shell-completions) directory of this repository. For bash: install `shell-completions/bash` as e.g. `/etc/bash_completion.d/ghcup` (depending on distro) diff --git a/data/build_mk/cross b/data/build_mk/cross new file mode 100644 index 0000000..eabf8c3 --- /dev/null +++ b/data/build_mk/cross @@ -0,0 +1,9 @@ +V=0 +BUILD_MAN = NO +BUILD_SPHINX_HTML = NO +BUILD_SPHINX_PDF = NO +HADDOCK_DOCS = NO +ifneq "$(BuildFlavour)" "" +include mk/flavours/$(BuildFlavour).mk +endif +Stage1Only = YES diff --git a/data/build_mk/default b/data/build_mk/default new file mode 100644 index 0000000..b075d05 --- /dev/null +++ b/data/build_mk/default @@ -0,0 +1,8 @@ +V=0 +BUILD_MAN = NO +BUILD_SPHINX_HTML = NO +BUILD_SPHINX_PDF = NO +HADDOCK_DOCS = YES +ifneq "$(BuildFlavour)" "" +include mk/flavours/$(BuildFlavour).mk +endif diff --git a/config.yaml b/data/config.yaml similarity index 100% rename from config.yaml rename to data/config.yaml diff --git a/ghcup-0.0.1.json b/data/metadata/ghcup-0.0.1.json similarity index 100% rename from ghcup-0.0.1.json rename to data/metadata/ghcup-0.0.1.json diff --git a/ghcup-0.0.2.json b/data/metadata/ghcup-0.0.2.json similarity index 100% rename from ghcup-0.0.2.json rename to data/metadata/ghcup-0.0.2.json diff --git a/ghcup-0.0.2.yaml b/data/metadata/ghcup-0.0.2.yaml similarity index 100% rename from ghcup-0.0.2.yaml rename to data/metadata/ghcup-0.0.2.yaml diff --git a/ghcup-0.0.3.yaml b/data/metadata/ghcup-0.0.3.yaml similarity index 100% rename from ghcup-0.0.3.yaml rename to data/metadata/ghcup-0.0.3.yaml diff --git a/ghcup-0.0.4.yaml b/data/metadata/ghcup-0.0.4.yaml similarity index 100% rename from ghcup-0.0.4.yaml rename to data/metadata/ghcup-0.0.4.yaml diff --git a/ghcup-0.0.5.yaml b/data/metadata/ghcup-0.0.5.yaml similarity index 100% rename from ghcup-0.0.5.yaml rename to data/metadata/ghcup-0.0.5.yaml diff --git a/ghcup-0.0.6.yaml b/data/metadata/ghcup-0.0.6.yaml similarity index 100% rename from ghcup-0.0.6.yaml rename to data/metadata/ghcup-0.0.6.yaml diff --git a/ghcup-0.0.7.yaml b/data/metadata/ghcup-0.0.7.yaml similarity index 100% rename from ghcup-0.0.7.yaml rename to data/metadata/ghcup-0.0.7.yaml diff --git a/CHANGELOG.md b/docs/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to docs/CHANGELOG.md diff --git a/HACKING.md b/docs/HACKING.md similarity index 100% rename from HACKING.md rename to docs/HACKING.md diff --git a/RELEASING.md b/docs/RELEASING.md similarity index 68% rename from RELEASING.md rename to docs/RELEASING.md index f970f7a..8c50483 100644 --- a/RELEASING.md +++ b/docs/RELEASING.md @@ -6,7 +6,7 @@ 3. Add ChangeLog entry -4. Add/fix downloads in `ghcup-.yaml`, then verify with `ghcup-gen check -f ghcup-.yaml` and possibly (example only) `ghcup-gen check-tarballs -f ghcup-.yaml -u 'ghc-8.10.7'`. Generally, new GHC/cabal/stack/hls versions are only added to the latest yaml file. New GHCup versions are added to all (great care must be taken here to not break the parser... e.g. ARM platforms don't parse in all older formats). +4. Add/fix downloads in `ghcup-.yaml` (under `data/metadata`), then verify with `ghcup-gen check -f ghcup-.yaml` and possibly (example only) `ghcup-gen check-tarballs -f ghcup-.yaml -u 'ghc-8.10.7'`. Generally, new GHC/cabal/stack/hls versions are only added to the latest yaml file. New GHCup versions are added to all (great care must be taken here to not break the parser... e.g. ARM platforms don't parse in all older formats). 5. Commit and git push with tag. Wait for tests to succeed and release artifacts to build. diff --git a/TODO.md b/docs/TODO.md similarity index 100% rename from TODO.md rename to docs/TODO.md diff --git a/ghcup.cabal b/ghcup.cabal index 0933614..96d186a 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -16,15 +16,15 @@ description: category: System build-type: Simple extra-doc-files: - CHANGELOG.md - config.yaml - ghcup-0.0.4.yaml - ghcup-0.0.5.yaml - ghcup-0.0.6.yaml - ghcup-0.0.7.yaml - HACKING.md README.md - RELEASING.md + docs/CHANGELOG.md + docs/HACKING.md + docs/RELEASING.md + data/config.yaml + data/metadata/ghcup-0.0.4.yaml + data/metadata/ghcup-0.0.5.yaml + data/metadata/ghcup-0.0.6.yaml + data/metadata/ghcup-0.0.7.yaml source-repository head type: git diff --git a/bootstrap-haskell b/scripts/bootstrap/bootstrap-haskell similarity index 100% rename from bootstrap-haskell rename to scripts/bootstrap/bootstrap-haskell diff --git a/bootstrap-haskell.ps1 b/scripts/bootstrap/bootstrap-haskell.ps1 similarity index 100% rename from bootstrap-haskell.ps1 rename to scripts/bootstrap/bootstrap-haskell.ps1 diff --git a/refreeze.sh b/scripts/dev/refreeze.sh similarity index 100% rename from refreeze.sh rename to scripts/dev/refreeze.sh diff --git a/shell-completions/bash b/scripts/shell-completions/bash similarity index 100% rename from shell-completions/bash rename to scripts/shell-completions/bash diff --git a/shell-completions/fish b/scripts/shell-completions/fish similarity index 100% rename from shell-completions/fish rename to scripts/shell-completions/fish diff --git a/shell-completions/zsh b/scripts/shell-completions/zsh similarity index 100% rename from shell-completions/zsh rename to scripts/shell-completions/zsh From c54dc05d9263c36f02e46c988019565133828061 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:09:14 +0200 Subject: [PATCH 4/9] Read build.mk from files at build time --- lib/GHCup.hs | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 56e8d5f..72dcb48 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -65,9 +65,10 @@ import Data.Time.Format.ISO8601 import Data.Versions import GHC.IO.Exception import Haskus.Utils.Variant.Excepts +import Language.Haskell.TH +import Language.Haskell.TH.Syntax ( Quasi(qAddDependentFile) ) import Optics import Prelude hiding ( abs - , readFile , writeFile ) import Safe hiding ( at ) @@ -1922,26 +1923,12 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had pure tver where - defaultConf = case targetGhc of - Left (GHCTargetVersion (Just _) _) -> [s| -V=0 -BUILD_MAN = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -HADDOCK_DOCS = NO -ifneq "$(BuildFlavour)" "" -include mk/flavours/$(BuildFlavour).mk -endif -Stage1Only = YES|] - _ -> [s| -V=0 -BUILD_MAN = NO -BUILD_SPHINX_HTML = NO -BUILD_SPHINX_PDF = NO -HADDOCK_DOCS = YES -ifneq "$(BuildFlavour)" "" -include mk/flavours/$(BuildFlavour).mk -endif|] + defaultConf = + let cross_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/cross" >> runIO (readFile "data/build_mk/default"))) + default_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/default" >> runIO (readFile "data/build_mk/default"))) + in case targetGhc of + Left (GHCTargetVersion (Just _) _) -> cross_mk + _ -> default_mk compileHadrianBindist :: ( MonadReader env m , HasDirs env From b962bf4af9681db10bc15b933bcda0293ae06d91 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:10:07 +0200 Subject: [PATCH 5/9] Add missing qAddDependentFiles --- app/ghcup/Main.hs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index e12d3dd..86a991e 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -57,6 +57,7 @@ import Data.Void import GHC.IO.Encoding import Haskus.Utils.Variant.Excepts import Language.Haskell.TH +import Language.Haskell.TH.Syntax ( Quasi(qAddDependentFile) ) import Options.Applicative hiding ( style ) import Options.Applicative.Help.Pretty ( text ) import Prelude hiding ( appendFile ) @@ -1405,6 +1406,7 @@ plan_json :: String plan_json = $( LitE . StringL <$> runIO (handleIO (\_ -> pure "") $ do fp <- findPlanJson (ProjectRelativeToDir ".") + qAddDependentFile fp c <- B.readFile fp (Just res) <- pure $ decodeStrict' @Value c pure $ T.unpack $ decUTF8Safe' $ encodePretty res From c057b4ae5c02a6dd58fe0e0720381182b99f4e6a Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:10:18 +0200 Subject: [PATCH 6/9] Improve documentation about building --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 514912e..c796cb2 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Similar in scope to [rustup](https://github.com/rust-lang-nursery/rustup.rs), [p * [Configuration](#configuration) * [Manpages](#manpages) * [Shell-completion](#shell-completion) - * [Cross support](#cross-support) + * [Compiling from sourc](#compiling-from-source) * [XDG support](#xdg-support) * [Env variables](#env-variables) * [Installing custom bindists](#installing-custom-bindists) @@ -109,7 +109,18 @@ as e.g. `/etc/bash_completion.d/ghcup` (depending on distro) and make sure your bashrc sources the startup script (`/usr/share/bash-completion/bash_completion` on some distros). -### Cross support +### Compiling from source + +Compiling from source is supported for both source tarballs and arbitrary git refs. See `ghcup compile ghc --help` +for a list of all available options. + +If you need to overwrite the existing `build.mk`, check the default files +in [data/build_mk](./data/build_mk), copy them somewhere, adjust them and +pass `--config path/to/build.mk` to `ghcup compile ghc`. + +Make sure your system meets all the [prerequisites](https://gitlab.haskell.org/ghc/ghc/-/wikis/building/preparation). + +#### Cross support ghcup can compile and install a cross GHC for any target. However, this requires that the build host has a complete cross toolchain and various From d2346a543a8c07e9499f16adc55e07db0233b1d5 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:27:57 +0200 Subject: [PATCH 7/9] Fixup --- .gitlab-ci.yml | 4 ++-- .gitlab/script/ghcup_bootstrap.sh | 2 +- .gitlab/script/ghcup_cross.sh | 2 +- .gitlab/script/ghcup_git.sh | 2 +- .gitlab/script/ghcup_version.sh | 12 ++++++------ app/ghcup/Main.hs | 11 +++++------ ghcup.cabal | 4 ++++ lib/GHCup.hs | 2 +- lib/GHCup/Utils.hs | 2 +- test/GHCup/Types/JSONSpec.hs | 3 ++- {golden => test/golden}/GHCupInfo.json | 0 11 files changed, 24 insertions(+), 20 deletions(-) rename {golden => test/golden}/GHCupInfo.json (100%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e82552f..5a26055 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,7 +103,7 @@ variables: artifacts: expire_in: 2 week paths: - - golden + - test/golden - dist-newstyle/cache/ when: on_failure @@ -240,7 +240,7 @@ test:linux:bootstrap_script: test:windows:bootstrap_powershell_script: stage: test script: - - ./bootstrap-haskell.ps1 -InstallDir $CI_PROJECT_DIR -BootstrapUrl $CI_PROJECT_DIR/bootstrap-haskell -InBash + - ./scripts/bootstrap/bootstrap-haskell.ps1 -InstallDir $CI_PROJECT_DIR -BootstrapUrl $CI_PROJECT_DIR/bootstrap-haskell -InBash after_script: - "[Environment]::SetEnvironmentVariable('GHCUP_INSTALL_BASE_PREFIX', $null, [System.EnvironmentVariableTarget]::User)" - "[Environment]::SetEnvironmentVariable('GHCUP_MSYS2', $null, [System.EnvironmentVariableTarget]::User)" diff --git a/.gitlab/script/ghcup_bootstrap.sh b/.gitlab/script/ghcup_bootstrap.sh index a1d9978..44e31a1 100755 --- a/.gitlab/script/ghcup_bootstrap.sh +++ b/.gitlab/script/ghcup_bootstrap.sh @@ -24,7 +24,7 @@ export BOOTSTRAP_HASKELL_NONINTERACTIVE=yes export BOOTSTRAP_HASKELL_GHC_VERSION=$GHC_VERSION export BOOTSTRAP_HASKELL_CABAL_VERSION=$CABAL_VERSION -./bootstrap-haskell +./scripts/bootstrap/bootstrap-haskell [ "$(ghc --numeric-version)" = "${GHC_VERSION}" ] diff --git a/.gitlab/script/ghcup_cross.sh b/.gitlab/script/ghcup_cross.sh index e76caac..996fa7d 100755 --- a/.gitlab/script/ghcup_cross.sh +++ b/.gitlab/script/ghcup_cross.sh @@ -13,7 +13,7 @@ ecabal() { } eghcup() { - ghcup -v -c -s file://$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@" + ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@" } git describe --always diff --git a/.gitlab/script/ghcup_git.sh b/.gitlab/script/ghcup_git.sh index 192e70e..38c4c28 100755 --- a/.gitlab/script/ghcup_git.sh +++ b/.gitlab/script/ghcup_git.sh @@ -13,7 +13,7 @@ ecabal() { } eghcup() { - ghcup -v -c -s file://$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@" + ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@" } git describe --always diff --git a/.gitlab/script/ghcup_version.sh b/.gitlab/script/ghcup_version.sh index 1918089..1737a2c 100755 --- a/.gitlab/script/ghcup_version.sh +++ b/.gitlab/script/ghcup_version.sh @@ -18,9 +18,9 @@ raw_eghcup() { eghcup() { if [ "${OS}" = "WINDOWS" ] ; then - ghcup -v -c -s file:/$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@" + ghcup -v -c -s file:/$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@" else - ghcup -v -c -s file://$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml "$@" + ghcup -v -c -s file://$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml "$@" fi } @@ -92,7 +92,7 @@ rm -rf "${GHCUP_DIR}" ### manual cli based testing -ghcup-gen check -f ghcup-${JSON_VERSION}.yaml +ghcup-gen check -f data/metadata/ghcup-${JSON_VERSION}.yaml eghcup --numeric-version @@ -172,10 +172,10 @@ else fi # check that lazy loading works for 'whereis' -cp "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml" "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml.bak" -echo '**' > "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml" +cp "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml.bak" +echo '**' > "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" eghcup whereis ghc $(ghc --numeric-version) -mv -f "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml.bak" "$CI_PROJECT_DIR/ghcup-${JSON_VERSION}.yaml" +mv -f "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml.bak" "$CI_PROJECT_DIR/data/metadata/ghcup-${JSON_VERSION}.yaml" eghcup rm $(ghc --numeric-version) diff --git a/app/ghcup/Main.hs b/app/ghcup/Main.hs index 86a991e..39b2e9a 100644 --- a/app/ghcup/Main.hs +++ b/app/ghcup/Main.hs @@ -1403,15 +1403,14 @@ describe_result = $( LitE . StringL <$> ) plan_json :: String -plan_json = $( LitE . StringL <$> - runIO (handleIO (\_ -> pure "") $ do +plan_json = $( do + (fp, c) <- runIO (handleIO (\_ -> pure ("", "")) $ do fp <- findPlanJson (ProjectRelativeToDir ".") - qAddDependentFile fp c <- B.readFile fp (Just res) <- pure $ decodeStrict' @Value c - pure $ T.unpack $ decUTF8Safe' $ encodePretty res - ) - ) + pure (fp, T.unpack $ decUTF8Safe' $ encodePretty res)) + when (not . null $ fp ) $ qAddDependentFile fp + pure . LitE . StringL $ c) formatConfig :: UserSettings -> String formatConfig settings diff --git a/ghcup.cabal b/ghcup.cabal index 96d186a..bf0b498 100644 --- a/ghcup.cabal +++ b/ghcup.cabal @@ -26,6 +26,10 @@ extra-doc-files: data/metadata/ghcup-0.0.6.yaml data/metadata/ghcup-0.0.7.yaml +extra-source-files: + data/build_mk/default + data/build_mk/cross + source-repository head type: git location: https://gitlab.haskell.org/haskell/ghcup-hs.git diff --git a/lib/GHCup.hs b/lib/GHCup.hs index 72dcb48..3a6f315 100644 --- a/lib/GHCup.hs +++ b/lib/GHCup.hs @@ -1924,7 +1924,7 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had where defaultConf = - let cross_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/cross" >> runIO (readFile "data/build_mk/default"))) + let cross_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/cross" >> runIO (readFile "data/build_mk/cross"))) default_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/default" >> runIO (readFile "data/build_mk/default"))) in case targetGhc of Left (GHCTargetVersion (Just _) _) -> cross_mk diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index c889285..69cb8da 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -1040,7 +1040,7 @@ ensureGlobalTools = do let dl = downloadCached' shimDownload (Just "gs.exe") Nothing void $ (\(DigestError _ _) -> do lift $ logWarn "Digest doesn't match, redownloading gs.exe..." - lift $ logDebug ("rm -f " <> T.pack shimDownload) + lift $ logDebug ("rm -f " <> (cacheDir dirs "gs.exe")) lift $ hideError doesNotExistErrorType $ recycleFile (cacheDir dirs "gs.exe") liftE @'[DigestError , DownloadFailed] $ dl ) `catchE` (liftE @'[DigestError , DownloadFailed] dl) diff --git a/test/GHCup/Types/JSONSpec.hs b/test/GHCup/Types/JSONSpec.hs index 2758bf3..951bfc0 100644 --- a/test/GHCup/Types/JSONSpec.hs +++ b/test/GHCup/Types/JSONSpec.hs @@ -13,4 +13,5 @@ import Test.Hspec spec :: Spec spec = do - roundtripAndGoldenSpecs (Proxy @GHCupInfo) + roundtripAndGoldenSpecsWithSettings (defaultSettings { goldenDirectoryOption = CustomDirectoryName "test/golden" }) (Proxy @GHCupInfo) + diff --git a/golden/GHCupInfo.json b/test/golden/GHCupInfo.json similarity index 100% rename from golden/GHCupInfo.json rename to test/golden/GHCupInfo.json From e5918de7af9f1449d6e245f8cc1953881707ffd7 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 15:59:14 +0200 Subject: [PATCH 8/9] Update README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c796cb2..1c2430b 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,7 @@ for a list of all available options. If you need to overwrite the existing `build.mk`, check the default files in [data/build_mk](./data/build_mk), copy them somewhere, adjust them and pass `--config path/to/build.mk` to `ghcup compile ghc`. +Common `build.mk` options are explained [here](https://gitlab.haskell.org/ghc/ghc/-/wikis/building/using#build-configuration). Make sure your system meets all the [prerequisites](https://gitlab.haskell.org/ghc/ghc/-/wikis/building/preparation). From db8207f8b9c4444dfed836fb74ff358e3ae4d144 Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Sat, 4 Sep 2021 16:06:33 +0200 Subject: [PATCH 9/9] Fixup --- lib/GHCup/Utils.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/GHCup/Utils.hs b/lib/GHCup/Utils.hs index 69cb8da..cc4ea5f 100644 --- a/lib/GHCup/Utils.hs +++ b/lib/GHCup/Utils.hs @@ -1040,7 +1040,7 @@ ensureGlobalTools = do let dl = downloadCached' shimDownload (Just "gs.exe") Nothing void $ (\(DigestError _ _) -> do lift $ logWarn "Digest doesn't match, redownloading gs.exe..." - lift $ logDebug ("rm -f " <> (cacheDir dirs "gs.exe")) + lift $ logDebug ("rm -f " <> T.pack (cacheDir dirs "gs.exe")) lift $ hideError doesNotExistErrorType $ recycleFile (cacheDir dirs "gs.exe") liftE @'[DigestError , DownloadFailed] $ dl ) `catchE` (liftE @'[DigestError , DownloadFailed] dl)