-
Notifications
You must be signed in to change notification settings - Fork 47
/
Makefile
228 lines (169 loc) · 9.54 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
.PHONY: all setup regenerate-i18n web desktop-common linux debian rpm pacman local-pkgbuild local-pkgbuild-install windows windows-portable
.PHONY: web-release debian-release rpm-release pacman-release windows-setup-release windows-unpacked-release windows-portable-release windows-release
.PHONY: macos-common macos macos-mas macos-release macos-mas-release icns
.PHONY: container-build-debian container-build-fedora container-build-windows
.PHONY: container-web-release container-debian-release container-rpm-release container-appimage-release container-windows-release container-release container-local-pkgbuild
.PHONY: linux-container-release container-debian-based-release
.PHONY: clean undo_setup fixup
.PHONY: fix_yarn_cache
CFGDIR ?= configs/sc
all: web
YARN ?= yarnpkg
CONTAINER_ENGINE ?= podman
NODE_VERSION ?= 22
VERSION := $(shell grep version element-desktop/package.json | sed 's|.*: \"\(.*\)\",|\1|')
WEB_APP_NAME := $(shell grep '"name"' element-web/package.json | head -n 1 | sed 's|.*: \"\(.*\)\",|\1|')
DESKTOP_APP_NAME := $(shell grep '"name"' element-desktop/package.json | head -n 1 | sed 's|.*: \"\(.*\)\",|\1|')
PRODUCT_NAME := $(shell grep '"productName"' element-desktop/package.json | sed 's|.*: \"\(.*\)\",|\1|')
WEB_OUT := element-web/dist
WEB_OUT_DIST_VERSION := $(VERSION)
#OUT_WEB := $(WEB_OUT)/$(WEB_APP_NAME)-$(WEB_OUT_DIST_VERSION).tar.gz
OUT_WEB := $(WEB_OUT)/element-$(WEB_OUT_DIST_VERSION).tar.gz
DESKTOP_OUT := element-desktop/dist
OUT_DEB64 := $(DESKTOP_OUT)/$(DESKTOP_APP_NAME)_$(VERSION)_amd64.deb
OUT_RPM64 := $(DESKTOP_OUT)/$(DESKTOP_APP_NAME)-$(VERSION).x86_64.rpm
OUT_PAC64 := $(DESKTOP_OUT)/$(DESKTOP_APP_NAME)-$(VERSION).pacman
OUT_APPIMAGE64 := $(DESKTOP_OUT)/$(PRODUCT_NAME)-$(VERSION).AppImage
OUT_TARXZ64 := $(DESKTOP_OUT)/$(DESKTOP_APP_NAME)-$(VERSION).tar.xz
OUT_WIN64 := $(DESKTOP_OUT)/$(PRODUCT_NAME)\ Setup\ $(VERSION).exe
OUT_WIN64_PORTABLE := $(DESKTOP_OUT)/$(PRODUCT_NAME)\ $(VERSION).exe
OUT_WIN64_BETTER_NAME := $(PRODUCT_NAME)_Setup_v$(VERSION).exe
OUT_WIN64_UNPACKED_BETTER_NAME := $(PRODUCT_NAME)_win-unpacked_v$(VERSION).zip
OUT_WIN64_PORTABLE_BETTER_NAME := $(PRODUCT_NAME)_win-portable_v$(VERSION)
OUT_MACOS := $(DESKTOP_OUT)/$(PRODUCT_NAME)-$(VERSION)-universal.dmg
OUT_MACOS_MAS := $(DESKTOP_OUT)/mas-universal/$(PRODUCT_NAME).app
CONTAINER_IMAGE_DEBIAN := schildichat-desktop-containerbuild-debian
CONTAINER_IMAGE_FEDORA := schildichat-desktop-containerbuild-fedora
CONTAINER_IMAGE_WINDOWS := schildichat-desktop-containerbuild-windows
RELEASE_DIR := release
CURRENT_RELEASE_DIR := $(RELEASE_DIR)/$(VERSION)
# macOS Codesigning
CSC_IDENTITY_AUTO_DISCOVERY ?= false
NOTARIZE_APPLE_ID ?=
CSC_NAME ?=
-include release.mk
setup:
./setup.sh
element-desktop/build/SchildiChat.xcassets/SchildiChat.iconset: $(wildcard element-desktop/build/SchildiChat.xcassets/SchildiChat.iconset/*)
element-desktop/build/icon.icns: element-desktop/build/SchildiChat.xcassets/SchildiChat.iconset
iconutil -c icns -o $@ $<
element-desktop/build/SchildiChat.xcassets/SchildiChatDMG.iconset: $(wildcard element-desktop/build/SchildiChat.xcassets/SchildiChatDMG.iconset/*)
element-desktop/build/dmg.icns: element-desktop/build/SchildiChat.xcassets/SchildiChatDMG.iconset
iconutil -c icns -o $@ $<
icns: element-desktop/build/icon.icns element-desktop/build/dmg.icns
regenerate-i18n: setup
./regenerate_i18n.sh
web: export DIST_VERSION=$(WEB_OUT_DIST_VERSION)
web: setup
cp $(CFGDIR)/config.json element-web/
$(YARN) --cwd element-web dist
echo "$(VERSION)" > element-web/webapp/version
desktop-common: web
$(YARN) --cwd element-desktop run fetch --cfgdir ''
SQLCIPHER_BUNDLED=1 $(YARN) --cwd element-desktop run build:native
macos-common: web icns
$(YARN) --cwd element-desktop run fetch --cfgdir ''
$(YARN) --cwd element-desktop run build:native:universal
linux: desktop-common
$(YARN) --cwd element-desktop run build:64 --linux deb pacman tar.xz
debian: desktop-common
$(YARN) --cwd element-desktop run build:64 --linux deb
rpm: desktop-common
$(YARN) --cwd element-desktop run build:64 --linux rpm
pacman: desktop-common
$(YARN) --cwd element-desktop run build:64 --linux pacman
appimage: desktop-common
$(YARN) --cwd element-desktop run build:64 --linux AppImage
windows: desktop-common
$(YARN) --cwd element-desktop run build:64 --windows nsis
windows-portable: desktop-common
$(YARN) --cwd element-desktop run build:64 --windows portable
macos: macos-common
export CSC_IDENTITY_AUTO_DISCOVERY
export NOTARIZE_APPLE_ID
export CSC_NAME
$(YARN) --cwd element-desktop run build:universal --mac dmg
macos-mas: macos-common
export NOTARIZE_APPLE_ID
export CSC_NAME
$(YARN) --cwd element-desktop run build:universal --mac mas
local-pkgbuild: debian
./create_local_pkgbuild.sh $(VERSION) $(DESKTOP_APP_NAME) $(PRODUCT_NAME) $(OUT_DEB64)
local-pkgbuild-install: local-pkgbuild
cd local-pkgbuild; makepkg --install
web-release: web
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_WEB) $(CURRENT_RELEASE_DIR)/${WEB_APP_NAME}-$(WEB_OUT_DIST_VERSION).tar.gz
debian-release: debian
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_DEB64) $(CURRENT_RELEASE_DIR)
rpm-release: rpm
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_RPM64) $(CURRENT_RELEASE_DIR)
pacman-release: pacman
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_PAC64) $(CURRENT_RELEASE_DIR)
appimage-release: appimage
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_APPIMAGE64) $(CURRENT_RELEASE_DIR)
windows-setup-release: windows
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_WIN64) $(CURRENT_RELEASE_DIR)/$(OUT_WIN64_BETTER_NAME)
windows-unpacked-release: windows
mkdir -p $(CURRENT_RELEASE_DIR)
cd element-desktop/dist/win-unpacked && zip -r ../../../$(CURRENT_RELEASE_DIR)/$(OUT_WIN64_UNPACKED_BETTER_NAME) *
windows-portable-release: windows-portable
./windowsportable.sh $(OUT_WIN64_PORTABLE) $(OUT_WIN64_PORTABLE_BETTER_NAME) $(CURRENT_RELEASE_DIR) $(VERSION)
windows-release: windows-setup-release windows-unpacked-release windows-portable-release
macos-release: macos
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_MACOS) $(CURRENT_RELEASE_DIR)
macos-mas-release: macos-mas
mkdir -p $(CURRENT_RELEASE_DIR)
cp $(OUT_MACOS_MAS) $(CURRENT_RELEASE_DIR)
container-build-debian:
$(CONTAINER_ENGINE) build --security-opt seccomp=unconfined --security-opt label=disable -t $(CONTAINER_IMAGE_DEBIAN) -f Containerfile.debian --build-arg NODE_VERSION=$(NODE_VERSION) .
container-build-fedora:
$(CONTAINER_ENGINE) build --security-opt seccomp=unconfined --security-opt label=disable -t $(CONTAINER_IMAGE_FEDORA) -f Containerfile.fedora --build-arg NODE_VERSION=$(NODE_VERSION) .
container-build-windows: container-build-debian
$(CONTAINER_ENGINE) build --security-opt seccomp=unconfined --security-opt label=disable -t $(CONTAINER_IMAGE_WINDOWS) -f Containerfile.windows --build-arg CONTAINER_IMAGE_DEBIAN=$(CONTAINER_IMAGE_DEBIAN) .
container-web-release: container-build-debian
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_DEBIAN):latest make web-release
container-debian-release: container-build-debian
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_DEBIAN):latest make debian-release
# For all releases which are fine being built from Debian
container-debian-based-release: container-build-debian
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_DEBIAN):latest make web-release debian-release appimage-release
container-rpm-release: container-build-fedora
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_FEDORA):latest make rpm-release
container-appimage-release: container-build-debian
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_DEBIAN):latest make appimage-release
container-windows-release: container-build-windows
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_WINDOWS):latest make windows-release
container-release: container-build-windows #container-build-fedora
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_WINDOWS):latest make web-release debian-release appimage-release rpm-release windows-setup-release windows-portable-release
#$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_FEDORA):latest make rpm-release
# For all Linux releases we build
linux-container-release: container-debian-based-release container-rpm-release
container-local-pkgbuild: container-build-debian
$(CONTAINER_ENGINE) run --rm -ti -v $(PWD):/project --security-opt seccomp=unconfined --security-opt label=disable $(CONTAINER_IMAGE_DEBIAN):latest make local-pkgbuild
bom.lock: element-desktop/yarn.lock element-web/yarn.lock matrix-js-sdk/yarn.lock
./build-bom.sh
bom: bom.lock
fix_yarn_cache:
$(YARN) cache list || $(YARN) cache clean
clean:
$(YARN) --cwd matrix-js-sdk clean
$(YARN) --cwd element-web clean
$(YARN) --cwd element-desktop clean
rm -f element-desktop/webapp || true
rm -rf element-web/dist
rm -rf local-pkgbuild
rm -f bom.lock
rm -f element-web/res/css/sc-cpd-overrides.css
undo_setup:
rm -rf element-desktop/node_modules element-web/node_modules matrix-js-sdk/node_modules i18n-helper/node_modules element-desktop/.hak
fixup: undo_setup fix_yarn_cache
make setup
make clean
make setup