Skip to content

Commit bb4b0fe

Browse files
committed
fix: resolve README formatting and workflow target compilation bugs
1 parent 8757926 commit bb4b0fe

8 files changed

Lines changed: 45 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,15 @@ jobs:
5959
run: cargo build --release --lib --target x86_64-pc-windows-msvc
6060

6161
- name: Build WASM Plugins
62+
shell: bash
6263
run: |
63-
mkdir plugins
64+
mkdir -p plugins
6465
rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o plugins/pTerm.wasm -C opt-level=z -C lto=true -C link-arg=--allow-undefined
6566
cp plug.app/rt/src_plugins/plugin.toml plugins/plugin.toml
6667
6768
- name: Run CMake Configuration
6869
run: |
69-
cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build -DRUST_LIB_PATH=../../plug.app/rt/target/x86_64-pc-windows-msvc/release/tm_main.lib -DCMAKE_BUILD_TYPE=Release
70+
cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build "-DRUST_LIB_PATH=${{ github.workspace }}/plug.app/rt/target/x86_64-pc-windows-msvc/release/tm_main.lib" -DCMAKE_BUILD_TYPE=Release
7071
7172
- name: Compile plug executable
7273
run: |
@@ -92,17 +93,17 @@ jobs:
9293
9394
- name: Build Rust Static Library
9495
working-directory: plug.app/rt
95-
run: cargo build --release --lib
96+
run: cargo build --release --lib --target x86_64-unknown-linux-gnu
9697

9798
- name: Build WASM Plugins
9899
run: |
99-
mkdir plugins
100+
mkdir -p plugins
100101
rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o plugins/pTerm.wasm -C opt-level=z -C lto=true -C link-arg=--allow-undefined
101102
cp plug.app/rt/src_plugins/plugin.toml plugins/plugin.toml
102103
103104
- name: Run CMake Configuration
104105
run: |
105-
cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build -DRUST_LIB_PATH=../../plug.app/rt/target/release/libtm_main.a -DCMAKE_BUILD_TYPE=Release
106+
cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build "-DRUST_LIB_PATH=${{ github.workspace }}/plug.app/rt/target/x86_64-unknown-linux-gnu/release/libtm_main.a" -DCMAKE_BUILD_TYPE=Release
106107
107108
- name: Compile plug executable
108109
run: |

.github/workflows/release.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,16 @@ jobs:
3232
run: cargo build --release --lib --target x86_64-pc-windows-msvc
3333

3434
- name: Build WASM Plugins
35+
shell: bash
3536
run: |
36-
mkdir release_pkg
37-
mkdir release_pkg/plugins
37+
mkdir -p release_pkg
38+
mkdir -p release_pkg/plugins
3839
rustc --target wasm32-unknown-unknown --crate-type cdylib plug.app/rt/src_plugins/pTerm/pTerm.rs -o release_pkg/plugins/pTerm.wasm -C opt-level=z -C lto=true -C link-arg=--allow-undefined
3940
cp plug.app/rt/src_plugins/plugin.toml release_pkg/plugins/plugin.toml
4041
4142
- name: Run CMake Configuration
4243
run: |
43-
cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build -DRUST_LIB_PATH=../../plug.app/rt/target/x86_64-pc-windows-msvc/release/tm_main.lib -DCMAKE_BUILD_TYPE=Release
44+
cmake -G Ninja -S plug.cross/windows -B plug.cross/windows/build "-DRUST_LIB_PATH=${{ github.workspace }}/plug.app/rt/target/x86_64-pc-windows-msvc/release/tm_main.lib" -DCMAKE_BUILD_TYPE=Release
4445
4546
- name: Compile plug executable
4647
run: |
@@ -78,7 +79,7 @@ jobs:
7879
7980
- name: Build Rust Static Library
8081
working-directory: plug.app/rt
81-
run: cargo build --release --lib
82+
run: cargo build --release --lib --target x86_64-unknown-linux-gnu
8283

8384
- name: Build WASM Plugins
8485
run: |
@@ -88,7 +89,7 @@ jobs:
8889
8990
- name: Run CMake Configuration
9091
run: |
91-
cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build -DRUST_LIB_PATH=../../plug.app/rt/target/release/libtm_main.a -DCMAKE_BUILD_TYPE=Release
92+
cmake -G Ninja -S plug.cross/linux -B plug.cross/linux/build "-DRUST_LIB_PATH=${{ github.workspace }}/plug.app/rt/target/x86_64-unknown-linux-gnu/release/libtm_main.a" -DCMAKE_BUILD_TYPE=Release
9293
9394
- name: Compile plug executable
9495
run: |

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
<p align="center">
2-
<img src="plug.res/ast/ico/p-1.png" width="180" />
1+
Plug: A WebAssembly Plugin Framework
2+
===
3+
4+
<p align="left">
5+
<img src="plug.res/ast/ico/p-1.png" alt="logo" width="500"/>
36
</p>
47

