Skip to content

Commit 8592fb7

Browse files
bagasmelunnymrsdizzieguillep2kjolheiser
authored
[Docs] Cross Build Gitea from Source (#10999)
* Add cross-build docs Note that C cross compiler is required for building Gitea with `TAGS`. * Apply suggestion from @mrsdizzie Co-Authored-By: mrsdizzie <[email protected]> * Apply suggestion from @guillep2k Co-Authored-By: guillep2k <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: mrsdizzie <[email protected]> Co-authored-by: guillep2k <[email protected]> Co-authored-by: John Olheiser <[email protected]>
1 parent 0dadea1 commit 8592fb7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/content/doc/installation/from-source.en-us.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,23 @@ Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable a
157157
with the appropriate `TAGS` as above.
158158

159159
Running `gitea help` will allow you to review what the computed settings will be for your `gitea`.
160+
161+
## Cross Build
162+
163+
The `go` compiler toolchain supports cross-compiling to different architecture targets that are supported by the toolchain. See [`GOOS` and `GOARCH` environment variable](https://golang.org/doc/install/source#environment) for the list of supported targets. Cross compilation is helpful if you want to build Gitea for less-powerful systems (such as Raspberry Pi).
164+
165+
To cross build Gitea with build tags (`TAGS`), you also need a C cross compiler which targets the same architecture as selected by the `GOOS` and `GOARCH` variables. For example, to cross build for Linux ARM64 (`GOOS=linux` and `GOARCH=arm64`), you need the `aarch64-unknown-linux-gnu-gcc` cross compiler. This is required because Gitea build tags uses `cgo`'s foreign-function interface (FFI).
166+
167+
Cross-build Gitea for Linux ARM64, without any tags:
168+
169+
```
170+
GOOS=linux GOARCH=arm64 make build
171+
```
172+
173+
Cross-build Gitea for Linux ARM64, with recommended build tags:
174+
175+
```
176+
CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sqlite_unlock_notify" make build
177+
```
178+
179+
Replace `CC`, `GOOS`, and `GOARCH` as appropriate for your architecture target.

0 commit comments

Comments
 (0)