Merge pull request #3998 from Kingtous/master

fix: move linux_headless to a new option
This commit is contained in:
RustDesk 2023-04-10 17:04:34 +08:00 committed by GitHub
commit 6eb7e09b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 11 deletions

View File

@ -545,19 +545,22 @@ jobs:
arch: x86_64, arch: x86_64,
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "linux_headless", extra-build-features: "",
enable-headless: true
} }
- { - {
arch: x86_64, arch: x86_64,
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "flatpak", extra-build-features: "flatpak",
enable-headless: false
} }
- { - {
arch: x86_64, arch: x86_64,
target: x86_64-unknown-linux-gnu, target: x86_64-unknown-linux-gnu,
os: ubuntu-20.04, os: ubuntu-20.04,
extra-build-features: "appimage", extra-build-features: "appimage",
enable-headless: false
} }
# - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
steps: steps:
@ -681,7 +684,11 @@ jobs:
x86_64) x86_64)
# no need mock on x86_64 # no need mock on x86_64
export VCPKG_ROOT=/opt/artifacts/vcpkg export VCPKG_ROOT=/opt/artifacts/vcpkg
cargo build --lib --features hwcodec,flutter,flutter_texture_render,${{ matrix.job.extra-build-features }} --release export DEFAULT_FEAT=""
if ${{ matrix.job.enable-headless }}; then
export DEFAULT_FEAT=linux_headless
fi
cargo build --lib --features hwcodec,flutter,flutter_texture_render,${{ matrix.job.extra-build-features }},$DEFAULT_FEAT --release
;; ;;
esac esac
@ -706,6 +713,7 @@ jobs:
os: ubuntu-20.04, # just for naming package, not running host os: ubuntu-20.04, # just for naming package, not running host
use-cross: true, use-cross: true,
extra-build-features: "", extra-build-features: "",
enable-headless: true
} }
- { - {
arch: aarch64, arch: aarch64,
@ -713,6 +721,7 @@ jobs:
os: ubuntu-20.04, # just for naming package, not running host os: ubuntu-20.04, # just for naming package, not running host
use-cross: true, use-cross: true,
extra-build-features: "appimage", extra-build-features: "appimage",
enable-headless: false
} }
# - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" } # - { arch: aarch64, target: aarch64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true, extra-build-features: "flatpak" }
# - { # - {
@ -839,7 +848,11 @@ jobs:
# start build # start build
pushd /workspace pushd /workspace
export VCPKG_ROOT=/opt/artifacts/vcpkg export VCPKG_ROOT=/opt/artifacts/vcpkg
cargo build --lib --features flutter,${{ matrix.job.extra-build-features }} --release export DEFAULT_FEAT=""
if ${{ matrix.job.enable-headless }}; then
export DEFAULT_FEAT=linux_headless
fi
cargo build --lib --features flutter,${{ matrix.job.extra-build-features }},$DEFAULT_FEAT --release
- name: Upload Artifacts - name: Upload Artifacts
uses: actions/upload-artifact@master uses: actions/upload-artifact@master
@ -863,6 +876,7 @@ jobs:
os: ubuntu-latest, os: ubuntu-latest,
use-cross: true, use-cross: true,
extra-build-features: "", extra-build-features: "",
enable-headless: true
} }
# - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" } # - { arch: armv7, target: armv7-unknown-linux-gnueabihf , os: ubuntu-20.04, use-cross: true, extra-build-features: "appimage" }
# - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true } # - { target: arm-unknown-linux-musleabihf, os: ubuntu-20.04, use-cross: true }
@ -968,7 +982,11 @@ jobs:
python3 ./res/inline-sciter.py python3 ./res/inline-sciter.py
export VCPKG_ROOT=/opt/artifacts/vcpkg export VCPKG_ROOT=/opt/artifacts/vcpkg
export ARCH=armhf export ARCH=armhf
cargo build --features inline --release --bins export DEFAULT_FEAT=""
if ${{ matrix.job.enable-headless }}; then
export DEFAULT_FEAT=linux_headless
fi
cargo build --features inline,${{ matrix.job.extra-build-features }},$DEFAULT_FEAT --release --bins
# package # package
mkdir -p ./Release mkdir -p ./Release
mv ./target/release/rustdesk ./Release/rustdesk mv ./target/release/rustdesk ./Release/rustdesk

View File

@ -7,7 +7,7 @@ arch=('x86_64')
url="" url=""
license=('AGPL-3.0') license=('AGPL-3.0')
groups=() groups=()
depends=('gtk3' 'xdotool' 'libxcb' 'libxfixes' 'alsa-lib' 'curl' 'libva' 'libvdpau' 'libappindicator-gtk3', 'pam') depends=('gtk3' 'xdotool' 'libxcb' 'libxfixes' 'alsa-lib' 'curl' 'libva' 'libvdpau' 'libappindicator-gtk3' 'pam')
makedepends=() makedepends=()
checkdepends=() checkdepends=()
optdepends=() optdepends=()

View File

@ -1,8 +1,10 @@
use std::ffi::c_char;
use crate::plugins::PLUGIN_REGISTRAR; use crate::plugins::PLUGIN_REGISTRAR;
// API provided by RustDesk. // API provided by RustDesk.
pub type LoadPluginFunc = fn(*const i8) -> i32; pub type LoadPluginFunc = fn(*const c_char) -> i32;
pub type UnloadPluginFunc = fn(*const i8) -> i32; pub type UnloadPluginFunc = fn(*const c_char) -> i32;
#[repr(C)] #[repr(C)]
pub struct RustDeskApiTable { pub struct RustDeskApiTable {
@ -11,12 +13,12 @@ pub struct RustDeskApiTable {
} }
#[no_mangle] #[no_mangle]
fn load_plugin(path: *const i8) -> i32 { fn load_plugin(path: *const c_char) -> i32 {
PLUGIN_REGISTRAR.load_plugin(path) PLUGIN_REGISTRAR.load_plugin(path)
} }
#[no_mangle] #[no_mangle]
fn unload_plugin(path: *const i8) -> i32 { fn unload_plugin(path: *const c_char) -> i32 {
PLUGIN_REGISTRAR.unload_plugin(path) PLUGIN_REGISTRAR.unload_plugin(path)
} }

View File

@ -75,7 +75,7 @@ pub struct PluginRegistar<P: Plugin> {
} }
impl<P: Plugin> PluginRegistar<P> { impl<P: Plugin> PluginRegistar<P> {
pub fn load_plugin(&self, path: *const i8) -> i32 { pub fn load_plugin(&self, path: *const c_char) -> i32 {
let p = unsafe { CStr::from_ptr(path) }; let p = unsafe { CStr::from_ptr(path) };
let lib_path = p.to_str().unwrap_or("").to_owned(); let lib_path = p.to_str().unwrap_or("").to_owned();
let lib = unsafe { libloading::Library::new(lib_path.as_str()) }; let lib = unsafe { libloading::Library::new(lib_path.as_str()) };
@ -100,7 +100,7 @@ impl<P: Plugin> PluginRegistar<P> {
-1 -1
} }
pub fn unload_plugin(&self, path: *const i8) -> i32 { pub fn unload_plugin(&self, path: *const c_char) -> i32 {
let p = unsafe { CStr::from_ptr(path) }; let p = unsafe { CStr::from_ptr(path) };
let lib_path = p.to_str().unwrap_or("").to_owned(); let lib_path = p.to_str().unwrap_or("").to_owned();
match PLUGIN_REGISTRAR.plugins.write().unwrap().remove(&lib_path) { match PLUGIN_REGISTRAR.plugins.write().unwrap().remove(&lib_path) {