-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
eternal-flame-AD
committed
Mar 2, 2019
1 parent
eb7cb60
commit 4c7ecaa
Showing
2 changed files
with
21 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,34 @@ | ||
BUILDDIR=./build | ||
GOTIFY_VERSION=master | ||
PLUGIN_NAME=broadcasts | ||
LICENSE_DIR=./OPENSOURCELICENSE | ||
PLUGIN_ENTRY=plugin.go | ||
GO_VERSION=`cat $(BUILDDIR)/gotify-server-go-version` | ||
|
||
download-tools: | ||
GO111MODULE=off go get -u github.com/gotify/plugin-api/cmd/gomod-cap | ||
|
||
create-build-dir: | ||
mkdir -p ${BUILDDIR} || true | ||
|
||
check-go: | ||
go test ./... | ||
|
||
update-go-mod: create-build-dir | ||
wget -LO ${BUILDDIR}/gotify-server.mod https://raw.githubusercontent.com/gotify/server/${GOTIFY_VERSION}/go.mod | ||
gomod-cap -from ${BUILDDIR}/gotify-server.mod -to go.mod | ||
rm ${BUILDDIR}/gotify-server.mod || true | ||
go mod tidy | ||
|
||
check-go-mod: create-build-dir | ||
wget -LO ${BUILDDIR}/gotify-server.mod https://raw.githubusercontent.com/gotify/server/${GOTIFY_VERSION}/go.mod | ||
gomod-cap -from ${BUILDDIR}/gotify-server.mod -to go.mod -check=true | ||
rm ${BUILDDIR}/gotify-server.mod || true | ||
get-gotify-server-go-version: create-build-dir | ||
rm ${BUILDDIR}/gotify-server-go-version || true | ||
wget -LO ${BUILDDIR}/gotify-server-go-version https://raw.githubusercontent.com/gotify/server/${GOTIFY_VERSION}/GO_VERSION | ||
|
||
build: create-build-dir update-go-mod | ||
CGO_ENABLED=1 go build -o build/${PLUGIN_NAME}-$$(go env -json | jq -r ".GOOS")-$$(go env -json | jq -r ".GOARCH")${GOARM}-for-gotify-${GOTIFY_VERSION}.so -buildmode=plugin | ||
build-linux-amd64: get-gotify-server-go-version update-go-mod | ||
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-amd64 go build -a -installsuffix cgo -ldflags "-w -s" -buildmode=plugin -o build/${PLUGIN_NAME}-linux-amd64${FILE_SUFFIX}.so /proj | ||
|
||
extract-licenses: | ||
go mod vendor | ||
mkdir ${LICENSE_DIR} || true | ||
for LICENSE in $(shell find vendor/* -name LICENSE); do \ | ||
DIR=`echo $$LICENSE | tr "/" _ | sed -e 's/vendor_//; s/_LICENSE//'` ; \ | ||
cp $$LICENSE ${LICENSE_DIR}/$$DIR ; \ | ||
done | ||
build-linux-arm-7: get-gotify-server-go-version update-go-mod | ||
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm-7 go build -a -installsuffix cgo -ldflags "-w -s" -buildmode=plugin -o build/${PLUGIN_NAME}-linux-arm-7${FILE_SUFFIX}.so /proj | ||
|
||
build-linux-arm64: get-gotify-server-go-version update-go-mod | ||
docker run --rm -v "$$PWD/.:/proj" -w /proj gotify/build:$(GO_VERSION)-linux-arm64 go build -a -installsuffix cgo -ldflags "-w -s" -buildmode=plugin -o build/${PLUGIN_NAME}-linux-arm64${FILE_SUFFIX}.so /proj | ||
|
||
check: check-go check-go-mod | ||
build: build-linux-arm-7 build-linux-amd64 build-linux-arm64 | ||
|
||
.PHONY: build download-tools check-go check-go-mod update-go-mod | ||
.PHONY: build |