From 880962f442f9ed93c094a204fa72a57b190e97a1 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Wed, 23 Feb 2022 23:55:47 -0500 Subject: [PATCH 1/2] common/build-helper/rust.sh: fix cross for bindgen When using a build.rs script to dynamically generate bindgen bindings at build-time, it will run on the host, and by default bindgen will generate bindings for the host arch/libc instead of the target. To generate the bindings on cross, we need to use BINDGEN_EXTRA_CLANG_ARGS to specify the proper sysroot and include path for the target. These arguments are not used for anything other than bindgen's clang invocation. --- common/build-helper/rust.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh index 431cb5f0fd43..798083709c3e 100644 --- a/common/build-helper/rust.sh +++ b/common/build-helper/rust.sh @@ -23,6 +23,9 @@ if [ "$CROSS_BUILD" ]; then # innocuous flags are used here just to disable its defaults export HOST_CC="gcc" export HOST_CFLAGS="-O2" + + # Crates that use bindgen via build.rs are not cross-aware unless these are set + export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=${XBPS_CROSS_BASE} -I${XBPS_CROSS_BASE}/usr/include" else unset CARGO_BUILD_TARGET fi From 4688b8689cff35642a522b9ddbe3efdcdb894a85 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Thu, 24 Feb 2022 00:07:36 -0500 Subject: [PATCH 2/2] New package: helvum-0.3.4 --- srcpkgs/helvum/patches/i686-pipewire.patch | 24 +++++++++++ srcpkgs/helvum/template | 46 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 srcpkgs/helvum/patches/i686-pipewire.patch create mode 100644 srcpkgs/helvum/template diff --git a/srcpkgs/helvum/patches/i686-pipewire.patch b/srcpkgs/helvum/patches/i686-pipewire.patch new file mode 100644 index 000000000000..17f0f17f8875 --- /dev/null +++ b/srcpkgs/helvum/patches/i686-pipewire.patch @@ -0,0 +1,24 @@ +From e8703de1c76f50553cedb7a1601e5b808a227604 Mon Sep 17 00:00:00 2001 +From: "Gabor Kecskemeti (sh)" +Date: Thu, 11 Nov 2021 11:41:09 +0000 +Subject: A possible fix for issue #27 + +--- + pipewire/src/loop_.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/helvum-0.3.4/pipewire/src/loop_.rs b/helvum-0.3.4/pipewire/src/loop_.rs +index 3e0d9bd..353025f 100644 +--- a/helvum-0.3.4/pipewire/src/loop_.rs ++++ b/helvum-0.3.4/pipewire/src/loop_.rs +@@ -411,7 +411,7 @@ where + fn duration_to_timespec(duration: Duration) -> spa_sys::timespec { + spa_sys::timespec { + tv_sec: duration.as_secs().try_into().expect("Duration too long"), +- tv_nsec: duration.subsec_nanos().into(), ++ tv_nsec: duration.subsec_nanos().try_into().unwrap(), + } + } + +-- + diff --git a/srcpkgs/helvum/template b/srcpkgs/helvum/template new file mode 100644 index 000000000000..49ad2dd6013a --- /dev/null +++ b/srcpkgs/helvum/template @@ -0,0 +1,46 @@ +# Template file for 'helvum' +pkgname=helvum +version=0.3.4 +revision=1 +create_wrksrc=yes +build_wrksrc="${pkgname}-${version}" +_pipewire_rs_version=0.4.1 +build_style=cargo +build_helper=rust +hostmakedepends="pkg-config clang libclang" +makedepends="gtk4-devel pipewire-devel glib-devel" +depends="pipewire" +short_desc="GTK patchbay for pipewire" +maintainer="classabbyamp " +license="GPL-3.0-only" +homepage="https://gitlab.freedesktop.org/pipewire/helvum" +distfiles="https://gitlab.freedesktop.org/pipewire/helvum/-/archive/${version}/helvum-${version}.tar.gz + https://gitlab.freedesktop.org/pipewire/pipewire-rs/-/archive/v${_pipewire_rs_version}/pipewire-rs-v${_pipewire_rs_version}.tar.gz" +checksum="e19054f3bcd1ba234c451134fe7f4c6afee35f108c122642c1d502fc16785c02 + 7df384c2a98154ae2cea8e14693db92e269437ea60fbcdfb6adb589226d12629" + +# XXX: this should not be necessary once the next version of the pipewire crate has been released +post_extract() { + pushd $build_wrksrc + echo "[patch.crates-io]" >> Cargo.toml + for crate in pipewire pipewire-sys libspa libspa-sys; do + mv ../pipewire-rs-*/$crate $crate + echo "$crate = { path = './$crate' }" >> Cargo.toml + done + popd +} + +post_install() { + # Normally, meson would do this, but it's simpler to use the cargo build style and do this manually + # This also avoids the need for makedeps/build steps that are made unnecessary by xbps' hooks + # On update, all meson.build files should be checked for changes + _app_id='org.pipewire.Helvum' + vinstall data/icons/$_app_id.svg 644 usr/share/icons/hicolor/scalable/apps/ + vinstall data/icons/$_app_id-symbolic.svg 644 usr/share/icons/hicolor/symbolic/apps/ + + vsed -i data/$_app_id.desktop.in -e "s/@icon@/$_app_id/" + vinstall data/$_app_id.desktop.in 644 usr/share/applications/ $_app_id.desktop + + vsed -i data/$_app_id.metainfo.xml.in -e "s/@app-id@/$_app_id/" + vinstall data/$_app_id.metainfo.xml.in 644 usr/share/metainfo/ $_app_id.metainfo.xml +}