Live video on the AT Protocol
at v0.7.21 852 lines 33 kB view raw
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_NO_V=$(subst v,,$(VERSION)) 9VERSION_ELECTRON=$(subst -,-z,$(subst v,,$(VERSION))) 10UUID?=$(shell go run ./pkg/config/uuid/uuid.go) 11BRANCH?=$(shell go run ./pkg/config/git/git.go --branch) 12 13BUILDOS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') 14BUILDARCH ?= $(shell uname -m | tr '[:upper:]' '[:lower:]') 15ifeq ($(BUILDARCH),aarch64) 16 BUILDARCH=arm64 17endif 18ifeq ($(BUILDARCH),x86_64) 19 BUILDARCH=amd64 20endif 21MACOS_VERSION_FLAG= 22ifeq ($(BUILDOS),darwin) 23 MACOS_VERSION_FLAG=-mmacosx-version-min=$(shell sw_vers -productVersion) 24endif 25BUILDDIR?=build-$(BUILDOS)-$(BUILDARCH) 26SHARED_LD_LIBRARY_PATH=$(shell pwd)/$(BUILDDIR)/lib/usr/local/lib/x86_64-linux-gnu 27SHARED_DYLD_LIBRARY_PATH=$(shell pwd)/$(BUILDDIR)/lib/usr/local/lib 28SHARED_PKG_CONFIG_PATH=$(shell pwd)/$(BUILDDIR)/meson-uninstalled 29 30.PHONY: version 31version: 32 @go run ./pkg/config/git/git.go -v \ 33 && go run ./pkg/config/git/git.go --env -o .ci/build.env 34 35.PHONY: install 36install: 37 pnpm install 38 39.PHONY: app-and-node 40app-and-node: 41 $(MAKE) app 42 $(MAKE) node 43 44.PHONY: app-and-node-and-test 45app-and-node-and-test: 46 $(MAKE) app 47 $(MAKE) node 48 $(MAKE) test 49.PHONY: app 50app: schema install 51 pnpm run build 52 53.PHONY: node 54node: schema 55 $(MAKE) meson-setup 56 meson compile -C $(BUILDDIR) streamplace 57 58js/app/dist/index.html: install 59 pnpm run build 60 61.PHONY: dev-setup 62dev-setup: schema install js/app/dist/index.html 63 $(MAKE) dev-setup-meson 64 $(MAKE) dev 65 66.PHONY: dev-setup-meson 67dev-setup-meson: 68 $(MAKE) dev-setup-meson-configure 69 $(MAKE) dev-setup-meson-compile 70 71.PHONY: dev-setup-meson-configure 72dev-setup-meson-configure: 73 meson setup --default-library=shared $(BUILDDIR) $(SHARED_OPTS) 74 meson configure --default-library=shared $(BUILDDIR) $(SHARED_OPTS) 75 76.PHONY: dev-setup-meson-compile 77dev-setup-meson-compile: 78 meson compile -C $(BUILDDIR) streamplace 79 meson install --destdir lib -C $(BUILDDIR) 80 81.PHONY: dev 82dev: 83 cp ./util/streamplace-dev.sh $(BUILDDIR)/streamplace 84 PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 85 LD_LIBRARY_PATH=$(SHARED_LD_LIBRARY_PATH) \ 86 DYLD_LIBRARY_PATH=$(SHARED_DYLD_LIBRARY_PATH) \ 87 CGO_LDFLAGS="$(MACOS_VERSION_FLAG)" go build -o $(BUILDDIR)/libstreamplace ./cmd/libstreamplace/... 88 89.PHONY: golangci-lint 90golangci-lint: 91 @PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 92 go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint run -c ./.golangci.yaml 93 94.PHONY: dev-test 95dev-test: 96 PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 97 LD_LIBRARY_PATH=$(SHARED_LD_LIBRARY_PATH) \ 98 DYLD_LIBRARY_PATH=$(SHARED_DYLD_LIBRARY_PATH) \ 99 go test -p 1 -timeout 300s ./... 100 101.PHONY: schema 102schema: 103 mkdir -p js/app/generated \ 104 && go run pkg/crypto/signers/eip712/export-schema/export-schema.go > js/app/generated/eip712-schema.json 105 106.PHONY: lexicons 107lexicons: 108 $(MAKE) go-lexicons \ 109 && $(MAKE) js-lexicons \ 110 && $(MAKE) md-lexicons \ 111 && make fix 112 113.PHONY: go-lexicons 114go-lexicons: 115 rm -rf ./pkg/streamplace \ 116 && mkdir -p ./pkg/streamplace \ 117 && rm -rf ./pkg/streamplace/cbor_gen.go \ 118 && $(MAKE) lexgen \ 119 && sed -i.bak 's/\tutil/\/\/\tutil/' $$(find ./pkg/streamplace -type f) \ 120 && go run golang.org/x/tools/cmd/goimports@latest -w $$(find ./pkg/streamplace -type f) \ 121 && go run ./pkg/gen/gen.go \ 122 && $(MAKE) lexgen \ 123 && find . | grep bak$$ | xargs rm \ 124 && rm -rf api 125 126.PHONY: js-lexicons 127js-lexicons: 128 node_modules/.bin/lex gen-api ./js/streamplace/src/lexicons $$(find ./lexicons -type f -name '*.json') --yes \ 129 && echo 'import { ComAtprotoRepoCreateRecord, ComAtprotoRepoDeleteRecord, ComAtprotoRepoGetRecord, ComAtprotoRepoListRecords } from "@atproto/api"' >> ./js/streamplace/src/lexicons/index.ts \ 130 && sed -i.bak "s/'\.\.\/\.\.\/app/'@atproto\/api\/src\/client\/types\/app/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 131 && sed -i.bak "s/'\.\.\/\.\.\/\.\.\/app/'@atproto\/api\/src\/client\/types\/app/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 132 && sed -i.bak "s/'\.\.\/\.\.\/com/'@atproto\/api\/src\/client\/types\/com/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 133 && sed -i.bak "s/'\.\.\/\.\.\/\.\.\/com/'@atproto\/api\/src\/client\/types\/com/" $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 134 && sed -i.bak 's/AppBskyGraphBlock\.Main/AppBskyGraphBlock\.Record/' $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 135 && sed -i.bak 's/PlaceStreamChatProfile\.Main/PlaceStreamChatProfile\.Record/' $$(find ./js/streamplace/src/lexicons/types/place/stream -type f) \ 136 && sed -i.bak "s/import\ \*\ as\ AppBskyFeedDefs\ from\ '.\/defs'/import \{ AppBskyFeedDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons/types -type f) \ 137 && sed -i.bak "s/import\ \*\ as\ AppBskyActorDefs\ from\ '.\/defs'/import \{ AppBskyActorDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons -type f) \ 138 && sed -i.bak "s/import\ \*\ as\ ComAtprotoAdminDefs\ from\ .*$$/import \{ ComAtprotoAdminDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons -type f) \ 139 && sed -i.bak "s/import\ \*\ as\ ComAtprotoRepoStrongRef\ from\ .*$$/import \{ ComAtprotoRepoStrongRef } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons -type f) \ 140 && sed -i.bak "s/import\ \*\ as\ ComAtprotoModerationDefs\ from\ .*$$/import \{ ComAtprotoModerationDefs } from '@atproto\/api'/" $$(find ./js/streamplace/src/lexicons -type f) \ 141 && npx prettier --write $$(find ./js/streamplace/src/lexicons -type f -name '*.ts') \ 142 && find . | grep bak$$ | xargs rm 143 144.PHONY: md-lexicons 145md-lexicons: 146 pnpm exec lexmd \ 147 ./lexicons \ 148 .build/temp \ 149 subprojects/atproto/lexicons \ 150 js/docs/src/content/docs/lex-reference/openapi.json \ 151 && ls -R .build/temp \ 152 && cp -rf .build/temp/place/stream/* js/docs/src/content/docs/lex-reference/ \ 153 && rm -rf .build/temp \ 154 && $(MAKE) fix 155 156.PHONY: lexgen 157lexgen: 158 $(MAKE) lexgen-types 159 $(MAKE) lexgen-server 160 161.PHONY: lexgen-types 162lexgen-types: 163 go run github.com/bluesky-social/indigo/cmd/lexgen \ 164 -outdir ./pkg/spxrpc \ 165 --build-file util/lexgen-types.json \ 166 --external-lexicons subprojects/atproto/lexicons \ 167 lexicons/place/stream \ 168 ./subprojects/atproto/lexicons 169 170.PHONY: lexgen-server 171lexgen-server: 172 mkdir -p ./pkg/spxrpc \ 173 && go run github.com/bluesky-social/indigo/cmd/lexgen \ 174 --gen-server \ 175 --types-import place.stream:stream.place/streamplace/pkg/streamplace \ 176 --types-import app.bsky:github.com/bluesky-social/indigo/api/bsky \ 177 --types-import com.atproto:github.com/bluesky-social/indigo/api/atproto \ 178 --types-import chat.bsky:github.com/bluesky-social/indigo/api/chat \ 179 --types-import tools.ozone:github.com/bluesky-social/indigo/api/ozone \ 180 -outdir ./pkg/spxrpc \ 181 --build-file util/lexgen-types.json \ 182 --external-lexicons subprojects/atproto/lexicons \ 183 --package spxrpc \ 184 lexicons/place/stream \ 185 lexicons/app/bsky \ 186 lexicons/com/atproto 187 188.PHONY: ci-lexicons 189ci-lexicons: 190 $(MAKE) lexicons \ 191 && if ! git diff --exit-code >/dev/null; then echo "lexicons are out of date, run 'make lexicons' to fix"; exit 1; fi 192 193.PHONY: test 194test: 195 meson test -C $(BUILDDIR) go-tests 196 197# test to make sure we haven't added any more dynamic dependencies 198LINUX_LINK_COUNT=5 199.PHONY: link-test-linux 200link-test-linux: 201 count=$(shell ldd ./build-linux-amd64/streamplace | wc -l) \ 202 && echo $$count \ 203 && if [ "$$count" != "$(LINUX_LINK_COUNT)" ]; then echo "ldd reports new libaries linked! want $(LINUX_LINK_COUNT) got $$count" \ 204 && ldd ./build-linux-amd64/streamplace \ 205 && exit 1; \ 206 fi 207 208MACOS_LINK_COUNT=10 209.PHONY: link-test-macos 210link-test-macos: 211 count=$(shell otool -L ./build-darwin-arm64/streamplace | wc -l | xargs) \ 212 && echo $$count \ 213 && if [ "$$count" != "$(MACOS_LINK_COUNT)" ]; then echo "otool -L reports new libaries linked! want $(MACOS_LINK_COUNT) got $$count" \ 214 && otool -L ./build-darwin-arm64/streamplace \ 215 && exit 1; \ 216 fi 217 218WINDOWS_LINK_COUNT=16 219.PHONY: link-test-windows 220link-test-windows: 221 count=$(shell x86_64-w64-mingw32-objdump -p ./build-windows-amd64/streamplace.exe | grep "DLL Name" | tr '[:upper:]' '[:lower:]' | sort | uniq | wc -l | xargs) \ 222 && echo $$count \ 223 && if [ "$$count" != "$(WINDOWS_LINK_COUNT)" ]; then echo "x86_64-w64-mingw32-objdump -p reports new libaries linked! want $(WINDOWS_LINK_COUNT) got $$count" \ 224 && x86_64-w64-mingw32-objdump -p ./build-windows-amd64/streamplace.exe | grep "DLL Name" \ 225 && exit 1; \ 226 fi 227 228.PHONY: all 229all: version install app test node-all-platforms android 230 231.PHONY: ci 232ci: version install app node-all-platforms ci-upload-node 233 234.PHONY: ci-ios 235ci-ios: version install app 236 $(MAKE) ios 237 $(MAKE) ci-upload-ios 238 239.PHONY: ci-desktop-darwin 240ci-desktop-darwin: version install 241 ./util/mac-codesign.sh \ 242 && for arch in amd64 arm64; do \ 243 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 \ 244 && tar -xzvf streamplace-$(VERSION)-darwin-$$arch.tar.gz \ 245 && ./streamplace --version \ 246 && ./streamplace self-test \ 247 && mkdir -p build-darwin-$$arch \ 248 && mv ./streamplace ./build-darwin-$$arch/streamplace; \ 249 done \ 250 && $(MAKE) desktop-darwin \ 251 && for arch in amd64 arm64; do \ 252 export file=streamplace-desktop-$(VERSION)-darwin-$$arch.zip \ 253 && $(MAKE) ci-upload-file upload_file=$$file \ 254 && export file=streamplace-desktop-$(VERSION)-darwin-$$arch.dmg \ 255 && $(MAKE) ci-upload-file upload_file=$$file; \ 256 done 257 258.PHONY: ci-android 259ci-android: version install android ci-upload-android 260 261.PHONY: ci-android-debug 262ci-android-debug: version install 263 pnpm run app prebuild 264 $(MAKE) android-debug 265 $(MAKE) ci-upload-android-debug 266 267.PHONY: ci-android-release 268ci-android-release: version install 269 pnpm run app prebuild 270 $(MAKE) android-release 271 $(MAKE) ci-upload-android-release 272 273.PHONY: ci-test 274ci-test: app 275 meson setup $(BUILDDIR) $(OPTS) 276 meson test -C $(BUILDDIR) go-tests 277 278.PHONY: ci-npm-release 279ci-npm-release: install 280 echo //registry.npmjs.org/:_authToken=$$NPM_TOKEN > ~/.npmrc \ 281 && npx lerna publish from-package --yes 282 283ANDROID_KEYSTORE_PASSWORD?=streamplace 284ANDROID_KEYSTORE_ALIAS?=alias_name 285ANDROID_KEYSTORE_BASE64?= 286 287.PHONY: android-keystore 288android-keystore: 289 if [ -n "$$ANDROID_KEYSTORE_BASE64" ]; then \ 290 echo "$$ANDROID_KEYSTORE_BASE64" | base64 -d > my-release-key.keystore; \ 291 fi; \ 292 if [ ! -f my-release-key.keystore ]; then \ 293 keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 -storepass $(ANDROID_KEYSTORE_PASSWORD) -keypass $(ANDROID_KEYSTORE_PASSWORD) -dname "CN=Streamplace, OU=Streamplace, O=Streamplace, L=Streamplace, S=Streamplace, C=US"; \ 294 fi 295 296.PHONY: android 297android: app .build/bundletool.jar 298 $(MAKE) android-release 299 $(MAKE) android-debug 300 301.PHONY: android-release 302android-release: .build/bundletool.jar android-keystore 303 export NODE_ENV=production \ 304 && cd ./js/app/android \ 305 && ./gradlew :app:bundleRelease \ 306 && cd - \ 307 && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \ 308 && cd bin \ 309 && java -jar ../.build/bundletool.jar build-apks --ks ../my-release-key.keystore --ks-key-alias alias_name --ks-pass pass:$(ANDROID_KEYSTORE_PASSWORD) --bundle=streamplace-$(VERSION)-android-release.aab --output=streamplace-$(VERSION)-android-release.apks --mode=universal \ 310 && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb 311 312.PHONY: android-debug 313android-debug: .build/bundletool.jar android-keystore 314 export NODE_ENV=production \ 315 && cd ./js/app/android \ 316 && ./gradlew :app:bundleDebug \ 317 && cd - \ 318 && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \ 319 && cd bin \ 320 && java -jar ../.build/bundletool.jar build-apks --ks ../my-release-key.keystore --ks-key-alias alias_name --ks-pass pass:$(ANDROID_KEYSTORE_PASSWORD) --bundle=streamplace-$(VERSION)-android-debug.aab --output=streamplace-$(VERSION)-android-debug.apks --mode=universal \ 321 && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb 322 323.PHONY: ios 324ios: app 325 xcodebuild \ 326 -workspace ./js/app/ios/Streamplace.xcworkspace \ 327 -sdk iphoneos \ 328 -configuration Release \ 329 -scheme Streamplace \ 330 -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \ 331 CODE_SIGN_IDENTITY=- \ 332 AD_HOC_CODE_SIGNING_ALLOWED=YES \ 333 CODE_SIGN_STYLE=Automatic \ 334 DEVELOPMENT_TEAM=ZZZZZZZZZZ \ 335 clean archive | xcpretty \ 336 && cd bin \ 337 && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive 338 339# xcodebuild -exportArchive -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive -exportOptionsPlist ./js/app/exportOptions.plist -exportPath ./bin/streamplace-$(VERSION)-ios-release.ipa 340 341.build/bundletool.jar: 342 mkdir -p .build \ 343 && curl -L -o ./.build/bundletool.jar https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar 344 345BASE_OPTS = \ 346 --buildtype=debugoptimized \ 347 -D "gst-plugins-base:audioresample=enabled" \ 348 -D "gst-plugins-base:playback=enabled" \ 349 -D "gst-plugins-base:opus=enabled" \ 350 -D "gst-plugins-base:gio-typefinder=enabled" \ 351 -D "gst-plugins-base:videotestsrc=enabled" \ 352 -D "gst-plugins-base:videoconvertscale=enabled" \ 353 -D "gst-plugins-base:typefind=enabled" \ 354 -D "gst-plugins-base:compositor=enabled" \ 355 -D "gst-plugins-base:videorate=enabled" \ 356 -D "gst-plugins-base:app=enabled" \ 357 -D "gst-plugins-base:audiorate=enabled" \ 358 -D "gst-plugins-base:audiotestsrc=enabled" \ 359 -D "gst-plugins-base:audioconvert=enabled" \ 360 -D "gst-plugins-good:matroska=enabled" \ 361 -D "gst-plugins-good:multifile=enabled" \ 362 -D "gst-plugins-good:rtp=enabled" \ 363 -D "gst-plugins-bad:fdkaac=enabled" \ 364 -D "gst-plugins-good:audioparsers=enabled" \ 365 -D "gst-plugins-good:isomp4=enabled" \ 366 -D "gst-plugins-good:png=enabled" \ 367 -D "gst-plugins-good:videobox=enabled" \ 368 -D "gst-plugins-good:jpeg=enabled" \ 369 -D "gst-plugins-good:audioparsers=enabled" \ 370 -D "gst-plugins-bad:videoparsers=enabled" \ 371 -D "gst-plugins-bad:mpegtsmux=enabled" \ 372 -D "gst-plugins-bad:mpegtsdemux=enabled" \ 373 -D "gst-plugins-bad:codectimestamper=enabled" \ 374 -D "gst-plugins-bad:opus=enabled" \ 375 -D "gst-plugins-ugly:x264=enabled" \ 376 -D "gst-plugins-ugly:gpl=enabled" \ 377 -D "x264:asm=enabled" \ 378 -D "gstreamer-full:gst-full=enabled" \ 379 -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" \ 380 -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \ 381 -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \ 382 -D "gstreamer-full:bad=enabled" \ 383 -D "gstreamer-full:tls=disabled" \ 384 -D "gstreamer-full:libav=enabled" \ 385 -D "gstreamer-full:ugly=enabled" \ 386 -D "gstreamer-full:gpl=enabled" \ 387 -D "gstreamer-full:gst-full-typefind-functions=" \ 388 -D "gstreamer:coretracers=enabled" \ 389 -D "gstreamer-full:glib_assert=false" \ 390 -D "gstreamer:glib_assert=false" \ 391 -D "gst-plugins-good:glib_assert=false" \ 392 -D "gst-plugins-bad:glib_assert=false" \ 393 -D "gst-plugins-base:glib_assert=false" \ 394 -D "gst-plugins-ugly:glib_assert=false" \ 395 -D "glib:glib_assert=false" \ 396 -D "glib:glib_assert=false" \ 397 -D "gst-libav:glib_assert=false" \ 398 -D "gst-plugins-good:adaptivedemux2=disabled" 399 400OPTS = \ 401 $(BASE_OPTS) \ 402 -D "gstreamer-full:gst-full-target-type=static_library" \ 403 -D "gstreamer:registry=false" 404 405SHARED_OPTS = \ 406 $(BASE_OPTS) \ 407 -D "FFmpeg:default_library=shared" \ 408 -D "gstreamer:registry=true" 409 410.PHONY: meson-setup 411meson-setup: 412 @meson setup $(BUILDDIR) $(OPTS) 413 @meson configure $(BUILDDIR) $(OPTS) 414 415.PHONY: node-all-platforms 416node-all-platforms: app 417 meson setup build-linux-amd64 $(OPTS) --buildtype debugoptimized 418 meson compile -C build-linux-amd64 archive 419 $(MAKE) link-test-linux 420 $(MAKE) linux-arm64 421 $(MAKE) windows-amd64 422 $(MAKE) windows-amd64-startup-test 423 $(MAKE) desktop-linux 424 $(MAKE) desktop-windows-amd64 425 426.PHONY: desktop-linux 427desktop-linux: 428 $(MAKE) desktop-linux-amd64 429 $(MAKE) desktop-linux-arm64 430 431.PHONY: desktop-linux-amd64 432desktop-linux-amd64: 433 cd js/desktop \ 434 && pnpm run make --platform linux --arch x64 \ 435 && cd - \ 436 && mv "js/desktop/out/make/AppImage/x64/Streamplace-$(VERSION_ELECTRON)-x64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-amd64.AppImage 437 438.PHONY: desktop-linux-arm64 439desktop-linux-arm64: 440 cd js/desktop \ 441 && pnpm run make --platform linux --arch arm64 \ 442 && cd - \ 443 && mv "js/desktop/out/make/AppImage/arm64/Streamplace-$(VERSION_ELECTRON)-arm64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-arm64.AppImage 444 445.PHONY: desktop-windows-amd64 446desktop-windows-amd64: 447 cd js/desktop \ 448 && pnpm run make --platform win32 --arch x64 \ 449 && cd - \ 450 && export SUM=$$(cat ./js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg | openssl sha1 | awk '{ print $$2 }') \ 451 && echo $$SUM > ./bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1 \ 452 && mv "js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \ 453 && mv "js/desktop/out/make/squirrel.windows/x64/Streamplace-$(VERSION_ELECTRON) Setup.exe" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.exe 454 455.PHONY: linux-amd64 456linux-amd64: 457 meson setup --buildtype debugoptimized build-linux-amd64 $(OPTS) 458 meson compile -C build-linux-amd64 archive 459 460.PHONY: linux-arm64 461linux-arm64: 462 rustup target add aarch64-unknown-linux-gnu 463 meson setup --cross-file util/linux-arm64-gnu.ini --buildtype debugoptimized build-linux-arm64 $(OPTS) 464 meson compile -C build-linux-arm64 archive 465 466.PHONY: windows-amd64 467windows-amd64: 468 rustup target add x86_64-pc-windows-gnu 469 $(MAKE) windows-amd64-meson-setup 470 meson compile -C build-windows-amd64 archive 2>&1 | grep -v drectve 471 $(MAKE) link-test-windows 472 473.PHONY: windows-amd64-meson-setup 474windows-amd64-meson-setup: 475 meson setup --cross-file util/windows-amd64-gnu.ini --buildtype debugoptimized build-windows-amd64 $(OPTS) 476 477# unbuffer here is a workaround for wine trying to pop up a terminal window and failing 478.PHONY: windows-amd64-startup-test 479windows-amd64-startup-test: 480 bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat' 481 482.PHONY: darwin-amd64 483darwin-amd64: 484 export CC=x86_64-apple-darwin24.4-clang \ 485 && export CC_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-clang \ 486 && export CXX_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-clang++ \ 487 && export AR_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-ar \ 488 && export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin24.4-clang \ 489 && export LD=x86_64-apple-darwin24.4-ld \ 490 && export CROSS_COMPILE=1 \ 491 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-amd64.ini build-darwin-amd64 $(OPTS) \ 492 && meson compile -C build-darwin-amd64 subprojects/glib-2.82.4/gio/gioenumtypes_h \ 493 && meson compile -C build-darwin-amd64 streamplace \ 494 && ./util/osxcross-codesign.sh ./build-darwin-amd64/streamplace \ 495 && mkdir -p bin \ 496 && cd build-darwin-amd64 \ 497 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \ 498 && cd - 499 500.PHONY: desktop-darwin-amd64 501desktop-darwin-amd64: 502 echo "TODO" 503 504.PHONY: darwin-amd64 505darwin-arm64: 506 export CC=aarch64-apple-darwin24.4-clang \ 507 && export CC_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-clang \ 508 && export CXX_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-clang++ \ 509 && export AR_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-ar \ 510 && export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin24.4-clang \ 511 && export LD=aarch64-apple-darwin24.4-ld \ 512 && export CROSS_COMPILE=1 \ 513 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-arm64.ini build-darwin-arm64 $(OPTS) \ 514 && meson compile -C build-darwin-arm64 streamplace \ 515 && ./util/osxcross-codesign.sh ./build-darwin-arm64/streamplace \ 516 && mkdir -p bin \ 517 && cd build-darwin-arm64 \ 518 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \ 519 && cd - 520 521.PHONY: desktop-darwin-arm64 522desktop-darwin-arm64: 523 echo "TODO" 524 525.PHONY: desktop-darwin 526desktop-darwin: 527 export DEBUG="electron-osx-sign*" \ 528 && cd js/desktop \ 529 && pnpm run make --platform darwin --arch arm64 \ 530 && pnpm run make --platform darwin --arch x64 \ 531 && cd - \ 532 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-x64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.dmg \ 533 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \ 534 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \ 535 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip 536 537.PHONY: selftest-macos 538selftest-macos: 539 js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test 540 541# link your local version of mist for dev 542.PHONY: link-mist 543link-mist: 544 rm -rf subprojects/mistserver 545 ln -s $$(realpath ../mistserver) ./subprojects/mistserver 546 547# link your local version of c2pa-go for dev 548.PHONY: link-c2pa-go 549link-c2pa-go: 550 rm -rf subprojects/c2pa_go 551 ln -s $$(realpath ../c2pa-go) ./subprojects/c2pa_go 552 553# link your local version of gstreamer 554.PHONY: link-gstreamer 555link-gstreamer: 556 rm -rf subprojects/gstreamer-full 557 ln -s $$(realpath ../gstreamer) ./subprojects/gstreamer-full 558 559# link your local version of ffmpeg for dev 560.PHONY: link-ffmpeg 561link-ffmpeg: 562 rm -rf subprojects/FFmpeg 563 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg 564 565.PHONY: docker 566docker: 567 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local . 568 569.PHONY: docker-build 570docker-build: docker-build-builder docker-build-in-container 571 572.PHONY: docker-test 573docker-test: docker-build-builder docker-test-in-container 574 575DOCKER_BUILD_OPTS?= 576BUILDER_TARGET?=builder 577.PHONY: docker-build-builder 578docker-build-builder: 579 podman build --target=$(BUILDER_TARGET) --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) $(DOCKER_BUILD_OPTS) . 580 581.PHONY: golangci-lint-container 582golangci-lint-container: docker-build-builder 583 podman run \ 584 -v $$(pwd):$$(pwd) \ 585 -w $$(pwd) \ 586 -e PKG_CONFIG_PATH=$$(pwd)/build-linux-amd64/meson-uninstalled \ 587 -d \ 588 --name golangci-lint \ 589 dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) \ 590 tail -f /dev/null 591 podman exec golangci-lint mkdir -p js/app/dist 592 podman exec golangci-lint touch js/app/dist/skip-build.txt 593 podman exec golangci-lint make node 594 595.PHONY: docker-build-in-container 596docker-build-in-container: 597 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node 598 599.PHONY: docker-test-in-container 600docker-test-in-container: 601 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node-and-test 602 603IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"' 604DOCKER_BIN?=podman 605DOCKER_REF?=dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) 606DOCKER_OPTS?= 607.PHONY: in-container 608in-container: docker-build-builder 609 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)" 610 611STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download 612.PHONY: docker-release 613docker-release: 614 cd docker \ 615 && docker build -f release.Dockerfile \ 616 --build-arg TARGETARCH=$(BUILDARCH) \ 617 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \ 618 -t dist.stream.place/streamplace/streamplace \ 619 . 620 621.PHONY: docker-mistserver 622docker-mistserver: 623 cd docker \ 624 && docker build -f mistserver.Dockerfile \ 625 --build-arg TARGETARCH=$(BUILDARCH) \ 626 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \ 627 -t dist.stream.place/streamplace/streamplace:mistserver \ 628 . 629 630FPM_BASE_OPTS= \ 631 -s dir \ 632 -t deb \ 633 -v $(VERSION_NO_V) \ 634 --force \ 635 --license=GPL-3.0-or-later \ 636 --maintainer="Streamplace <support@stream.place>" \ 637 --vendor="Streamplace" \ 638 --url="https://stream.place" 639SP_ARCH_NAME?=amd64 640.PHONY: deb-pkg 641deb-pkg: 642 fpm $(FPM_BASE_OPTS) \ 643 -n streamplace \ 644 -a $(SP_ARCH_NAME) \ 645 -p bin/streamplace-$(VERSION)-linux-$(SP_ARCH_NAME).deb \ 646 --deb-systemd=util/systemd/streamplace.service \ 647 --deb-systemd-restart-after-upgrade \ 648 --after-install=util/systemd/after-install.sh \ 649 --description="Live video for the AT Protocol. Solving video for everybody forever." \ 650 build-linux-$(SP_ARCH_NAME)/streamplace=/usr/bin/streamplace \ 651 && fpm $(FPM_BASE_OPTS) \ 652 -n streamplace-default-http \ 653 -a $(SP_ARCH_NAME) \ 654 -d streamplace \ 655 --deb-systemd-restart-after-upgrade \ 656 -p bin/streamplace-default-http-$(VERSION)-linux-$(SP_ARCH_NAME).deb \ 657 --description="Installing this package will install Streamplace as the default HTTP server on ports 80 and 443." \ 658 util/systemd/streamplace-http.socket=/lib/systemd/system/streamplace-http.socket \ 659 util/systemd/streamplace-https.socket=/lib/systemd/system/streamplace-https.socket 660 661.PHONY: pkg-linux-amd64 662pkg-linux-amd64: 663 $(MAKE) deb-pkg SP_ARCH_NAME=amd64 664 665.PHONY: pkg-linux-arm64 666pkg-linux-arm64: 667 $(MAKE) deb-pkg SP_ARCH_NAME=arm64 668 669.PHONY: pkg-darwin-amd64 670pkg-darwin-amd64: 671 echo todo 672 673.PHONY: pkg-darwin-arm64 674pkg-darwin-arm64: 675 echo todo 676 677.PHONY: pkg-windows-amd64 678pkg-windows-amd64: 679 echo todo 680 681.PHONY: ci-upload 682ci-upload: ci-upload-node ci-upload-android 683 684.PHONY: ci-upload-node-linux-amd64 685ci-upload-node-linux-amd64: 686 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-amd64.tar.gz \ 687 && $(MAKE) ci-upload-file upload_file=streamplace-desktop-$(VERSION)-linux-amd64.AppImage \ 688 && $(MAKE) ci-upload-file upload_file=streamplace-default-http-$(VERSION)-linux-amd64.deb \ 689 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-amd64.deb 690 691.PHONY: ci-upload-node-linux-arm64 692ci-upload-node-linux-arm64: 693 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-arm64.tar.gz \ 694 && $(MAKE) ci-upload-file upload_file=streamplace-desktop-$(VERSION)-linux-arm64.AppImage \ 695 && $(MAKE) ci-upload-file upload_file=streamplace-default-http-$(VERSION)-linux-arm64.deb \ 696 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-arm64.deb 697 698.PHONY: ci-upload-node-darwin-arm64 699ci-upload-node-darwin-arm64: 700 export file=streamplace-$(VERSION)-darwin-arm64.tar.gz \ 701 && $(MAKE) ci-upload-file upload_file=$$file; 702 703.PHONY: ci-upload-node-darwin-amd64 704ci-upload-node-darwin-amd64: 705 export file=streamplace-$(VERSION)-darwin-amd64.tar.gz \ 706 && $(MAKE) ci-upload-file upload_file=$$file; 707 708.PHONY: ci-upload-node-windows-amd64 709ci-upload-node-windows-amd64: 710 export file=streamplace-$(VERSION)-windows-amd64.zip \ 711 && $(MAKE) ci-upload-file upload_file=$$file; \ 712 export file=streamplace-desktop-$(VERSION)-windows-amd64.exe \ 713 && $(MAKE) ci-upload-file upload_file=$$file; \ 714 export SUM=$$(cat bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1) \ 715 && export file=streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \ 716 && $(MAKE) ci-upload-file upload_file=$$file; 717 718.PHONY: ci-upload-node-macos 719ci-upload-node-macos: node-all-platforms-macos 720 for GOOS in darwin; do \ 721 for GOARCH in amd64 arm64; do \ 722 export file=streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz \ 723 && $(MAKE) ci-upload-file upload_file=$$file; \ 724 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.dmg \ 725 && $(MAKE) ci-upload-file upload_file=$$file; \ 726 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.zip \ 727 && $(MAKE) ci-upload-file upload_file=$$file; \ 728 done \ 729 done; 730 731.PHONY: ci-upload-android 732ci-upload-android: android 733 $(MAKE) ci-upload-android-debug \ 734 && $(MAKE) ci-upload-android-release 735 736.PHONY: ci-upload-android-debug 737ci-upload-android-debug: 738 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.apk \ 739 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.aab 740 741.PHONY: ci-upload-android-release 742ci-upload-android-release: 743 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.apk \ 744 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.aab 745 746.PHONY: ci-upload-ios 747ci-upload-ios: ios 748 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-ios-release.xcarchive.tar.gz 749 750upload_file?="" 751.PHONY: ci-upload-file 752ci-upload-file: 753 curl \ 754 --fail-with-body \ 755 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \ 756 --upload-file bin/$(upload_file) \ 757 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(upload_file)"; 758 759download_file?="" 760.PHONY: ci-download-file 761ci-download-file: 762 curl \ 763 --fail-with-body \ 764 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \ 765 -o bin/$(download_file) \ 766 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(download_file)"; 767 768.PHONY: release 769release: install 770 $(MAKE) lexicons 771 pnpm run release 772 773.PHONY: ci-release 774ci-release: 775 go install gitlab.com/gitlab-org/release-cli/cmd/release-cli 776 go run ./pkg/config/git/git.go -release -o release.yml 777 release-cli create-from-file --file release.yml 778 779.PHONY: deb-release 780deb-release: 781 aptly repo create -distribution=all -component=main streamplace-releases 782 aptly mirror create old-version $$S3_PUBLIC_URL/debian all 783 aptly mirror update old-version 784 aptly repo import old-version streamplace-releases streamplace streamplace-default-http 785 aptly repo add streamplace-releases \ 786 bin/streamplace-default-http-$(VERSION)-linux-arm64.deb \ 787 bin/streamplace-$(VERSION)-linux-arm64.deb \ 788 bin/streamplace-default-http-$(VERSION)-linux-amd64.deb \ 789 bin/streamplace-$(VERSION)-linux-amd64.deb 790 aptly snapshot create streamplace-$(VERSION) from repo streamplace-releases 791 aptly publish snapshot -distribution=all streamplace-$(VERSION) s3:streamplace-releases: 792 793.PHONY: ci-deb-release 794ci-deb-release: 795 $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-amd64.deb 796 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.deb 797 $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-arm64.deb 798 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.deb 799 echo $$CI_SIGNING_KEY_BASE64 | base64 -d | gpg --import 800 gpg --armor --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import 801 echo '{"S3PublishEndpoints":{"streamplace-releases":{"region":"'$$S3_REGION'","bucket":"'$$S3_BUCKET_NAME'","endpoint":"'$$S3_ENDPOINT'","acl":"public-read","prefix":"debian"}}}' > ~/.aptly.conf 802 $(MAKE) deb-release 803 804.PHONY: check 805check: install 806 $(MAKE) golangci-lint 807 pnpm run check 808 if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi 809 810.PHONY: fix 811fix: 812 pnpm run fix 813 gofmt -w . 814 815.PHONY: precommit 816precommit: dockerfile-hash-precommit 817 818.PHONY: dockefile-hash-precommit 819dockerfile-hash-precommit: 820 @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \ 821 && git add .ci/dockerfile-hash.yaml 822 823.PHONY: rtcrec 824rtcrec: 825 go build -o $(BUILDDIR)/rtcrec ./pkg/rtcrec/cmd/... 826 827.PHONY: homebrew 828homebrew: 829 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.tar.gz 830 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.tar.gz 831 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-amd64.tar.gz 832 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-arm64.tar.gz 833 git clone git@github.com:streamplace/homebrew-streamplace.git /tmp/homebrew-streamplace 834 go run ./pkg/config/git/git.go -homebrew -o /tmp/homebrew-streamplace/Formula/streamplace.rb 835 836.PHONY: ci-homebrew 837ci-homebrew: 838 git config --global user.name "Streamplace Homebrew Robot" 839 git config --global user.email support@stream.place 840 mkdir -p ~/.ssh 841 echo "Host * \n\ 842 StrictHostKeyChecking no \n\ 843 UserKnownHostsFile=/dev/null" > ~/.ssh/config 844 echo "$$CI_HOMEBREW_KEY_BASE64" | base64 -d > ~/.ssh/id_ed25519 845 chmod 600 ~/.ssh/id_ed25519 846 847 chmod 600 ~/.ssh/config 848 $(MAKE) homebrew 849 cd /tmp/homebrew-streamplace \ 850 && git add . \ 851 && git commit -m "Update streamplace $(VERSION)" \ 852 && git push