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