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: darwin-amd64
441darwin-amd64:
442 export CC=x86_64-apple-darwin24.4-clang \
443 && export CROSS_COMPILE=1 \
444 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-amd64.ini build-darwin-amd64 $(OPTS) \
445 && meson compile -C build-darwin-amd64 streamplace \
446 && ./util/osxcross-codesign.sh ./build-darwin-amd64/streamplace \
447 && mkdir -p bin \
448 && cd build-darwin-amd64 \
449 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \
450 && cd -
451
452.PHONY: desktop-darwin-amd64
453desktop-darwin-amd64:
454 echo "TODO"
455
456.PHONY: darwin-amd64
457darwin-arm64:
458 export CC=aarch64-apple-darwin24.4-clang \
459 && export CROSS_COMPILE=1 \
460 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-arm64.ini build-darwin-arm64 $(OPTS) \
461 && meson compile -C build-darwin-arm64 streamplace \
462 && ./util/osxcross-codesign.sh ./build-darwin-arm64/streamplace \
463 && mkdir -p bin \
464 && cd build-darwin-arm64 \
465 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \
466 && cd -
467
468.PHONY: desktop-darwin-arm64
469desktop-darwin-arm64:
470 echo "TODO"
471
472.PHONY: desktop-macos
473desktop-macos:
474 export DEBUG="electron-osx-sign*" \
475 && cd js/desktop \
476 && pnpm run make --platform darwin --arch arm64 \
477 && pnpm run make --platform darwin --arch x64 \
478 && cd - \
479 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-x64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.dmg \
480 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \
481 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \
482 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip
483
484.PHONY: selftest-macos
485selftest-macos:
486 js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test
487
488# link your local version of mist for dev
489.PHONY: link-mist
490link-mist:
491 rm -rf subprojects/mistserver
492 ln -s $$(realpath ../mistserver) ./subprojects/mistserver
493
494# link your local version of c2pa-go for dev
495.PHONY: link-c2pa-go
496link-c2pa-go:
497 rm -rf subprojects/c2pa_go
498 ln -s $$(realpath ../c2pa-go) ./subprojects/c2pa_go
499
500# link your local version of gstreamer
501.PHONY: link-gstreamer
502link-gstreamer:
503 rm -rf subprojects/gstreamer-full
504 ln -s $$(realpath ../gstreamer) ./subprojects/gstreamer-full
505
506# link your local version of ffmpeg for dev
507.PHONY: link-ffmpeg
508link-ffmpeg:
509 rm -rf subprojects/FFmpeg
510 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg
511
512.PHONY: docker
513docker:
514 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local .
515
516.PHONY: docker-build
517docker-build: docker-build-builder docker-build-in-container
518
519.PHONY: docker-test
520docker-test: docker-build-builder docker-test-in-container
521
522BUILDER_TARGET?=builder
523.PHONY: docker-build-builder
524docker-build-builder:
525 podman build --target=$(BUILDER_TARGET) --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) .
526
527.PHONY: golangci-lint-container
528golangci-lint-container: docker-build-builder
529 podman run \
530 -v $$(pwd):$$(pwd) \
531 -w $$(pwd) \
532 -e PKG_CONFIG_PATH=$$(pwd)/build-linux-amd64/meson-uninstalled \
533 -d \
534 --name golangci-lint \
535 dist.stream.place/streamplace/streamplace:builder \
536 tail -f /dev/null
537 podman exec golangci-lint mkdir -p js/app/dist
538 podman exec golangci-lint touch js/app/dist/skip-build.txt
539 podman exec golangci-lint make node
540
541.PHONY: docker-build-in-container
542docker-build-in-container:
543 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node
544
545.PHONY: docker-test-in-container
546docker-test-in-container:
547 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node-and-test
548
549IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"'
550DOCKER_BIN?=podman
551DOCKER_REF?=dist.stream.place/streamplace/streamplace:builder
552DOCKER_OPTS?=
553.PHONY: in-container
554in-container: docker-build-builder
555 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)"
556
557STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download
558.PHONY: docker-release
559docker-release:
560 cd docker \
561 && docker build -f release.Dockerfile \
562 --build-arg TARGETARCH=$(BUILDARCH) \
563 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
564 -t dist.stream.place/streamplace/streamplace \
565 .
566
567.PHONY: docker-mistserver
568docker-mistserver:
569 cd docker \
570 && docker build -f mistserver.Dockerfile \
571 --build-arg TARGETARCH=$(BUILDARCH) \
572 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
573 -t dist.stream.place/streamplace/streamplace:mistserver \
574 .
575
576.PHONY: ci-upload
577ci-upload: ci-upload-node ci-upload-android
578
579.PHONY: ci-upload-node-linux-amd64
580ci-upload-node-linux-amd64:
581 export file=streamplace-$(VERSION)-linux-amd64.tar.gz \
582 && $(MAKE) ci-upload-file upload_file=$$file; \
583 export file=streamplace-desktop-$(VERSION)-linux-amd64.AppImage \
584 && $(MAKE) ci-upload-file upload_file=$$file;
585
586.PHONY: ci-upload-node-linux-arm64
587ci-upload-node-linux-arm64:
588 export file=streamplace-$(VERSION)-linux-arm64.tar.gz \
589 && $(MAKE) ci-upload-file upload_file=$$file; \
590 export file=streamplace-desktop-$(VERSION)-linux-arm64.AppImage \
591 && $(MAKE) ci-upload-file upload_file=$$file;
592
593.PHONY: ci-upload-node-darwin-arm64
594ci-upload-node-darwin-arm64:
595 export file=streamplace-$(VERSION)-darwin-arm64.tar.gz \
596 && $(MAKE) ci-upload-file upload_file=$$file;
597
598.PHONY: ci-upload-node-darwin-amd64
599ci-upload-node-darwin-amd64:
600 export file=streamplace-$(VERSION)-darwin-amd64.tar.gz \
601 && $(MAKE) ci-upload-file upload_file=$$file;
602
603.PHONY: ci-upload-node-windows-amd64
604ci-upload-node-windows-amd64:
605 export file=streamplace-$(VERSION)-windows-amd64.zip \
606 && $(MAKE) ci-upload-file upload_file=$$file; \
607 export file=streamplace-desktop-$(VERSION)-windows-amd64.exe \
608 && $(MAKE) ci-upload-file upload_file=$$file; \
609 export SUM=$$(cat bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1) \
610 && export file=streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \
611 && $(MAKE) ci-upload-file upload_file=$$file;
612
613.PHONY: ci-upload-node-macos
614ci-upload-node-macos: node-all-platforms-macos
615 for GOOS in darwin; do \
616 for GOARCH in amd64 arm64; do \
617 export file=streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz \
618 && $(MAKE) ci-upload-file upload_file=$$file; \
619 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.dmg \
620 && $(MAKE) ci-upload-file upload_file=$$file; \
621 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.zip \
622 && $(MAKE) ci-upload-file upload_file=$$file; \
623 done \
624 done;
625
626.PHONY: ci-upload-android
627ci-upload-android: android
628 $(MAKE) ci-upload-android-debug \
629 && $(MAKE) ci-upload-android-release
630
631.PHONY: ci-upload-android-debug
632ci-upload-android-debug:
633 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.apk \
634 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.aab
635
636.PHONY: ci-upload-android-release
637ci-upload-android-release:
638 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.apk \
639 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.aab
640
641.PHONY: ci-upload-ios
642ci-upload-ios: ios
643 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-ios-release.xcarchive.tar.gz
644
645upload_file?=""
646.PHONY: ci-upload-file
647ci-upload-file:
648 curl \
649 --fail-with-body \
650 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \
651 --upload-file bin/$(upload_file) \
652 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(upload_file)";
653
654.PHONY: release
655release: install
656 $(MAKE) lexicons
657 pnpm run release
658
659.PHONY: ci-release
660ci-release:
661 go install gitlab.com/gitlab-org/release-cli/cmd/release-cli
662 go run ./pkg/config/git/git.go -release -o release.yml
663 release-cli create-from-file --file release.yml
664
665.PHONY: check
666check: install
667 $(MAKE) golangci-lint
668 pnpm run check
669 if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi
670
671.PHONY: fix
672fix:
673 pnpm run fix
674 gofmt -w .
675
676.PHONY: precommit
677precommit: dockerfile-hash-precommit
678
679.PHONY: dockefile-hash-precommit
680dockerfile-hash-precommit:
681 @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \
682 && git add .ci/dockerfile-hash.yaml