diff options
author | Bagas Sanjaya <bagasdotme@gmail.com> | 2020-04-11 10:13:31 +0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 00:13:31 -0300 |
commit | 8592fb7121874f7998e0df10c3c7e6777eb78033 (patch) | |
tree | 4e0bdee387c0bba45353ab3a2ba8e9cafb3d6ba4 /docs | |
parent | 0dadea19bcc469937d0b2376db031a46cfcfb742 (diff) | |
download | gitea-8592fb7121874f7998e0df10c3c7e6777eb78033.tar.gz gitea-8592fb7121874f7998e0df10c3c7e6777eb78033.zip |
[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 <info@mrsdizzie.com>
* Apply suggestion from @guillep2k
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/doc/installation/from-source.en-us.md | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/content/doc/installation/from-source.en-us.md b/docs/content/doc/installation/from-source.en-us.md index 2089a5df39..d70e000352 100644 --- a/docs/content/doc/installation/from-source.en-us.md +++ b/docs/content/doc/installation/from-source.en-us.md @@ -157,3 +157,23 @@ Add as many of the strings with their preceding `-X` to the `LDFLAGS` variable a with the appropriate `TAGS` as above. Running `gitea help` will allow you to review what the computed settings will be for your `gitea`. + +## Cross Build + +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). + +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). + +Cross-build Gitea for Linux ARM64, without any tags: + +``` +GOOS=linux GOARCH=arm64 make build +``` + +Cross-build Gitea for Linux ARM64, with recommended build tags: + +``` +CC=aarch64-unknown-linux-gnu-gcc GOOS=linux GOARCH=arm64 TAGS="bindata sqlite sqlite_unlock_notify" make build +``` + +Replace `CC`, `GOOS`, and `GOARCH` as appropriate for your architecture target. |