Skip to content

Commit 5397097

Browse files
PEN²lunny
authored and
Sysoev, Vladimir
committed
Update zh-cn translation for Installation from source (go-gitea#20772)
Co-authored-by: Lunny Xiao <[email protected]>
1 parent 4afd88c commit 5397097

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

docs/content/doc/installation/from-source.zh-cn.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,35 @@ menu:
1515

1616
# 从源代码安装
1717

18-
首先你需要安装Golang,关于Golang的安装,参见官方文档 [install instructions](https://golang.org/doc/install)
18+
首先你需要安装Golang,关于Golang的安装,参见[官方文档](https://golang.google.cn/doc/install)
19+
20+
其次你需要[安装Node.js](https://nodejs.org/zh-cn/download/),Node.js 和 npm 将用于构建 Gitea 前端。
21+
22+
**目录**
23+
24+
{{< toc >}}
1925

2026
## 下载
2127

22-
你需要获取Gitea的源码,最方便的方式是使用 go 命令。执行以下命令:
28+
你需要获取Gitea的源码,最方便的方式是使用 `git` 命令。执行以下命令:
2329

2430
```
25-
go get -d -u code.gitea.io/gitea
26-
cd $GOPATH/src/code.gitea.io/gitea
31+
git clone https://github.com/go-gitea/gitea
32+
cd gitea
2733
```
2834

29-
然后你可以选择编译和安装的版本,当前你有多个选择。如果你想编译 `master` 版本,你可以直接跳到 [编译](#编译) 部分,这是我们的开发分支,虽然也很稳定但不建议您在正式产品中使用。
35+
然后你可以选择编译和安装的版本,当前你有多个选择。如果你想编译 `main` 版本,你可以直接跳到 [编译](#编译) 部分,这是我们的开发分支,虽然也很稳定但不建议您在正式产品中使用。
3036

3137
如果你想编译最新稳定分支,你可以执行以下命令签出源码:
3238

33-
```
39+
```bash
3440
git branch -a
3541
git checkout v{{< version >}}
3642
```
3743

3844
最后,你也可以直接使用标签版本如 `v{{< version >}}`。你可以执行以下命令列出可用的版本并选择某个版本签出:
3945

40-
```
46+
```bash
4147
git tag -l
4248
git checkout v{{< version >}}
4349
```
@@ -46,11 +52,11 @@ git checkout v{{< version >}}
4652

4753
要从源代码进行编译,以下依赖程序必须事先安装好:
4854

49-
- `go` {{< min-go-version >}} 或以上版本, 详见 [here](https://golang.org/dl/)
50-
- `node` {{< min-node-version >}} 或以上版本,并且安装 `npm`, 详见 [here](https://nodejs.org/en/download/)
51-
- `make`, 详见 <a href='{{< relref "make.zh-cn.md" >}}'>这里</a>
55+
- `go` {{< min-go-version >}} 或以上版本, 详见[这里](https://golang.google.cn/doc/install)
56+
- `node` {{< min-node-version >}} 或以上版本,并且安装 `npm`, 详见[这里](https://nodejs.org/zh-cn/download/)
57+
- `make`, 详见[这里]({{< relref "make.zh-cn.md" >}})</a>
5258

53-
各种可用的 [make 任务](https://github.com/go-gitea/gitea/blob/master/Makefile)
59+
各种可用的 [make 任务](https://github.com/go-gitea/gitea/blob/main/Makefile)
5460
可以用来使编译过程更方便。
5561

5662
按照您的编译需求,以下 tags 可以使用:
@@ -76,10 +82,26 @@ TAGS="bindata sqlite sqlite_unlock_notify" make build
7682

7783
在执行了以上步骤之后,你将会获得 `gitea` 的二进制文件,在你复制到部署的机器之前可以先测试一下。在命令行执行完后,你可以 `Ctrl + C` 关掉程序。
7884

79-
```
85+
```bash
8086
./gitea web
8187
```
8288

89+
## 交叉编译
90+
91+
Go 编译器支持交叉编译到不同的目标架构。有关 Go 支持的目标架构列表,请参见 [Optional environment variables](https://go.dev/doc/install/source#environment)
92+
93+
交叉构建适用于 Linux ARM64 的 Gitea:
94+
95+
```bash
96+
GOOS=linux GOARCH=arm64 make build
97+
```
98+
99+
交叉构建适用于 Linux ARM64 的 Gitea,并且带上 Gitea 发行版采用的编译选项:
100+
101+
```bash
102+
CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sqlite_unlock_notify" make build
103+
```
104+
83105
## 需要帮助?
84106

85107
如果从本页中没有找到你需要的内容,请访问 [帮助页面]({{< relref "seek-help.zh-cn.md" >}})

0 commit comments

Comments
 (0)