rustdesk: fix build

This commit is contained in:
ocfox 2023-04-08 15:06:12 +08:00
parent 5947116ce7
commit 09462c7f66
No known key found for this signature in database
GPG key ID: 8C2212388306143C
3 changed files with 5252 additions and 74 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,38 +1,3 @@
diff --git a/Cargo.lock b/Cargo.lock
index fb17c7e..ef157e5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2332,10 +2332,10 @@ dependencies = [
[[package]]
name = "magnum-opus"
version = "0.4.0"
-source = "git+https://github.com/open-trade/magnum-opus#3c3d0b86ae95c84930bebffe4bcb03b3bd83342b"
+source = "git+https://github.com/TheRadioGuy/magnum-opus#171e1d021004626f7444d1e39b98f50bc3cb2604"
dependencies = [
- "bindgen",
- "target_build_utils",
+ "libc",
+ "opusic-sys",
]
[[package]]
@@ -2796,6 +2796,16 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
+[[package]]
+name = "opusic-sys"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5eace752ce07a037241dba8f02c654799f051e431b27028056bcb480e83b54f5"
+dependencies = [
+ "cmake",
+ "libc",
+]
+
[[package]]
name = "os_str_bytes"
version = "6.0.0"
diff --git a/Cargo.toml b/Cargo.toml
index 1b715bd..960e8da 100644
--- a/Cargo.toml

View file

@ -1,5 +1,4 @@
{ lib
, stdenv
, fetchFromGitHub
, makeDesktopItem
, copyDesktopItems
@ -8,7 +7,6 @@
, cmake
, yasm
, nasm
, zip
, pkg-config
, clang
, gtk3
@ -43,9 +41,22 @@ rustPlatform.buildRustPackage rec {
./fix-for-rust-1.65.diff
];
cargoSha256 = "sha256-1OMWEk+DerltF7kwdo4d04rbgIFLHBRq3vZaL7jtrdE=";
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
LIBCLANG_PATH="${llvmPackages.libclang.lib}/lib";
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"confy-0.4.0" = "sha256-e91cvEixhpPzIthAxzTa3fDY6eCsHUy/eZQAqs7QTDo=";
"parity-tokio-ipc-0.7.3-1" = "sha256-eULJePtBu0iBI3It/bPH0h82Obsb1PJALgwYwrnCFYI=";
"rdev-0.5.0-2" = "sha256-7CEZ2wIM4QAPfY1tGKqXfHplTaxHnccVqFRPjY21Svo=";
"tokio-socks-0.5.1-1" = "sha256-45QQ6FrhGU9uEhbKXTKd/mY6MDumO6p46NmlakdyDQk=";
"libappindicator-0.6.1" = "sha256-JGnnZrcwbh8WJ6+/4bYhfD3HvgF2C7XaaGb6TaMRWdw=";
"magnum-opus-0.4.0" = "sha256-U5uuN4YolOYDnFNbtPpwYefcBDTUUyioui0UCcW8dyo=";
"rust-pulsectl-0.2.12" = "sha256-8jXTspWvjONFcvw9/Z8C43g4BuGZ3rsG32tvLMQbtbM=";
"sciter-rs-0.5.57" = "sha256-ZZnZDhMjK0LjgmK0da1yvB0uoKueLhhhQtzmjoN+1R0=";
"systray-0.4.1" = "sha256-p1PMr/8oS6zHx4+Ng4zCqt0xZ57cq3wAu6/agyWq5Jw=";
};
};
# Change magnus-opus version to upstream so that it does not use
# vcpkg for libopus since it does not work.
@ -55,35 +66,37 @@ rustPlatform.buildRustPackage rec {
# Manually simulate a vcpkg installation so that it can link the libaries
# properly.
postUnpack = let
vcpkg_target = "x64-linux";
postUnpack =
let
vcpkg_target = "x64-linux";
updates_vcpkg_file = writeText "update_vcpkg_rustdesk"
updates_vcpkg_file = writeText "update_vcpkg_rustdesk"
''
Package : libyuv
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
Package : libvpx
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
'';
in
''
Package : libyuv
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
export VCPKG_ROOT="$TMP/vcpkg";
Package : libvpx
Architecture : ${vcpkg_target}
Version : 1.0
Status : is installed
mkdir -p $VCPKG_ROOT/.vcpkg-root
mkdir -p $VCPKG_ROOT/installed/${vcpkg_target}/lib
mkdir -p $VCPKG_ROOT/installed/vcpkg/updates
ln -s ${updates_vcpkg_file} $VCPKG_ROOT/installed/vcpkg/status
mkdir -p $VCPKG_ROOT/installed/vcpkg/info
touch $VCPKG_ROOT/installed/vcpkg/info/libyuv_1.0_${vcpkg_target}.list
touch $VCPKG_ROOT/installed/vcpkg/info/libvpx_1.0_${vcpkg_target}.list
ln -s ${libvpx.out}/lib/* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
ln -s ${libyuv.out}/lib/* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
'';
in ''
export VCPKG_ROOT="$TMP/vcpkg";
mkdir -p $VCPKG_ROOT/.vcpkg-root
mkdir -p $VCPKG_ROOT/installed/${vcpkg_target}/lib
mkdir -p $VCPKG_ROOT/installed/vcpkg/updates
ln -s ${updates_vcpkg_file} $VCPKG_ROOT/installed/vcpkg/status
mkdir -p $VCPKG_ROOT/installed/vcpkg/info
touch $VCPKG_ROOT/installed/vcpkg/info/libyuv_1.0_${vcpkg_target}.list
touch $VCPKG_ROOT/installed/vcpkg/info/libvpx_1.0_${vcpkg_target}.list
ln -s ${libvpx.out}/lib/* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
ln -s ${libyuv.out}/lib/* $VCPKG_ROOT/installed/${vcpkg_target}/lib/
'';
nativeBuildInputs = [ pkg-config cmake makeWrapper copyDesktopItems yasm nasm clang wrapGAppsHook ];
buildInputs = [ alsa-lib pulseaudio libXfixes libxcb xdotool gtk3 libvpx libopus libXtst libyuv ];
@ -91,15 +104,22 @@ rustPlatform.buildRustPackage rec {
# Checks require an active X display.
doCheck = false;
desktopItems = [ (makeDesktopItem {
name = "rustdesk";
exec = meta.mainProgram;
icon = "rustdesk";
desktopName = "RustDesk";
comment = meta.description;
genericName = "Remote Desktop";
categories = ["Network"];
}) ];
desktopItems = [
(makeDesktopItem {
name = "rustdesk";
exec = meta.mainProgram;
icon = "rustdesk";
desktopName = "RustDesk";
comment = meta.description;
genericName = "Remote Desktop";
categories = [ "Network" ];
})
];
postPatch = ''
rm Cargo.lock
ln -s ${./Cargo.lock} Cargo.lock
'';
# Add static ui resources and libsciter to same folder as binary so that it
# can find them.
@ -122,7 +142,7 @@ rustPlatform.buildRustPackage rec {
description = "Yet another remote desktop software";
homepage = "https://rustdesk.com";
license = licenses.gpl3Only;
maintainers = with maintainers; [ leixb ];
maintainers = with maintainers; [ ocfox leixb ];
platforms = [ "x86_64-linux" ];
mainProgram = "rustdesk";
};