forked from chapar-rest/chapar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
103 lines (91 loc) · 3.08 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
TAG_NAME?=$(shell git describe --tags)
APP_NAME="Chapar"
.PHONY: build_macos_app
build_macos_app:
@echo "Building Macos..."
gogio -appid=rest.chapar.app -icon=./build/appicon.png -target=macos -arch=amd64 -o ./dist/amd64/Chapar.app .
gogio -appid=rest.chapar.app -icon=./build/appicon.png -target=macos -arch=arm64 -o ./dist/arm64/Chapar.app .
codesign --force --deep --sign - ./dist/amd64/Chapar.app
codesign --force --deep --sign - ./dist/arm64/Chapar.app
.PHONY: build_macos
build_macos: build_macos_app
@echo "Building Macos..."
tar -cJf ./dist/Chapar_macos_amd64.tar.xz --directory=./dist/amd64 Chapar.app
tar -cJf ./dist/Chapar_macos_arm64.tar.xz --directory=./dist/arm64 Chapar.app
rm -rf ./dist/amd64
rm -rf ./dist/arm64
.PHONY: build_macos_dmg
build_macos_dmg: build_macos_app
@echo "Building Macos DMG..."
rm -rf ./dist/chapar-macos-$(TAG_NAME)-amd64.dmg
rm -rf ./dist/chapar-macos-$(TAG_NAME)-arm64.dmg
create-dmg \
--volname "Chapar Installer" \
--volicon "./build/appicon.icns" \
--background "./build/chapar-installer-bk.png" \
--window-pos 300 300 \
--window-size 500 350 \
--icon-size 100 \
--icon "Chapar.app" 125 150 \
--hide-extension "Chapar.app" \
--app-drop-link 375 150 \
"./dist/chapar-macos-$(TAG_NAME)-arm64.dmg" \
"./dist/arm64/Chapar.app"
create-dmg \
--volname "Chapar Installer" \
--volicon "./build/appicon.icns" \
--background "./build/chapar-installer-bk.png" \
--window-pos 300 300 \
--window-size 500 350 \
--icon-size 100 \
--icon "Chapar.app" 125 150 \
--hide-extension "Chapar.app" \
--app-drop-link 375 150 \
"./dist/chapar-macos-$(TAG_NAME)-amd64.dmg" \
"./dist/amd64/Chapar.app"
.PHONY: build_windows
build_windows:
@echo "Building Windows..."
cp build\appicon.png .
gogio -target=windows -arch=amd64 -o dist\amd64\Chapar.exe .
gogio -target=windows -arch=386 -o dist\i386\Chapar.exe .
rm *.syso
powershell -Command "Compress-Archive -Path dist\amd64\Chapar.exe -Destination dist\chapar-windows-$(TAG_NAME)-amd64.zip"
powershell -Command "Compress-Archive -Path dist\i386\Chapar.exe -Destination dist\chapar-windows-$(TAG_NAME)-i386.zip"
rm -rf .\dist\amd64
rm -rf .\dist\i386
.PHONY: build_linux
build_linux:
@echo "Building Linux amd64..."
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./dist/amd64/chapar .
cp ./build/install-linux.sh ./dist/amd64
cp ./build/appicon.png ./dist/amd64
cp ./LICENSE ./dist/amd64
cp -r ./build/desktop-assets ./dist/amd64
tar -cJf ./dist/chapar-linux-$(TAG_NAME)-amd64.tar.xz --directory=./dist/amd64 chapar desktop-assets install-linux.sh appicon.png ./LICENSE
rm -rf ./dist/amd64
.PHONY: run
run:
@echo "Running..."
go run .
.PHONY: clean
clean:
@echo "Cleaning..."
rm -rf ./Chapar.app
.PHONY: install_deps
install_deps:
go install gioui.org/cmd/gogio@latest
.PHONY: lint
lint:
docker run --rm \
-e CGO_ENABLED=1 \
-v $(PWD):/app \
-w /app chapar/builder:0.1.3 \
golangci-lint -c .golangci-lint.yaml run --timeout 5m
.PHONY: test
test:
docker run --rm \
-e CGO_ENABLED=1 \
-v $(PWD):/app \
-w /app chapar/builder:0.1.3 \
go test -v ./...