Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.6 KB

File metadata and controls

49 lines (36 loc) · 1.6 KB

Build Gotify

  1. Setup development environment

  2. Build the UI

    $ (cd ui && yarn build)
  3. Build the Go Binary

    It is recommended to build gotify/server via the gotify/build docker images. This ensures that plugins will be compatible with the built binary because the same build environment is used.

    Set the LD_FLAGS with meta information like the version or the commit:

    $ export LD_FLAGS="-w -s -X main.Version=$(git describe --tags | cut -c 2-) -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD) -X main.Mode=prod";

    Execute gotify/server Makefile tasks to build gotify/server.

    # builds all supported platforms
    $ make build
    # builds a specific platform
    $ make build-linux-amd64
    $ make build-linux-arm-7
    $ make build-linux-arm64
    $ make build-linux-386
    $ make build-linux-riscv64
    $ make build-windows-amd64
    $ make build-windows-386

    If you do not want to use the docker images you can build gotify/server like this:

    $ go build -ldflags="$LD_FLAGS" -o gotify-server

    The project has a CGO reference (because of sqlite3), therefore a CGO cross compiler is needed when compiling for other platforms (the gotify/build docker images already contain the needed cross compilers).

    $ CGO_ENABLED=1 CC=${CROSS_GCC} CXX=${CROSS_G++} GOOS=${TARGET_GOOS} GOARCH=${TARGET_GOARCH} \
        go build -ldflags="$LD_FLAGS" -o gotify-server