Skip to content

Commit

Permalink
ghcup: add illustration for using cross compilers and vanilla channel (
Browse files Browse the repository at this point in the history
…#270)

* gather new text in one line

* ghcup: split *nix-like and windows installation commands for better copy/paste experience

* ghcup: add illustration for cross compilers and vanilla versions

* ghcup: ghcup to upper case

* ghcup: use definition list and fenced block ot illustrate installation on different platforms

* ghcup: remove trailing spaces

* ghcup: revert trial of definition list

* ghcup: Adjust step 1 text format
  • Loading branch information
Erchiusx authored Dec 27, 2024
1 parent 421c379 commit e4d1b83
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions docs/ghcup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ Stackage 源使用。

**第一步(可选)** :使用科大源安装 GHCup 本体。如已经安装 GHCup,可跳到下一步。

# Linux, FreeBSD, macOS 用户:在终端中运行如下命令
curl --proto '=https' --tlsv1.2 -sSf https://mirrors.ustc.edu.cn/ghcup/sh/bootstrap-haskell | BOOTSTRAP_HASKELL_YAML=https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml sh
Linux, FreeBSD, macOS 用户:在终端中运行如下命令:

# Windows 用户:以非管理员身份在 PowerShell 中运行如下命令
$env:BOOTSTRAP_HASKELL_YAML = 'https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml'
Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://mirrors.ustc.edu.cn/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true
```bash
curl --proto '=https' --tlsv1.2 -sSf https://mirrors.ustc.edu.cn/ghcup/sh/bootstrap-haskell | BOOTSTRAP_HASKELL_YAML=https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml sh
```

Windows 用户:以非管理员身份在 PowerShell 中运行如下命令:

```powershell
$env:BOOTSTRAP_HASKELL_YAML = 'https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml'
Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://mirrors.ustc.edu.cn/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true
```

**第二步** :配置 GHCup 使用科大源。编辑 `~/.ghcup/config.yaml` 增加如下配置:

url-source:
OwnSource: https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml
OwnSource:
- https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml

**第三步(可选)** :配置 Cabal 和 Stack 使用科大源,请参考文档 [hackage](hackage.md)[stackage](stackage.md)

Expand All @@ -46,14 +53,18 @@ Stackage 源使用。
及以上)。如果你使用的 GHCup 版本比较旧,请参考上述步骤安装新版本
GHCup。

## 预发布版本
## 非正式频道

使用预发布频道可以安装尚未正式发布的测试版本。要启用预发布源,将 `~/.ghcup/config.yaml` 文件中 `url-source` 一节修改如下:
Ghcup 提供预发布版本(`prereleases`)、交叉编译版本(`cross`)和基础安装版本(`vanilla`)作为额外频道。要启用这些频道,修改 `~/.ghcup/config.yaml` 中的 `url-source` 节,并依需要添加不同的频道对应的元数据。

url-source:
OwnSource:
- https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-0.0.8.yaml
- https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-prereleases-0.0.8.yaml
- https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-cross-0.0.8.yaml
- https://mirrors.ustc.edu.cn/ghcup/ghcup-metadata/ghcup-vanilla-0.0.8.yaml

关于使用 GHCup 安装交叉编译器的说明,请参考 GHCup User Guide 的 [Cross Support](https://www.haskell.org/ghcup/guide/#cross-support) 章节。

## 相关链接

Expand Down

0 comments on commit e4d1b83

Please sign in to comment.