From fa74b7117b9c8aca8b51dbc106dd2dac2295e193 Mon Sep 17 00:00:00 2001 From: Mufeed VH Date: Wed, 20 Dec 2023 15:17:45 +0530 Subject: [PATCH] Update README - Single build step --- README.md | 71 +++++++++++------------------------------------- cpp/prebuild.ps1 | 1 + 2 files changed, 17 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index 43fbcbe..d248adf 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,39 @@ +binserve logo + # VarnamIME for Windows Easily type Indian languages on Windows using [Varnam transliteration engine](https://varnamproject.github.io/). -> [!NOTE] -> This project is a hard-fork of [ime-rs](https://github.com/saschanaz/ime-rs) extended to support plugging Varnam as the transliteration engine on native Windows IME. -> -> **Project Status:** _Experimental_. Please refer to the [Checklist](#checklist) for pending tasks. +> This project is a hard-fork of [ime-rs](https://github.com/saschanaz/ime-rs) extended to support plugging [Varnam](https://github.com/varnamproject/govarnam) as the transliteration engine on native Windows IME. ## Build **Prerequisites:** -- Windows 64bit +- Windows 64 bit - [Visual Studio](https://visualstudio.microsoft.com/downloads/) (Including command-line utils: `lib.exe` and `gendef.exe`) -- [Rust](https://www.rust-lang.org/) +- [Rust](https://www.rust-lang.org/) and [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) - [Go](https://go.dev/) - [msys64](https://www.msys2.org/) - [PowerShell](https://www.microsoft.com/store/productId/9MZ1SNWT0N5D) ### Setup: -**1.** Install cbindgen for Rust: - -``` -cargo install cbindgen -``` +**1.** Open the project **Varnam Windows** by opening the file `cpp\VarnamWindows.sln` in Visual Studio. -**2.** Compile the libgovarnam shared library +**2.** Build and compile the bundle: ``` -cd varnam-windows\govarnam -windows-build.bat +Build -> Build Varnam Windows ``` -This will generate a dynamically linked DLL: `libgovarnam.dll`. +This should: +1. Build Govarnam, Rust native IME, and the SampleIME-cpp in sequence. +2. Build the necessary DLL, LIB, and PDB files into the `varnam-windows\cpp\x64\Debug` directory. +3. Fetch the latest language schemes from https://github.com/varnamproject/schemes. +4. Import words from the VLF files into the language schemes. +5. Setup language choice configuration. -**3.** Open the project **Varnam Windows** by opening the file `cpp\VarnamWindows.sln` in Visual Studio. - -**4.** Build and compile the bundle: - -``` -Build -> Clean Varnam Windows -Build -> Rebuild Varnam Windows -``` - -This should install the `libgovarnam.dll` and `libgovarnam.lib` into the env configured PATH - `C:\lib` and fetch the latest language schemes from https://github.com/varnamproject/schemes and place them inside the `C:\Users\\.libvarnam` directory. - -**5.** Open "Command Prompt" as Administrator, navigate to `varnam-windows\cpp\x64\Debug` and register the DLL to install Varnam as the native IME for the supported languages. +**3.** Open "Command Prompt" as Administrator, navigate to `varnam-windows\cpp\x64\Debug` and register the DLL to install Varnam as the native IME for the supported languages. ``` regsvr32 "Varnam Windows.dll" @@ -57,33 +45,6 @@ To unregister the DLL, run: regsvr32 /u "Varnam Windows.dll" ``` -> [!IMPORTANT] -> Only the x64/Debug configuration build is supported. - -## Checklist - -- [x] Compile [govarnam](https://github.com/varnamproject/govarnam) into a DLL and LIB to use as a shared library on Windows. -- [x] Call the DLL from Rust for transliteration via dynamic linking. This is extended from [govarnam-rust](https://github.com/varnamproject/govarnam-rust). -- [x] Link the Rust interface and SampleIME CPP to build an IME build dll. -- [x] Windows Setup Wizard script via Inno Setup. -- [x] Keyboard Layout shifting (Active/Disable toggle) -- [x] Resource files for icons (`*.ico`) for Registry Profile. (Currently the SampleIME 'Chinese Simplified' icon resources are loaded) -- [ ] Language Switching (Currently runs on just [Malayalam VST](https://github.com/varnamproject/schemes/tree/master/schemes/ml)) - - [ ] Implement the supported CONSTANTS for languages from [`windows_sys::Win32::System::SystemServices`](https://docs.rs/windows-sys/latest/windows_sys/Win32/System/SystemServices/index.html) and trigger language switch on Language Settings change. -- [ ] 🔴Handle Govarnam `nil pointer dereference` and potential race conditions (due to early freeing?). An example stack trace: - -``` -panic: runtime error: invalid memory address or nil pointer dereference -[signal 0xc0000005 code=0x0 addr=0x48 pc=0x7ffe9289dcfb] - -goroutine 19 [running]: -github.com/varnamproject/govarnam/govarnam.(*Varnam).tokenizeWord(0x0, {0x7ffe92a55f20, 0xc0000520a0}, {0xc00000a100, 0xc}, 0x0?, 0x0) - libvarnam-windows/govarnam/govarnam/symbol.go:258 +0x15b -github.com/varnamproject/govarnam/govarnam.(*Varnam).channelTokenizeWord(0x0?, {0x7ffe92a55f20, 0xc0000520a0}, {0xc00000a100, 0xc}, 0x0?, 0x0?, 0x0?) - libvarnam-windows/govarnam/govarnam/channel.go:24 +0xb6 -created by github.com/varnamproject/govarnam/govarnam.(*Varnam).transliterate in goroutine 7 - libvarnam-windows/govarnam/govarnam/govarnam.go:281 +0x189 -error: process didn't exit successfully: `target\debug\varnam_init.exe` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) -``` +**4.** Compile the `varnam-windows.iss` using [Inno Setup](https://jrsoftware.org/isinfo.php) to package and generate the Varnam Setup Wizard (`Varnam Windows Install.exe`). --- \ No newline at end of file diff --git a/cpp/prebuild.ps1 b/cpp/prebuild.ps1 index c3d7f05..f2fab4a 100644 --- a/cpp/prebuild.ps1 +++ b/cpp/prebuild.ps1 @@ -45,6 +45,7 @@ Pop-Location Push-Location $scriptDir/../rust cargo build --release --target=x86_64-pc-windows-msvc +cargo install cbindgen cbindgen --crate composition_processor --output ../cpp/SampleIME/cbindgen/composition_processor.h cbindgen --crate input_processor --output ../cpp/SampleIME/cbindgen/input_processor.h cbindgen --crate itf_components --output ../cpp/SampleIME/cbindgen/itf_components.h