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-ios
214ci-ios: version install app
215 $(MAKE) ios
216 $(MAKE) ci-upload-ios
217
218.PHONY: ci-desktop-darwin
219ci-desktop-darwin: version install
220 ./util/mac-codesign.sh \
221 && for arch in amd64 arm64; do \
222 curl -v --fail-with-body -O "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/streamplace-$(VERSION)-darwin-$$arch.tar.gz" || exit 1 \
223 && tar -xzvf streamplace-$(VERSION)-darwin-$$arch.tar.gz \
224 && ./streamplace --version \
225 && ./streamplace self-test \
226 && mkdir -p build-darwin-$$arch \
227 && mv ./streamplace ./build-darwin-$$arch/streamplace; \
228 done \
229 && $(MAKE) desktop-darwin \
230 && for arch in amd64 arm64; do \
231 export file=streamplace-desktop-$(VERSION)-darwin-$$arch.zip \
232 && $(MAKE) ci-upload-file upload_file=$$file \
233 && export file=streamplace-desktop-$(VERSION)-darwin-$$arch.dmg \
234 && $(MAKE) ci-upload-file upload_file=$$file; \
235 done
236
237.PHONY: ci-android
238ci-android: version install android ci-upload-android
239
240.PHONY: ci-android-debug
241ci-android-debug: version install
242 pnpm run app prebuild
243 $(MAKE) android-debug
244 $(MAKE) ci-upload-android-debug
245
246.PHONY: ci-android-release
247ci-android-release: version install
248 pnpm run app prebuild
249 $(MAKE) android-release
250 $(MAKE) ci-upload-android-release
251
252.PHONY: ci-test
253ci-test: app
254 meson setup $(BUILDDIR) $(OPTS)
255 meson test -C $(BUILDDIR) go-tests
256
257.PHONY: android
258android: app .build/bundletool.jar
259 $(MAKE) android-release
260 $(MAKE) android-debug
261
262.PHONY: android-release
263android-release: .build/bundletool.jar
264 export NODE_ENV=production \
265 && cd ./js/app/android \
266 && ./gradlew :app:bundleRelease \
267 && cd - \
268 && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \
269 && cd bin \
270 && 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 \
271 && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb
272
273.PHONY: android-debug
274android-debug: .build/bundletool.jar
275 export NODE_ENV=production \
276 && cd ./js/app/android \
277 && ./gradlew :app:bundleDebug \
278 && cd - \
279 && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \
280 && cd bin \
281 && 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 \
282 && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb
283
284.PHONY: ios
285ios: app
286 xcodebuild \
287 -workspace ./js/app/ios/Streamplace.xcworkspace \
288 -sdk iphoneos \
289 -configuration Release \
290 -scheme Streamplace \
291 -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \
292 CODE_SIGN_IDENTITY=- \
293 AD_HOC_CODE_SIGNING_ALLOWED=YES \
294 CODE_SIGN_STYLE=Automatic \
295 DEVELOPMENT_TEAM=ZZZZZZZZZZ \
296 clean archive | xcpretty \
297 && cd bin \
298 && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive
299
300# xcodebuild -exportArchive -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive -exportOptionsPlist ./js/app/exportOptions.plist -exportPath ./bin/streamplace-$(VERSION)-ios-release.ipa
301
302.build/bundletool.jar:
303 mkdir -p .build \
304 && curl -L -o ./.build/bundletool.jar https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar
305
306BASE_OPTS = \
307 --buildtype=debugoptimized \
308 -D "gst-plugins-base:audioresample=enabled" \
309 -D "gst-plugins-base:playback=enabled" \
310 -D "gst-plugins-base:opus=enabled" \
311 -D "gst-plugins-base:gio-typefinder=enabled" \
312 -D "gst-plugins-base:videotestsrc=enabled" \
313 -D "gst-plugins-base:videoconvertscale=enabled" \
314 -D "gst-plugins-base:typefind=enabled" \
315 -D "gst-plugins-base:compositor=enabled" \
316 -D "gst-plugins-base:videorate=enabled" \
317 -D "gst-plugins-base:app=enabled" \
318 -D "gst-plugins-base:audiorate=enabled" \
319 -D "gst-plugins-base:audiotestsrc=enabled" \
320 -D "gst-plugins-base:audioconvert=enabled" \
321 -D "gst-plugins-good:matroska=enabled" \
322 -D "gst-plugins-good:multifile=enabled" \
323 -D "gst-plugins-good:rtp=enabled" \
324 -D "gst-plugins-bad:fdkaac=enabled" \
325 -D "gst-plugins-good:audioparsers=enabled" \
326 -D "gst-plugins-good:isomp4=enabled" \
327 -D "gst-plugins-good:png=enabled" \
328 -D "gst-plugins-good:videobox=enabled" \
329 -D "gst-plugins-good:jpeg=enabled" \
330 -D "gst-plugins-good:audioparsers=enabled" \
331 -D "gst-plugins-bad:videoparsers=enabled" \
332 -D "gst-plugins-bad:mpegtsmux=enabled" \
333 -D "gst-plugins-bad:mpegtsdemux=enabled" \
334 -D "gst-plugins-bad:codectimestamper=enabled" \
335 -D "gst-plugins-bad:opus=enabled" \
336 -D "gst-plugins-ugly:x264=enabled" \
337 -D "gst-plugins-ugly:gpl=enabled" \
338 -D "x264:asm=enabled" \
339 -D "gstreamer-full:gst-full=enabled" \
340 -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" \
341 -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \
342 -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \
343 -D "gstreamer-full:bad=enabled" \
344 -D "gstreamer-full:tls=disabled" \
345 -D "gstreamer-full:libav=enabled" \
346 -D "gstreamer-full:ugly=enabled" \
347 -D "gstreamer-full:gpl=enabled" \
348 -D "gstreamer-full:gst-full-typefind-functions=" \
349 -D "gstreamer-full:glib_assert=false" \
350 -D "gstreamer:glib_assert=false" \
351 -D "gstreamer:coretracers=enabled" \
352 -D "gst-plugins-good:glib_assert=false" \
353 -D "gst-plugins-bad:glib_assert=false" \
354 -D "gst-plugins-base:glib_assert=false" \
355 -D "gst-plugins-ugly:glib_assert=false" \
356 -D "glib:glib_assert=false"
357
358OPTS = \
359 $(BASE_OPTS) \
360 -D "gstreamer-full:gst-full-target-type=static_library"
361
362SHARED_OPTS = \
363 $(BASE_OPTS) \
364 -D "FFmpeg:default_library=shared"
365
366.PHONY: meson-setup
367meson-setup:
368 @meson setup $(BUILDDIR) $(OPTS)
369 @meson configure $(BUILDDIR) $(OPTS)
370
371.PHONY: node-all-platforms
372node-all-platforms: app
373 meson setup build-linux-amd64 $(OPTS) --buildtype debugoptimized
374 meson compile -C build-linux-amd64 archive
375 $(MAKE) link-test-linux
376 $(MAKE) linux-arm64
377 $(MAKE) windows-amd64
378 $(MAKE) windows-amd64-startup-test
379 $(MAKE) desktop-linux
380 $(MAKE) desktop-windows-amd64
381
382.PHONY: desktop-linux
383desktop-linux:
384 $(MAKE) desktop-linux-amd64
385 $(MAKE) desktop-linux-arm64
386
387.PHONY: desktop-linux-amd64
388desktop-linux-amd64:
389 cd js/desktop \
390 && pnpm run make --platform linux --arch x64 \
391 && cd - \
392 && mv "js/desktop/out/make/AppImage/x64/Streamplace-$(VERSION_ELECTRON)-x64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-amd64.AppImage
393
394.PHONY: desktop-linux-arm64
395desktop-linux-arm64:
396 cd js/desktop \
397 && pnpm run make --platform linux --arch arm64 \
398 && cd - \
399 && mv "js/desktop/out/make/AppImage/arm64/Streamplace-$(VERSION_ELECTRON)-arm64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-arm64.AppImage
400
401.PHONY: desktop-windows-amd64
402desktop-windows-amd64:
403 cd js/desktop \
404 && pnpm run make --platform win32 --arch x64 \
405 && cd - \
406 && export SUM=$$(cat ./js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg | openssl sha1 | awk '{ print $$2 }') \
407 && echo $$SUM > ./bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1 \
408 && mv "js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \
409 && mv "js/desktop/out/make/squirrel.windows/x64/Streamplace-$(VERSION_ELECTRON) Setup.exe" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.exe
410
411.PHONY: linux-amd64
412linux-amd64:
413 meson setup --buildtype debugoptimized build-linux-amd64 $(OPTS)
414 meson compile -C build-linux-amd64 archive
415
416.PHONY: linux-arm64
417linux-arm64:
418 rustup target add aarch64-unknown-linux-gnu
419 meson setup --cross-file util/linux-arm64-gnu.ini --buildtype debugoptimized build-linux-arm64 $(OPTS)
420 meson compile -C build-linux-arm64 archive
421
422.PHONY: windows-amd64
423windows-amd64:
424 rustup target add x86_64-pc-windows-gnu
425 $(MAKE) windows-amd64-meson-setup
426 meson compile -C build-windows-amd64 archive 2>&1 | grep -v drectve
427 $(MAKE) link-test-windows
428
429.PHONY: windows-amd64-meson-setup
430windows-amd64-meson-setup:
431 meson setup --cross-file util/windows-amd64-gnu.ini --buildtype debugoptimized build-windows-amd64 $(OPTS)
432
433# unbuffer here is a workaround for wine trying to pop up a terminal window and failing
434.PHONY: windows-amd64-startup-test
435windows-amd64-startup-test:
436 bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat'
437
438.PHONY: darwin-amd64
439darwin-amd64:
440 export CC=x86_64-apple-darwin24.4-clang \
441 && export CROSS_COMPILE=1 \
442 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-amd64.ini build-darwin-amd64 $(OPTS) \
443 && meson compile -C build-darwin-amd64 streamplace \
444 && ./util/osxcross-codesign.sh ./build-darwin-amd64/streamplace \
445 && mkdir -p bin \
446 && cd build-darwin-amd64 \
447 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \
448 && cd -
449
450.PHONY: desktop-darwin-amd64
451desktop-darwin-amd64:
452 echo "TODO"
453
454.PHONY: darwin-amd64
455darwin-arm64:
456 export CC=aarch64-apple-darwin24.4-clang \
457 && export CROSS_COMPILE=1 \
458 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-arm64.ini build-darwin-arm64 $(OPTS) \
459 && meson compile -C build-darwin-arm64 streamplace \
460 && ./util/osxcross-codesign.sh ./build-darwin-arm64/streamplace \
461 && mkdir -p bin \
462 && cd build-darwin-arm64 \
463 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \
464 && cd -
465
466.PHONY: desktop-darwin-arm64
467desktop-darwin-arm64:
468 echo "TODO"
469
470.PHONY: desktop-darwin
471desktop-darwin:
472 export DEBUG="electron-osx-sign*" \
473 && cd js/desktop \
474 && pnpm run make --platform darwin --arch arm64 \
475 && pnpm run make --platform darwin --arch x64 \
476 && cd - \
477 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-x64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.dmg \
478 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \
479 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \
480 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip
481
482.PHONY: selftest-macos
483selftest-macos:
484 js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test
485
486# link your local version of mist for dev
487.PHONY: link-mist
488link-mist:
489 rm -rf subprojects/mistserver
490 ln -s $$(realpath ../mistserver) ./subprojects/mistserver
491
492# link your local version of c2pa-go for dev
493.PHONY: link-c2pa-go
494link-c2pa-go:
495 rm -rf subprojects/c2pa_go
496 ln -s $$(realpath ../c2pa-go) ./subprojects/c2pa_go
497
498# link your local version of gstreamer
499.PHONY: link-gstreamer
500link-gstreamer:
501 rm -rf subprojects/gstreamer-full
502 ln -s $$(realpath ../gstreamer) ./subprojects/gstreamer-full
503
504# link your local version of ffmpeg for dev
505.PHONY: link-ffmpeg
506link-ffmpeg:
507 rm -rf subprojects/FFmpeg
508 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg
509
510.PHONY: docker
511docker:
512 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local .
513
514.PHONY: docker-build
515docker-build: docker-build-builder docker-build-in-container
516
517.PHONY: docker-test
518docker-test: docker-build-builder docker-test-in-container
519
520BUILDER_TARGET?=builder
521.PHONY: docker-build-builder
522docker-build-builder:
523 podman build --target=$(BUILDER_TARGET) --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) .
524
525.PHONY: golangci-lint-container
526golangci-lint-container: docker-build-builder
527 podman run \
528 -v $$(pwd):$$(pwd) \
529 -w $$(pwd) \
530 -e PKG_CONFIG_PATH=$$(pwd)/build-linux-amd64/meson-uninstalled \
531 -d \
532 --name golangci-lint \
533 dist.stream.place/streamplace/streamplace:builder \
534 tail -f /dev/null
535 podman exec golangci-lint mkdir -p js/app/dist
536 podman exec golangci-lint touch js/app/dist/skip-build.txt
537 podman exec golangci-lint make node
538
539.PHONY: docker-build-in-container
540docker-build-in-container:
541 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node
542
543.PHONY: docker-test-in-container
544docker-test-in-container:
545 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:builder make app-and-node-and-test
546
547IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"'
548DOCKER_BIN?=podman
549DOCKER_REF?=dist.stream.place/streamplace/streamplace:builder
550DOCKER_OPTS?=
551.PHONY: in-container
552in-container: docker-build-builder
553 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)"
554
555STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download
556.PHONY: docker-release
557docker-release:
558 cd docker \
559 && docker build -f release.Dockerfile \
560 --build-arg TARGETARCH=$(BUILDARCH) \
561 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
562 -t dist.stream.place/streamplace/streamplace \
563 .
564
565.PHONY: docker-mistserver
566docker-mistserver:
567 cd docker \
568 && docker build -f mistserver.Dockerfile \
569 --build-arg TARGETARCH=$(BUILDARCH) \
570 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \
571 -t dist.stream.place/streamplace/streamplace:mistserver \
572 .
573
574.PHONY: ci-upload
575ci-upload: ci-upload-node ci-upload-android
576
577.PHONY: ci-upload-node-linux-amd64
578ci-upload-node-linux-amd64:
579 export file=streamplace-$(VERSION)-linux-amd64.tar.gz \
580 && $(MAKE) ci-upload-file upload_file=$$file; \
581 export file=streamplace-desktop-$(VERSION)-linux-amd64.AppImage \
582 && $(MAKE) ci-upload-file upload_file=$$file;
583
584.PHONY: ci-upload-node-linux-arm64
585ci-upload-node-linux-arm64:
586 export file=streamplace-$(VERSION)-linux-arm64.tar.gz \
587 && $(MAKE) ci-upload-file upload_file=$$file; \
588 export file=streamplace-desktop-$(VERSION)-linux-arm64.AppImage \
589 && $(MAKE) ci-upload-file upload_file=$$file;
590
591.PHONY: ci-upload-node-darwin-arm64
592ci-upload-node-darwin-arm64:
593 export file=streamplace-$(VERSION)-darwin-arm64.tar.gz \
594 && $(MAKE) ci-upload-file upload_file=$$file;
595
596.PHONY: ci-upload-node-darwin-amd64
597ci-upload-node-darwin-amd64:
598 export file=streamplace-$(VERSION)-darwin-amd64.tar.gz \
599 && $(MAKE) ci-upload-file upload_file=$$file;
600
601.PHONY: ci-upload-node-windows-amd64
602ci-upload-node-windows-amd64:
603 export file=streamplace-$(VERSION)-windows-amd64.zip \
604 && $(MAKE) ci-upload-file upload_file=$$file; \
605 export file=streamplace-desktop-$(VERSION)-windows-amd64.exe \
606 && $(MAKE) ci-upload-file upload_file=$$file; \
607 export SUM=$$(cat bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1) \
608 && export file=streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \
609 && $(MAKE) ci-upload-file upload_file=$$file;
610
611.PHONY: ci-upload-node-macos
612ci-upload-node-macos: node-all-platforms-macos
613 for GOOS in darwin; do \
614 for GOARCH in amd64 arm64; do \
615 export file=streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz \
616 && $(MAKE) ci-upload-file upload_file=$$file; \
617 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.dmg \
618 && $(MAKE) ci-upload-file upload_file=$$file; \
619 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.zip \
620 && $(MAKE) ci-upload-file upload_file=$$file; \
621 done \
622 done;
623
624.PHONY: ci-upload-android
625ci-upload-android: android
626 $(MAKE) ci-upload-android-debug \
627 && $(MAKE) ci-upload-android-release
628
629.PHONY: ci-upload-android-debug
630ci-upload-android-debug:
631 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.apk \
632 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.aab
633
634.PHONY: ci-upload-android-release
635ci-upload-android-release:
636 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.apk \
637 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.aab
638
639.PHONY: ci-upload-ios
640ci-upload-ios: ios
641 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-ios-release.xcarchive.tar.gz
642
643upload_file?=""
644.PHONY: ci-upload-file
645ci-upload-file:
646 curl \
647 --fail-with-body \
648 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \
649 --upload-file bin/$(upload_file) \
650 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(upload_file)";
651
652.PHONY: release
653release: install
654 $(MAKE) lexicons
655 pnpm run release
656
657.PHONY: ci-release
658ci-release:
659 go install gitlab.com/gitlab-org/release-cli/cmd/release-cli
660 go run ./pkg/config/git/git.go -release -o release.yml
661 release-cli create-from-file --file release.yml
662
663.PHONY: check
664check: install
665 $(MAKE) golangci-lint
666 pnpm run check
667 if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi
668
669.PHONY: fix
670fix:
671 pnpm run fix
672 gofmt -w .
673
674.PHONY: precommit
675precommit: dockerfile-hash-precommit
676
677.PHONY: dockefile-hash-precommit
678dockerfile-hash-precommit:
679 @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \
680 && git add .ci/dockerfile-hash.yaml