mirror of
https://github.com/obhq/obliteration.git
synced 2024-11-26 20:50:22 +00:00
Updates Flatpak to build Slint instead of Qt (#1130)
This commit is contained in:
parent
118c693710
commit
fe45c4a733
7
.github/workflows/ci-linux.yml
vendored
7
.github/workflows/ci-linux.yml
vendored
@ -6,7 +6,7 @@ jobs:
|
|||||||
name: Linux
|
name: Linux
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install System Packages
|
- name: Install System Packages
|
||||||
run: |
|
run: |
|
||||||
@ -18,10 +18,8 @@ jobs:
|
|||||||
run: rustup target add x86_64-unknown-none
|
run: rustup target add x86_64-unknown-none
|
||||||
- name: Lint Rust sources
|
- name: Lint Rust sources
|
||||||
run: cargo clippy --package obkrnl --target x86_64-unknown-none -- -D warnings
|
run: cargo clippy --package obkrnl --target x86_64-unknown-none -- -D warnings
|
||||||
working-directory: src
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --workspace --exclude gui --exclude kernel
|
run: cargo test --workspace --exclude gui --exclude kernel
|
||||||
working-directory: src
|
|
||||||
- name: Add Flathub
|
- name: Add Flathub
|
||||||
run: flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo
|
run: flatpak remote-add --user flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
- name: Generate cache keys
|
- name: Generate cache keys
|
||||||
@ -37,8 +35,7 @@ jobs:
|
|||||||
- name: Install Flatpak runtimes
|
- name: Install Flatpak runtimes
|
||||||
run: |
|
run: |
|
||||||
flatpak install --noninteractive flathub \
|
flatpak install --noninteractive flathub \
|
||||||
org.kde.Platform//6.7 org.kde.Sdk//6.7 \
|
org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
|
||||||
org.freedesktop.Sdk.Extension.rust-stable//23.08
|
|
||||||
if: ${{ steps.flatpak-runtime.outputs.cache-hit != 'true' }}
|
if: ${{ steps.flatpak-runtime.outputs.cache-hit != 'true' }}
|
||||||
- name: Generate Flatpak branch
|
- name: Generate Flatpak branch
|
||||||
run: |
|
run: |
|
||||||
|
15
build.py
15
build.py
@ -90,6 +90,10 @@ def main():
|
|||||||
description='Script to build Obliteration and create distribution file')
|
description='Script to build Obliteration and create distribution file')
|
||||||
|
|
||||||
p.add_argument('-r', '--release', action='store_true', help='enable optimization')
|
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.
|
# Parse arguments.
|
||||||
args = p.parse_args()
|
args = p.parse_args()
|
||||||
@ -117,12 +121,15 @@ def main():
|
|||||||
gui = cargo('gui', release=args.release, args=['--bin', 'obliteration', '-F', 'slint'])
|
gui = cargo('gui', release=args.release, args=['--bin', 'obliteration', '-F', 'slint'])
|
||||||
|
|
||||||
# Create output directory.
|
# Create output directory.
|
||||||
dest = 'dist'
|
dest = args.root
|
||||||
|
|
||||||
if os.path.exists(dest):
|
if dest is None:
|
||||||
shutil.rmtree(dest)
|
dest = 'dist'
|
||||||
|
|
||||||
os.mkdir(dest)
|
if os.path.exists(dest):
|
||||||
|
shutil.rmtree(dest)
|
||||||
|
|
||||||
|
os.mkdir(dest)
|
||||||
|
|
||||||
# Export artifacts.
|
# Export artifacts.
|
||||||
s = platform.system()
|
s = platform.system()
|
||||||
|
10
flatpak.yml
10
flatpak.yml
@ -1,10 +1,10 @@
|
|||||||
app-id: io.github.obhq.Obliteration
|
app-id: io.github.obhq.Obliteration
|
||||||
default-branch: stable
|
default-branch: stable
|
||||||
runtime: org.kde.Platform
|
runtime: org.freedesktop.Platform
|
||||||
runtime-version: '6.7'
|
runtime-version: '24.08'
|
||||||
platform-extensions:
|
platform-extensions:
|
||||||
- org.freedesktop.Platform.GL.default
|
- org.freedesktop.Platform.GL.default
|
||||||
sdk: org.kde.Sdk
|
sdk: org.freedesktop.Sdk
|
||||||
command: obliteration
|
command: obliteration
|
||||||
build-options:
|
build-options:
|
||||||
build-args:
|
build-args:
|
||||||
@ -32,9 +32,7 @@ modules:
|
|||||||
if [ ${FLATPAK_ARCH} == 'x86_64' ]; then
|
if [ ${FLATPAK_ARCH} == 'x86_64' ]; then
|
||||||
rustup target add x86_64-unknown-none
|
rustup target add x86_64-unknown-none
|
||||||
fi
|
fi
|
||||||
- cmake --preset linux-release
|
- ./build.py -r --root "$FLATPAK_DEST"
|
||||||
- cmake --build --preset linux-release
|
|
||||||
- cmake --install build --prefix "$FLATPAK_DEST"
|
|
||||||
sources:
|
sources:
|
||||||
- type: dir
|
- type: dir
|
||||||
path: .
|
path: .
|
||||||
|
27
gui/core.h
27
gui/core.h
@ -41,11 +41,6 @@ struct DebugClient;
|
|||||||
*/
|
*/
|
||||||
struct DebugServer;
|
struct DebugServer;
|
||||||
|
|
||||||
/**
|
|
||||||
* Reason for [`VmmEvent::Breakpoint`].
|
|
||||||
*/
|
|
||||||
struct KernelStop;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains settings to launch the kernel.
|
* Contains settings to launch the kernel.
|
||||||
*/
|
*/
|
||||||
@ -61,26 +56,6 @@ struct RustError;
|
|||||||
*/
|
*/
|
||||||
struct Vmm;
|
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
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
@ -157,8 +132,6 @@ struct RustError *update_firmware(const char *root,
|
|||||||
|
|
||||||
void vmm_free(struct Vmm *vmm);
|
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);
|
ptrdiff_t vmm_debug_socket(struct Vmm *vmm);
|
||||||
|
|
||||||
void vmm_shutdown(struct Vmm *vmm);
|
void vmm_shutdown(struct Vmm *vmm);
|
||||||
|
@ -407,53 +407,6 @@ void MainWindow::setupDebugger()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
bool MainWindow::loadGame(const QString &gameId)
|
||||||
|
@ -46,7 +46,6 @@ private:
|
|||||||
void vmmError(const QString &msg);
|
void vmmError(const QString &msg);
|
||||||
void waitKernelExit(bool success);
|
void waitKernelExit(bool success);
|
||||||
void setupDebugger();
|
void setupDebugger();
|
||||||
void dispatchDebug(KernelStop *stop);
|
|
||||||
bool loadGame(const QString &gameId);
|
bool loadGame(const QString &gameId);
|
||||||
bool requireVmmStopped();
|
bool requireVmmStopped();
|
||||||
void stopDebug();
|
void stopDebug();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
use super::{DebugResult, DispatchDebugResult, KernelStop, Vmm};
|
use super::Vmm;
|
||||||
use crate::error::RustError;
|
|
||||||
use gdbstub::stub::state_machine::GdbStubStateMachine;
|
use gdbstub::stub::state_machine::GdbStubStateMachine;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
@ -8,26 +7,6 @@ pub unsafe extern "C" fn vmm_free(vmm: *mut Vmm) {
|
|||||||
drop(Box::from_raw(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]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn vmm_debug_socket(vmm: *mut Vmm) -> isize {
|
pub unsafe extern "C" fn vmm_debug_socket(vmm: *mut Vmm) -> isize {
|
||||||
let s = match &mut (*vmm).gdb {
|
let s = match &mut (*vmm).gdb {
|
||||||
|
Loading…
Reference in New Issue
Block a user