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

Update from-source.zh-cn.md & from-source.en-us.md - Cross Compile Using Zig #25194

Merged
merged 14 commits into from
Jun 13, 2023
Merged

Update from-source.zh-cn.md & from-source.en-us.md - Cross Compile Using Zig #25194

merged 14 commits into from
Jun 13, 2023

Conversation

editfund-founder
Copy link
Contributor

Compile & Cross Compile Gitea With CGO Dependencies Using Zig

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 10, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 10, 2023
@editfund-founder
Copy link
Contributor Author

editfund-founder commented Jun 10, 2023

Install cc

¹which cc
Not available

²Install cc

$ gcc
Command 'gcc' not found, but can be installed with:
sudo apt install pentium-builder
sudo apt install gcc            
mx@ef:~/3rd-dev/gitea-npm--1.19.3
$ sudo apt install gcc
[sudo] mx 的密码:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
正在读取状态信息... 完成                 
建议安装:
  gcc-multilib autoconf automake libtool flex bison gdb gcc-doc
下列【新】软件包将被安装:
  gcc
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 212 个软件包未被升级。
需要下载 5,192 B 的归档。
解压缩后会消耗 46.1 kB 的额外空间。
获取:1 https://deb.debian.org/debian bullseye/main amd64 gcc amd64 4:10.2.1-1 [5,192 B]
已下载 5,192 B,耗时 6秒 (882 B/s)
正在选中未选择的软件包 gcc。
(正在读取数据库 ... 系统当前共安装有 297827 个文件和目录。)
准备解压 .../gcc_4%3a10.2.1-1_amd64.deb  ...
正在解压 gcc (4:10.2.1-1) ...
正在设置 gcc (4:10.2.1-1) ...
正在处理用于 man-db (2.9.4-2) 的触发器 ...
mx@ef:~/3rd-dev/gitea-npm--1.19.3
$ 

³which cc

mx@ef:~/3rd-dev/gitea-npm--1.19.3
$ which cc
/usr/bin/cc
mx@ef:~/3rd-dev/gitea-npm--1.19.3
$ which gcc
/usr/bin/gcc
mx@ef:~/3rd-dev/gitea-npm--1.19.3
$ 

@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 11, 2023
@editfund-founder editfund-founder changed the title Update from-source.zh-cn.md Update from-source.zh-cn.md & from-source.en-us.md - Cross Compile Using Zig Jun 11, 2023
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 11, 2023
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits including:

  • The version like "0.10.1" should be general but not hard-coded.
  • The "mingw/make" part could share a general document
  • The Linux steps and Windows steps are pretty similar
  • ❓ I don't have time to test it myself, if there is any exception, welcome to fix it it should be removed

Meanwhile it's not bad to have such "zig cross compile" being document.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 12, 2023
Copy link
Member

@wolfogre wolfogre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR, it's awesome to complie Gitea with zig. And I have some suggestions about tone.

@@ -1,5 +1,5 @@
---
date: "2016-12-01T16:00:00+02:00"
date: "2023-06-11T16:00:00+02:00"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the time of creation, not the time of update.

Comment on lines 212 to 222
- Download: https://ziglang.org/download/
- To install:
```sh
sudo rm -rf /usr/local/zig && tar -C /usr/local -xf zig-linux-x86_64-0.10.1.tar.xz
```
- Environment variable: `export PATH=$PATH:/usr/local/zig-linux-x86_64-0.10.1/`
- Install cc
```
sudo apt install gcc
which cc
```
Copy link
Member

@wolfogre wolfogre Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

Suggested change
- Download: https://ziglang.org/download/
- To install:
```sh
sudo rm -rf /usr/local/zig && tar -C /usr/local -xf zig-linux-x86_64-0.10.1.tar.xz
```
- Environment variable: `export PATH=$PATH:/usr/local/zig-linux-x86_64-0.10.1/`
- Install cc
```
sudo apt install gcc
which cc
```
Follow [Getting Started of Zig](https://ziglang.org/learn/getting-started/#installing-zig) to install zig.

is enough?

I don't think it's appropriate to introduce too much about "how to install zig" into Gitea's documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💕Thanks

TAGS="bindata sqlite sqlite_unlock_notify" \
make build
```
❓ I don't have time to test it myself, if there is any exception, welcome to fix it
Copy link
Member

@wolfogre wolfogre Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I don't think they are appropriate:

✅Proven success
✅Proven success (Gitea version 1.20.0-rc0,compiled 96.4M, select SQLite3 can be installed normally)
❓ I don't have time to test it myself, if there is any exception, welcome to fix it

It doesn't look like the official documentation for Gitea, it looks like a personal article ”How to compile Gitea with zig“. How about removing them? If someone get a exception, they will submit an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💕I love the community, I love you.

Comment on lines 253 to 266
To install zig:
- Download: https://ziglang.org/download/
- Decompress and set environment variables


Make `GIT BASH` support make:
- Go to https://sourceforge.net/projects/ezwinports/files/ and download `make-4.4.1-without-guile-w32-bin.zip`
- Decompress the file
- Copy all the extracted files to the git installation directory: . \Program Files\Git\mingw64\, merge the folders, and choose not to replace the files that pop up if they need to be replaced.
- So that you can execute make in the git bash window (the compiler still needs to be installed separately when compiling)

To make `GIT BASH` support make (second method):
- Download: [https://github.com/niXman/mingw-builds-binaries](https://github.com/niXman/mingw-builds-binaries)
- Copy mingw32-make.exe to `C:\Program Files\Git\mingw64\bin`, renamed make.exe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💕Thanks

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Jun 12, 2023

ps: I would improve the documents for development and building later, so these nits could be fixed later (my comment: #25194 (review))


The real block is that this PR fails the lint 😂

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. labels Jun 12, 2023
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
@wolfogre wolfogre added the type/docs This PR mainly updates/creates documentation label Jun 13, 2023
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 13, 2023
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.en-us.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
docs/content/doc/installation/from-source.zh-cn.md Outdated Show resolved Hide resolved
@wolfogre wolfogre added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 13, 2023
@lunny lunny merged commit 139704f into go-gitea:main Jun 13, 2023
20 checks passed
@GiteaBot GiteaBot added this to the 1.21.0 milestone Jun 13, 2023
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 13, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/docs This PR mainly updates/creates documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants