Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghcup: add illustration for using cross compilers and vanilla channel #270

Merged
merged 14 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading