Live video on the AT Protocol
1OUT_DIR?="bin"
2$(shell mkdir -p $(OUT_DIR))
3
4.PHONY: default
5default: app node
6
7VERSION?=$(shell go run ./pkg/config/git/git.go -v)
8VERSION_ELECTRON=$(subst -,-z,$(subst v,,$(VERSION)))
9UUID?=$(shell go run ./pkg/config/uuid/uuid.go)
10BRANCH?=$(shell go run ./pkg/config/git/git.go --branch)
11
12BUILDOS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
13BUILDARCH ?= $(shell uname -m | tr '[:upper:]' '[:lower:]')
14ifeq ($(BUILDARCH),aarch64)
15 BUILDARCH=arm64
16endif
17ifeq ($(BUILDARCH),x86_64)
18 BUILDARCH=amd64
19endif
20BUILDDIR?=build-$(BUILDOS)-$(BUILDARCH)
21SHARED_LD_LIBRARY_PATH=$(shell pwd)/$(BUILDDIR)/lib/usr/local/lib/x86_64-linux-gnu
22SHARED_DYLD_LIBRARY_PATH=$(shell pwd)/$(BUILDDIR)/lib/usr/local/lib
23SHARED_PKG_CONFIG_PATH=$(shell pwd)/$(BUILDDIR)/meson-uninstalled
24
25.PHONY: version
26version:
27 @go run ./pkg/config/git/git.go -v \
28 && go run ./pkg/config/git/git.go --env -o .ci/build.env
29
30.PHONY: install
31install:
32 pnpm install
33
34.PHONY: app-and-node
35app-and-node:
36 $(MAKE) app
37 $(MAKE) node
38
39.PHONY: app-and-node-and-test
40app-and-node-and-test:
41 $(MAKE) app
42 $(MAKE) node
43 $(MAKE) test
44.PHONY: app
45app: schema install
46 pnpm run build
47
48.PHONY: node
49node: schema
50 $(MAKE) meson-setup
51 meson compile -C $(BUILDDIR) streamplace
52
53js/app/dist/index.html: install
54 pnpm run build
55
56.PHONY: dev-setup
57dev-setup: schema install js/app/dist/index.html
58 meson setup --default-library=shared $(BUILDDIR) $(SHARED_OPTS)
59 meson configure --default-library=shared $(BUILDDIR) $(SHARED_OPTS)
60 meson compile -C $(BUILDDIR) streamplace
61 meson install --destdir lib -C $(BUILDDIR)
62 $(MAKE) dev
63
64.PHONY: dev
65dev:
66 cp ./util/streamplace-dev.sh $(BUILDDIR)/streamplace
67 PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \
68 LD_LIBRARY_PATH=$(SHARED_LD_LIBRARY_PATH) \
69 DYLD_LIBRARY_PATH=$(SHARED_DYLD_LIBRARY_PATH) \
70 go build -o $(BUILDDIR)/libstreamplace ./cmd/libstreamplace/...
71
72.PHONY: golangci-lint
73golangci-lint:
74 @PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \
75 go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint run -c ./.golangci.yaml
76
77.PHONY: dev-test
78dev-test:
79 PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \
80 LD_LIBRARY_PATH=$(SHARED_LD_LIBRARY_PATH) \
81 DYLD_LIBRARY_PATH=$(SHARED_DYLD_LIBRARY_PATH) \
82 go test -p 1 -timeout 120s ./...
83
84.PHONY: schema
85schema:
86 mkdir -p js/app/generated \
87 && go run pkg/crypto/signers/eip712/export-schema/export-schema.go > js/app/generated/eip712-schema.json
88
89.PHONY: lexicons
90lexicons:
91 $(MAKE) go-lexicons \
92 && $(MAKE) js-lexicons \
93 && $(MAKE) md-lexicons \
94 && make fix
95
96.PHONY: go-lexicons
97go-lexicons:
98 rm -rf ./pkg/streamplace \
99 && mkdir -p ./pkg/streamplace \
100 && rm -rf ./pkg/streamplace/cbor_gen.go \
101 && $(MAKE) lexgen \
102 && sed -i.bak 's/\tutil/\/\/\tutil/' $$(find ./pkg/streamplace -type f) \
103 && go run golang.org/x/tools/cmd/goimports@latest -w $$(find ./pkg/streamplace -type f) \
104 && go run ./pkg/gen/gen.go \
105 && $(MAKE) lexgen \
106 && find . | grep bak$$ | xargs rm \
107 && rm -rf api
108
109.PHONY: js-lexicons
110js-lexicons:
111 node_modules/.bin/lex gen-api ./js/streamplace/src/lexicons $$(find ./lexicons -type f -name '*.json') --yes \
112 && echo 'import { ComAtprotoRepoCreateRecord, ComAtprotoRepoDeleteRecord, ComAtprotoRepoGetRecord, ComAtprotoRepoListRecords } from "@atproto/api"' >> ./js/streamplace/src/lexicons/index.ts \
113 && sed -i.bak "s/'\.\.\/\.\.\/app/'@atproto\/api\/src\/client\/types\/app/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
114 && sed -i.bak "s/'\.\.\/\.\.\/\.\.\/app/'@atproto\/api\/src\/client\/types\/app/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
115 && sed -i.bak "s/'\.\.\/\.\.\/com/'@atproto\/api\/src\/client\/types\/com/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
116 && sed -i.bak "s/'\.\.\/\.\.\/\.\.\/com/'@atproto\/api\/src\/client\/types\/com/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
117 && sed -i.bak 's/AppBskyGraphBlock\.Main/AppBskyGraphBlock\.Record/' $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
118 && sed -i.bak 's/PlaceStreamChatProfile\.Main/PlaceStreamChatProfile\.Record/' $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \
119 && sed -i.bak "s/import\ \*\ as\ AppBskyFeedDefs\ from\ '.\/defs'/import \{ AppBskyFeedDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons/types -type f) \
120 && sed -i.bak "s/import\ \*\ as\ AppBskyActorDefs\ from\ '.\/defs'/import \{ AppBskyActorDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons -type f) \
121 && find . | grep bak$$ | xargs rm
122
123.PHONY: md-lexicons
124md-lexicons:
125 pnpm exec lexmd \
126 ./lexicons \
127 .build/temp \
128 subprojects/atproto/lexicons \
129 js/docs/src/content/docs/lex-reference/openapi.json \
130 && ls -R .build/temp \
131 && cp -rf .build/temp/place/stream/* js/docs/src/content/docs/lex-reference/ \
132 && rm -rf .build/temp \
133 && $(MAKE) fix
134
135.PHONY: lexgen
136lexgen:
137 $(MAKE) lexgen-types
138 $(MAKE) lexgen-server
139
140.PHONY: lexgen-types
141lexgen-types:
142 go run github.com/bluesky-social/indigo/cmd/lexgen \
143 -outdir ./pkg/spxrpc \
144 --build-file util/lexgen-types.json \
145 --external-lexicons subprojects/atproto/lexicons \
146 lexicons/place/stream \
147 ./subprojects/atproto/lexicons
148
149.PHONY: lexgen-server
150lexgen-server:
151 mkdir -p ./pkg/spxrpc \
152 && go run github.com/bluesky-social/indigo/cmd/lexgen \
153 --gen-server \
154 --types-import place.stream:stream.place/streamplace/pkg/streamplace \
155 --types-import app.bsky:github.com/bluesky-social/indigo/api/bsky \
156 --types-import com.atproto:github.com/bluesky-social/indigo/api/atproto \
157 --types-import chat.bsky:github.com/bluesky-social/indigo/api/chat \
158 --types-import tools.ozone:github.com/bluesky-social/indigo/api/ozone \
159 -outdir ./pkg/spxrpc \
160 --build-file util/lexgen-types.json \
161 --external-lexicons subprojects/atproto/lexicons \
162 --package spxrpc \
163 lexicons/place/stream \
164 lexicons/app/bsky \
165 lexicons/com/atproto
166
167.PHONY: ci-lexicons
168ci-lexicons:
169 $(MAKE) lexicons \
170 && if ! git diff --exit-code >/dev/null; then echo "lexicons are out of date, run 'make lexicons' to fix"; exit 1; fi
171
172.PHONY: test
173test:
174 meson test -C $(BUILDDIR) go-tests
175
176# test to make sure we haven't added any more dynamic dependencies
177LINUX_LINK_COUNT=5
178.PHONY: link-test-linux
179link-test-linux:
180 count=$(shell ldd ./build-linux-amd64/streamplace | wc -l) \
181 && echo $$count \
182 && if [ "$$count" != "$(LINUX_LINK_COUNT)" ]; then echo "ldd reports new libaries linked! want $(LINUX_LINK_COUNT) got $$count" \
183 && ldd ./build-linux-amd64/streamplace \
184 && exit 1; \
185 fi
186
187MACOS_LINK_COUNT=10
188.PHONY: link-test-macos
189link-test-macos:
190 count=$(shell otool -L ./build-darwin-arm64/streamplace | wc -l | xargs) \
191 && echo $$count \
192 && if [ "$$count" != "$(MACOS_LINK_COUNT)" ]; then echo "otool -L reports new libaries linked! want $(MACOS_LINK_COUNT) got $$count" \
193 && otool -L ./build-darwin-arm64/streamplace \
194 && exit 1; \
195 fi
196
197WINDOWS_LINK_COUNT=16
198.PHONY: link-test-windows
199link-test-windows:
200 count=$(shell x86_64-w64-mingw32-objdump -p ./build-windows-amd64/streamplace.exe | grep "DLL Name" | tr '[:upper:]' '[:lower:]' | sort | uniq | wc -l | xargs) \
201 && echo $$count \
202 && if [ "$$count" != "$(WINDOWS_LINK_COUNT)" ]; then echo "x86_64-w64-mingw32-objdump -p reports new libaries linked! want $(WINDOWS_LINK_COUNT) got $$count" \
203 && x86_64-w64-mingw32-objdump -p ./build-windows-amd64/streamplace.exe | grep "DLL Name" \
204 && exit 1; \
205 fi
206
207.PHONY: all
208all: version install app test node-all-platforms android
209
210.PHONY: ci
211ci: version install app node-all-platforms ci-upload-node
212
213.PHONY: ci-macos
214ci-macos: version install app node-all-platforms-macos ci-upload-node-macos ios ci-upload-ios
215
216.PHONY: ci-android
217ci-android: version install android ci-upload-android
218
219.PHONY: ci-android-debug
220ci-android-debug: version install
221 pnpm run app prebuild
222 $(MAKE) android-debug
223 $(MAKE) ci-upload-android-debug
224
225.PHONY: ci-android-release
226ci-android-release: version install
227 pnpm run app prebuild
228 $(MAKE) android-release
229 $(MAKE) ci-upload-android-release
230
231.PHONY: ci-test
232ci-test: app
233 meson setup $(BUILDDIR) $(OPTS)
234 meson test -C $(BUILDDIR) go-tests
235
236.PHONY: android
237android: app .build/bundletool.jar
238 $(MAKE) android-release
239 $(MAKE) android-debug
240
241.PHONY: android-release
242android-release: .build/bundletool.jar
243 export NODE_ENV=production \
244 && cd ./js/app/android \
245 && ./gradlew :app:bundleRelease \
246 && cd - \
247 && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \
248 && cd bin \
249 && java -jar ../.build/bundletool.jar build-apks --ks ../my-release-key.keystore --ks-key-alias alias_name --ks-pass pass:aquareum --bundle=streamplace-$(VERSION)-android-release.aab --output=streamplace-$(VERSION)-android-release.apks --mode=universal \
250 && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb
251
252.PHONY: android-debug
253android-debug: .build/bundletool.jar
254 export NODE_ENV=production \
255 && cd ./js/app/android \
256 && ./gradlew :app:bundleDebug \
257 && cd - \
258 && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \
259 && cd bin \
260 && java -jar ../.build/bundletool.jar build-apks --ks ../my-release-key.keystore --ks-key-alias alias_name --ks-pass pass:aquareum --bundle=streamplace-$(VERSION)-android-debug.aab --output=streamplace-$(VERSION)-android-debug.apks --mode=universal \
261 && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb
262
263.PHONY: ios
264ios: app
265 xcodebuild \
266 -workspace ./js/app/ios/Streamplace.xcworkspace \
267 -sdk iphoneos \
268 -configuration Release \
269 -scheme Streamplace \
270 -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \
271 CODE_SIGN_IDENTITY=- \
272 AD_HOC_CODE_SIGNING_ALLOWED=YES \
273 CODE_SIGN_STYLE=Automatic \
274 DEVELOPMENT_TEAM=ZZZZZZZZZZ \
275 clean archive | xcpretty \
276 && cd bin \
277 && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive
278
279# xcodebuild -exportArchive -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive -exportOptionsPlist ./js/app/exportOptions.plist -exportPath ./bin/streamplace-$(VERSION)-ios-release.ipa
280
281.build/bundletool.jar:
282 mkdir -p .build \
283 && curl -L -o ./.build/bundletool.jar https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar
284
285BASE_OPTS = \
286 --buildtype=debugoptimized \
287 -D "gst-plugins-base:audioresample=enabled" \
288 -D "gst-plugins-base:playback=enabled" \
289 -D "gst-plugins-base:opus=enabled" \
290 -D "gst-plugins-base:gio-typefinder=enabled" \
291 -D "gst-plugins-base:videotestsrc=enabled" \
292 -D "gst-plugins-base:videoconvertscale=enabled" \
293 -D "gst-plugins-base:typefind=enabled" \
294 -D "gst-plugins-base:compositor=enabled" \
295 -D "gst-plugins-base:videorate=enabled" \
296 -D "gst-plugins-base:app=enabled" \
297 -D "gst-plugins-base:audiorate=enabled" \
298 -D "gst-plugins-base:audiotestsrc=enabled" \
299 -D "gst-plugins-base:audioconvert=enabled" \
300 -D "gst-plugins-good:matroska=enabled" \
301 -D "gst-plugins-good:multifile=enabled" \
302 -D "gst-plugins-good:rtp=enabled" \
303 -D "gst-plugins-bad:fdkaac=enabled" \
304 -D "gst-plugins-good:audioparsers=enabled" \
305 -D "gst-plugins-good:isomp4=enabled" \
306 -D "gst-plugins-good:png=enabled" \
307 -D "gst-plugins-good:videobox=enabled" \
308 -D "gst-plugins-good:jpeg=enabled" \
309 -D "gst-plugins-good:audioparsers=enabled" \
310 -D "gst-plugins-bad:videoparsers=enabled" \
311 -D "gst-plugins-bad:mpegtsmux=enabled" \
312 -D "gst-plugins-bad:mpegtsdemux=enabled" \
313 -D "gst-plugins-bad:codectimestamper=enabled" \
314 -D "gst-plugins-bad:opus=enabled" \
315 -D "gst-plugins-ugly:x264=enabled" \
316 -D "gst-plugins-ugly:gpl=enabled" \
317 -D "x264:asm=enabled" \
318 -D "gstreamer-full:gst-full=enabled" \
319 -D "gstreamer-full:gst-full-plugins=libgstopusparse.a;libgstcodectimestamper.a;libgstrtp.a;libgstaudioresample.a;libgstlibav.a;libgstmatroska.a;libgstmultifile.a;libgstjpeg.a;libgstaudiotestsrc.a;libgstaudioconvert.a;libgstaudioparsers.a;libgstfdkaac.a;libgstisomp4.a;libgstapp.a;libgstvideoconvertscale.a;libgstvideobox.a;libgstvideorate.a;libgstpng.a;libgstcompositor.a;libgstaudiorate.a;libgstx264.a;libgstopus.a;libgstvideotestsrc.a;libgstvideoparsersbad.a;libgstaudioparsers.a;libgstmpegtsmux.a;libgstmpegtsdemux.a;libgstplayback.a;libgsttypefindfunctions.a;libgstcoretracers.a" \
320 -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \
321 -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \
322 -D "gstreamer-full:bad=enabled" \
323 -D "gstreamer-full:tls=disabled" \
324 -D "gstreamer-full:libav=enabled" \
325 -D "gstreamer-full:ugly=enabled" \
326 -D "gstreamer-full:gpl=enabled" \
327 -D "gstreamer-full:gst-full-typefind-functions=" \
328 -D "gstreamer-full:glib_assert=false" \
329 -D "gstreamer:glib_assert=false" \
330 -D "gstreamer:coretracers=enabled" \
331 -D "gst-plugins-good:glib_assert=false" \
332 -D "gst-plugins-bad:glib_assert=false" \
333 -D "gst-plugins-base:glib_assert=false" \
334 -D "gst-plugins-ugly:glib_assert=false" \
335 -D "glib:glib_assert=false"
336
337OPTS = \
338 $(BASE_OPTS) \
339 -D "gstreamer-full:gst-full-target-type=static_library"
340
341SHARED_OPTS = \
342 $(BASE_OPTS) \
343 -D "FFmpeg:default_library=shared"
344
345.PHONY: meson-setup
346meson-setup:
347 @meson setup $(BUILDDIR) $(OPTS)
348 @meson configure $(BUILDDIR) $(OPTS)
349
350.PHONY: node-all-platforms
351node-all-platforms: app
352 meson setup build-linux-amd64 $(OPTS) --buildtype debugoptimized
353 meson compile -C build-linux-amd64 archive
354 $(MAKE) link-test-linux
355 $(MAKE) linux-arm64
356 $(MAKE) windows-amd64
357 $(MAKE) windows-amd64-startup-test
358 $(MAKE) desktop-linux
359 $(MAKE) desktop-windows-amd64
360
361.PHONY: desktop-linux
362desktop-linux:
363 $(MAKE) desktop-linux-amd64
364 $(MAKE) desktop-linux-arm64
365
366.PHONY: desktop-linux-amd64
367desktop-linux-amd64:
368 cd js/desktop \
369 && pnpm run make --platform linux --arch x64 \
370 && cd - \
371 && mv "js/desktop/out/make/AppImage/x64/Streamplace-$(VERSION_ELECTRON)-x64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-amd64.AppImage
372
373.PHONY: desktop-linux-arm64
374desktop-linux-arm64:
375 cd js/desktop \
376 && pnpm run make --platform linux --arch arm64 \
377 && cd - \
378 && mv "js/desktop/out/make/AppImage/arm64/Streamplace-$(VERSION_ELECTRON)-arm64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-arm64.AppImage
379
380.PHONY: desktop-windows-amd64
381desktop-windows-amd64:
382 cd js/desktop \
383 && pnpm run make --platform win32 --arch x64 \
384 && cd - \
385 && export SUM=$$(cat ./js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg | openssl sha1 | awk '{ print $$2 }') \
386 && echo $$SUM > ./bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1 \
387 && mv "js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \
388 && mv "js/desktop/out/make/squirrel.windows/x64/Streamplace-$(VERSION_ELECTRON) Setup.exe" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.exe
389
390.PHONY: linux-amd64
391linux-amd64:
392 meson setup --buildtype debugoptimized build-linux-amd64 $(OPTS)
393 meson compile -C build-linux-amd64 archive
394
395.PHONY: linux-arm64
396linux-arm64:
397 rustup target add aarch64-unknown-linux-gnu
398 meson setup --cross-file util/linux-arm64-gnu.ini --buildtype debugoptimized build-linux-arm64 $(OPTS)
399 meson compile -C build-linux-arm64 archive
400
401.PHONY: windows-amd64
402windows-amd64:
403 rustup target add x86_64-pc-windows-gnu
404 $(MAKE) windows-amd64-meson-setup
405 meson compile -C build-windows-amd64 archive 2>&1 | grep -v drectve
406 $(MAKE) link-test-windows
407
408.PHONY: windows-amd64-meson-setup
409windows-amd64-meson-setup:
410 meson setup --cross-file util/windows-amd64-gnu.ini --buildtype debugoptimized build-windows-amd64 $(OPTS)
411
412# unbuffer here is a workaround for wine trying to pop up a terminal window and failing
413.PHONY: windows-amd64-startup-test
414windows-amd64-startup-test:
415 bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat'
416
417.PHONY: node-all-platforms-macos
418node-all-platforms-macos: app
419 meson setup --buildtype debugoptimized build-darwin-arm64 $(OPTS)
420 meson compile -C build-darwin-arm64
421 ./util/mac-codesign.sh ./build-darwin-arm64/streamplace
422 cd build-darwin-arm64 \
423 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \
424 && cd -
425 ./build-darwin-arm64/streamplace --version
426 ./build-darwin-arm64/streamplace self-test
427 $(MAKE) link-test-macos
428 rustup target add x86_64-apple-darwin
429 meson setup --buildtype debugoptimized --cross-file util/darwin-amd64-apple.ini build-darwin-amd64 $(OPTS)
430 meson compile -C build-darwin-amd64
431 ./util/mac-codesign.sh ./build-darwin-amd64/streamplace
432 cd build-darwin-amd64 \
433 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \
434 && cd -
435 ./build-darwin-amd64/streamplace --version
436 ./build-darwin-arm64/streamplace self-test
437 $(MAKE) desktop-macos
438 meson test -C build-darwin-arm64 go-tests
439
440.PHONY: desktop-macos
441desktop-macos:
442 export DEBUG="electron-osx-sign*" \
443 && cd js/desktop \
444 && pnpm run make --platform darwin --arch arm64 \
445 && pnpm run make --platform darwin --arch x64 \
446 && cd - \
447 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-x64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.dmg \
448 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \
449 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \
450 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip
451
452.PHONY: selftest-macos
453selftest-macos:
454 js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test
455
456# link your local version of mist for dev
457.PHONY: link-mist
458link-mist:
459 rm -rf subprojects/mistserver
460 ln -s $$(realpath ../mistserver) ./subprojects/mistserver
461
462# link your local version of c2pa-go for dev
463.PHONY: link-c2pa-go
464link-c2pa-go:
465 rm -rf subprojects/c2pa_go
466 ln -s $$(realpath ../c2pa-go) ./subprojects/c2pa_go
467
468# link your local version of gstreamer
469.PHONY: link-gstreamer
470link-gstreamer:
471 rm -rf subprojects/gstreamer-full
472 ln -s $$(realpath ../gstreamer) ./subprojects/gstreamer-full
473
474# link your local version of ffmpeg for dev
475.PHONY: link-ffmpeg
476link-ffmpeg:
477 rm -rf subprojects/FFmpeg
478 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg
479
480.PHONY: docker
481docker:
482 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local .
483
484.PHONY: docker-build
485docker-build: docker-build-builder docker-build-in-container
486
487.PHONY: docker-test
488docker-test: docker-build-builder docker-test-in-container
489
490.PHONY: docker-build-builder
491docker-build-builder:
492 podman build --target=builder --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:builder .
493
494.PHONY: golangci-lint-container
495golangci-lint-container: docker-build-builder
496 podman run \
497 -v $$(pwd):$$(pwd) \
498 -w $$(pwd) \
499 -e PKG_CONFIG_PATH=$$(pwd)/build-linux-amd64/meson-uninstalled \
500 -d \
501 --name golangci-lint \
502 dist.stream.place/streamplace/streamplace:builder \
503 tail -f /dev/null
504 podman exec golangci-lint mkdir -p js/app/dist
505 podman exec golangci-lint touch js/app/dist/skip-build.txt
506 podman exec golangci-lint make node
507
508.PHONY: docker-build-in-container
509docker-build-in-container:
510 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node
511
512.PHONY: docker-test-in-container
513docker-test-in-container:
514 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node-and-test
515
516IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"'
517DOCKER_BIN?=podman
518DOCKER_REF?=dist.stream.place/streamplace/streamplace:builder
519DOCKER_OPTS?=
520.PHONY: in-container
521in-container: docker-build-builder
522 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)"
523
524STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download
525.PHONY: docker-release
526docker-release:
527 cd docker \
528 && docker build -f release.Dockerfile \
529 --build-arg TARGETARCH=$(BUILDARCH) \
530 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
531 -t dist.stream.place/streamplace/streamplace \
532 .
533
534.PHONY: docker-mistserver
535docker-mistserver:
536 cd docker \
537 && docker build -f mistserver.Dockerfile \
538 --build-arg TARGETARCH=$(BUILDARCH) \
539 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
540 -t dist.stream.place/streamplace/streamplace:mistserver \
541 .
542
543.PHONY: ci-upload
544ci-upload: ci-upload-node ci-upload-android
545
546.PHONY: ci-upload-node-linux-amd64
547ci-upload-node-linux-amd64:
548 export file=streamplace-$(VERSION)-linux-amd64.tar.gz \
549 && $(MAKE) ci-upload-file upload_file=$$file; \
550 export file=streamplace-desktop-$(VERSION)-linux-amd64.AppImage \
551 && $(MAKE) ci-upload-file upload_file=$$file;
552
553.PHONY: ci-upload-node-linux-arm64
554ci-upload-node-linux-arm64:
555 export file=streamplace-$(VERSION)-linux-arm64.tar.gz \
556 && $(MAKE) ci-upload-file upload_file=$$file; \
557 export file=streamplace-desktop-$(VERSION)-linux-arm64.AppImage \
558 && $(MAKE) ci-upload-file upload_file=$$file;
559
560.PHONY: ci-upload-node-windows-amd64
561ci-upload-node-windows-amd64:
562 export file=streamplace-$(VERSION)-windows-amd64.zip \
563 && $(MAKE) ci-upload-file upload_file=$$file; \
564 export file=streamplace-desktop-$(VERSION)-windows-amd64.exe \
565 && $(MAKE) ci-upload-file upload_file=$$file; \
566 export SUM=$$(cat bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1) \
567 && export file=streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \
568 && $(MAKE) ci-upload-file upload_file=$$file;
569
570.PHONY: ci-upload-node-macos
571ci-upload-node-macos: node-all-platforms-macos
572 for GOOS in darwin; do \
573 for GOARCH in amd64 arm64; do \
574 export file=streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz \
575 && $(MAKE) ci-upload-file upload_file=$$file; \
576 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.dmg \
577 && $(MAKE) ci-upload-file upload_file=$$file; \
578 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.zip \
579 && $(MAKE) ci-upload-file upload_file=$$file; \
580 done \
581 done;
582
583.PHONY: ci-upload-android
584ci-upload-android: android
585 $(MAKE) ci-upload-android-debug \
586 && $(MAKE) ci-upload-android-release
587
588.PHONY: ci-upload-android-debug
589ci-upload-android-debug:
590 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.apk \
591 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.aab
592
593.PHONY: ci-upload-android-release
594ci-upload-android-release:
595 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.apk \
596 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.aab
597
598.PHONY: ci-upload-ios
599ci-upload-ios: ios
600 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-ios-release.xcarchive.tar.gz
601
602upload_file?=""
603.PHONY: ci-upload-file
604ci-upload-file:
605 curl \
606 --fail-with-body \
607 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \
608 --upload-file bin/$(upload_file) \
609 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(upload_file)";
610
611.PHONY: release
612release: install
613 $(MAKE) lexicons
614 pnpm run release
615
616.PHONY: ci-release
617ci-release:
618 go install gitlab.com/gitlab-org/release-cli/cmd/release-cli
619 go run ./pkg/config/git/git.go -release -o release.yml
620 release-cli create-from-file --file release.yml
621
622.PHONY: check
623check: install
624 $(MAKE) golangci-lint
625 pnpm run check
626 if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi
627
628.PHONY: fix
629fix:
630 pnpm run fix
631 gofmt -w .
632
633.PHONY: precommit
634precommit: dockerfile-hash-precommit
635
636.PHONY: dockefile-hash-precommit
637dockerfile-hash-precommit:
638 @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \
639 && git add .ci/dockerfile-hash.yaml