summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorStaticRocket2023-04-26 00:05:41 -0500
committerStaticRocket2023-04-26 00:12:19 -0500
commitaca6f4c6db5c6a2fcf294ef2bdc3c31d7670948f (patch)
tree6df32a118525a1ff25bf506fe6b71f9bffa57c66
parent748aa4ef2e3f81f8d0e32d9697a6ba1c7871e16c (diff)
downloadaur-aca6f4c6db5c6a2fcf294ef2bdc3c31d7670948f.tar.gz
all: add some patches to work around build issues
Add some interim patches to get this building with the latest version of cargo/rust. This is messy and will be dropped as soon as the corresponding upstream PR is accepted [1]. Why is the patch bumping the uhid-virt version? Because the version published to crates.io doesn't match the upstream package version, despite the actual contents of the crate being the same. Feel free to verify this [2]. [1] https://github.com/flukejones/uhid-virt/pull/4 [2] https://static.crates.io/crates/uhid-virt/uhid-virt-0.0.5.crate Signed-off-by: StaticRocket <35777938+StaticRocket@users.noreply.github.com>
-rw-r--r--.SRCINFO6
-rw-r--r--0001-Fix-reference-to-packed-field-is-unaligned.patch51
-rw-r--r--0001-cargo-patch-the-source-to-pull-a-patch.patch31
-rwxr-xr-xPKGBUILD18
4 files changed, 103 insertions, 3 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 97eda20604c5..22588cda266e 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -22,6 +22,12 @@ pkgbase = asusctl-git
provides = asusctl
conflicts = asusctl
source = git+https://gitlab.com/asus-linux/asusctl.git
+ source = git+https://github.com/flukejones/uhid-virt.git
+ source = 0001-Fix-reference-to-packed-field-is-unaligned.patch
+ source = 0001-cargo-patch-the-source-to-pull-a-patch.patch
md5sums = SKIP
+ md5sums = SKIP
+ md5sums = 6407424a4f9f698d51564fc4ecf45555
+ md5sums = e60fc2d845d1eb363c664ef20d15adbd
pkgname = asusctl-git
diff --git a/0001-Fix-reference-to-packed-field-is-unaligned.patch b/0001-Fix-reference-to-packed-field-is-unaligned.patch
new file mode 100644
index 000000000000..833962c9c731
--- /dev/null
+++ b/0001-Fix-reference-to-packed-field-is-unaligned.patch
@@ -0,0 +1,51 @@
+From bb82ca57bcdf5283d279ce76bbf3862fbc2545c3 Mon Sep 17 00:00:00 2001
+From: Jacob Alexander <haata@kiibohd.com>
+Date: Mon, 29 Aug 2022 22:10:46 -0700
+Subject: [PATCH] Fix `reference to packed field is unaligned`
+
+error: reference to packed field is unaligned
+ --> src/codec.rs:187:35
+ |
+187 | let payload = &event.u.start;
+ | ^^^^^^^^^^^^^^
+ |
+ = note: `#[deny(unaligned_references)]` on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #82523 <https://github.com/rust-lang/rust/issues/82523>
+ = note: fields of packed structs are not properly aligned, and creating a misaligned reference is undefined behavior (even if that reference is never dereferenced)
+ = help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers)
+---
+ Cargo.toml | 2 +-
+ src/codec.rs | 3 +--
+ 2 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index bdbceb6..39639b6 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -1,6 +1,6 @@
+ [package]
+ name = "uhid-virt"
+-version = "0.0.4"
++version = "0.0.5"
+ authors = ["Luke Jones <luke@ljones.dev>", "Sameer Puri <purisame@spuri.io>", "Daniel Stiner <danstiner@gmail.com>"]
+ edition = "2018"
+ description = "Interface to Linux UHID (user-space HID transport drivers)"
+diff --git a/src/codec.rs b/src/codec.rs
+index f8cbe7d..944813b 100644
+--- a/src/codec.rs
++++ b/src/codec.rs
+@@ -184,9 +184,8 @@ impl TryFrom<sys::uhid_event> for OutputEvent {
+ if let Some(event_type) = to_uhid_event_type(event.type_) {
+ match event_type {
+ sys::uhid_event_type_UHID_START => Ok(unsafe {
+- let payload = &event.u.start;
+ OutputEvent::Start {
+- dev_flags: BitFlags::from_bits_truncate(payload.dev_flags)
++ dev_flags: BitFlags::from_bits_truncate(event.u.start.dev_flags)
+ .iter()
+ .collect(),
+ }
+--
+2.40.0
+
diff --git a/0001-cargo-patch-the-source-to-pull-a-patch.patch b/0001-cargo-patch-the-source-to-pull-a-patch.patch
new file mode 100644
index 000000000000..76179819eaeb
--- /dev/null
+++ b/0001-cargo-patch-the-source-to-pull-a-patch.patch
@@ -0,0 +1,31 @@
+From d5c8611e12156ca52e61117e6faa346e159a3618 Mon Sep 17 00:00:00 2001
+From: StaticRocket <35777938+StaticRocket@users.noreply.github.com>
+Date: Tue, 25 Apr 2023 22:51:14 -0500
+Subject: [PATCH] cargo: patch the source to pull a patch
+
+Update the source to pull a local copy of uhid-virt with a patch to
+resolve "reference to packed field is unaligned" until flukes fork of
+uhid-virt accepts it.
+
+Signed-off-by: StaticRocket <35777938+StaticRocket@users.noreply.github.com>
+---
+ Cargo.toml | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/Cargo.toml b/Cargo.toml
+index 6278384..ad1d1a3 100644
+--- a/Cargo.toml
++++ b/Cargo.toml
+@@ -39,6 +39,9 @@ versions = "4.1"
+
+ notify-rust = { git = "https://github.com/flukejones/notify-rust.git", default-features = false, features = ["z"] }
+
++[patch.crates-io]
++uhid-virt = { path = "../uhid-virt" }
++
+ [profile.release]
+ # thin = 57s, asusd = 9.0M
+ # fat = 72s, asusd = 6.4M
+--
+2.40.0
+
diff --git a/PKGBUILD b/PKGBUILD
index 0d1b95de8738..811138277b63 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -16,8 +16,18 @@ optdepends=(
makedepends=('git' 'cargo' 'clang' 'cmake' 'pango' 'gdk-pixbuf2' 'at-spi2-core' 'gtk3')
provides=('asusctl')
conflicts=('asusctl')
-source=('git+https://gitlab.com/asus-linux/asusctl.git')
-md5sums=('SKIP')
+source=(
+ 'git+https://gitlab.com/asus-linux/asusctl.git'
+ 'git+https://github.com/flukejones/uhid-virt.git'
+ '0001-Fix-reference-to-packed-field-is-unaligned.patch'
+ '0001-cargo-patch-the-source-to-pull-a-patch.patch'
+)
+md5sums=(
+ 'SKIP'
+ 'SKIP'
+ '6407424a4f9f698d51564fc4ecf45555'
+ 'e60fc2d845d1eb363c664ef20d15adbd'
+)
_gitdir=${pkgname%"-git"}
pkgver() {
@@ -28,7 +38,9 @@ pkgver() {
prepare() {
cd "$srcdir/$_gitdir"
export RUSTUP_TOOLCHAIN=stable
- cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
+ patch --directory="$srcdir/uhid-virt" --forward --strip=1 --input="${srcdir}/0001-Fix-reference-to-packed-field-is-unaligned.patch"
+ patch --forward --strip=1 --input="${srcdir}/0001-cargo-patch-the-source-to-pull-a-patch.patch"
+ cargo fetch --target "$CARCH-unknown-linux-gnu"
}
build() {