Build Hangar
Hangar is written in Golang.
You can follow the below instructions to build hangar executable binary.
Building in a container
-
Requirements:
- Ensure
docker,curl,makeinstalled. - Hangar only supports Linux & Unix systems.
- Ensure
-
Clone the source code.
git clone https://github.com/hangar.git && cd hangar -
Build hangar in container by executing
makecommands:# Get help informationmake help# Build hangar in containermake build -
The built binary file is available in
bindirectory.
Building without a container
-
Install following build dependencies:
- Golang >=
1.22.2
# Arch Linuxsudo pacman -S base-devel gpgme device-mapper btrfs-progs# Ubuntu/Debiansudo apt install libgpgme-dev libassuan-dev libbtrfs-dev libdevmapper-dev pkg-config gcc# macOSbrew install gpgme# openSUSEsudo zypper install libgpgme-devel device-mapper-devel libbtrfs-devel glib2-devel# Fedorasudo dnf install gpgme-devel libassuan-devel btrfs-progs-devel device-mapper-devel - Golang >=
-
Clone the source code.
git clone https://github.com/hangar.git && cd hangar -
Build hangar by execute build scripts manually:
./scripts/build.sh -
The built binary file is available in the
bindirectory.
Disable CGO
You can add DISABLE_CGO=1 environment variable when building hangar with CGO disabled.
备注
Keep in mind that the resulting binary is unsupported and might crash randomly. Only use if you know what you're doing!