I recommend looking at what the build script does and reading the documentation. It’s what we use to build the distribution archives that end up on GitHub and so on, so it shows the required setup, build steps and so on. Make sure that you can build Syncthing correctly using the build script before doing anything else. For example, go run build.go tar creates the distribution tar archive for your platform.
But expanding a bit on that;
To build just the “syncthing” binary, you need to 1) create the compiled in assets and 2) build the binary, with automatic upgrades disabled. That becomes two commands:
$ go run script/genassets.go gui
$ go build -i -v -ldflags "-w -X main.Version=v0.13.7+54-gd55850d-protobufs \
-X main.BuildStamp=1466063965 -X main.BuildUser=jb -X main.BuildHost=syno" \
-tags noupgrade ./cmd/syncthing
This requires a correct Go setup with $GOPATH etc. You’ll want to learn about building Go projects in general if you’re doing anything more advanced than just running our build script. You’ll see that we set a number of variables above extracted from the environment. You’ll want to get these right as well, however you determine them.
Just running go run build.go -no-upgrade build is the quickest way to get a correctly built syncthing binary and nothing else.
Mostly. When built natively, it tends to depend on the system C library (glibc on Linux etc). It also requires accessing the system CA bundle to verify HTTPS certificates for things like usage reporting and upgrades (when not disabled).