I’ve been working on making a flatpak for OBS Teleport, after a while I was able to come up with this:
id: com.obsproject.Studio.Plugin.Teleport
branch: stable
runtime: com.obsproject.Studio
runtime-version: stable
sdk: org.freedesktop.Sdk//24.08
sdk-extensions:
- org.freedesktop.Sdk.Extension.golang
build-extension: true
separate-locales: false
appstream-compose: false
build-options:
prefix: /app/plugins/Teleport
libdir: lib/obs-plugins
append-path: /usr/lib/sdk/golang/bin
modules:
- name: obs-teleport
buildsystem: simple
build-options:
build-args:
- --share=network
env:
- GOBIN=/app/bin
- GOFLAGS="-buildmode=c-shared"
- GOPATH=/run/build/obs-teleport/go
- CGO_CFLAGS="-I/app/include/obs"
- CGO_LDFLAGS="-L/app/lib -Wl,-z,relro,-z,now -Wl,--as-needed -lturbojpeg -lobs -lobs-frontend-api"
build-commands:
- go mod vendor
- chmod -R u+w *
- go build -mod=vendor -ldflags "-compressdwarf=false -linkmode external -X main.version=0.7.4" -v -o "${FLATPAK_DEST}/lib/obs-plugins/obs-teleport.so" .
sources:
- type: git
url: https://github.com/fzwoch/obs-teleport.git
tag: 0.7.4
commit: 3e012bdcde3c8609cc89f1ede6225e30c89451ab
x-checker-data:
type: git
tag-pattern: ^([\d.]+)
- type: file
path: com.obsproject.Studio.Plugin.Teleport.metainfo.xml
After that I went to check the flathub submission documents and I see that it requires we add the --sandbox
flag. This breaks GO from being able to download it’s dependencies, because it requires I remove
build-args:
- --share=network
how is this usually handled? The only thing I’m finding is to source the dependencies ahead of time, download the dependencies ahead of time and then pass the pre-obtained sources in to the builder, which I’m hoping to avoid. Also this is the first flatpak I’ve ever made so if anyone notices something that could be done better please let me know.