--- Makefile.orig	2022-06-02 12:16:33 UTC
+++ Makefile
@@ -1,7 +1,7 @@
 all: build
 
 GO := $(shell which go)
-GOPATH := $(shell "$(GO)" env GOPATH)
+GOPATH := $(CURDIR):$(CURDIR)/vendor
 GODIR := $(shell dirname "$(GO)")
 GOFMT := "$(GODIR)/gofmt"
 GOOS ?= linux
@@ -52,10 +52,8 @@ endif
 hook:
 	[ ! -d "$(CURDIR)/.git/hooks" ] || ln -sf "$(CURDIR)/scripts/pre-commit.hook" "$(CURDIR)/.git/hooks/pre-commit"
 
-$(GOPATHBIN)/easyjson:
-	$(GO) get -u -d github.com/mailru/easyjson/...
-	$(GO) install github.com/mailru/easyjson/...
-
+easyjson:
+	GOPATH=$(GOPATH):$(CURDIR) $(GO) build -o ./bin/easyjson ./vendor/src/github.com/mailru/easyjson/easyjson/main.go
 continentmap.go:
 	$(CURDIR)/scripts/get_continent_map.py $@
 
@@ -91,8 +89,8 @@ coverhtml: vet common
 	sed -i "/_easyjson/d" cover.out && \
 	$(GO) tool cover -html=cover.out -o coverage.html
 
-%_easyjson.go: %.go $(GOPATHBIN)/easyjson
-	PATH="$(GODIR)":$(PATH) "$(GOPATHBIN)/easyjson" -all $*.go
+%_easyjson.go: %.go easyjson
+	PATH="$(GODIR)":$(PATH) ./bin/easyjson -all $(CURDIR)/vendor/src/github.com/strukturag/nextcloud-spreed-signaling/$*.go
 
 common: \
 	api_signaling_easyjson.go \
@@ -100,7 +98,6 @@ common: \
 	api_proxy_easyjson.go \
 	natsclient_easyjson.go \
 	room_easyjson.go
-	$(GO) mod tidy
 
 $(BINDIR):
 	mkdir -p $(BINDIR)
@@ -112,7 +109,7 @@ server: common $(BINDIR)
 	$(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/signaling ./server/...
 
 proxy: common $(BINDIR)
-	$(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/proxy ./proxy/...
+	GOPATH=$(GOPATH):$(CURDIR) GOPATH="$(CURDIR)/vendor" $(GO) build $(BUILDARGS) -ldflags '$(INTERNALLDFLAGS)' -o $(BINDIR)/proxy ./proxy/...
 
 clean:
 	rm -f *_easyjson.go
@@ -126,6 +123,13 @@ tarball:
 		HEAD
 
 dist: tarball
+install:
+	install -d $(DESTDIR)$(PREFIX)/etc/ncs/
+	install -m 644 server.conf.in $(DESTDIR)$(PREFIX)/etc/ncs/server.conf.sample
+	install -m 644 proxy.conf.in $(DESTDIR)$(PREFIX)/etc/ncs/proxy.conf.sample
+	install -m 644 gnatsd.conf $(DESTDIR)$(PREFIX)/etc/ncs/gnatsd.conf.sample
+	install -m 755 bin/signaling $(DESTDIR)$(PREFIX)/bin/ncs-signaling
+	install -m 755 bin/proxy $(DESTDIR)$(PREFIX)/bin/ncs-proxy
 
 .NOTPARALLEL: %_easyjson.go
 .PHONY: continentmap.go
