Live video on the AT Protocol

build: substantial refactor into static and dynamic builds

authored by

Eli Mallon and committed by
Eli Mallon
85926c8f c00aaef3

+627 -409
+3 -3
.github/workflows/build.yaml
··· 19 19 include: 20 20 - name: linux-amd64 21 21 cmd: >- 22 - make && (make test || make test) && make check && make ci-lexicons 22 + make linux-amd64 && make test && make check && make ci-lexicons 23 23 - name: linux-arm64 24 - cmd: "make app && make linux-arm64" 24 + cmd: "make linux-arm64" 25 25 - name: windows-amd64 26 - cmd: "make app && make windows-amd64 && make desktop-windows-amd64" 26 + cmd: "make windows-amd64 && make desktop-windows-amd64" 27 27 - name: android 28 28 cmd: "make app && make android-release" 29 29 steps:
+1 -1
.gitlab-ci.yml
··· 71 71 script: 72 72 - rm -rf /usr/x86_64-w64-mingw32/include/d3dcompiler.h /usr/share/mingw-w64/include/d3dcompiler.h /usr/lib/gcc/x86_64-w64-mingw32/10-posix/libssp.dll.a /usr/lib/gcc/x86_64-w64-mingw32/10-posix/libssp-0.dll /usr/lib/gcc/x86_64-w64-mingw32/10-win32/libssp-0.dll /usr/lib/gcc/x86_64-w64-mingw32/10-win32/libssp.dll.a 73 73 - git fetch --unshallow || echo 'already unshallow' 74 - - bash -c "make version && make app && make $TARGET && make desktop-$TARGET && make pkg-$TARGET && make ci-upload-node-$TARGET -j$(nproc)" 74 + - bash -c "make version && make $TARGET && make desktop-$TARGET && make pkg-$TARGET && make ci-upload-node-$TARGET -j$(nproc)" 75 75 artifacts: 76 76 reports: 77 77 dotenv: .ci/build.env
+437 -321
Makefile
··· 2 2 $(shell mkdir -p $(OUT_DIR)) 3 3 4 4 .PHONY: default 5 - default: app node 5 + default: streamplace 6 6 7 7 VERSION?=$(shell go run ./pkg/config/git/git.go -v) 8 8 VERSION_NO_V=$(subst v,,$(VERSION)) ··· 23 23 MACOS_VERSION_FLAG=-mmacosx-version-min=$(shell sw_vers -productVersion) 24 24 endif 25 25 BUILDDIR?=build-$(BUILDOS)-$(BUILDARCH) 26 - SHARED_PKG_CONFIG_PATH=$(shell pwd)/$(BUILDDIR)/lib/pkgconfig 26 + PKG_CONFIG_PATH=$(shell pwd)/$(BUILDDIR)/lib/pkgconfig:$(shell pwd)/$(BUILDDIR)/lib/gstreamer-1.0/pkgconfig:$(shell pwd)/$(BUILDDIR)/meson-uninstalled 27 27 28 28 .PHONY: version 29 29 version: 30 30 @go run ./pkg/config/git/git.go -v \ 31 31 && go run ./pkg/config/git/git.go --env -o .ci/build.env 32 32 33 + # _____ _____ 34 + # /\ | __ \| __ \ 35 + # / \ | |__) | |__) | 36 + # / /\ \ | ___/| ___/ 37 + # / ____ \| | | | 38 + # /_/ \_\_| |_| 39 + 40 + # front-end stuff innit 41 + 33 42 .PHONY: install 34 43 install: 35 44 pnpm install 36 45 37 - .PHONY: app-and-node 38 - app-and-node: 39 - $(MAKE) app 40 - $(MAKE) node 41 - 42 - .PHONY: app-and-node-and-test 43 - app-and-node-and-test: 44 - $(MAKE) app 45 - $(MAKE) node 46 - $(MAKE) test 47 46 .PHONY: app 48 - app: schema install 47 + app: install 49 48 pnpm run build 50 49 51 - .PHONY: node 52 - node: schema 50 + .PHONY: app-cached 51 + app-cached: 52 + if [ ! -f js/app/dist/index.html ]; then $(MAKE) app; else echo "js/app/dist/index.html exists, not rebuilding, run make app to rebuild"; fi 53 + 54 + .PHONY: ci-ios 55 + ci-ios: version install app 56 + $(MAKE) ios 57 + $(MAKE) ci-upload-ios 58 + 59 + .PHONY: ci-android 60 + ci-android: version install android ci-upload-android 61 + 62 + .PHONY: ci-android-debug 63 + ci-android-debug: version install 64 + pnpm run app prebuild 65 + $(MAKE) android-debug 66 + $(MAKE) ci-upload-android-debug 67 + 68 + .PHONY: ci-android-release 69 + ci-android-release: version install 70 + pnpm run app prebuild 71 + $(MAKE) android-release 72 + $(MAKE) ci-upload-android-release 73 + 74 + 75 + ANDROID_KEYSTORE_PASSWORD?=streamplace 76 + ANDROID_KEYSTORE_ALIAS?=alias_name 77 + ANDROID_KEYSTORE_BASE64?= 78 + 79 + .PHONY: android-keystore 80 + android-keystore: 81 + if [ -n "$$ANDROID_KEYSTORE_BASE64" ]; then \ 82 + echo "$$ANDROID_KEYSTORE_BASE64" | base64 -d > my-release-key.keystore; \ 83 + fi; \ 84 + if [ ! -f my-release-key.keystore ]; then \ 85 + 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"; \ 86 + fi 87 + 88 + .PHONY: android 89 + android: app .build/bundletool.jar 90 + $(MAKE) android-release 91 + $(MAKE) android-debug 92 + 93 + .PHONY: android-release 94 + android-release: .build/bundletool.jar android-keystore 95 + export NODE_ENV=production \ 96 + && cd ./js/app/android \ 97 + && ./gradlew :app:bundleRelease \ 98 + && cd - \ 99 + && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \ 100 + && cd bin \ 101 + && 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 \ 102 + && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb 103 + 104 + .PHONY: android-debug 105 + android-debug: .build/bundletool.jar android-keystore 106 + export NODE_ENV=production \ 107 + && cd ./js/app/android \ 108 + && ./gradlew :app:bundleDebug \ 109 + && cd - \ 110 + && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \ 111 + && cd bin \ 112 + && 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 \ 113 + && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb 114 + 115 + .PHONY: ios 116 + ios: app 117 + xcodebuild \ 118 + -workspace ./js/app/ios/Streamplace.xcworkspace \ 119 + -sdk iphoneos \ 120 + -configuration Release \ 121 + -scheme Streamplace \ 122 + -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \ 123 + CODE_SIGN_IDENTITY=- \ 124 + AD_HOC_CODE_SIGNING_ALLOWED=YES \ 125 + CODE_SIGN_STYLE=Automatic \ 126 + DEVELOPMENT_TEAM=ZZZZZZZZZZ \ 127 + clean archive | xcpretty \ 128 + && cd bin \ 129 + && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive 130 + 131 + # _____ ____ 132 + # / ____|/ __ \ 133 + # | | __| | | | 134 + # | | |_ | | | | 135 + # | |__| | |__| | 136 + # \_____|\____/ 137 + 138 + .PHONY: rtcrec 139 + rtcrec: 140 + go build -o $(BUILDDIR)/rtcrec ./pkg/rtcrec/cmd/... 141 + 142 + # __ __ ______ _____ ____ _ _ 143 + # | \/ | ____|/ ____|/ __ \| \ | | 144 + # | \ / | |__ | (___ | | | | \| | 145 + # | |\/| | __| \___ \| | | | . ` | 146 + # | | | | |____ ____) | |__| | |\ | 147 + # |_| |_|______|_____/ \____/|_| \_| 148 + 149 + BASE_OPTS = \ 150 + --buildtype=debugoptimized \ 151 + -D "gst-plugins-base:audioresample=enabled" \ 152 + -D "gst-plugins-base:playback=enabled" \ 153 + -D "gst-plugins-base:opus=enabled" \ 154 + -D "gst-plugins-base:gio-typefinder=enabled" \ 155 + -D "gst-plugins-base:videotestsrc=enabled" \ 156 + -D "gst-plugins-base:videoconvertscale=enabled" \ 157 + -D "gst-plugins-base:typefind=enabled" \ 158 + -D "gst-plugins-base:compositor=enabled" \ 159 + -D "gst-plugins-base:videorate=enabled" \ 160 + -D "gst-plugins-base:app=enabled" \ 161 + -D "gst-plugins-base:audiorate=enabled" \ 162 + -D "gst-plugins-base:audiotestsrc=enabled" \ 163 + -D "gst-plugins-base:audioconvert=enabled" \ 164 + -D "gst-plugins-good:matroska=enabled" \ 165 + -D "gst-plugins-good:multifile=enabled" \ 166 + -D "gst-plugins-good:rtp=enabled" \ 167 + -D "gst-plugins-bad:fdkaac=enabled" \ 168 + -D "gst-plugins-good:audioparsers=enabled" \ 169 + -D "gst-plugins-good:isomp4=enabled" \ 170 + -D "gst-plugins-good:png=enabled" \ 171 + -D "gst-plugins-good:videobox=enabled" \ 172 + -D "gst-plugins-good:jpeg=enabled" \ 173 + -D "gst-plugins-good:audioparsers=enabled" \ 174 + -D "gst-plugins-bad:videoparsers=enabled" \ 175 + -D "gst-plugins-bad:mpegtsmux=enabled" \ 176 + -D "gst-plugins-bad:mpegtsdemux=enabled" \ 177 + -D "gst-plugins-bad:codectimestamper=enabled" \ 178 + -D "gst-plugins-bad:opus=enabled" \ 179 + -D "gst-plugins-ugly:x264=enabled" \ 180 + -D "gst-plugins-ugly:gpl=enabled" \ 181 + -D "x264:asm=enabled" \ 182 + -D "gstreamer-full:gst-full=enabled" \ 183 + -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" \ 184 + -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \ 185 + -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \ 186 + -D "gstreamer-full:bad=enabled" \ 187 + -D "gstreamer-full:tls=disabled" \ 188 + -D "gstreamer-full:libav=enabled" \ 189 + -D "gstreamer-full:ugly=enabled" \ 190 + -D "gstreamer-full:gpl=enabled" \ 191 + -D "gstreamer-full:gst-full-typefind-functions=" \ 192 + -D "gstreamer:coretracers=enabled" \ 193 + -D "gstreamer-full:glib_assert=false" \ 194 + -D "gstreamer:glib_assert=false" \ 195 + -D "gst-plugins-good:glib_assert=false" \ 196 + -D "gst-plugins-bad:glib_assert=false" \ 197 + -D "gst-plugins-base:glib_assert=false" \ 198 + -D "gst-plugins-ugly:glib_assert=false" \ 199 + -D "glib:glib_assert=false" \ 200 + -D "glib:glib_assert=false" \ 201 + -D "gst-libav:glib_assert=false" \ 202 + -D "gst-plugins-good:adaptivedemux2=disabled" 203 + 204 + STATIC_OPTS = \ 205 + $(BASE_OPTS) \ 206 + -D "gstreamer-full:gst-full-target-type=static_library" \ 207 + -D "gstreamer:registry=false" 208 + 209 + SHARED_OPTS = \ 210 + $(BASE_OPTS) \ 211 + -D "FFmpeg:default_library=shared" \ 212 + -D "gstreamer:registry=true" 213 + 214 + .PHONY: meson 215 + meson: 53 216 $(MAKE) meson-setup 54 - meson compile -C $(BUILDDIR) streamplace 55 - meson install --no-rebuild -C $(BUILDDIR) 217 + $(MAKE) meson-compile 56 218 57 - js/app/dist/index.html: install 58 - pnpm run build 219 + MESON_SETUP_OPTS?= 220 + .PHONY: meson-setup 221 + meson-setup: 222 + @meson setup $(BUILDDIR) $(MESON_SETUP_OPTS) 223 + @meson configure $(BUILDDIR) $(OPTS) 224 + 225 + .PHONY: meson-setup-static 226 + meson-setup-static: 227 + @meson setup $(BUILDDIR) $(MESON_SETUP_OPTS) $(STATIC_OPTS) 228 + @meson configure $(BUILDDIR) $(STATIC_OPTS) 229 + 230 + .PHONY: meson-compile 231 + meson-compile: 232 + meson install -C $(BUILDDIR) 233 + 234 + 235 + # _____ _______ _______ _____ _____ 236 + # / ____|__ __|/\|__ __|_ _/ ____| 237 + # | (___ | | / \ | | | || | 238 + # \___ \ | | / /\ \ | | | || | 239 + # ____) | | |/ ____ \| | _| || |____ 240 + # |_____/ |_/_/ \_\_| |_____\_____| 241 + 242 + # Production distributions of Streamplace with bundled node and app. 243 + 244 + static: 245 + $(MAKE) meson-setup meson-compile app OPTS=$(STATIC_OPTS) -j16 246 + $(MAKE) streamplace 247 + 248 + .PHONY: static-test 249 + static-test: 250 + meson test -C $(BUILDDIR) go-tests 251 + 252 + # _____ ________ __ 253 + # | __ \| ____\ \ / / 254 + # | | | | |__ \ \ / / 255 + # | | | | __| \ \/ / 256 + # | |__| | |____ \ / 257 + # |_____/|______| \/ 258 + 259 + # Local builds of Streamplace with node and app. 59 260 60 261 .PHONY: dev-setup 61 - dev-setup: schema install js/app/dist/index.html 62 - $(MAKE) dev-setup-meson 63 - $(MAKE) dev 262 + dev-setup: 263 + $(MAKE) -j16 app-cached dev-setup-meson 264 + 265 + .PHONY: dev 266 + dev: app-cached 267 + if [ ! -d $(BUILDDIR) ]; then $(MAKE) dev-setup; fi 268 + cp ./util/streamplace-dev.sh $(BUILDDIR)/streamplace 269 + $(MAKE) dev-rust 270 + PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) \ 271 + CGO_LDFLAGS="$(MACOS_VERSION_FLAG)" \ 272 + LD_LIBRARY_PATH=$(BUILDDIR)/lib go build -o $(BUILDDIR)/libstreamplace ./cmd/libstreamplace/... 64 273 65 274 .PHONY: dev-setup-meson 66 275 dev-setup-meson: 67 276 $(MAKE) dev-setup-meson-configure 68 - $(MAKE) dev-setup-meson-compile 277 + $(MAKE) meson-compile 69 278 70 279 .PHONY: dev-setup-meson-configure 71 280 dev-setup-meson-configure: ··· 73 282 meson setup --default-library=shared $(BUILDDIR) $(SHARED_OPTS) 74 283 meson configure --default-library=shared $(BUILDDIR) $(SHARED_OPTS) 75 284 76 - .PHONY: dev-setup-meson-compile 77 - dev-setup-meson-compile: 78 - meson install -C $(BUILDDIR) 79 - 80 285 .PHONY: dev-rust 81 286 dev-rust: 82 287 cargo build ··· 86 291 && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/rust/iroh-streamplace/libiroh_streamplace.$$EXT \ 87 292 && cp ./target/debug/libiroh_streamplace.$$EXT $(BUILDDIR)/lib/libiroh_streamplace.$$EXT 88 293 89 - .PHONY: dev 90 - dev: 91 - cp ./util/streamplace-dev.sh $(BUILDDIR)/streamplace 92 - $(MAKE) dev-rust 93 - PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 94 - CGO_LDFLAGS="$(MACOS_VERSION_FLAG)" go build -o $(BUILDDIR)/libstreamplace ./cmd/libstreamplace/... 294 + .PHONY: dev-test 295 + dev-test: 296 + PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) \ 297 + LD_LIBRARY_PATH=$(shell realpath $(BUILDDIR))/lib \ 298 + go test -p 1 -timeout 300s ./... 299 + 300 + # _ _____ _ _ _______ _____ _ _ _____ 301 + # | | |_ _| \ | |__ __|_ _| \ | |/ ____| 302 + # | | | | | \| | | | | | | \| | | __ 303 + # | | | | | . ` | | | | | | . ` | | |_ | 304 + # | |____ _| |_| |\ | | | _| |_| |\ | |__| | 305 + # |______|_____|_| \_| |_| |_____|_| \_|\_____| 306 + 307 + .PHONY: check 308 + check: install 309 + $(MAKE) golangci-lint 310 + pnpm run check 311 + if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi 312 + 313 + .PHONY: fix 314 + fix: 315 + pnpm run fix 316 + gofmt -w . 95 317 96 318 .PHONY: golangci-lint 97 319 golangci-lint: 98 - @PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 320 + @PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) \ 99 321 go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint run -c ./.golangci.yaml 100 322 101 - .PHONY: dev-test 102 - dev-test: 103 - PKG_CONFIG_PATH=$(SHARED_PKG_CONFIG_PATH) \ 104 - go test -p 1 -timeout 300s ./... 323 + # _ ________ _______ _____ ____ _ _ _____ 324 + # | | | ____\ \ / /_ _/ ____/ __ \| \ | |/ ____| 325 + # | | | |__ \ V / | || | | | | | \| | (___ 326 + # | | | __| > < | || | | | | | . ` |\___ \ 327 + # | |____| |____ / . \ _| || |___| |__| | |\ |____) | 328 + # |______|______/_/ \_\_____\_____\____/|_| \_|_____/ 105 329 106 - .PHONY: schema 107 - schema: 108 - mkdir -p js/app/generated \ 109 - && go run pkg/crypto/signers/eip712/export-schema/export-schema.go > js/app/generated/eip712-schema.json 330 + # Mostly codegen for lexicons. 110 331 111 332 .PHONY: lexicons 112 333 lexicons: ··· 142 363 done \ 143 364 && npx prettier --write $$(find ./js/streamplace/src/lexicons -type f -name '*.ts') \ 144 365 && find . | grep bak$$ | xargs rm 145 - 146 366 147 367 .PHONY: md-lexicons 148 368 md-lexicons: ··· 193 413 $(MAKE) lexicons \ 194 414 && if ! git diff --exit-code >/dev/null; then echo "lexicons are out of date, run 'make lexicons' to fix"; exit 1; fi 195 415 196 - .PHONY: test 197 - test: 198 - meson test -C $(BUILDDIR) go-tests 416 + # _______ ______ _____ _______ _____ _ _ _____ 417 + # |__ __| ____|/ ____|__ __|_ _| \ | |/ ____| 418 + # | | | |__ | (___ | | | | | \| | | __ 419 + # | | | __| \___ \ | | | | | . ` | | |_ | 420 + # | | | |____ ____) | | | _| |_| |\ | |__| | 421 + # |_| |______|_____/ |_| |_____|_| \_|\_____| 199 422 200 423 # test to make sure we haven't added any more dynamic dependencies 201 424 LINUX_LINK_COUNT=5 ··· 228 451 && exit 1; \ 229 452 fi 230 453 231 - .PHONY: all 232 - all: version install app test node-all-platforms android 233 - 234 454 .PHONY: ci 235 455 ci: version install app node-all-platforms ci-upload-node 236 456 237 - .PHONY: ci-ios 238 - ci-ios: version install app 239 - $(MAKE) ios 240 - $(MAKE) ci-upload-ios 241 457 242 458 .PHONY: ci-desktop-darwin 243 459 ci-desktop-darwin: version install ··· 258 474 && $(MAKE) ci-upload-file upload_file=$$file; \ 259 475 done 260 476 261 - .PHONY: ci-android 262 - ci-android: version install android ci-upload-android 263 - 264 - .PHONY: ci-android-debug 265 - ci-android-debug: version install 266 - pnpm run app prebuild 267 - $(MAKE) android-debug 268 - $(MAKE) ci-upload-android-debug 269 - 270 - .PHONY: ci-android-release 271 - ci-android-release: version install 272 - pnpm run app prebuild 273 - $(MAKE) android-release 274 - $(MAKE) ci-upload-android-release 275 - 276 477 .PHONY: ci-test 277 478 ci-test: app 278 479 meson setup $(BUILDDIR) $(OPTS) ··· 283 484 echo //registry.npmjs.org/:_authToken=$$NPM_TOKEN > ~/.npmrc \ 284 485 && npx lerna publish from-package --yes 285 486 286 - ANDROID_KEYSTORE_PASSWORD?=streamplace 287 - ANDROID_KEYSTORE_ALIAS?=alias_name 288 - ANDROID_KEYSTORE_BASE64?= 289 - 290 - .PHONY: android-keystore 291 - android-keystore: 292 - if [ -n "$$ANDROID_KEYSTORE_BASE64" ]; then \ 293 - echo "$$ANDROID_KEYSTORE_BASE64" | base64 -d > my-release-key.keystore; \ 294 - fi; \ 295 - if [ ! -f my-release-key.keystore ]; then \ 296 - 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"; \ 297 - fi 298 - 299 - .PHONY: android 300 - android: app .build/bundletool.jar 301 - $(MAKE) android-release 302 - $(MAKE) android-debug 303 - 304 - .PHONY: android-release 305 - android-release: .build/bundletool.jar android-keystore 306 - export NODE_ENV=production \ 307 - && cd ./js/app/android \ 308 - && ./gradlew :app:bundleRelease \ 309 - && cd - \ 310 - && mv ./js/app/android/app/build/outputs/bundle/release/app-release.aab ./bin/streamplace-$(VERSION)-android-release.aab \ 311 - && cd bin \ 312 - && 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 \ 313 - && unzip streamplace-$(VERSION)-android-release.apks && mv universal.apk streamplace-$(VERSION)-android-release.apk && rm toc.pb 314 - 315 - .PHONY: android-debug 316 - android-debug: .build/bundletool.jar android-keystore 317 - export NODE_ENV=production \ 318 - && cd ./js/app/android \ 319 - && ./gradlew :app:bundleDebug \ 320 - && cd - \ 321 - && mv ./js/app/android/app/build/outputs/bundle/debug/app-debug.aab ./bin/streamplace-$(VERSION)-android-debug.aab \ 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 - && unzip streamplace-$(VERSION)-android-debug.apks && mv universal.apk streamplace-$(VERSION)-android-debug.apk && rm toc.pb 325 - 326 - .PHONY: ios 327 - ios: app 328 - xcodebuild \ 329 - -workspace ./js/app/ios/Streamplace.xcworkspace \ 330 - -sdk iphoneos \ 331 - -configuration Release \ 332 - -scheme Streamplace \ 333 - -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive \ 334 - CODE_SIGN_IDENTITY=- \ 335 - AD_HOC_CODE_SIGNING_ALLOWED=YES \ 336 - CODE_SIGN_STYLE=Automatic \ 337 - DEVELOPMENT_TEAM=ZZZZZZZZZZ \ 338 - clean archive | xcpretty \ 339 - && cd bin \ 340 - && tar -czvf streamplace-$(VERSION)-ios-release.xcarchive.tar.gz streamplace-$(VERSION)-ios-release.xcarchive 341 - 342 - # xcodebuild -exportArchive -archivePath ./bin/streamplace-$(VERSION)-ios-release.xcarchive -exportOptionsPlist ./js/app/exportOptions.plist -exportPath ./bin/streamplace-$(VERSION)-ios-release.ipa 343 - 344 487 .build/bundletool.jar: 345 488 mkdir -p .build \ 346 489 && curl -L -o ./.build/bundletool.jar https://github.com/google/bundletool/releases/download/1.17.0/bundletool-all-1.17.0.jar 347 490 348 - BASE_OPTS = \ 349 - --buildtype=debugoptimized \ 350 - -D "gst-plugins-base:audioresample=enabled" \ 351 - -D "gst-plugins-base:playback=enabled" \ 352 - -D "gst-plugins-base:opus=enabled" \ 353 - -D "gst-plugins-base:gio-typefinder=enabled" \ 354 - -D "gst-plugins-base:videotestsrc=enabled" \ 355 - -D "gst-plugins-base:videoconvertscale=enabled" \ 356 - -D "gst-plugins-base:typefind=enabled" \ 357 - -D "gst-plugins-base:compositor=enabled" \ 358 - -D "gst-plugins-base:videorate=enabled" \ 359 - -D "gst-plugins-base:app=enabled" \ 360 - -D "gst-plugins-base:audiorate=enabled" \ 361 - -D "gst-plugins-base:audiotestsrc=enabled" \ 362 - -D "gst-plugins-base:audioconvert=enabled" \ 363 - -D "gst-plugins-good:matroska=enabled" \ 364 - -D "gst-plugins-good:multifile=enabled" \ 365 - -D "gst-plugins-good:rtp=enabled" \ 366 - -D "gst-plugins-bad:fdkaac=enabled" \ 367 - -D "gst-plugins-good:audioparsers=enabled" \ 368 - -D "gst-plugins-good:isomp4=enabled" \ 369 - -D "gst-plugins-good:png=enabled" \ 370 - -D "gst-plugins-good:videobox=enabled" \ 371 - -D "gst-plugins-good:jpeg=enabled" \ 372 - -D "gst-plugins-good:audioparsers=enabled" \ 373 - -D "gst-plugins-bad:videoparsers=enabled" \ 374 - -D "gst-plugins-bad:mpegtsmux=enabled" \ 375 - -D "gst-plugins-bad:mpegtsdemux=enabled" \ 376 - -D "gst-plugins-bad:codectimestamper=enabled" \ 377 - -D "gst-plugins-bad:opus=enabled" \ 378 - -D "gst-plugins-ugly:x264=enabled" \ 379 - -D "gst-plugins-ugly:gpl=enabled" \ 380 - -D "x264:asm=enabled" \ 381 - -D "gstreamer-full:gst-full=enabled" \ 382 - -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" \ 383 - -D "gstreamer-full:gst-full-libraries=gstreamer-controller-1.0,gstreamer-plugins-base-1.0,gstreamer-pbutils-1.0" \ 384 - -D "gstreamer-full:gst-full-elements=coreelements:concat,filesrc,filesink,queue,queue2,multiqueue,typefind,tee,capsfilter,fakesink,identity" \ 385 - -D "gstreamer-full:bad=enabled" \ 386 - -D "gstreamer-full:tls=disabled" \ 387 - -D "gstreamer-full:libav=enabled" \ 388 - -D "gstreamer-full:ugly=enabled" \ 389 - -D "gstreamer-full:gpl=enabled" \ 390 - -D "gstreamer-full:gst-full-typefind-functions=" \ 391 - -D "gstreamer:coretracers=enabled" \ 392 - -D "gstreamer-full:glib_assert=false" \ 393 - -D "gstreamer:glib_assert=false" \ 394 - -D "gst-plugins-good:glib_assert=false" \ 395 - -D "gst-plugins-bad:glib_assert=false" \ 396 - -D "gst-plugins-base:glib_assert=false" \ 397 - -D "gst-plugins-ugly:glib_assert=false" \ 398 - -D "glib:glib_assert=false" \ 399 - -D "glib:glib_assert=false" \ 400 - -D "gst-libav:glib_assert=false" \ 401 - -D "gst-plugins-good:adaptivedemux2=disabled" 491 + .PHONY: selftest-macos 492 + selftest-macos: 493 + js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test 402 494 403 - OPTS = \ 404 - $(BASE_OPTS) \ 405 - -D "gstreamer-full:gst-full-target-type=static_library" \ 406 - -D "gstreamer:registry=false" 495 + # _____ _____ ____ _____ _____ 496 + # / ____| __ \ / __ \ / ____/ ____| 497 + # | | | |__) | | | | (___| (___ 498 + # | | | _ /| | | |\___ \\___ \ 499 + # | |____| | \ \| |__| |____) |___) | 500 + # \_____|_| \_\\____/|_____/_____/ 501 + # _____ ____ __ __ _____ _____ _ _____ _ _ _____ 502 + # / ____/ __ \| \/ | __ \_ _| | |_ _| \ | |/ ____| 503 + # | | | | | | \ / | |__) || | | | | | | \| | | __ 504 + # | | | | | | |\/| | ___/ | | | | | | | . ` | | |_ | 505 + # | |___| |__| | | | | | _| |_| |____ _| |_| |\ | |__| | 506 + # \_____\____/|_| |_|_| |_____|______|_____|_| \_|\_____| 407 507 408 - SHARED_OPTS = \ 409 - $(BASE_OPTS) \ 410 - -D "FFmpeg:default_library=shared" \ 411 - -D "gstreamer:registry=true" 508 + # Cross-compiling is exclusively right now from linux-amd64 to: 412 509 413 - .PHONY: meson-setup 414 - meson-setup: 415 - @meson setup $(BUILDDIR) $(OPTS) 416 - @meson configure $(BUILDDIR) $(OPTS) 510 + # linux-amd64 (native) 511 + # linux-arm64 512 + # windows-amd64 513 + # darwin-amd64 514 + # darwin-arm64 417 515 418 516 .PHONY: node-all-platforms 419 517 node-all-platforms: app ··· 455 553 && mv "js/desktop/out/make/squirrel.windows/x64/streamplace_desktop-$(VERSION_ELECTRON)-full.nupkg" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.$$SUM.nupkg \ 456 554 && mv "js/desktop/out/make/squirrel.windows/x64/Streamplace-$(VERSION_ELECTRON) Setup.exe" ./bin/streamplace-desktop-$(VERSION)-windows-amd64.exe 457 555 556 + .PHONY: streamplace 557 + streamplace: app-cached meson-setup-static 558 + meson compile -C $(BUILDDIR) streamplace | grep -v drectve 559 + 560 + .PHONY: archive 561 + archive: app-cached meson-setup-static 562 + meson compile -C $(BUILDDIR) archive | grep -v drectve 563 + 458 564 .PHONY: linux-amd64 459 565 linux-amd64: 460 - meson setup --buildtype debugoptimized build-linux-amd64 $(OPTS) 461 - meson compile -C build-linux-amd64 archive 566 + $(MAKE) -j $(shell nproc) archive 567 + $(MAKE) link-test-linux 462 568 463 569 .PHONY: linux-arm64 464 570 linux-arm64: 465 - rustup target add aarch64-unknown-linux-gnu 466 - meson setup --cross-file util/linux-arm64-gnu.ini --buildtype debugoptimized build-linux-arm64 $(OPTS) 467 - meson compile -C build-linux-arm64 archive 571 + rustup target add aarch64-unknown-linux-gnu \ 572 + && CC=aarch64-linux-gnu-gcc \ 573 + LD=aarch64-linux-gnu-ld \ 574 + CROSS_COMPILE=1 \ 575 + MESON_SETUP_OPTS="--cross-file util/linux-arm64-gnu.ini" \ 576 + BUILDDIR=build-linux-arm64 \ 577 + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ 578 + $(MAKE) -j $(shell nproc) archive 468 579 469 580 .PHONY: windows-amd64 470 581 windows-amd64: 471 - rustup target add x86_64-pc-windows-gnu 472 - $(MAKE) windows-amd64-meson-setup 473 - meson compile -C build-windows-amd64 archive 2>&1 | grep -v drectve 474 - $(MAKE) link-test-windows 475 - 476 - .PHONY: windows-amd64-meson-setup 477 - windows-amd64-meson-setup: 478 - meson setup --cross-file util/windows-amd64-gnu.ini --buildtype debugoptimized build-windows-amd64 $(OPTS) 479 - 480 - # unbuffer here is a workaround for wine trying to pop up a terminal window and failing 481 - .PHONY: windows-amd64-startup-test 482 - windows-amd64-startup-test: 483 - bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat' 582 + rustup target add x86_64-pc-windows-gnu \ 583 + && CC=x86_64-w64-mingw32-gcc \ 584 + LD=x86_64-w64-mingw32-ld \ 585 + CROSS_COMPILE=1 \ 586 + MESON_SETUP_OPTS="--cross-file util/windows-amd64-gnu.ini" \ 587 + BUILDDIR=build-windows-amd64 \ 588 + $(MAKE) -j $(shell nproc) archive 484 589 485 590 .PHONY: darwin-amd64 486 591 darwin-amd64: ··· 491 596 && export CARGO_TARGET_X86_64_APPLE_DARWIN_LINKER=x86_64-apple-darwin24.4-clang \ 492 597 && export LD=x86_64-apple-darwin24.4-ld \ 493 598 && export CROSS_COMPILE=1 \ 494 - && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-amd64.ini build-darwin-amd64 $(OPTS) \ 495 - && meson compile -C build-darwin-amd64 subprojects/glib-2.82.4/gio/gioenumtypes_h \ 496 - && meson compile -C build-darwin-amd64 streamplace \ 599 + && export MESON_SETUP_OPTS="--cross-file util/osxcross-darwin-amd64.ini" \ 600 + && export BUILDDIR=build-darwin-amd64 \ 601 + && $(MAKE) -j $(shell nproc) streamplace \ 497 602 && ./util/osxcross-codesign.sh ./build-darwin-amd64/streamplace \ 498 603 && mkdir -p bin \ 499 604 && cd build-darwin-amd64 \ 500 605 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-amd64.tar.gz ./streamplace \ 501 606 && cd - 502 607 503 - .PHONY: desktop-darwin-amd64 504 - desktop-darwin-amd64: 505 - echo "TODO" 506 - 507 - .PHONY: darwin-amd64 608 + .PHONY: darwin-arm64 508 609 darwin-arm64: 509 610 export CC=aarch64-apple-darwin24.4-clang \ 510 611 && export CC_AARCH64_APPLE_DARWIN=aarch64-apple-darwin24.4-clang \ ··· 513 614 && export CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKER=aarch64-apple-darwin24.4-clang \ 514 615 && export LD=aarch64-apple-darwin24.4-ld \ 515 616 && export CROSS_COMPILE=1 \ 516 - && meson setup --buildtype debugoptimized --cross-file util/osxcross-darwin-arm64.ini build-darwin-arm64 $(OPTS) \ 517 - && meson compile -C build-darwin-arm64 streamplace \ 617 + && export MESON_SETUP_OPTS="--cross-file util/osxcross-darwin-arm64.ini" \ 618 + && export BUILDDIR=build-darwin-arm64 \ 619 + && $(MAKE) -j $(shell nproc) streamplace \ 518 620 && ./util/osxcross-codesign.sh ./build-darwin-arm64/streamplace \ 519 621 && mkdir -p bin \ 520 622 && cd build-darwin-arm64 \ 521 623 && tar -czvf ../bin/streamplace-$(VERSION)-darwin-arm64.tar.gz ./streamplace \ 522 624 && cd - 523 625 626 + # unbuffer here is a workaround for wine trying to pop up a terminal window and failing 627 + .PHONY: windows-amd64-startup-test 628 + windows-amd64-startup-test: 629 + bash -c 'set -euo pipefail && unbuffer wine64 ./build-windows-amd64/streamplace.exe self-test | cat' 630 + 631 + .PHONY: desktop-darwin-amd64 632 + desktop-darwin-amd64: 633 + echo "TODO" 634 + 524 635 .PHONY: desktop-darwin-arm64 525 636 desktop-darwin-arm64: 526 637 echo "TODO" ··· 536 647 && mv js/desktop/out/make/Streamplace-$(VERSION_ELECTRON)-arm64.dmg ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.dmg \ 537 648 && mv js/desktop/out/make/zip/darwin/x64/Streamplace-darwin-x64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-amd64.zip \ 538 649 && mv js/desktop/out/make/zip/darwin/arm64/Streamplace-darwin-arm64-$(VERSION_ELECTRON).zip ./bin/streamplace-desktop-$(VERSION)-darwin-arm64.zip 539 - 540 - .PHONY: selftest-macos 541 - selftest-macos: 542 - js/desktop/out/Streamplace-darwin-arm64/Streamplace.app/Contents/MacOS/Streamplace -- --self-test 543 650 544 651 # link your local version of mist for dev 545 652 .PHONY: link-mist ··· 565 672 rm -rf subprojects/FFmpeg 566 673 ln -s $$(realpath ../ffmpeg) ./subprojects/FFmpeg 567 674 675 + # _____ ____ _____ _ ________ _____ 676 + # | __ \ / __ \ / ____| |/ / ____| __ \ 677 + # | | | | | | | | | ' /| |__ | |__) | 678 + # | | | | | | | | | < | __| | _ / 679 + # | |__| | |__| | |____| . \| |____| | \ \ 680 + # |_____/ \____/ \_____|_|\_\______|_| \_\ 681 + 682 + # Actually, Podman. I'm not sure if these commands will actually run on Docker, untested. 683 + 568 684 .PHONY: docker 569 685 docker: 570 686 docker build -f docker/local.Dockerfile -t dist.stream.place/streamplace/streamplace:local . ··· 581 697 docker-build-builder: 582 698 podman build --target=$(BUILDER_TARGET) --os=linux --arch=amd64 -f docker/build.Dockerfile -t dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) $(DOCKER_BUILD_OPTS) . 583 699 700 + .PHONY: precommit 701 + precommit: dockerfile-hash-precommit 702 + 703 + .PHONY: dockefile-hash-precommit 704 + dockerfile-hash-precommit: 705 + @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \ 706 + && git add .ci/dockerfile-hash.yaml 707 + 708 + # tricks the github action for golangci-lint to run inside a container 584 709 .PHONY: golangci-lint-container 585 710 golangci-lint-container: docker-build-builder 586 711 podman run \ ··· 592 717 dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) \ 593 718 tail -f /dev/null 594 719 podman exec golangci-lint mkdir -p js/app/dist 595 - podman exec golangci-lint touch js/app/dist/skip-build.txt 596 - podman exec golangci-lint make node 597 - 598 - .PHONY: docker-build-in-container 599 - docker-build-in-container: 600 - podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node 601 - 602 - .PHONY: docker-test-in-container 603 - docker-test-in-container: 604 - podman run -v $$(pwd):$$(pwd) -w $$(pwd) --rm -it dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) make app-and-node-and-test 720 + podman exec golangci-lint touch js/app/dist/index.html 721 + podman exec golangci-lint make dev 605 722 723 + # runs a command in the build container, building if necessary 606 724 IN_CONTAINER_CMD?=echo 'usage: make in-container IN_CONTAINER_CMD=\"<command>\"' 607 725 DOCKER_BIN?=podman 608 726 DOCKER_REF?=dist.stream.place/streamplace/streamplace:$(BUILDER_TARGET) ··· 610 728 .PHONY: in-container 611 729 in-container: docker-build-builder 612 730 $(DOCKER_BIN) run $(DOCKER_OPTS) -v $$(pwd):$$(pwd) -w $$(pwd) --rm $(DOCKER_REF) bash -c "$(IN_CONTAINER_CMD)" 731 + 732 + .PHONY: docker-shell 733 + docker-shell: 734 + $(MAKE) in-container IN_CONTAINER_CMD="bash" DOCKER_OPTS="-it -v $$(pwd):$$(pwd) -w $$(pwd)" 613 735 614 736 STREAMPLACE_URL?=https://git.stream.place/streamplace/streamplace/-/package_files/10122/download 615 737 .PHONY: docker-release ··· 628 750 --build-arg TARGETARCH=$(BUILDARCH) \ 629 751 --build-arg STREAMPLACE_URL=$(STREAMPLACE_URL) \ 630 752 -t dist.stream.place/streamplace/streamplace:mistserver \ 631 - . 753 + 754 + # _____ _____ _____ _______ _____ ____ 755 + # | __ \_ _|/ ____|__ __| __ \ / __ \ 756 + # | | | || | | (___ | | | |__) | | | | 757 + # | | | || | \___ \ | | | _ /| | | | 758 + # | |__| || |_ ____) | | | | | \ \| |__| | 759 + # |_____/_____|_____/ |_| |_| \_\\____/ 760 + 761 + # distro: cut new versions, build apt and brew packages, upload to S3/gitlab 762 + 763 + .PHONY: release 764 + release: install 765 + $(MAKE) lexicons 766 + pnpm run release 767 + 768 + .PHONY: ci-release 769 + ci-release: 770 + go install gitlab.com/gitlab-org/release-cli/cmd/release-cli 771 + go run ./pkg/config/git/git.go -release -o release.yml 772 + release-cli create-from-file --file release.yml 773 + 774 + .PHONY: homebrew 775 + homebrew: 776 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.tar.gz 777 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.tar.gz 778 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-amd64.tar.gz 779 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-arm64.tar.gz 780 + git clone git@github.com:streamplace/homebrew-streamplace.git /tmp/homebrew-streamplace 781 + go run ./pkg/config/git/git.go -homebrew -o /tmp/homebrew-streamplace/Formula/streamplace.rb 782 + 783 + .PHONY: ci-homebrew 784 + ci-homebrew: 785 + git config --global user.name "Streamplace Homebrew Robot" 786 + git config --global user.email support@stream.place 787 + mkdir -p ~/.ssh 788 + echo "Host * \n\ 789 + StrictHostKeyChecking no \n\ 790 + UserKnownHostsFile=/dev/null" > ~/.ssh/config 791 + echo "$$CI_HOMEBREW_KEY_BASE64" | base64 -d > ~/.ssh/id_ed25519 792 + chmod 600 ~/.ssh/id_ed25519 793 + 794 + chmod 600 ~/.ssh/config 795 + $(MAKE) homebrew 796 + cd /tmp/homebrew-streamplace \ 797 + && git add . \ 798 + && git commit -m "Update streamplace $(VERSION)" \ 799 + && git push 632 800 633 801 FPM_BASE_OPTS= \ 634 802 -s dir \ ··· 681 849 pkg-windows-amd64: 682 850 echo todo 683 851 852 + .PHONY: deb-release 853 + deb-release: 854 + aptly repo create -distribution=all -component=main streamplace-releases 855 + aptly mirror create old-version $$S3_PUBLIC_URL/debian all 856 + aptly mirror update old-version 857 + aptly repo import old-version streamplace-releases streamplace streamplace-default-http 858 + aptly repo add streamplace-releases \ 859 + bin/streamplace-default-http-$(VERSION)-linux-arm64.deb \ 860 + bin/streamplace-$(VERSION)-linux-arm64.deb \ 861 + bin/streamplace-default-http-$(VERSION)-linux-amd64.deb \ 862 + bin/streamplace-$(VERSION)-linux-amd64.deb 863 + aptly snapshot create streamplace-$(VERSION) from repo streamplace-releases 864 + aptly publish snapshot -distribution=all streamplace-$(VERSION) s3:streamplace-releases: 865 + 866 + .PHONY: ci-deb-release 867 + ci-deb-release: 868 + $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-amd64.deb 869 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.deb 870 + $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-arm64.deb 871 + $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.deb 872 + echo $$CI_SIGNING_KEY_BASE64 | base64 -d | gpg --import 873 + gpg --armor --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import 874 + echo '{"S3PublishEndpoints":{"streamplace-releases":{"region":"'$$S3_REGION'","bucket":"'$$S3_BUCKET_NAME'","endpoint":"'$$S3_ENDPOINT'","acl":"public-read","prefix":"debian"}}}' > ~/.aptly.conf 875 + $(MAKE) deb-release 876 + 877 + # _____ _____ 878 + # / ____|_ _| 879 + # | | | | 880 + # | | | | 881 + # | |____ _| |_ 882 + # \_____|_____| 883 + 884 + # mostly "do a thing and then gitlab upload the artifact" 885 + 684 886 .PHONY: ci-upload 685 887 ci-upload: ci-upload-node ci-upload-android 686 888 ··· 767 969 --header "JOB-TOKEN: $$CI_JOB_TOKEN" \ 768 970 -o bin/$(download_file) \ 769 971 "$$CI_API_V4_URL/projects/$$CI_PROJECT_ID/packages/generic/$(BRANCH)/$(VERSION)/$(download_file)"; 770 - 771 - .PHONY: release 772 - release: install 773 - $(MAKE) lexicons 774 - pnpm run release 775 - 776 - .PHONY: ci-release 777 - ci-release: 778 - go install gitlab.com/gitlab-org/release-cli/cmd/release-cli 779 - go run ./pkg/config/git/git.go -release -o release.yml 780 - release-cli create-from-file --file release.yml 781 - 782 - .PHONY: deb-release 783 - deb-release: 784 - aptly repo create -distribution=all -component=main streamplace-releases 785 - aptly mirror create old-version $$S3_PUBLIC_URL/debian all 786 - aptly mirror update old-version 787 - aptly repo import old-version streamplace-releases streamplace streamplace-default-http 788 - aptly repo add streamplace-releases \ 789 - bin/streamplace-default-http-$(VERSION)-linux-arm64.deb \ 790 - bin/streamplace-$(VERSION)-linux-arm64.deb \ 791 - bin/streamplace-default-http-$(VERSION)-linux-amd64.deb \ 792 - bin/streamplace-$(VERSION)-linux-amd64.deb 793 - aptly snapshot create streamplace-$(VERSION) from repo streamplace-releases 794 - aptly publish snapshot -distribution=all streamplace-$(VERSION) s3:streamplace-releases: 795 - 796 - .PHONY: ci-deb-release 797 - ci-deb-release: 798 - $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-amd64.deb 799 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.deb 800 - $(MAKE) ci-download-file download_file=streamplace-default-http-$(VERSION)-linux-arm64.deb 801 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.deb 802 - echo $$CI_SIGNING_KEY_BASE64 | base64 -d | gpg --import 803 - gpg --armor --export | gpg --no-default-keyring --keyring trustedkeys.gpg --import 804 - echo '{"S3PublishEndpoints":{"streamplace-releases":{"region":"'$$S3_REGION'","bucket":"'$$S3_BUCKET_NAME'","endpoint":"'$$S3_ENDPOINT'","acl":"public-read","prefix":"debian"}}}' > ~/.aptly.conf 805 - $(MAKE) deb-release 806 - 807 - .PHONY: check 808 - check: install 809 - $(MAKE) golangci-lint 810 - pnpm run check 811 - if [ "`gofmt -l . | wc -l`" -gt 0 ]; then echo 'gofmt failed, run make fix'; exit 1; fi 812 - 813 - .PHONY: fix 814 - fix: 815 - pnpm run fix 816 - gofmt -w . 817 - 818 - .PHONY: precommit 819 - precommit: dockerfile-hash-precommit 820 - 821 - .PHONY: dockefile-hash-precommit 822 - dockerfile-hash-precommit: 823 - @bash -c 'printf "variables:\n DOCKERFILE_HASH: `git hash-object docker/build.Dockerfile`" > .ci/dockerfile-hash.yaml' \ 824 - && git add .ci/dockerfile-hash.yaml 825 - 826 - .PHONY: rtcrec 827 - rtcrec: 828 - go build -o $(BUILDDIR)/rtcrec ./pkg/rtcrec/cmd/... 829 - 830 - .PHONY: homebrew 831 - homebrew: 832 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-amd64.tar.gz 833 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-linux-arm64.tar.gz 834 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-amd64.tar.gz 835 - $(MAKE) ci-download-file download_file=streamplace-$(VERSION)-darwin-arm64.tar.gz 836 - git clone git@github.com:streamplace/homebrew-streamplace.git /tmp/homebrew-streamplace 837 - go run ./pkg/config/git/git.go -homebrew -o /tmp/homebrew-streamplace/Formula/streamplace.rb 838 - 839 - .PHONY: ci-homebrew 840 - ci-homebrew: 841 - git config --global user.name "Streamplace Homebrew Robot" 842 - git config --global user.email support@stream.place 843 - mkdir -p ~/.ssh 844 - echo "Host * \n\ 845 - StrictHostKeyChecking no \n\ 846 - UserKnownHostsFile=/dev/null" > ~/.ssh/config 847 - echo "$$CI_HOMEBREW_KEY_BASE64" | base64 -d > ~/.ssh/id_ed25519 848 - chmod 600 ~/.ssh/id_ed25519 849 - 850 - chmod 600 ~/.ssh/config 851 - $(MAKE) homebrew 852 - cd /tmp/homebrew-streamplace \ 853 - && git add . \ 854 - && git commit -m "Update streamplace $(VERSION)" \ 855 - && git push
+1 -1
cmd/libstreamplace/streamplace.go
··· 10 10 "stream.place/streamplace/pkg/log" 11 11 12 12 "stream.place/streamplace/pkg/cmd" 13 + _ "stream.place/streamplace/pkg/streamplacedeps" 13 14 // _ "github.com/go-gst/go-glib/glib" 14 15 // _ "github.com/go-gst/go-gst/gst" 15 16 ) 16 17 17 - //#cgo pkg-config: streamplacedeps 18 18 import "C" 19 19 20 20 var cleanExits = []error{
+4 -1
cmd/streamplace/empty.c
··· 1 + // intentionally empty program that we use as atarget to convince meson to 2 + // build all the streamplace dependencies 3 + 1 4 int main(int argc, char *argv[]) 2 5 { 3 6 return 0; 4 - } 7 + }
+1 -1
js/desktop/package.json
··· 11 11 "make": "electron-forge make", 12 12 "publish": "electron-forge publish", 13 13 "nolint": "eslint --ext .ts,.tsx .", 14 - "prepare": "go run ../../pkg/config/git/git.go --js > src/version.ts" 14 + "prepare": "CGO_ENABLED=0 go run ../../pkg/config/git/git.go --js > src/version.ts" 15 15 }, 16 16 "devDependencies": { 17 17 "@electron-forge/cli": "^7.5.0",
+148 -47
meson.build
··· 9 9 'force_fallback_for': 'gio-2.0,gstreamer-controller-1.0,gstreamer-app-1.0,gstreamer-pbutils-1.0,glib-2.0,gobject-2.0,gio-2.0,gio-unix-2.0,fdk-aac,zlib,libffi,pcre2,intl,proxy-libintl,x264,freetype2,libpng,libjpeg,fontconfig,pango,opus,fribidi,harfbuzz,nettle,cairo,pixman,expat,openssl', 10 10 'buildtype': 'debugoptimized', 11 11 'prefix': meson.current_build_dir(), # otherwise mac meson will try and do /opt/homebrew sometimes 12 + 'libdir': 'lib' 12 13 }, 13 14 ) 14 15 15 - fs = import('fs') 16 - 17 - prog_go = find_program('go') 18 - 19 - flagbuilder = custom_target( 20 - 'flagbuilder', 21 - input: ['pkg/config/git/git.go'], 22 - output: ['flagbuilder'], 23 - command: [prog_go, 'build', '-o', '@OUTPUT0@', '@INPUT@'], 24 - build_always_stale: true, 25 - env: { 26 - 'CGO_ENABLED': '0', 27 - }, 28 - ) 29 - 30 - flags = custom_target( 31 - 'flags', 32 - input: [], 33 - output: ['build-flags.go'], 34 - command: [flagbuilder, '-o', '@OUTPUT0@'], 35 - build_always_stale: true, 36 - ) 37 - 38 - version_cmd = run_command( 39 - prog_go, 40 - 'run', 41 - 'pkg/config/git/git.go', 42 - '-v', 43 - check: true, 44 - env: { 45 - 'CGO_ENABLED': '0', 46 - }, 47 - ) 48 - version = version_cmd.stdout().strip() 49 - 50 - streamplace_go = custom_target( 51 - 'streamplace.go', 52 - input: 'cmd/libstreamplace/streamplace.go', 53 - output: 'streamplace.go', 54 - command: ['cp', '@INPUT@', '@OUTPUT@'], 55 - ) 56 - 57 - # todo: teach meson to automatically populate this CPATH thing for go 58 - env = { 59 - 'PKG_CONFIG_PATH': meson.current_build_dir() + '/lib/pkgconfig', 60 - } 16 + env = {} 17 + if get_option('default_library') == 'static' 18 + env = { 19 + 'PKG_CONFIG_PATH': meson.current_build_dir() + '/meson-uninstalled', 20 + } 21 + else 22 + env = { 23 + 'PKG_CONFIG_PATH': meson.current_build_dir() + '/lib/pkgconfig', 24 + } 25 + endif 61 26 62 27 GOOS = meson.get_external_property('GOOS', host_machine.system()) 63 28 GOARCH = meson.get_external_property('GOARCH', host_machine.cpu()) ··· 238 203 dependency('gstreamer-controller-1.0'), 239 204 dependency('gstreamer-app-1.0'), 240 205 dependency('gstreamer-pbutils-1.0'), 206 + dependency('libffi'), 241 207 ] 242 208 243 209 atproto = subproject( ··· 284 250 description: 'all streamplace dependencies bundled for easy inclusion', 285 251 ) 286 252 287 - streamplacedeps = executable( 253 + # dummy executable that we use as a target to convince meson to build all the streamplace dependencies 254 + executable( 288 255 'streamplacedeps', 289 256 ['cmd/streamplace/empty.c'], 290 257 dependencies: [ 291 258 streamplace_deps, 292 259 ], 293 260 link_with: [c2pa_go_dep, iroh_streamplace_dep], 261 + install_tag: 'streamplacedeps', 294 262 ) 263 + 264 + if get_option('default_library') == 'static' 265 + prog_go = find_program('go') 266 + 267 + flagbuilder = custom_target( 268 + 'flagbuilder', 269 + input: ['pkg/config/git/git.go'], 270 + output: ['flagbuilder'], 271 + command: [prog_go, 'build', '-o', '@OUTPUT0@', '@INPUT@'], 272 + build_always_stale: true, 273 + env: { 274 + 'CGO_ENABLED': '0', 275 + }, 276 + ) 277 + version_cmd = run_command(prog_go, 'run', 'pkg/config/git/git.go', '-v', check: true, env: { 278 + 'CGO_ENABLED': '0', 279 + }) 280 + version = version_cmd.stdout().strip() 281 + 282 + streamplace_go = custom_target( 283 + 'streamplace.go', 284 + input: 'cmd/libstreamplace/streamplace.go', 285 + output: 'streamplace.go', 286 + command: ['cp', '@INPUT@', '@OUTPUT@'], 287 + ) 288 + flags = custom_target( 289 + 'flags', 290 + input: [], 291 + output: ['build-flags.go'], 292 + command: [flagbuilder, '-o', '@OUTPUT0@'], 293 + build_always_stale: true, 294 + ) 295 + 296 + libstreamplace = custom_target( 297 + 'libstreamplace', 298 + input: [streamplace_go, flags], 299 + output: ['streamplace.a', 'streamplace.h'], 300 + command: [ 301 + prog_go, 302 + 'build', 303 + '-o', '@OUTPUT0@', 304 + '-buildmode', 'c-archive', 305 + '-tags', 'netgo,static', 306 + '@INPUT@', 307 + ], 308 + build_always_stale: true, 309 + env: env, 310 + ) 311 + 312 + if build_machine.system() == 'linux' and host_machine.system() == 'darwin' 313 + # this only exists to convince meson to build all of the streamplace dependencies 314 + # the real binary comes from the `go build` command below 315 + cstreamplace = executable( 316 + 'cstreamplace', 317 + ['cmd/streamplace/streamplace.c', libstreamplace], 318 + dependencies: [ 319 + streamplace_deps, 320 + ], 321 + link_with: [c2pa_go_dep, iroh_streamplace_dep], 322 + ) 323 + 324 + streamplace = custom_target( 325 + 'streamplace', 326 + input: [cstreamplace, flags], 327 + output: ['streamplace'], 328 + command: [ 329 + prog_go, 330 + 'build', 331 + '-o', '@OUTPUT0@', 332 + '-tags', 'netgo,static', 333 + 'streamplace.go', 334 + '@INPUT1@' 335 + ], 336 + build_always_stale: true, 337 + env: env, 338 + ) 339 + else 340 + streamplace = executable( 341 + 'streamplace', 342 + ['cmd/streamplace/streamplace.c', libstreamplace], 343 + dependencies: [ 344 + streamplace_deps, 345 + ], 346 + link_with: [c2pa_go_dep, iroh_streamplace_dep], 347 + ) 348 + endif 349 + 350 + 351 + if not meson.is_cross_build() 352 + test( 353 + 'go-tests', 354 + prog_go, 355 + depends: [streamplace], 356 + env: env, 357 + verbose: true, 358 + timeout: 0, 359 + args: [ 360 + 'test', 361 + '-p', '1', 362 + '-timeout', '600s', 363 + '@0@/pkg/...'.format(meson.current_source_dir()), 364 + '@0@/cmd/...'.format(meson.current_source_dir()), 365 + ], 366 + ) 367 + endif 368 + 369 + if host_machine.system() == 'windows' 370 + prog_zip = find_program('zip') 371 + archive_name = 'streamplace-' + version + '-' + GOOS + '-' + GOARCH + '.zip' 372 + custom_target( 373 + 'archive', 374 + input: [streamplace], 375 + output: ['streamplace.zip'], 376 + command: [prog_zip, '../bin/' + archive_name, '@INPUT@'], 377 + install: true, 378 + install_dir: './bin', 379 + build_by_default: false, 380 + ) 381 + else 382 + prog_tar = find_program('tar') 383 + # archive_name = streamplace-$(VERSION)-$$GOOS-$$GOARCH.tar.gz 384 + archive_name = 'streamplace-' + version + '-' + GOOS + '-' + GOARCH + '.tar.gz' 385 + custom_target( 386 + 'archive', 387 + input: [streamplace], 388 + output: ['streamplace.tar.gz'], 389 + command: [prog_tar, '-czvf', '../bin/' + archive_name, '@INPUT@'], 390 + install: true, 391 + install_dir: './bin', 392 + build_by_default: false, 393 + ) 394 + endif 395 + endif
+4 -22
pkg/cmd/streamplace.go
··· 30 30 "stream.place/streamplace/pkg/log" 31 31 "stream.place/streamplace/pkg/media" 32 32 "stream.place/streamplace/pkg/notifications" 33 - "stream.place/streamplace/pkg/replication/iroh" 33 + "stream.place/streamplace/pkg/replication" 34 + "stream.place/streamplace/pkg/replication/boring" 34 35 "stream.place/streamplace/pkg/rtmps" 35 36 v0 "stream.place/streamplace/pkg/schema/v0" 36 37 "stream.place/streamplace/pkg/spmetrics" ··· 43 44 "stream.place/streamplace/pkg/config" 44 45 "stream.place/streamplace/pkg/model" 45 46 46 - irohStreamplace "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" 47 + _ "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" 47 48 ) 48 49 49 50 // Additional jobs that can be injected by platforms ··· 305 306 log.Log(ctx, "successfully initialized hardware signer", "address", addr) 306 307 signer = hwsigner 307 308 } 308 - irohEndpoint, err2 := irohStreamplace.NewEndpoint() 309 - if err2.AsError() != nil { 310 - return err2.AsError() 311 - } 312 - // TODO: something more useful 313 - defaultTopic := "iroh-topic" 314 - rep, err := iroh.NewIrohReplicator(ctx, irohEndpoint, defaultTopic) 315 - if err != nil { 316 - return err 317 - } 318 - addr := irohEndpoint.NodeAddr() 319 - fmt.Printf("iroh running, ID: %s\nHome Relay: %s\n", addr.NodeId().String(), *addr.RelayUrl()) 309 + var rep replication.Replicator = &boring.BoringReplicator{Peers: cli.Peers} 320 310 321 311 mod, err := model.MakeDB(cli.DataFilePath([]string{"index"})) 322 - 323 312 if err != nil { 324 313 return err 325 314 } ··· 377 366 if err != nil { 378 367 return err 379 368 } 380 - 381 - // TODO: based on a flag, subscribe 382 - // rec, err2 := irohStreamplace.NewReceiver(irohEndpoint, mm) 383 - // if err2.AsError() != nil { 384 - // return err2.AsError() 385 - // } 386 - // rec.Subscribe(peer, defaultTopic) 387 369 388 370 ms, err := media.MakeMediaSigner(ctx, &cli, cli.StreamerName, signer) 389 371 if err != nil {
+1 -1
pkg/iroh/iroh_streamplace.go
··· 2 2 3 3 import ( 4 4 _ "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" 5 + _ "stream.place/streamplace/pkg/streamplacedeps" 5 6 ) 6 7 7 - // #cgo pkg-config: streamplacedeps 8 8 // #cgo darwin LDFLAGS: -framework Security -framework SystemConfiguration 9 9 import "C"
+2 -3
pkg/media/media.go
··· 29 29 "github.com/piprate/json-gold/ld" 30 30 31 31 irohStreamplace "stream.place/streamplace/pkg/iroh/generated/iroh_streamplace" 32 + 33 + _ "stream.place/streamplace/pkg/streamplacedeps" 32 34 ) 33 - 34 - // #cgo pkg-config: streamplacedeps 35 - import "C" 36 35 37 36 const CertFile = "cert.pem" 38 37 const SegmentsDir = "segments"
+2 -3
pkg/replication/iroh/iroh.go
··· 10 10 11 11 // IrohReplicator implements the replication mechanism using iroh 12 12 type IrohReplicator struct { 13 - topic string 13 + topic string 14 14 sender *irohStreamplace.Sender 15 15 } 16 16 ··· 20 20 return nil, err.AsError() 21 21 } 22 22 23 - 24 23 return &IrohReplicator{ 25 - topic: topic, 24 + topic: topic, 26 25 sender: sender, 27 26 }, nil 28 27 }
+8
pkg/streamplacedeps/streamplacedeps-dynamic.go
··· 1 + //go:build !static 2 + 3 + // This runs during dynamic builds in dev 4 + 5 + package streamplacedeps 6 + 7 + // #cgo pkg-config: streamplacedeps 8 + import "C"
+8
pkg/streamplacedeps/streamplacedeps-static.go
··· 1 + //go:build static 2 + 3 + // This runs during static builds when we're making production executables 4 + 5 + package streamplacedeps 6 + 7 + // #cgo pkg-config: streamplacedeps-uninstalled 8 + import "C"
-1
rust/iroh-streamplace/README.md
··· 1 1 # iroh-streamplace 2 2 3 - 4 3 ## Development 5 4 6 5 ```sh
+4
rust/iroh-streamplace/meson.build
··· 21 21 'cd "@2@/../.." && @0@ && cp "@2@/../../target/debug/libiroh_streamplace.@3@" "@1@/libiroh_streamplace.@3@"'.format(cargo_cmd, meson.current_build_dir(), meson.current_source_dir(), ext), 22 22 ], 23 23 build_by_default: true, 24 + install: true, 25 + install_dir: get_option('libdir'), 24 26 ) 25 27 else 26 28 cargo_cmd = '@0@ build --release --target-dir "@1@"'.format(prog_cargo.full_path(), meson.current_build_dir()) ··· 42 44 'cd "@2@" && @0@ && cp "@3@/release/libiroh_streamplace.a" "@1@/libiroh_streamplace.a"'.format(cargo_cmd, meson.current_build_dir(), meson.current_source_dir(), archive_dir), 43 45 ], 44 46 build_by_default: true, 47 + install: true, 48 + install_dir: get_option('libdir'), 45 49 ) 46 50 endif
+2 -2
subprojects/c2pa_go.wrap
··· 1 1 [wrap-git] 2 - url = https://git.stream.place/streamplace/c2pa-go.git 3 - revision = v0.7.0 2 + url = https://github.com/streamplace/c2pa-go.git 3 + revision = v0.7.2 4 4 depth = 1
+1 -2
util/streamplace-dev.sh
··· 7 7 8 8 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 9 9 STREAMPLACE_DEV_VERSION=$(go run ./pkg/config/git/git.go -v) \ 10 - LD_LIBRARY_PATH="$SCRIPT_DIR/lib/usr/local/lib/x86_64-linux-gnu:$SCRIPT_DIR/../target/debug" \ 11 - DYLD_LIBRARY_PATH="$SCRIPT_DIR/lib/usr/local/lib:$SCRIPT_DIR/../target/debug" \ 10 + LD_LIBRARY_PATH="$SCRIPT_DIR/lib" \ 12 11 SP_DEV_FRONTEND_PROXY="http://127.0.0.1:38081" \ 13 12 exec "$SCRIPT_DIR/libstreamplace" "$@"