mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Use go build instead of go install
go install doesn't like to cross-compile things. (Try running build.sh with GOARCH set to something other than what it "should" be.) With go build, it appears that cross-compilation is really, really straightforward. Simply install a compiler for your target platform and set `GOARCH` and `CC` accordingly.
This commit is contained in:
parent
fdd534f86a
commit
aa2bd39969
11
build.sh
11
build.sh
|
|
@ -17,6 +17,13 @@ else
|
||||||
export FLAGS=""
|
export FLAGS=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
go install -trimpath -ldflags "$FLAGS" -v $PWD/`dirname $0`/cmd/...
|
for pkg in ./cmd/*; do
|
||||||
|
if [[ -d "$pkg" && ! -L "$pkg" ]]; then
|
||||||
|
# https://unix.stackexchange.com/a/94307/125869
|
||||||
|
pkg_x="$(basename -- "$pkg"; echo .)"
|
||||||
|
base="${pkg_x%??}"
|
||||||
|
CGO_ENABLED=1 go build -trimpath -ldflags "$FLAGS" -v -o "./bin/$base" "./cmd/$base"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o bin/main.wasm ./cmd/dendritejs
|
CGO_ENABLED=0 GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o bin/main.wasm ./cmd/dendritejs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue