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