-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
Makefile
106 lines (94 loc) · 3.57 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
TAG_NAME?=$(shell git describe --tags --abbrev=0)
APP_NAME="Chapar"
.PHONY: build_macos_app
build_macos_app:
@echo "Building Macos..."
gogio -ldflags="-X main.serviceVersion=$(TAG_NAME)" -appid=rest.chapar.app -icon=./build/appicon.png -target=macos -arch=amd64 -o ./dist/amd64/Chapar.app .
gogio -ldflags="-X main.serviceVersion=$(TAG_NAME)" -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 -ldflags="-X main.serviceVersion=${TAG_NAME}" -target=windows -arch=amd64 -o "dist\amd64\Chapar.exe" .
gogio -ldflags="-X main.serviceVersion=${TAG_NAME}" -target=windows -arch=386 -o "dist\i386\Chapar.exe" .
gogio -ldflags="-X main.serviceVersion=${TAG_NAME}" -target=windows -arch=arm64 -o "dist\arm64\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"
powershell -Command "Compress-Archive -Path dist\arm64\Chapar.exe -Destination dist\chapar-windows-${TAG_NAME}-arm64.zip"
rm -rf .\dist\amd64
rm -rf .\dist\i386
rm -rf .\dist\arm64
.PHONY: build_linux
build_linux:
@echo "Building Linux amd64..."
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags="-X main.serviceVersion=$(TAG_NAME)" -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 ./...