Updates Flatpak to build Slint instead of Qt (#1130)

This commit is contained in:
Putta Khunchalee 2024-11-22 23:16:28 +07:00 committed by GitHub
parent 118c693710
commit fe45c4a733
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 112 deletions

View File

@ -6,7 +6,7 @@ jobs:
name: Linux
runs-on: ubuntu-22.04
steps:
- name: Checkout source
- name: Checkout repository
uses: actions/checkout@v4
- name: Install System Packages
run: |
@ -18,10 +18,8 @@ jobs:
run: rustup target add x86_64-unknown-none
- name: Lint Rust sources
run: cargo clippy --package obkrnl --target x86_64-unknown-none -- -D warnings
working-directory: src
- name: Run tests
run: cargo test --workspace --exclude gui --exclude kernel
working-directory: src
- name: Add Flathub
run: flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Generate cache keys
@ -37,8 +35,7 @@ jobs:
- name: Install Flatpak runtimes
run: |
flatpak install --noninteractive flathub \
org.kde.Platform//6.7 org.kde.Sdk//6.7 \
org.freedesktop.Sdk.Extension.rust-stable//23.08
org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
if: ${{ steps.flatpak-runtime.outputs.cache-hit != 'true' }}
- name: Generate Flatpak branch
run: |

View File

@ -90,6 +90,10 @@ def main():
description='Script to build Obliteration and create distribution file')
p.add_argument('-r', '--release', action='store_true', help='enable optimization')
p.add_argument(
'--root',
metavar='PATH',
help='directory to store build outputs')
# Parse arguments.
args = p.parse_args()
@ -117,6 +121,9 @@ def main():
gui = cargo('gui', release=args.release, args=['--bin', 'obliteration', '-F', 'slint'])
# Create output directory.
dest = args.root
if dest is None:
dest = 'dist'
if os.path.exists(dest):

View File

@ -1,10 +1,10 @@
app-id: io.github.obhq.Obliteration
default-branch: stable
runtime: org.kde.Platform
runtime-version: '6.7'
runtime: org.freedesktop.Platform
runtime-version: '24.08'
platform-extensions:
- org.freedesktop.Platform.GL.default
sdk: org.kde.Sdk
sdk: org.freedesktop.Sdk
command: obliteration
build-options:
build-args:
@ -32,9 +32,7 @@ modules:
if [ ${FLATPAK_ARCH} == 'x86_64' ]; then
rustup target add x86_64-unknown-none
fi
- cmake --preset linux-release
- cmake --build --preset linux-release
- cmake --install build --prefix "$FLATPAK_DEST"
- ./build.py -r --root "$FLATPAK_DEST"
sources:
- type: dir
path: .

View File

@ -41,11 +41,6 @@ struct DebugClient;
*/
struct DebugServer;
/**
* Reason for [`VmmEvent::Breakpoint`].
*/
struct KernelStop;
/**
* Contains settings to launch the kernel.
*/
@ -61,26 +56,6 @@ struct RustError;
*/
struct Vmm;
/**
* Result of [`vmm_dispatch_debug()`].
*/
enum DebugResult_Tag {
DebugResult_Ok,
DebugResult_Disconnected,
DebugResult_Error,
};
struct DebugResult_Error_Body {
struct RustError *reason;
};
struct DebugResult {
enum DebugResult_Tag tag;
union {
struct DebugResult_Error_Body error;
};
};
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
@ -157,8 +132,6 @@ struct RustError *update_firmware(const char *root,
void vmm_free(struct Vmm *vmm);
struct DebugResult vmm_dispatch_debug(struct Vmm *vmm, struct KernelStop *stop);
ptrdiff_t vmm_debug_socket(struct Vmm *vmm);
void vmm_shutdown(struct Vmm *vmm);

View File

@ -407,53 +407,6 @@ void MainWindow::setupDebugger()
return;
}
#endif
// Watch for incoming data.
m_debugNoti = new QSocketNotifier(QSocketNotifier::Read, this);
m_debugNoti->setSocket(sock);
connect(m_debugNoti, &QSocketNotifier::activated, [this] { dispatchDebug(nullptr); });
m_debugNoti->setEnabled(true);
// Setup GDB session.
dispatchDebug(nullptr);
}
void MainWindow::dispatchDebug(KernelStop *stop)
{
// Do nothing if the previous thread already trigger the shutdown.
if (vmm_shutting_down(m_vmm)) {
return;
}
// Dispatch debug events.
auto r = vmm_dispatch_debug(m_vmm, stop);
switch (r.tag) {
case DebugResult_Ok:
break;
case DebugResult_Disconnected:
// It is not safe to let the kernel running since it is assume there are a debugger.
vmm_shutdown(m_vmm);
break;
case DebugResult_Error:
{
Rust<RustError> e(r.error.reason);
QMessageBox::critical(
this,
"Error",
QString("Failed to dispatch debug events: %1").arg(error_message(e)));
}
vmm_shutdown(m_vmm);
break;
}
if (vmm_shutting_down(m_vmm)) {
stopDebug();
}
}
bool MainWindow::loadGame(const QString &gameId)

View File

@ -46,7 +46,6 @@ private:
void vmmError(const QString &msg);
void waitKernelExit(bool success);
void setupDebugger();
void dispatchDebug(KernelStop *stop);
bool loadGame(const QString &gameId);
bool requireVmmStopped();
void stopDebug();

View File

@ -1,5 +1,4 @@
use super::{DebugResult, DispatchDebugResult, KernelStop, Vmm};
use crate::error::RustError;
use super::Vmm;
use gdbstub::stub::state_machine::GdbStubStateMachine;
use std::sync::atomic::Ordering;
@ -8,26 +7,6 @@ pub unsafe extern "C" fn vmm_free(vmm: *mut Vmm) {
drop(Box::from_raw(vmm));
}
#[no_mangle]
pub unsafe extern "C" fn vmm_dispatch_debug(vmm: *mut Vmm, stop: *mut KernelStop) -> DebugResult {
// Consume stop reason now to prevent memory leak.
let vmm = &mut *vmm;
let stop = if stop.is_null() {
None
} else {
Some(Box::from_raw(stop).0)
};
match vmm.dispatch_debug(stop) {
Ok(DispatchDebugResult::Ok) => DebugResult::Ok,
Ok(DispatchDebugResult::Disconnected) => DebugResult::Disconnected,
Err(e) => {
let e = RustError::wrap(e).into_c();
DebugResult::Error { reason: e }
}
}
}
#[no_mangle]
pub unsafe extern "C" fn vmm_debug_socket(vmm: *mut Vmm) -> isize {
let s = match &mut (*vmm).gdb {