From 4b04b2becbf602e3ec3160fd1ffe128d8fedf2f1 Mon Sep 17 00:00:00 2001 From: Markus Volk Date: Sun, 20 Feb 2022 12:03:58 +0100 Subject: [PATCH] import squeekboard recipe Virtboard has been replaced by squeekboard in phosh. While finding this out i also found out that there already exists a meta-phosh layer ;) Anyway they have an existing recipe for squeekeboard over at: https://github.com/JPEWdev/meta-phosh/blob/master/recipes-graphics/squeekboard/squeekboard_git.bb import it --- ...1-Pass-additional-arguments-to-cargo.patch | 65 ++++++++++ ...0001-Skip-build-tests-if-not-enabled.patch | 73 +++++++++++ .../squeekboard/squeekboard_git.bb | 113 ++++++++++++++++++ recipes-support/virtboard/virtboard_git.bb | 33 ----- 4 files changed, 251 insertions(+), 33 deletions(-) create mode 100644 recipes-support/squeekboard/squeekboard/0001-Pass-additional-arguments-to-cargo.patch create mode 100644 recipes-support/squeekboard/squeekboard/0001-Skip-build-tests-if-not-enabled.patch create mode 100644 recipes-support/squeekboard/squeekboard_git.bb delete mode 100644 recipes-support/virtboard/virtboard_git.bb diff --git a/recipes-support/squeekboard/squeekboard/0001-Pass-additional-arguments-to-cargo.patch b/recipes-support/squeekboard/squeekboard/0001-Pass-additional-arguments-to-cargo.patch new file mode 100644 index 0000000..5916037 --- /dev/null +++ b/recipes-support/squeekboard/squeekboard/0001-Pass-additional-arguments-to-cargo.patch @@ -0,0 +1,65 @@ +From f4de5125daeaffe237f2e2b42f3a0a8f960e3816 Mon Sep 17 00:00:00 2001 +From: Joshua Watt +Date: Fri, 19 Nov 2021 08:36:28 -0600 +Subject: [PATCH] Pass additional arguments to cargo + +Adds an option to pass additional arguments to cargo. This is necessary +for cross compiling + +Signed-off-by: Joshua Watt +--- + cargo_build.py | 6 ++++++ + meson.build | 6 +++--- + meson_options.txt | 4 ++++ + 3 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/cargo_build.py b/cargo_build.py +index 0c7c5c6..cfd34e8 100644 +--- a/cargo_build.py ++++ b/cargo_build.py +@@ -27,6 +27,12 @@ else: + args.pop(i) + filename = args.pop(i) + ++try: ++ i = args.index('--target') ++ binary_dir = "{}/{}".format(args[i + 1], binary_dir) ++except ValueError: ++ pass ++ + # The target destination of the produced file is a positional argument + out_path = [arg for arg in args if not arg.startswith('--')] + if out_path: +diff --git a/meson.build b/meson.build +index 342ecca..a2a6f2f 100644 +--- a/meson.build ++++ b/meson.build +@@ -54,10 +54,10 @@ endif + if get_option('buildtype') != 'plain' + add_project_arguments('-fstack-protector-strong', language: 'c') + endif ++ ++cargo_build_flags = get_option('cargo-flags') + if get_option('buildtype') == 'release' +- cargo_build_flags = ['--release'] # for artifacts +-else +- cargo_build_flags = [] ++ cargo_build_flags += ['--release'] # for artifacts + endif + + prefix = get_option('prefix') +diff --git a/meson_options.txt b/meson_options.txt +index bb68374..459807a 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -14,3 +14,7 @@ option('legacy', + option('strict', + type: 'boolean', value: true, + description: 'Turn more warnings into errors') ++ ++option('cargo-flags', ++ type: 'array', value: [], ++ description: 'Extra flags to pass to cargo') +-- +2.33.0 + diff --git a/recipes-support/squeekboard/squeekboard/0001-Skip-build-tests-if-not-enabled.patch b/recipes-support/squeekboard/squeekboard/0001-Skip-build-tests-if-not-enabled.patch new file mode 100644 index 0000000..bf7dbbd --- /dev/null +++ b/recipes-support/squeekboard/squeekboard/0001-Skip-build-tests-if-not-enabled.patch @@ -0,0 +1,73 @@ +From 8c83844e57dc454a0041f61351e2f9c297eb7b23 Mon Sep 17 00:00:00 2001 +From: Joshua Watt +Date: Fri, 19 Nov 2021 10:49:06 -0600 +Subject: [PATCH] Skip build tests if not enabled + +Signed-off-by: Joshua Watt +--- + src/meson.build | 48 +++++++++++++++++++++++++----------------------- + 1 file changed, 25 insertions(+), 23 deletions(-) + +diff --git a/src/meson.build b/src/meson.build +index d85be96..b3bb776 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -61,30 +61,32 @@ rslibs = custom_target( + depends: cargo_toml, + ) + +-build_rstests = custom_target( +- 'build_rstests', +- build_by_default: false, +- # HACK: this target needs to build before all the tests, +- # but it doesn't produce anything stable. +- # Declaring build_by_default with some random but irrelevant output +- # ensures that it's always built as it should +- build_always_stale: true, +- output: ['src'], +- install: false, +- console: true, +- command: [cargo_script, 'test', '--no-run'] + cargo_build_flags, +- depends: [rslibs, cargo_toml], # no point building tests if the code itself fails +-) ++if get_option('tests') ++ build_rstests = custom_target( ++ 'build_rstests', ++ build_by_default: false, ++ # HACK: this target needs to build before all the tests, ++ # but it doesn't produce anything stable. ++ # Declaring build_by_default with some random but irrelevant output ++ # ensures that it's always built as it should ++ build_always_stale: true, ++ output: ['src'], ++ install: false, ++ console: true, ++ command: [cargo_script, 'test', '--no-run'] + cargo_build_flags, ++ depends: [rslibs, cargo_toml], # no point building tests if the code itself fails ++ ) + +-test( +- 'rstest', +- cargo_script, +- args: ['test'] + cargo_build_flags, +- env: ['SOURCE_DIR=' + meson.source_root()], +- # this is a whole Carg-based test suite, let it run for a while +- timeout: 900, +- depends: [build_rstests, cargo_toml], +-) ++ test( ++ 'rstest', ++ cargo_script, ++ args: ['test'] + cargo_build_flags, ++ env: ['SOURCE_DIR=' + meson.source_root()], ++ # this is a whole Carg-based test suite, let it run for a while ++ timeout: 900, ++ depends: [build_rstests, cargo_toml], ++ ) ++endif + + libsqueekboard = static_library('libsqueekboard', + sources, +-- +2.33.0 + diff --git a/recipes-support/squeekboard/squeekboard_git.bb b/recipes-support/squeekboard/squeekboard_git.bb new file mode 100644 index 0000000..1389278 --- /dev/null +++ b/recipes-support/squeekboard/squeekboard_git.bb @@ -0,0 +1,113 @@ +SUMMARY = "A Wayland virtual keyboard" +DESCRIPTION = "Squeekboard is a virtual keyboard supporting Wayland, built \ +primarily for the Librem 5 phone. \ +It squeaks because some Rust got inside." +HOMEPAGE = "https://developer.puri.sm/projects/squeekboard/" +BUGTRACKER = "https://gitlab.gnome.org/World/Phosh/squeekboard/-/issues" +LICENSE = "GPL-3.0-or-later" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504 \ + file://debian/copyright;md5=03d0c6e3f2e8ec62fb33c983433ce7e5" + +DEPENDS = "\ + feedbackd \ + glib-2.0 \ + glib-2.0-native \ + gnome-desktop \ + gtk+3 \ + libxkbcommon \ + wayland \ + wayland-native \ + wayland-protocols \ + " + +SRC_URI = "\ + git://gitlab.gnome.org/World/Phosh/squeekboard.git;protocol=https;branch=${BRANCH} \ + file://0001-Pass-additional-arguments-to-cargo.patch \ + file://0001-Skip-build-tests-if-not-enabled.patch \ + crate://crates.io/atk-sys/0.9.1 \ + crate://crates.io/atk/0.7.0 \ + crate://crates.io/autocfg/1.0.1 \ + crate://crates.io/bitflags/1.2.1 \ + crate://crates.io/cairo-rs/0.7.1 \ + crate://crates.io/cairo-sys-rs/0.9.2 \ + crate://crates.io/cc/1.0.72 \ + crate://crates.io/clap/2.33.3 \ + crate://crates.io/dtoa/0.4.8 \ + crate://crates.io/fragile/0.3.0 \ + crate://crates.io/gdk-pixbuf-sys/0.9.1 \ + crate://crates.io/gdk-pixbuf/0.7.0 \ + crate://crates.io/gdk-sys/0.9.1 \ + crate://crates.io/gdk/0.11.0 \ + crate://crates.io/gio-sys/0.9.1 \ + crate://crates.io/gio/0.7.0 \ + crate://crates.io/glib-sys/0.9.1 \ + crate://crates.io/glib/0.8.2 \ + crate://crates.io/gobject-sys/0.9.1 \ + crate://crates.io/gtk-sys/0.9.2 \ + crate://crates.io/gtk/0.7.0 \ + crate://crates.io/hashbrown/0.8.1 \ + crate://crates.io/indexmap/1.5.2 \ + crate://crates.io/lazy_static/1.4.0 \ + crate://crates.io/libc/0.2.107 \ + crate://crates.io/linked-hash-map/0.5.4 \ + crate://crates.io/maplit/1.0.2 \ + crate://crates.io/memmap/0.7.0 \ + crate://crates.io/pango-sys/0.9.1 \ + crate://crates.io/pango/0.7.0 \ + crate://crates.io/pkg-config/0.3.22 \ + crate://crates.io/proc-macro2/1.0.32 \ + crate://crates.io/quote/1.0.10 \ + crate://crates.io/regex-syntax/0.6.25 \ + crate://crates.io/regex/1.3.9 \ + crate://crates.io/serde/1.0.130 \ + crate://crates.io/serde_derive/1.0.130 \ + crate://crates.io/serde_yaml/0.8.21 \ + crate://crates.io/syn/1.0.81 \ + crate://crates.io/textwrap/0.11.0 \ + crate://crates.io/unicode-width/0.1.9 \ + crate://crates.io/unicode-xid/0.2.2 \ + crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 \ + crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 \ + crate://crates.io/winapi/0.3.9 \ + crate://crates.io/xkbcommon/0.4.0 \ + crate://crates.io/yaml-rust/0.4.5 \ + " + +# Modify these as desired +PV = "1.16.0" +SRCREV = "d49ce45de0956432cef9b957f806d9377fee4bc0" +BRANCH = "master" + +S = "${WORKDIR}/git" + +inherit cargo meson rust pkgconfig + +EXTRA_OEMESON = "\ + -Dcargo-flags=[\'--target\',\'${HOST_SYS}\',\'-v\'] \ + -Dtests=false \ + -Ddepdatadir=${datadir} \ + " + +export CARGO_FEATURE_STD = "1" + +do_configure() { + cargo_common_do_configure + meson_do_configure +} + +do_compile() { + oe_cargo_fix_env + export RUSTFLAGS="${RUSTFLAGS}" + export RUST_TARGET_PATH="${RUST_TARGET_PATH}" + meson_do_compile +} + +do_install() { + oe_cargo_fix_env + export RUSTFLAGS="${RUSTFLAGS}" + export RUST_TARGET_PATH="${RUST_TARGET_PATH}" + meson_do_install + + install -d ${D}${sysconfdir}/xdg/autostart + cp ${D}${datadir}/applications/sm.puri.Squeekboard.desktop ${D}${sysconfdir}/xdg/autostart +} diff --git a/recipes-support/virtboard/virtboard_git.bb b/recipes-support/virtboard/virtboard_git.bb deleted file mode 100644 index 3aec76d..0000000 --- a/recipes-support/virtboard/virtboard_git.bb +++ /dev/null @@ -1,33 +0,0 @@ -SUMMARY = "A basic keyboard, blazing the path of modern Wayland keyboards." -HOMEPAGE = "https://source.puri.sm/Librem5/virtboard" -LICENSE = "MIT" - -LIC_FILES_CHKSUM = "file://COPYING;md5=0ebb9978fd668af3c88c6dfa393e866d" - -REQUIRED_DISTRO_FEATURES = "wayland" - -DEPENDS = " \ - cairo \ - glib-2.0-native \ - libpng \ - libxkbcommon \ - pixman \ - wayland \ - wayland-native \ - wayland-protocols \ -" - -SRC_URI = " \ - git://source.puri.sm/Librem5/virtboard.git;protocol=https;branch=pureos/byzantium \ -" - -inherit meson pkgconfig gtk-icon-cache features_check - -S = "${WORKDIR}/git" -PV = "0.0.6" -SRCREV = "2d30762e546b7f2a165fed094c58b3d0fda30ff6" - -FILES:${PN} += "${datadir}" - -BBCLASSEXTEND = "" -