Build streamdeck + daemon into flatpak

TODO: Figure out serial port access from inside flatpak
This commit is contained in:
Aode 2021-05-25 21:35:16 -05:00
parent 354b6aa566
commit eeff874fb3
24 changed files with 463 additions and 1361 deletions

2
.gitignore vendored
View file

@ -1 +1,3 @@
target/
.flatpak-builder/
build/

354
Cargo.lock generated
View file

@ -36,6 +36,57 @@ version = "1.0.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b"
[[package]]
name = "async-broadcast"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c53006e3a562799d414fad784fdb8789dcf94f78f9e66e642347e50492852f7"
dependencies = [
"easy-parallel",
"event-listener",
"futures-core",
]
[[package]]
name = "async-channel"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
dependencies = [
"concurrent-queue",
"event-listener",
"futures-core",
]
[[package]]
name = "async-io"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bbfd5cf2794b1e908ea8457e6c45f8f8f1f6ec5f74617bf4662623f47503c3b"
dependencies = [
"concurrent-queue",
"fastrand",
"futures-lite",
"libc",
"log",
"once_cell",
"parking",
"polling",
"slab",
"socket2",
"waker-fn",
"winapi",
]
[[package]]
name = "async-lock"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6a8ea61bf9947a1007c5cada31e647dbc77b103c679858150003ba697ea798b"
dependencies = [
"event-listener",
]
[[package]]
name = "async-stream"
version = "0.3.1"
@ -135,6 +186,12 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040"
[[package]]
name = "cache-padded"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "631ae5198c9be5e753e5cc215e1bd73c2b466a3565173db433f52bb9d3e66dba"
[[package]]
name = "cairo-rs"
version = "0.13.0"
@ -194,6 +251,15 @@ dependencies = [
"num-traits",
]
[[package]]
name = "concurrent-queue"
version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
dependencies = [
"cache-padded",
]
[[package]]
name = "cpufeatures"
version = "0.1.1"
@ -303,6 +369,17 @@ dependencies = [
"tokio",
]
[[package]]
name = "derivative"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "digest"
version = "0.9.0"
@ -338,6 +415,12 @@ version = "0.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f"
[[package]]
name = "easy-parallel"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd4afd79212583ff429b913ad6605242ed7eec277e950b1438f300748f948f4"
[[package]]
name = "either"
version = "1.6.1"
@ -347,6 +430,27 @@ dependencies = [
"serde",
]
[[package]]
name = "enumflags2"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0"
dependencies = [
"enumflags2_derive",
"serde",
]
[[package]]
name = "enumflags2_derive"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "env_logger"
version = "0.7.1"
@ -431,6 +535,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
@ -653,7 +758,7 @@ source = "git+https://github.com/gtk-rs/gtk-rs-core.git#8a66492fb2c1a03bb9c99cfc
dependencies = [
"anyhow",
"heck",
"proc-macro-crate",
"proc-macro-crate 1.0.0",
"proc-macro-error",
"proc-macro2",
"quote",
@ -726,7 +831,7 @@ source = "git+https://github.com/gtk-rs/gtk3-rs.git#2f86e52185021b540913ae8e87cf
dependencies = [
"anyhow",
"heck",
"proc-macro-crate",
"proc-macro-crate 1.0.0",
"proc-macro-error",
"proc-macro2",
"quote",
@ -751,6 +856,12 @@ dependencies = [
"libc",
]
[[package]]
name = "hex"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
name = "http"
version = "0.2.4"
@ -863,6 +974,46 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "libhandy"
version = "0.8.0"
source = "git+https://gitlab.gnome.org/World/Rust/libhandy-rs#d65896f44c786eedd096a0fad876fa554253f8e3"
dependencies = [
"bitflags",
"gdk",
"gdk-pixbuf",
"gdk-pixbuf-sys",
"gdk-sys",
"gio",
"gio-sys",
"glib",
"glib-sys",
"gobject-sys",
"gtk",
"gtk-sys",
"lazy_static",
"libc",
"libhandy-sys",
"pango",
]
[[package]]
name = "libhandy-sys"
version = "0.8.0"
source = "git+https://gitlab.gnome.org/World/Rust/libhandy-rs#d65896f44c786eedd096a0fad876fa554253f8e3"
dependencies = [
"gdk-pixbuf-sys",
"gdk-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"gtk-sys",
"libc",
"pango-sys",
"pkg-config",
"system-deps",
]
[[package]]
name = "libudev"
version = "0.2.0"
@ -932,6 +1083,19 @@ dependencies = [
"pango",
]
[[package]]
name = "marble"
version = "0.1.0"
source = "git+https://git.asonix.dog/asonix/streamdeck-workspace?branch=main#354b6aa56609ec7d57ceb09d5aad874d4e13ef51"
dependencies = [
"event-listener",
"futures-core",
"glib",
"gtk",
"once_cell",
"pango",
]
[[package]]
name = "matches"
version = "0.1.8"
@ -988,6 +1152,18 @@ dependencies = [
"void",
]
[[package]]
name = "nix"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "ntapi"
version = "0.3.6"
@ -1171,6 +1347,19 @@ version = "0.3.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
[[package]]
name = "polling"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b"
dependencies = [
"cfg-if 1.0.0",
"libc",
"log",
"wepoll-sys",
"winapi",
]
[[package]]
name = "ppv-lite86"
version = "0.2.10"
@ -1187,6 +1376,15 @@ dependencies = [
"log",
]
[[package]]
name = "proc-macro-crate"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785"
dependencies = [
"toml",
]
[[package]]
name = "proc-macro-crate"
version = "1.0.0"
@ -1388,6 +1586,12 @@ version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "scopeguard"
version = "1.1.0"
@ -1454,6 +1658,17 @@ dependencies = [
"serde",
]
[[package]]
name = "serde_repr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_test"
version = "1.0.125"
@ -1498,7 +1713,7 @@ dependencies = [
"cfg-if 0.1.10",
"libudev",
"mach 0.2.3",
"nix",
"nix 0.16.1",
"regex",
"winapi",
]
@ -1516,6 +1731,12 @@ dependencies = [
"opaque-debug",
]
[[package]]
name = "sha1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]]
name = "sha2"
version = "0.9.5"
@ -1560,18 +1781,72 @@ dependencies = [
"parking_lot",
]
[[package]]
name = "slotmap"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585cd5dffe4e9e06f6dfdf66708b70aca3f781bed561f4f667b2d9c0d4559e36"
dependencies = [
"version_check",
]
[[package]]
name = "smallvec"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
[[package]]
name = "socket2"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2"
dependencies = [
"libc",
"winapi",
]
[[package]]
name = "spin"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]]
name = "streamdeck"
version = "0.1.0"
dependencies = [
"anyhow",
"async-io",
"async-stream",
"env_logger 0.8.3",
"event-listener",
"futures-channel",
"futures-core",
"futures-util",
"gdk",
"gdk-pixbuf",
"gio",
"glib",
"glib-sys",
"gtk",
"libhandy",
"log",
"marble 0.1.0 (git+https://git.asonix.dog/asonix/streamdeck-workspace?branch=main)",
"once_cell",
"pango",
"serde_json",
"streamdeck-common",
"zbus",
"zvariant",
]
[[package]]
name = "streamdeck-common"
version = "0.1.0"
@ -1968,6 +2243,15 @@ dependencies = [
"webpki",
]
[[package]]
name = "wepoll-sys"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff"
dependencies = [
"cc",
]
[[package]]
name = "winapi"
version = "0.3.9"
@ -1998,3 +2282,67 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "zbus"
version = "2.0.0-beta.3"
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#21ac31f602b5d7fb6dbf3465e78436225fe6e197"
dependencies = [
"async-broadcast",
"async-channel",
"async-io",
"async-lock",
"byteorder",
"derivative",
"enumflags2",
"event-listener",
"futures-core",
"futures-sink",
"futures-util",
"hex",
"nix 0.20.0",
"once_cell",
"rand",
"scoped-tls",
"serde",
"serde_repr",
"sha1",
"slotmap",
"static_assertions",
"zbus_macros",
"zvariant",
]
[[package]]
name = "zbus_macros"
version = "2.0.0-beta.3"
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#21ac31f602b5d7fb6dbf3465e78436225fe6e197"
dependencies = [
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "zvariant"
version = "2.6.0"
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#21ac31f602b5d7fb6dbf3465e78436225fe6e197"
dependencies = [
"byteorder",
"enumflags2",
"serde",
"static_assertions",
"zvariant_derive",
]
[[package]]
name = "zvariant_derive"
version = "2.6.0"
source = "git+https://gitlab.freedesktop.org/dbus/zbus?branch=main#21ac31f602b5d7fb6dbf3465e78436225fe6e197"
dependencies = [
"proc-macro-crate 0.1.5",
"proc-macro2",
"quote",
"syn",
]

View file

@ -2,9 +2,7 @@
members = [
"./streamdeck-common",
"./streamdeck-daemon",
"./streamdeck-gtk",
"./marble",
"./obws"
]
exclude = [
"./streamdeck-gtk"
]

View file

@ -7,6 +7,15 @@ i18n.merge_file(
install_dir: join_paths(get_option('datadir'), 'applications')
)
i18n.merge_file(
input: 'streamdeck-daemon.desktop.in',
output: 'dog.asonix.git.asonix.StreamdeckDaemon.desktop',
po_dir: join_paths(meson.source_root(), 'po'),
type: 'desktop',
install: true,
install_dir: join_paths(get_option('sysconfdir'), 'xdg', 'autostart')
)
i18n.merge_file(
input: 'streamdeck.appdata.xml.in',
output: 'dog.asonix.git.asonix.Streamdeck.appdata.xml',
@ -15,9 +24,15 @@ i18n.merge_file(
install_dir: join_paths(get_option('datadir'), 'metainfo')
)
# Install our gschema.xml file so that we can write stateful information to GSettings
install_data (
'gschema.xml',
install_dir: join_paths (get_option ('datadir'), 'glib-2.0', 'schemas'),
rename: 'dog.asonix.git.asonix.Streamdeck.gschema.xml'
install_data(
'streamdeck-daemon.service',
install_dir: dbus_service_dir,
rename: 'dog.asonix.git.asonix.StreamdeckDaemon.service'
)
# Install our gschema.xml file so that we can write stateful information to GSettings
install_data(
'gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
rename: 'dog.asonix.git.asonix.Streamdeck.gschema.xml'
)

View file

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Streamdeck
GenericName=Streamdeck
Comment=Simple streamdeck configuration
Categories=Video;Utility;
Exec=streamdeck-daemon
Terminal=false
StartupNotify=false
NoDisplay=true
Type=Application
Keywords=streamdeck;obs;livestreaming;media;

View file

@ -0,0 +1,3 @@
[D-BUS Service]
Name=dog.asonix.git.asonix.StreamdeckDaemon
Exec=streamdeck-daemon

View file

@ -10,9 +10,11 @@ command: streamdeck
finish-args:
- '--share=ipc'
- '--share=network'
- '--socket=fallback-x11'
- '--socket=wayland'
- '--talk-name=dog.asonix.git.asonix.StreamdeckDaemon'
- '--own-name=dog.asonix.git.asonix.StreamdeckDaemon'
- '--device=all'
build-options:
append-path: /usr/lib/sdk/rust-stable/bin

25
meson.build Normal file
View file

@ -0,0 +1,25 @@
project('streamdeck',
version: '0.1.0',
meson_version: '>= 0.51.0',
default_options: [ 'warning_level=2',
],
)
i18n = import('i18n')
base_cargo_sources = files(
'Cargo.toml',
'Cargo.lock',
)
dbus_service_dir = dependency('dbus-1').get_variable(
pkgconfig: 'session_bus_services_dir',
pkgconfig_define: ['datadir', join_paths(get_option('prefix'), get_option('datadir'))]
)
subdir('data')
subdir('po')
subdir('streamdeck-gtk')
subdir('streamdeck-daemon')
meson.add_install_script('build-aux/meson/post_install.py')

View file

@ -0,0 +1,5 @@
daemon_cargo_sources = files(
'Cargo.toml'
)
subdir('src')

View file

@ -0,0 +1,34 @@
pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
daemon_sources = files(
'dbus.rs',
'deck.rs',
'input.rs',
'main.rs',
'manager.rs',
'message.rs',
'obs.rs',
'port.rs',
'store.rs',
)
sources = [base_cargo_sources, daemon_cargo_sources, daemon_sources]
cargo_script = find_program(join_paths(meson.source_root(), 'build-aux/cargo.sh'))
daemon_release = custom_target(
'cargo-build',
build_by_default: true,
input: sources,
output: 'streamdeck-daemon',
console: true,
install: true,
install_dir: get_option('bindir'),
command: [
cargo_script,
join_paths(meson.build_root(), 'streamdeck-daemon'),
join_paths(meson.source_root(), 'streamdeck-daemon'),
'@OUTPUT@',
get_option('buildtype'),
'streamdeck-daemon',
]
)

View file

@ -1,4 +1,3 @@
target/
.flatpak-builder/
build/
src/config.rs

1326
streamdeck-gtk/Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,7 @@ edition = "2018"
anyhow = "1"
async-io = "1.4.1"
async-stream = "0.3.1"
streamdeck-common = { git = "https://git.asonix.dog/asonix/streamdeck-workspace", branch = "main" }
streamdeck-common = { path = "../streamdeck-common" }
env_logger = "0.8.3"
event-listener = "2.5.1"
futures-channel = { version = "0.3.14", features = ["sink"] }

View file

@ -1,22 +1,10 @@
project('streamdeck',
version: '0.1.0',
meson_version: '>= 0.50.0',
default_options: [ 'warning_level=2',
],
)
application_id = 'dog.asonix.git.asonix.Streamdeck'
i18n = import('i18n')
cargo_sources = files(
'Cargo.toml',
'Cargo.lock',
)
subdir('data')
subdir('src')
subdir('po')
dependencies = [
dependency('gdk-3.0'),
@ -26,5 +14,3 @@ dependencies = [
dependency('libhandy-1'),
dependency('pango')
]
meson.add_install_script('build-aux/meson/post_install.py')

View file

@ -13,8 +13,8 @@ configure_file(
# Copy the config.rs output to the source directory.
run_command(
'cp',
join_paths(meson.build_root(), 'src', 'config.rs'),
join_paths(meson.source_root(), 'src', 'config.rs'),
join_paths(meson.build_root(), 'streamdeck-gtk', 'src', 'config.rs'),
join_paths(meson.source_root(), 'streamdeck-gtk', 'src', 'config.rs'),
check: true
)
@ -42,23 +42,23 @@ rust_sources = files(
'main_window.rs',
)
sources = [cargo_sources, rust_sources]
sources = [base_cargo_sources, cargo_sources, rust_sources]
cargo_script = find_program(join_paths(meson.source_root(), 'build-aux/cargo.sh'))
cargo_release = custom_target(
'cargo-build',
build_by_default: true,
input: sources,
output: meson.project_name(),
output: 'streamdeck',
console: true,
install: true,
install_dir: get_option('bindir'),
command: [
cargo_script,
meson.build_root(),
meson.source_root(),
join_paths(meson.build_root(), 'streamdeck-gtk'),
join_paths(meson.source_root(), 'streamdeck-gtk'),
'@OUTPUT@',
get_option('buildtype'),
meson.project_name(),
'streamdeck',
]
)