8+
**Plug** is a native framework that helps run sandboxed WebAssembly (WASM) plugins.
9+
510
<p align="center">
611
<a href="https://github.com/PlugFrameWork/plug/actions/workflows/ci.yml"><img src="https://github.com/PlugFrameWork/plug/actions/workflows/ci.yml/badge.svg" alt="CI Build" /></a>
712
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT" /></a>
813
</p>
914

10-
![Main Interface](plug.res/ast/iMg/screenshots/screenshot_1.png)
11-
12-
**Plug** is a lightweight, cross-platform host Framework that helps run sandboxed WebAssembly (WASM) plugins inside native multitab window interfaces.
13-
14-
---
15-
1615
## Features
1716

1817
- **Sandboxed WASM Execution**: Run plugins in secure, isolated containers using the Wasmer JIT compiler.
@@ -85,4 +84,4 @@ pub extern "C" fn run() {
8584
}
8685
```
8786

88-
Refer to [docs/PLUGIN_DEVELOPMENT.md](docs/PLUGIN_DEVELOPMENT.md) for details on permissions configuration (`plugin.toml`) and FFI imports.
87+
Refer to [docs/PLUGIN_DEVELOPMENT.md](docs/PLUGIN_DEVELOPMENT.md) for details on permissions configuration (`plugin.toml`) and FFI imports.

plug.app/rt/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ opt-level = "z" # Optimize for size
2525
lto = "fat" # Fat Link Time Optimization (Maximum)
2626
codegen-units = 1 # Better optimization, slower build
2727
panic = "abort" # Reduce size by removing stack unwinding
28-
strip = "debuginfo" # Remove symbols
28+
strip = true # Remove all symbols and debug info

plug.app/src/linux/api/intf/main_l.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ struct CmdItem { int tab; std::string cmd; };
4444
static std::queue<CmdItem> g_cmd_queue;
4545
static std::atomic_bool g_cmd_thread_running{false};
4646
thread_local int g_print_tab = -1;
47-
static int g_hover_close_tab = -1;
48-
static std::vector<HitBox> g_tab_close_boxes;
49-
static int g_char_w = 8;
47+
int g_hover_close_tab = -1;
48+
std::vector<HitBox> g_tab_close_boxes;
49+
int g_char_w = 8;
5050
static int g_tab_counter = 1;
5151

5252

@@ -620,6 +620,16 @@ const char* main_l_get_tab_owner(int tab_idx) {
620620
return "";
621621
}
622622

623+
void main_l_replace_last_line(const char* msg) {
624+
std::lock_guard<std::mutex> lk(g_mutex);
625+
if (g_tabs.empty()) return;
626+
int target_tab = (g_print_tab != -1) ? g_print_tab : g_active_tab;
627+
if (g_tabs[target_tab].raw_lines.empty()) return;
628+
g_tabs[target_tab].raw_lines.back().text = msg ? msg : "";
629+
g_tabs[target_tab].wrapped_lines.clear();
630+
if (g_drawing_area) gtk_widget_queue_draw(g_drawing_area);
631+
}
632+
623633
void main_l_request_close(void) {
624634
if (g_app) {
625635
g_application_quit(G_APPLICATION(g_app));

plug.app/src/windows/api/intf/main_w.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,13 @@ extern "C" void main_w_replace_last_line_internal(const char* msg) {
12671267
}
12681268
}
12691269

1270+
extern "C" void main_w_replace_last_line_safe(const char* msg);
1271+
1272+
extern "C" void main_w_replace_last_line(const char* msg) {
1273+
main_w_replace_last_line_safe(msg);
1274+
}
1275+
1276+
12701277

12711278
extern "C" void main_w_add_tab(const char* owner) {
12721279
if (!g_hwnd) return;

plug.cross/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ target_link_directories(plug PRIVATE
4747
)
4848

4949
target_compile_options(plug PRIVATE -O3 -ffunction-sections -fdata-sections -flto)
50-
target_link_options(plug PRIVATE -Wl,--gc-sections -flto)
50+
target_link_options(plug PRIVATE -Wl,--gc-sections -flto -s)
5151

5252
target_link_libraries(plug PRIVATE
5353
rust_core

plug.cross/windows/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ else()
4545
add_executable(plug ${SOURCES})
4646
endif()
4747

48+
target_compile_definitions(plug PRIVATE NOMINMAX)
49+
4850
target_include_directories(plug PRIVATE
4951
"${APP_DIR}/inc"
5052
"${COMMON_DIR}/inc"
@@ -65,7 +67,7 @@ if(MSVC)
6567
)
6668
else()
6769
target_compile_options(plug PRIVATE -Os -ffunction-sections -fdata-sections -flto)
68-
target_link_options(plug PRIVATE -static -static-libgcc -static-libstdc++ -Wl,--gc-sections -flto)
70+
target_link_options(plug PRIVATE -static -static-libgcc -static-libstdc++ -Wl,--gc-sections -flto -s)
6971

7072
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
7173
target_link_options(plug PRIVATE -fuse-ld=lld)

0 commit comments

Comments
 (0)