]> source.dussan.org Git - gitea.git/commitdiff
[Docs] Cross Build Gitea from Source (#10999)
authorBagas Sanjaya <bagasdotme@gmail.com>
Sat, 11 Apr 2020 03:13:31 +0000 (10:13 +0700)
committerGitHub <noreply@github.com>
Sat, 11 Apr 2020 03:13:31 +0000 (00:13 -0300)
* 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>
docs/content/doc/installation/from-source.en-us.md

index 2089a5df391480913fcecf45736d13aa06a397ab..d70e000352b86f2a5d2ea15de2e1449b3643798b 100644 (file)
@@ -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.