Live video on the AT Protocol
at eli/postgres 843 lines 32 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 283.PHONY: android 284android: app .build/bundletool.jar 285 $(MAKE) android-release 286 $(MAKE) android-debug 287 288.PHONY: android-release 289android-release: .build/bundletool.jar 290 export NODE_ENV=production \ 291 && cd ./js/app/android \ 292 && ./gradlew :app:bundleRelease \ 293 && cd - \ 294 && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \ 295 && cd bin \ 296 && 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 \ 297 && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb 298 299.PHONY: android-debug 300android-debug: .build/bundletool.jar 301 export NODE_ENV=production \ 302 && cd ./js/app/android \ 303 && ./gradlew :app:bundleDebug \ 304 && cd - \ 305 && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \ 306 && cd bin \ 307 && 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 \ 308 && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb 309 310.PHONY: ios 311ios: app 312 xcodebuild \ 313 -workspace ./js/app/ios/Streamplace.xcworkspace \ 314 -sdk iphoneos \ 315 -configuration Release \ 316 -scheme Streamplace \ 317 -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \ 318 CODE_SIGN_IDENTITY=- \ 319 AD_HOC_CODE_SIGNING_ALLOWED=YES \ 320 CODE_SIGN_STYLE=Automatic \ 321 DEVELOPMENT_TEAM=ZZZZZZZZZZ \ 322 clean archive | xcpretty \ 323 && cd bin \ 324 && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive 325 326# xcodebuild -exportArchive -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive -exportOptionsPlist ./js/app/exportOptions.plist -exportPath ./bin/streamplace-$(VERSION)-ios-release.ipa 327 328.build/bundletool.jar: 329 mkdir -p .build \ 330 && curl -L -o ./.build/bundletool.jar https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar 331 332BASE_OPTS = \ 333 --buildtype=debugoptimized \ 334 -D "gst-plugins-base:audioresample=enabled" \ 335 -D "gst-plugins-base:playback=enabled" \ 336 -D "gst-plugins-base:opus=enabled" \ 337 -D "gst-plugins-base:gio-typefinder=enabled" \ 338 -D "gst-plugins-base:videotestsrc=enabled" \ 339 -D "gst-plugins-base:videoconvertscale=enabled" \ 340 -D "gst-plugins-base:typefind=enabled" \ 341 -D "gst-plugins-base:compositor=enabled" \ 342 -D "gst-plugins-base:videorate=enabled" \ 343 -D "gst-plugins-base:app=enabled" \ 344 -D "gst-plugins-base:audiorate=enabled" \ 345 -D "gst-plugins-base:audiotestsrc=enabled" \ 346 -D "gst-plugins-base:audioconvert=enabled" \ 347 -D "gst-plugins-good:matroska=enabled" \ 348 -D "gst-plugins-good:multifile=enabled" \ 349 -D "gst-plugins-good:rtp=enabled" \ 350 -D "gst-plugins-bad:fdkaac=enabled" \ 351 -D "gst-plugins-good:audioparsers=enabled" \ 352 -D "gst-plugins-good:isomp4=enabled" \ 353 -D "gst-plugins-good:png=enabled" \ 354 -D "gst-plugins-good:videobox=enabled" \ 355 -D "gst-plugins-good:jpeg=enabled" \ 356 -D "gst-plugins-good:audioparsers=enabled" \ 357 -D "gst-plugins-bad:videoparsers=enabled" \ 358 -D "gst-plugins-bad:mpegtsmux=enabled" \ 359 -D "gst-plugins-bad:mpegtsdemux=enabled" \ 360 -D "gst-plugins-bad:codectimestamper=enabled" \ 361 -D "gst-plugins-bad:opus=enabled" \ 362 -D "gst-plugins-ugly:x264=enabled" \ 363 -D "gst-plugins-ugly:gpl=enabled" \ 364 -D "x264:asm=enabled" \ 365 -D "gstreamer-full:gst-full=enabled" \ 366 -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" \ 367 -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \ 368 -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \ 369 -D "gstreamer-full:bad=enabled" \ 370 -D "gstreamer-full:tls=disabled" \ 371 -D "gstreamer-full:libav=enabled" \ 372 -D "gstreamer-full:ugly=enabled" \ 373 -D "gstreamer-full:gpl=enabled" \ 374 -D "gstreamer-full:gst-full-typefind-functions=" \ 375 -D "gstreamer:coretracers=enabled" \ 376 -D "gstreamer-full:glib_assert=false" \ 377 -D "gstreamer:glib_assert=false" \ 378 -D "gst-plugins-good:glib_assert=false" \ 379 -D "gst-plugins-bad:glib_assert=false" \ 380 -D "gst-plugins-base:glib_assert=false" \ 381 -D "gst-plugins-ugly:glib_assert=false" \ 382 -D "glib:glib_assert=false" \ 383 -D "glib:glib_assert=false" \ 384 -D "gst-libav:glib_assert=false" \ 385 -D "gst-plugins-good:adaptivedemux2=disabled" 386 387OPTS = \ 388 $(BASE_OPTS) \ 389 -D "gstreamer-full:gst-full-target-type=static_library" \ 390 -D "gstreamer:registry=false" 391 392SHARED_OPTS = \ 393 $(BASE_OPTS) \ 394 -D "FFmpeg:default_library=shared" \ 395 -D "gstreamer:registry=true" 396 397.PHONY: meson-setup 398meson-setup: 399 @meson setup $(BUILDDIR) $(OPTS) 400 @meson configure $(BUILDDIR) $(OPTS) 401 402.PHONY: node-all-platforms 403node-all-platforms: app 404 meson setup build-linux-amd64 $(OPTS) --buildtype debugoptimized 405 meson compile -C build-linux-amd64 archive 406 $(MAKE) link-test-linux 407 $(MAKE) linux-arm64 408 $(MAKE) windows-amd64 409 $(MAKE) windows-amd64-startup-test 410 $(MAKE) desktop-linux 411 $(MAKE) desktop-windows-amd64 412 413.PHONY: desktop-linux 414desktop-linux: 415 $(MAKE) desktop-linux-amd64 416 $(MAKE) desktop-linux-arm64 417 418.PHONY: desktop-linux-amd64 419desktop-linux-amd64: 420 cd js/desktop \ 421 && pnpm run make --platform linux --arch x64 \ 422 && cd - \ 423 && mv "js/desktop/out/make/AppImage/x64/Streamplace-$(VERSION_ELECTRON)-x64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-amd64.AppImage 424 425.PHONY: desktop-linux-arm64 426desktop-linux-arm64: 427 cd js/desktop \ 428 && pnpm run make --platform linux --arch arm64 \ 429 && cd - \ 430 && mv "js/desktop/out/make/AppImage/arm64/Streamplace-$(VERSION_ELECTRON)-arm64.AppImage" ./bin/streamplace-desktop-$(VERSION)-linux-arm64.AppImage 431 432.PHONY: desktop-windows-amd64 433desktop-windows-amd64: 434 cd js/desktop \ 435 && pnpm run make --platform win32 --arch x64 \ 436 && cd - \ 437 && export SUM=$$(cat ./js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg | openssl sha1 | awk '{ print $$2 }') \ 438 && echo $$SUM > ./bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1 \ 439 && mv "js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \ 440 && mv "js/desktop/out/make/squirrel.windows/x64/Streamplace-$(VERSION_ELECTRON) Setup.exe" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.exe 441 442.PHONY: linux-amd64 443linux-amd64: 444 meson setup --buildtype debugoptimized build-linux-amd64 $(OPTS) 445 meson compile -C build-linux-amd64 archive 446 447.PHONY: linux-arm64 448linux-arm64: 449 rustup target add aarch64-unknown-linux-gnu 450 meson setup --cross-file util/linux-arm64-gnu.ini --buildtype debugoptimized build-linux-arm64 $(OPTS) 451 meson compile -C build-linux-arm64 archive 452 453.PHONY: windows-amd64 454windows-amd64: 455 rustup target add x86_64-pc-windows-gnu 456 $(MAKE) windows-amd64-meson-setup 457 meson compile -C build-windows-amd64 archive 2>&1 | grep -v drectve 458 $(MAKE) link-test-windows 459 460.PHONY: windows-amd64-meson-setup 461windows-amd64-meson-setup: 462 meson setup --cross-file util/windows-amd64-gnu.ini --buildtype debugoptimized build-windows-amd64 $(OPTS) 463 464# unbuffer here is a workaround for wine trying to pop up a terminal window and failing 465.PHONY: windows-amd64-startup-test 466windows-amd64-startup-test: 467 bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat' 468 469.PHONY: darwin-amd64 470darwin-amd64: 471 export CC=x86_64-apple-darwin24.4-clang \ 472 && export CC_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-clang \ 473 && export CXX_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-clang++ \ 474 && export AR_X86_64_APPLE_DARWIN=x86_64-apple-darwin24.4-ar \ 475 && export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin24.4-clang \ 476 && export LD=x86_64-apple-darwin24.4-ld \ 477 && export CROSS_COMPILE=1 \ 478 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-amd64.ini build-darwin-amd64 $(OPTS) \ 479 && meson compile -C build-darwin-amd64 subprojects/glib-2.82.4/gio/gioenumtypes_h \ 480 && meson compile -C build-darwin-amd64 streamplace \ 481 && ./util/osxcross-codesign.sh ./build-darwin-amd64/streamplace \ 482 && mkdir -p bin \ 483 && cd build-darwin-amd64 \ 484 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \ 485 && cd - 486 487.PHONY: desktop-darwin-amd64 488desktop-darwin-amd64: 489 echo "TODO" 490 491.PHONY: darwin-amd64 492darwin-arm64: 493 export CC=aarch64-apple-darwin24.4-clang \ 494 && export CC_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-clang \ 495 && export CXX_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-clang++ \ 496 && export AR_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-ar \ 497 && export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin24.4-clang \ 498 && export LD=aarch64-apple-darwin24.4-ld \ 499 && export CROSS_COMPILE=1 \ 500 && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-arm64.ini build-darwin-arm64 $(OPTS) \ 501 && meson compile -C build-darwin-arm64 streamplace \ 502 && ./util/osxcross-codesign.sh ./build-darwin-arm64/streamplace \ 503 && mkdir -p bin \ 504 && cd build-darwin-arm64 \ 505 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \ 506 && cd - 507 508.PHONY: desktop-darwin-arm64 509desktop-darwin-arm64: 510 echo "TODO" 511 512.PHONY: desktop-darwin 513desktop-darwin: 514 export DEBUG="electron-osx-sign*" \ 515 && cd js/desktop \ 516 && pnpm run make --platform darwin --arch arm64 \ 517 && pnpm run make --platform darwin --arch x64 \ 518 && cd - \ 519 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-x64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.dmg \ 520 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \ 521 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \ 522 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip 523 524.PHONY: selftest-macos 525selftest-macos: 526 js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test 527 528# link your local version of mist for dev 529.PHONY: link-mist 530link-mist: 531 rm -rf subprojects/mistserver 532 ln -s $$(realpath ../mistserver) ./subprojects/mistserver 533 534# link your local version of c2pa-go for dev 535.PHONY: link-c2pa-go 536link-c2pa-go: 537 rm -rf subprojects/c2pa_go 538 ln -s $$(realpath ../c2pa-go) ./subprojects/c2pa_go 539 540# link your local version of gstreamer 541.PHONY: link-gstreamer 542link-gstreamer: 543 rm -rf subprojects/gstreamer-full 544 ln -s $$(realpath ../gstreamer) ./subprojects/gstreamer-full 545 546# link your local version of ffmpeg for dev 547.PHONY: link-ffmpeg 548link-ffmpeg: 549 rm -rf subprojects/FFmpeg 550 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg 551 552.PHONY: docker 553docker: 554 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local . 555 556.PHONY: docker-build 557docker-build: docker-build-builder docker-build-in-container 558 559.PHONY: docker-test 560docker-test: docker-build-builder docker-test-in-container 561 562DOCKER_BUILD_OPTS?= 563BUILDER_TARGET?=builder 564.PHONY: docker-build-builder 565docker-build-builder: 566 podman build --target=$(BUILDER_TARGET) --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) $(DOCKER_BUILD_OPTS) . 567 568.PHONY: golangci-lint-container 569golangci-lint-container: docker-build-builder 570 podman run \ 571 -v $$(pwd):$$(pwd) \ 572 -w $$(pwd) \ 573 -e PKG_CONFIG_PATH=$$(pwd)/build-linux-amd64/meson-uninstalled \ 574 -d \ 575 --name golangci-lint \ 576 dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) \ 577 tail -f /dev/null 578 podman exec golangci-lint mkdir -p js/app/dist 579 podman exec golangci-lint touch js/app/dist/skip-build.txt 580 podman exec golangci-lint make node 581 582.PHONY: docker-build-in-container 583docker-build-in-container: 584 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node 585 586.PHONY: docker-test-in-container 587docker-test-in-container: 588 podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node-and-test 589 590IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"' 591DOCKER_BIN?=podman 592DOCKER_REF?=dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) 593DOCKER_OPTS?= 594.PHONY: in-container 595in-container: docker-build-builder 596 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)" 597 598STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download 599.PHONY: docker-release 600docker-release: 601 cd docker \ 602 && docker build -f release.Dockerfile \ 603 --build-arg TARGETARCH=$(BUILDARCH) \ 604 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \ 605 -t dist.stream.place/streamplace/streamplace \ 606 . 607 608.PHONY: docker-mistserver 609docker-mistserver: 610 cd docker \ 611 && docker build -f mistserver.Dockerfile \ 612 --build-arg TARGETARCH=$(BUILDARCH) \ 613 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \ 614 -t dist.stream.place/streamplace/streamplace:mistserver \ 615 . 616 617FPM_BASE_OPTS= \ 618 -s dir \ 619 -t deb \ 620 -v $(VERSION_NO_V) \ 621 --force \ 622 --license=GPL-3.0-or-later \ 623 --maintainer="Streamplace <support@stream.place>" \ 624 --vendor="Streamplace" \ 625 --url="https://stream.place" 626SP_ARCH_NAME?=amd64 627.PHONY: deb-pkg 628deb-pkg: 629 fpm $(FPM_BASE_OPTS) \ 630 -n streamplace \ 631 -a $(SP_ARCH_NAME) \ 632 -p bin/streamplace-$(VERSION)-linux-$(SP_ARCH_NAME).deb \ 633 --deb-systemd=util/systemd/streamplace.service \ 634 --deb-systemd-auto-start \ 635 --deb-systemd-enable \ 636 --deb-systemd-restart-after-upgrade \ 637 --after-install=util/systemd/after-install.sh \ 638 --description="Live video for the AT Protocol. Solving video for everybody forever." \ 639 build-linux-$(SP_ARCH_NAME)/streamplace=/usr/bin/streamplace \ 640 && fpm $(FPM_BASE_OPTS) \ 641 -n streamplace-default-http \ 642 -a $(SP_ARCH_NAME) \ 643 -d streamplace \ 644 --deb-systemd-auto-start \ 645 --deb-systemd-enable \ 646 --deb-systemd-restart-after-upgrade \ 647 -p bin/streamplace-default-http-$(VERSION)-linux-$(SP_ARCH_NAME).deb \ 648 --description="Installing this package will install Streamplace as the default HTTP server on ports 80 and 443." \ 649 util/systemd/streamplace-http.socket=/lib/systemd/system/streamplace-http.socket \ 650 util/systemd/streamplace-https.socket=/lib/systemd/system/streamplace-https.socket 651 652.PHONY: pkg-linux-amd64 653pkg-linux-amd64: 654 $(MAKE) deb-pkg SP_ARCH_NAME=amd64 655 656.PHONY: pkg-linux-arm64 657pkg-linux-arm64: 658 $(MAKE) deb-pkg SP_ARCH_NAME=arm64 659 660.PHONY: pkg-darwin-amd64 661pkg-darwin-amd64: 662 echo todo 663 664.PHONY: pkg-darwin-arm64 665pkg-darwin-arm64: 666 echo todo 667 668.PHONY: pkg-windows-amd64 669pkg-windows-amd64: 670 echo todo 671 672.PHONY: ci-upload 673ci-upload: ci-upload-node ci-upload-android 674 675.PHONY: ci-upload-node-linux-amd64 676ci-upload-node-linux-amd64: 677 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-amd64.tar.gz \ 678 && $(MAKE) ci-upload-file upload_file=streamplace-desktop-$(VERSION)-linux-amd64.AppImage \ 679 && $(MAKE) ci-upload-file upload_file=streamplace-default-http-$(VERSION)-linux-amd64.deb \ 680 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-amd64.deb 681 682.PHONY: ci-upload-node-linux-arm64 683ci-upload-node-linux-arm64: 684 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-arm64.tar.gz \ 685 && $(MAKE) ci-upload-file upload_file=streamplace-desktop-$(VERSION)-linux-arm64.AppImage \ 686 && $(MAKE) ci-upload-file upload_file=streamplace-default-http-$(VERSION)-linux-arm64.deb \ 687 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-linux-arm64.deb 688 689.PHONY: ci-upload-node-darwin-arm64 690ci-upload-node-darwin-arm64: 691 export file=streamplace-$(VERSION)-darwin-arm64.tar.gz \ 692 && $(MAKE) ci-upload-file upload_file=$$file; 693 694.PHONY: ci-upload-node-darwin-amd64 695ci-upload-node-darwin-amd64: 696 export file=streamplace-$(VERSION)-darwin-amd64.tar.gz \ 697 && $(MAKE) ci-upload-file upload_file=$$file; 698 699.PHONY: ci-upload-node-windows-amd64 700ci-upload-node-windows-amd64: 701 export file=streamplace-$(VERSION)-windows-amd64.zip \ 702 && $(MAKE) ci-upload-file upload_file=$$file; \ 703 export file=streamplace-desktop-$(VERSION)-windows-amd64.exe \ 704 && $(MAKE) ci-upload-file upload_file=$$file; \ 705 export SUM=$$(cat bin/streamplace-desktop-$(VERSION)-windows-amd64.nupkg.sha1) \ 706 && export file=streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \ 707 && $(MAKE) ci-upload-file upload_file=$$file; 708 709.PHONY: ci-upload-node-macos 710ci-upload-node-macos: node-all-platforms-macos 711 for GOOS in darwin; do \ 712 for GOARCH in amd64 arm64; do \ 713 export file=streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz \ 714 && $(MAKE) ci-upload-file upload_file=$$file; \ 715 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.dmg \ 716 && $(MAKE) ci-upload-file upload_file=$$file; \ 717 export file=streamplace-desktop-$(VERSION)-$$GOOS-$$GOARCH.zip \ 718 && $(MAKE) ci-upload-file upload_file=$$file; \ 719 done \ 720 done; 721 722.PHONY: ci-upload-android 723ci-upload-android: android 724 $(MAKE) ci-upload-android-debug \ 725 && $(MAKE) ci-upload-android-release 726 727.PHONY: ci-upload-android-debug 728ci-upload-android-debug: 729 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.apk \ 730 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-debug.aab 731 732.PHONY: ci-upload-android-release 733ci-upload-android-release: 734 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.apk \ 735 && $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-android-release.aab 736 737.PHONY: ci-upload-ios 738ci-upload-ios: ios 739 $(MAKE) ci-upload-file upload_file=streamplace-$(VERSION)-ios-release.xcarchive.tar.gz 740 741upload_file?="" 742.PHONY: ci-upload-file 743ci-upload-file: 744 curl \ 745 --fail-with-body \ 746 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \ 747 --upload-file bin/$(upload_file) \ 748 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(upload_file)"; 749 750download_file?="" 751.PHONY: ci-download-file 752ci-download-file: 753 curl \ 754 --fail-with-body \ 755 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \ 756 -o bin/$(download_file) \ 757 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(download_file)"; 758 759.PHONY: release 760release: install 761 $(MAKE) lexicons 762 pnpm run release 763 764.PHONY: ci-release 765ci-release: 766 go install gitlab.com/gitlab-org/release-cli/cmd/release-cli 767 go run ./pkg/config/git/git.go -release -o release.yml 768 release-cli create-from-file --file release.yml 769 770.PHONY: deb-release 771deb-release: 772 aptly repo create -distribution=all -component=main streamplace-releases 773 aptly mirror create old-version $$S3_PUBLIC_URL/debian all 774 aptly mirror update old-version 775 aptly repo import old-version streamplace-releases streamplace streamplace-default-http 776 aptly repo add streamplace-releases \ 777 bin/streamplace-default-http-$(VERSION)-linux-arm64.deb \ 778 bin/streamplace-$(VERSION)-linux-arm64.deb \ 779 bin/streamplace-default-http-$(VERSION)-linux-amd64.deb \ 780 bin/streamplace-$(VERSION)-linux-amd64.deb 781 aptly snapshot create streamplace-$(VERSION) from repo streamplace-releases 782 aptly publish snapshot -distribution=all streamplace-$(VERSION) s3:streamplace-releases: 783 784.PHONY: ci-deb-release 785ci-deb-release: 786 $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-amd64.deb 787 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.deb 788 $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-arm64.deb 789 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.deb 790 echo $$CI_SIGNING_KEY_BASE64 | base64 -d | gpg --import 791 gpg --armor --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import 792 echo '{"S3PublishEndpoints":{"streamplace-releases":{"region":"'$$S3_REGION'","bucket":"'$$S3_BUCKET_NAME'","endpoint":"'$$S3_ENDPOINT'","acl":"public-read","prefix":"debian"}}}' > ~/.aptly.conf 793 $(MAKE) deb-release 794 795.PHONY: check 796check: install 797 $(MAKE) golangci-lint 798 pnpm run check 799 if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi 800 801.PHONY: fix 802fix: 803 pnpm run fix 804 gofmt -w . 805 806.PHONY: precommit 807precommit: dockerfile-hash-precommit 808 809.PHONY: dockefile-hash-precommit 810dockerfile-hash-precommit: 811 @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \ 812 && git add .ci/dockerfile-hash.yaml 813 814.PHONY: rtcrec 815rtcrec: 816 go build -o $(BUILDDIR)/rtcrec ./pkg/rtcrec/cmd/... 817 818.PHONY: homebrew 819homebrew: 820 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.tar.gz 821 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.tar.gz 822 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-amd64.tar.gz 823 $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-arm64.tar.gz 824 git clone git@github.com:streamplace/homebrew-streamplace.git /tmp/homebrew-streamplace 825 go run ./pkg/config/git/git.go -homebrew -o /tmp/homebrew-streamplace/Formula/streamplace.rb 826 827.PHONY: ci-homebrew 828ci-homebrew: 829 git config --global user.name "Streamplace Homebrew Robot" 830 git config --global user.email support@stream.place 831 mkdir -p ~/.ssh 832 echo "Host * \n\ 833 StrictHostKeyChecking no \n\ 834 UserKnownHostsFile=/dev/null" > ~/.ssh/config 835 echo "$$CI_HOMEBREW_KEY_BASE64" | base64 -d > ~/.ssh/id_ed25519 836 chmod 600 ~/.ssh/id_ed25519 837 838 chmod 600 ~/.ssh/config 839 $(MAKE) homebrew 840 cd /tmp/homebrew-streamplace \ 841 && git add . \ 842 && git commit -m "Update streamplace $(VERSION)" \ 843 && git push