-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
176 lines (134 loc) · 8.03 KB
/
Copy pathmakefile
File metadata and controls
176 lines (134 loc) · 8.03 KB
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
.PHONY: run generate frontend \
build build-linux build-windows build-macos \
build-windows-amd64 build-windows-arm64 \
build-linux-amd64 build-linux-arm64 \
clean dev test ci icons icons-check icons-propagate
# ─────────────────────────────────────────────
# Development
# ─────────────────────────────────────────────
run:
wails dev -tags webkit2_41
dev:
wails dev -tags webkit2_41 --browser
# Generate Wails bindings
generate:
wails generate module
g: generate
# ─────────────────────────────────────────────
# Frontend
# ─────────────────────────────────────────────
frontend:
cd frontend && npm run build
# ─────────────────────────────────────────────
# Linux
# ─────────────────────────────────────────────
build-linux: frontend
wails build -platform linux/amd64 -tags webkit2_41
build-linux-amd64: frontend
wails build -platform linux/amd64 -tags webkit2_41
build-linux-arm64: frontend
wails build -platform linux/arm64 -tags webkit2_41
# ─────────────────────────────────────────────
# Windows
# ─────────────────────────────────────────────
build-windows: frontend
wails build -platform windows/amd64 && \
rm -rf /home/clancy/share/fireburger && \
mkdir -p /home/clancy/share/fireburger && \
cp build/bin/FireBurger.exe /home/clancy/share/fireburger/ && \
cp -a DB /home/clancy/share/fireburger/ && \
cd /home/clancy/share && \
rm -f FireBurger.zip && \
zip -r FireBurger.zip fireburger/
build-win32: frontend
wails build -platform windows/386 && \
rm -rf /home/clancy/share/fireburger && \
mkdir -p /home/clancy/share/fireburger && \
cp build/bin/FireBurger.exe /home/clancy/share/fireburger/ && \
cp -a DB /home/clancy/share/fireburger/ && \
cd /home/clancy/share && \
rm -f FireBurger.zip && \
zip -r FireBurger.zip fireburger/
build-windows-amd64: frontend
wails build -platform windows/amd64
build-windows-arm64: frontend
wails build -platform windows/arm64
# ─────────────────────────────────────────────
# macOS
# ─────────────────────────────────────────────
build-macos: frontend
wails build -platform darwin/amd64
build-macos-amd64: frontend
wails build -platform darwin/amd64
build-macos-arm64: frontend
wails build -platform darwin/arm64
# ─────────────────────────────────────────────
# Default build
# ─────────────────────────────────────────────
build: build-linux
sudo cp ./build/bin/sqlancy /usr/local/bin/sqlancy
# ─────────────────────────────────────────────
# Cleanup
# ─────────────────────────────────────────────
clean:
rm -rf build/bin
rm -rf frontend/dist
lint:
cd frontend && npx tsc --noEmit
test:
go test -v ./...
VERSION ?= $(shell git describe --tags --abbrev=0 2>/dev/null || echo v0.0.0)
VERSION_NUM := $(patsubst v%,%,$(VERSION))
DIST := dist
WEBKIT_TAG ?= $(shell pkg-config --exists webkit2gtk-4.1 2>/dev/null && echo webkit2_41 || echo webkit2_40)
# Icon: master is build/appicon.png (1024x1024 PNG). Wails generates
# build/windows/icon.ico and build/darwin/iconfile.icns from it if missing.
icons-check:
@test -f build/appicon.png || (echo "Missing build/appicon.png (1024x1024 PNG)"; exit 1)
@identify build/appicon.png 2>/dev/null | grep -q "PNG" || echo "WARN: build/appicon.png not PNG"
@ls -lh build/appicon.png build/windows/icon.ico 2>/dev/null | awk '{print}'
icons:
@echo "==> Propagating build/appicon.png -> all platforms (delete derived, next build regenerates)"
@rm -f build/windows/icon.ico build/darwin/iconfile.icns build/darwin/iconfile.png
@echo " removed build/windows/icon.ico, build/darwin/iconfile.icns"
@ls -lh build/appicon.png
@echo " Next wails build will regenerate derived icons from master."
icons-propagate: icons
@echo "==> Regenerating icons (building current platform)..."
@if [ "$$(uname)" = "Darwin" ]; then wails build -platform darwin/universal -tags $(WEBKIT_TAG) -clean; \
elif pkg-config --exists webkit2gtk-4.1 2>/dev/null || pkg-config --exists webkit2gtk-4.0 2>/dev/null; then wails build -platform linux/amd64 -tags $(WEBKIT_TAG) -clean; \
else wails build -platform windows/amd64 -clean; fi
@ls -lh build/windows/icon.ico build/darwin/iconfile.icns 2>/dev/null || true
@echo " Done."
ci: icons clean
@echo "==> [ci] VERSION=$(VERSION) ($(VERSION_NUM)) WEBKIT_TAG=$(WEBKIT_TAG)"
@rm -rf $(DIST)
@mkdir -p $(DIST)
@echo "==> [ci] linux build"
wails build -platform linux/amd64 -tags $(WEBKIT_TAG) -clean
@echo "==> [ci] .deb"
@rm -rf deb-package
@mkdir -p deb-package/DEBIAN deb-package/usr/bin deb-package/usr/share/applications deb-package/usr/share/icons/hicolor/512x512/apps deb-package/usr/share/icons/hicolor/256x256/apps deb-package/usr/share/pixmaps
@cp build/bin/sqlancy deb-package/usr/bin/sqlancy && chmod +x deb-package/usr/bin/sqlancy
@if [ -f build/appicon.png ]; then cp build/appicon.png deb-package/usr/share/pixmaps/sqlancy.png && cp build/appicon.png deb-package/usr/share/icons/hicolor/512x512/apps/sqlancy.png && cp build/appicon.png deb-package/usr/share/icons/hicolor/256x256/apps/sqlancy.png; fi
@echo "Package: sqlancy" > deb-package/DEBIAN/control
@echo "Version: $(VERSION_NUM)" >> deb-package/DEBIAN/control
@echo "Section: utils" >> deb-package/DEBIAN/control
@echo "Priority: optional" >> deb-package/DEBIAN/control
@echo "Architecture: amd64" >> deb-package/DEBIAN/control
@echo "Maintainer: Clancy <a7mdmo2mn@gmail.com>" >> deb-package/DEBIAN/control
@echo "Depends: libgtk-3-0, libwebkit2gtk-4.0-37 | libwebkit2gtk-4.1-0" >> deb-package/DEBIAN/control
@echo "Description: High performance modern SQLite Browser built with Wails, Go, and React." >> deb-package/DEBIAN/control
@echo " Fast, lightweight SQLite GUI for browsing, querying and managing databases." >> deb-package/DEBIAN/control
@printf '%s\n' '[Desktop Entry]' 'Name=SQLancy' 'Comment=SQLite Browser & Management GUI' 'Exec=/usr/bin/sqlancy' 'Icon=sqlancy' 'Terminal=false' 'Type=Application' 'Categories=Development;Database;' 'StartupWMClass=sqlancy' > deb-package/usr/share/applications/sqlancy.desktop
@dpkg-deb --build deb-package "$(DIST)/sqlancy_$(VERSION_NUM)_amd64.deb" && ls -lh $(DIST)/*.deb && rm -rf deb-package
@echo "==> [ci] tarball"
@tar -czvf $(DIST)/sqlancy-linux-amd64.tar.gz -C build/bin sqlancy && ls -lh $(DIST)/*.tar.gz
@echo "==> [ci] windows build"
@wails build -platform windows/amd64 -clean
@cp build/bin/sqlancy.exe $(DIST)/sqlancy-windows-amd64.exe && ls -lh $(DIST)/sqlancy-windows-amd64.exe
@if [ "$$(uname)" = "Darwin" ]; then echo "==> [ci] macOS build"; wails build -platform darwin/universal -clean && ditto -c -k --keepParent build/bin/sqlancy.app $(DIST)/sqlancy-macos-universal.zip && ls -lh $(DIST)/*.zip; else echo "==> [ci] skip macOS (requires macOS host)"; fi
@echo ""
@echo "─────────────────────────────────────────────"
@echo " CI done — artifacts in ./$(DIST)/"
@ls -lh $(DIST)/