aboutsummaryrefslogtreecommitdiff
path: root/build.sh
blob: f790077e37ee7bf5780b5460e2103860e3d4b2fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash -eu

# Put installed packages into ./bin
export GOBIN=$PWD/`dirname $0`/bin

if [ -d ".git" ] 
then
    export BUILD=`git rev-parse --short HEAD || ""`
    export BRANCH=`(git symbolic-ref --short HEAD | tr -d \/ ) || ""`
    [[ $BRANCH == "master" ]] && export BRANCH=""

    export FLAGS="-X github.com/matrix-org/dendrite/internal.branch=$BRANCH -X github.com/matrix-org/dendrite/internal.build=$BUILD"
else
    export FLAGS=""
fi

go install -trimpath -ldflags "$FLAGS" -v $PWD/`dirname $0`/cmd/...

GOOS=js GOARCH=wasm go build -trimpath -ldflags "$FLAGS" -o main.wasm ./cmd/dendritejs