forked from cointop-sh/cointop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
297 lines (212 loc) · 7.38 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
VERSION = $$(git describe --abbrev=0 --tags)
COMMIT_TAG = $$(git tag --points-at HEAD)
VERSION_DATE = $$(git log -1 --pretty='%ad' --date=format:'%Y-%m-%d' $(VERSION))
COMMIT_REV = $$(git rev-list -n 1 $(VERSION))
MAINTAINER = "Miguel Mota"
all: build
version:
@echo $(VERSION)
commit_rev:
@echo $(COMMIT_REV)
start:
go run main.go
deps-clean:
go clean -modcache
rm -rf vendor
deps-download:
GO111MODULE=on go mod download
GO111MODULE=on go mod vendor
deps: deps-clean deps-download
vendor: deps
debug:
DEBUG=1 go run main.go
.PHONY: build
build:
go build -ldflags "-X github.com/cointop-sh/cointop/cointop.version=$(VERSION)" -o bin/cointop main.go
# http://macappstore.org/upx
build-mac: clean-mac
env GOARCH=amd64 go build -ldflags "-s -w -X github.com/cointop-sh/cointop/cointop.version=$(VERSION)" -o bin/macos/cointop && upx bin/macos/cointop
build-linux: clean-linux
env GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X github.com/cointop-sh/cointop/cointop.version=$(VERSION)" -o bin/linux/cointop && upx bin/linux/cointop
build-multiple: clean
env GOARCH=amd64 go build -ldflags "-s -w -X github.com/cointop-sh/cointop/cointop.version=$(VERSION)" -o bin/cointop64 && upx bin/cointop64 && \
env GOARCH=386 go build -ldflags "-s -w -X github.com/cointop-sh/cointop/cointop.version=$(VERSION)" -o bin/cointop32 && upx bin/cointop32
install: build
sudo mv bin/cointop /usr/local/bin
uninstall:
sudo rm /usr/local/bin/cointop
clean-mac:
go clean && \
rm -rf bin/mac
clean-linux:
go clean && \
rm -rf bin/linux
clean:
go clean && \
rm -rf bin/
.PHONY: docs
docs:
(cd docs && hugo)
docs-server:
(cd docs && hugo serve -p 8080)
docs-deploy: docs
netlify deploy --prod
docs-open:
xdg-open "http://localhost:8080"
test:
go test ./...
cointop-test:
go run main.go -test
cointop-version:
go run main.go -version
cointop-clean:
go run main.go -clean
cointop-reset:
go run main.go -reset
snap-clean:
snapcraft clean
rm -f cointop_*.snap
rm -f cointop_*.tar.bz2
snap-stage:
# https://github.com/elopio/go/issues/2
mv go.mod go.mod~ ;GO111MODULE=off GOFLAGS="-ldflags=-s -ldflags=-w -ldflags=-X=github.com/cointop-sh/cointop/cointop.version=$(VERSION)" snapcraft stage; mv go.mod~ go.mod
snap-install:
sudo apt install snapd
sudo snap install snapcraft --classic
sudo snap install core20
snap-install-arch:
yay -S snapd
sudo snap install snapcraft --classic
sudo ln -s /var/lib/snapd/snap /snap # enable classic snap support
sudo snap install hello-world
snap-install-local:
sudo snap install --dangerous cointop_master_amd64.snap
snap-build: snap-clean snap-stage
snapcraft snap
snap-deploy:
snapcraft push cointop_*.snap --release stable
snap-remove:
snap remove cointop
snap-build-and-deploy: snap-build snap-deploy snap-clean
@echo "done"
snap: snap-build-and-deploy
flatpak-build:
flatpak-builder --force-clean build-dir com.github.miguelmota.Cointop.json
flatpak-run-test:
flatpak-builder --run build-dir com.github.miguelmota.Cointop.json cointop
flatpak-repo:
flatpak-builder --repo=repo --force-clean build-dir com.github.miguelmota.Cointop.json
flatpak-add-repo:
flatpak --user remote-add --no-gpg-verify cointop-repo repo
flatpak-add-flathub:
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak-remove:
flatpak --user remote-delete cointop-repo
flatpak-install:
flatpak --user install cointop-repo com.github.miguelmota.Cointop
flatpak-install-local:
flatpak-builder --force-clean --install --install-deps-from=flathub --user build-dir com.github.miguelmota.Cointop.json
flatpak-run:
flatpak run com.github.miguelmota.Cointop
flatpak-update-version:
xmlstarlet ed --inplace -u '/component/releases/release/@version' -v $(VERSION) .flathub/com.github.miguelmota.Cointop.appdata.xml
xmlstarlet ed --inplace -u '/component/releases/release/@date' -v $(VERSION_DATE) .flathub/com.github.miguelmota.Cointop.appdata.xml
rpm-install-deps:
sudo dnf install -y rpm-build
sudo dnf install -y dnf-plugins-core
rpm-cp-specs:
cp .rpm/cointop.spec ~/rpmbuild/SPECS/
rpm-build:
rpmbuild --nodeps -ba ~/rpmbuild/SPECS/cointop.spec
rpm-lint:
rpmlint ~/rpmbuild/SPECS/cointop.spec
rpm-dirs:
mkdir -p ~/rpmbuild
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
chmod -R a+rwx ~/rpmbuild
rpm-download:
wget https://github.com/cointop-sh/cointop/archive/$(VERSION).tar.gz -O ~/rpmbuild/SOURCES/$(VERSION).tar.gz
copr-install-cli:
sudo dnf install -y copr-cli
copr-deps: copr-install-cli rpm-install-deps
copr-create-project:
copr-cli create cointop --chroot fedora-rawhide-x86_64
copr-build:
copr-cli build cointop ~/rpmbuild/SRPMS/cointop-*.rpm
rm -rf ~/rpmbuild/SRPMS/cointop-*.rpm
.PHONY: copr
copr: rpm-dirs rpm-cp-specs rpm-download rpm-build copr-build
brew-clean: brew-remove
brew cleanup --force cointop
brew prune
brew-remove:
brew uninstall --force cointop
brew-build: brew-remove
brew install --build-from-source cointop.rb
brew-audit:
brew audit --strict cointop.rb
brew-test:
brew test cointop.rb
brew-tap:
brew tap cointop/cointop https://github.com/cointop-sh/cointop
brew-untap:
brew untap cointop/cointop
git-rm-large:
java -jar bfg.jar --strip-blobs-bigger-than 200K .
git-repack:
git reflog expire --expire=now --all
git fsck --full --unreachable
git repack -A -d
git gc --aggressive --prune=now
release:
rm -rf dist
VERSION=$(VERSION) goreleaser
docker-login:
docker login
docker-login-ci:
docker login -u $(DOCKER_USER) -p $(DOCKER_PASS)
docker-build:
docker build --build-arg VERSION=$(VERSION) --build-arg MAINTAINER=$(MAINTAINER) -t cointop/cointop .
docker-tag:
docker tag cointop/cointop:latest cointop/cointop:$(VERSION)
docker-tag-ci:
docker tag cointop/cointop:latest cointop/cointop:$(CIRCLE_SHA1)
docker tag cointop/cointop:latest cointop/cointop:$(CIRCLE_BRANCH)
test $(COMMIT_TAG) && docker tag cointop/cointop:latest cointop/cointop:$(COMMIT_TAG); true
docker-run:
docker run -it cointop/cointop
docker-push:
docker push cointop/cointop:$(VERSION)
docker push cointop/cointop:latest
docker-push-ci:
docker push cointop/cointop:$(CIRCLE_SHA1)
docker push cointop/cointop:$(CIRCLE_BRANCH)
test $(COMMIT_TAG) && docker push cointop/cointop:$(COMMIT_TAG); true
test $(CIRCLE_BRANCH) == "master" && docker push cointop/cointop:latest; true
docker-build-and-push: docker-build docker-tag docker-push
docker-run-ssh:
docker run -p 2222:22 -v ~/.ssh/demo:/keys -v ~/.cache/cointop:/tmp/cointop_config --entrypoint cointop -it cointop/cointop server -k /keys/id_rsa
ssh-server:
go run cmd/cointop/cointop.go server -p 2222 -k ~/.ssh/demo/id_rsa
ssh-client:
ssh localhost -p 2222
mp3:
cat <(printf "package notifier\nfunc Mp3() string {\nreturn \`" "") <(xxd -p media/notification.mp3 | tr -d "\n") <(printf "\`\n}" "") > pkg/notifier/mp3.go
pkg2appimage-install:
wget -c https://github.com/$(wget -q https://github.com/AppImage/pkg2appimage/releases -O - | grep "pkg2appimage-.*-x86_64.AppImage" | head -n 1 | cut -d '"' -f 2)
chmod +x pkg2appimage-*.AppImage
appimage-clean-workspace:
rm -rf .appimage_workspace
appimage-clean: appimage-clean-workspace
rm -rf *.AppImage
.PHONY: appimage
appimage: appimage-clean-workspace
( \
mkdir -p .appimage_workspace && \
mkdir -p dist/appimage && \
cd .appimage_workspace && \
../pkg2appimage-*.AppImage ../.appimage/cointop.yml && \
cp out/cointop-*.AppImage ../dist/appimage/ \
)
appimage-run:
./dist/appimage/cointop-*.AppImage