Storage buckets, indexer names, the bleve analyzer, the lock prefix, SSH host keys, the markdown front-matter key, the container data paths, the RPM repo id and the API security scheme all read as this product now, and app.example.ini matches the code again. The upstream maintainer list and the changelog generator config went with the release history they belonged to, and the citation comments state the fact rather than link the issue. Three inert rules turn out to have been inert because they named a module path this tree does not use: gci grouped no first-party imports under prefix(), and depguard let models/migrations import models and modules/structs. They now name github.com/hanzoai/git. The config example also documented .gitea/workflows while the code has read .hanzo/workflows for some time. The authorized_keys marker follows the delegate-hook precedent: the new name is written and the old one is still recognised, because a marker we do not know is copied through as a hand-added key and leaves a revoked key authorized. The stored user_setting key keeps its value; only a migration may change that. Co-authored-by: Hanzo Dev <[email protected]>
3.6 KiB
Prepare build environment
Complete the steps in build-setup.md to prepare your environment for building Hanzo Forge from source.
Choose a branch
By default, the cloned repository is on main branch (the current development branch for next major release, aka: main nightly).
You can switch to a versioned branch (the branch for the next minor stable release, aka: stable nightly ) or a versioned tag (matches the official releases with version numbers)
To test a Pull Request, you can fetch its code by its Pull Request number (take PR #123456 as example):
git fetch origin pull/123456/head:pr-123456
Build
Various make tasks are provided to keep the build process as simple as possible.
Depending on requirements, the following build tags can be included.
bindata: Build a single monolithic binary, with all assets included. Required for distribution and production build.pam: Enable support for PAM (Linux Pluggable Authentication Modules). Can be used to authenticate local users or extend authentication to methods available to PAM.gogit: (EXPERIMENTAL) Use go-git variants of Git commands.
To include all assets, use the bindata tag:
TAGS="bindata" make build
Tag gogit is used to try to resolve some Windows-specific performance problems, POSIX systems don't need it.
You can build a Windows binary by:
GOOS=windows TAGS="bindata gogit" make build
Changing default paths
Hanzo Forge will search for a number of things from the CustomPath.
By default, this is the custom/ directory in the current working directory when running it.
It will also look for its configuration file CustomConf in $(CustomPath)/conf/app.ini,
and will use the current working directory as the relative base path AppWorkPath.
These values, although useful when developing, may conflict with downstream users preferences.
For packagers who need to use paths like /etc/forge/app.ini,
they should define these values at build time for make build by environment variable like
LDFLAGS='-X "module.Var1=Value1" -X "module.Var2=Value2"' TAGS="bindata" make build.
CustomConf:-X "github.com/hanzoai/git/modules/setting.CustomConf=/etc/forge/app.ini"AppWorkPath:-X "github.com/hanzoai/git/modules/setting.AppWorkPath=/var/lib/forge"CustomPath:-X "github.com/hanzoai/git/modules/setting.CustomPath=/var/lib/forge/custom"- Default PID file location:
-X "github.com/hanzoai/git/cmd.PIDFile=/run/gitd.pid"
Add as many of the strings with their preceding -X to the LDFLAGS variable and run make build
with the appropriate TAGS as above.
Running gitd help will allow you to review what the computed settings will be for your build.
Cross Build
Hanzo Forge use's Golang's toolchain variables for cross-building.
For example, to cross build for Linux ARM64:
GOOS=linux GOARCH=arm64 TAGS="bindata" make build
Adding shell autocompletion
Shell completion can be generated directly from binary with:
gitd completion <shell>
Supported values for <shell> are bash, fish, pwsh and zsh.
Details on how to load the completion for your shell can be found in the completion command help.
Source Maps
By default, Hanzo Forge generates reduced source maps for frontend files to conserve space. This can be controlled with the ENABLE_SOURCEMAP environment variable:
ENABLE_SOURCEMAP=truegenerates all source maps, the default for development buildsENABLE_SOURCEMAP=reducedgenerates limited source maps, the default for production buildsENABLE_SOURCEMAP=falsegenerates no source maps