From ff17e315d435a0d544e6b18c4a6fa0434bcbd637 Mon Sep 17 00:00:00 2001 From: Nikita Hasert Date: Sat, 24 May 2025 00:15:42 +0200 Subject: [PATCH] Update README to describe how to build game2text from source --- README.md | 51 +++++++++++++++++++++++++++++++++++++++ install_all | 3 +++ scripts/install_game2text | 22 +++-------------- 3 files changed, 57 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a782bec..c5b96ff 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ - [Japanese Learning](#japanese-learning) - [./scripts/enable\_jp\_locale](#scriptsenable_jp_locale) - [Installing game2text](#installing-game2text) + - [Running the Windows Build Via Bottles](#running-the-windows-build-via-bottles) + - [Building Game2text From Source on the Steamdeck](#building-game2text-from-source-on-the-steamdeck) - [Installing MPV and mpvacious](#installing-mpv-and-mpvacious) - [Japanese Input](#japanese-input) - [Anki](#anki) @@ -66,6 +68,11 @@ LANG=ja_JP 7zz x ### Installing game2text +#### Running the Windows Build Via Bottles + +> [!WARNING] +> Unfortunately attempting to run game2text on SteamOS 3.7 via bottles seems to be broken currently + [game2text](https://game2text.com/) can be used via [bottles](https://usebottles.com/). 1. Install bottles from the Software Center @@ -74,6 +81,50 @@ LANG=ja_JP 7zz x 4. Setup a bottle optimized for gaming 5. Run game2text inside the bottle you just created +#### Building Game2text From Source on the Steamdeck + +See: [Game2Text](https://github.com/mathewthe2/Game2Text) + +Install the prerequisites +```bash +# This will install tesseract and data for horizontal and vertical japanese +./scripts/install_tesseract_jpn +# This will install virtualenv which we will need for building game2text from source +./scipts/install_virtualenv +# This will install the prerequisites to build game2text +sudo steamos-readonly disable +sudo pacman base-devel glibc linux-api-headers zlib cmake python3 gcc nodejs npm libffi openssl rust tk tcl +sudo steamos-readonly enable +``` + +Clone Game2Text and prepare its directory contents for building + +```bash +git clone https://github.com/mathewthe2/Game2Text.git +cd Game2Text +virtualenv venv --python='/usr/bin/python' +source venv/bin/activate +pip install virtualenv +``` + +> [!IMPORTANT] +> Before continuing +> 1. Replace `==` with `>=` for the versions in `requirements.py` +> 2. In `config.ini` replace `browser = default` with `browser = chromium`. See: https://game2text.com/faq/switch-browser/ + +```bash +pip install -r requirements.txt +deactivate +``` + +You can now run game2text natively in `Game2Text/` via + +```bash +source venv/bin/activate +python game2text.py +deactivate +``` + ### Installing MPV and mpvacious 1. Install MPV through the Software Center diff --git a/install_all b/install_all index 06c775e..82fde3b 100755 --- a/install_all +++ b/install_all @@ -6,3 +6,6 @@ . scripts/install_neovim . scripts/install_xclip . scripts/install_podman-compose + +. scipts/install_virtualenv +. scipts/install_tesseract_jpn diff --git a/scripts/install_game2text b/scripts/install_game2text index 6803e9a..06fa41b 100644 --- a/scripts/install_game2text +++ b/scripts/install_game2text @@ -1,26 +1,12 @@ #!/bin/bash # See: https://github.com/mathewthe2/Game2Text -function make_python_3_7_4 { -# wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz && \ -# tar -xf Python-3.7.4.tgz && \ -# cd Python-3.7.4 && \ -# ./configure && \ -# make && \ -# cd .. && \ - pip install virtualenv && \ -# curl -fsSL https://pyenv.run | bash - # Add the following to your ~/.bashrc - # echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc - # echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc - # echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc -# pyenv install 3.12.10 -} function make_game2text { # The requirements may need to be slightly adjusted if e.g. the specific version of numpy is not available # TODO: Replace == with >= in requirements.py automatically - # TODO: In config.ini replace `browser = default` with `browser = chromium` automatically See: https://game2text.com/faq/switch-browser/ + # TODO: In config.ini replace `browser = default` with `browser = chromium` automatically + # See: https://game2text.com/faq/switch-browser/ pip install -r requirements.txt } @@ -29,11 +15,9 @@ sudo pacman base-devel glibc linux-api-headers zlib cmake python3 gcc nodejs npm sudo steamos-readonly enable && \ git clone https://github.com/mathewthe2/Game2Text.git && \ cd Game2Text && \ -#virtualenv venv --python=Python-3.7.4/python && \ -#virtualenv venv --python='/home/deck/.pyenv/versions/3.12.10/bin/python' && \ virtualenv venv --python='/usr/bin/python' && \ source venv/bin/activate && \ -make_python_3_7_4 && \ +pip install virtualenv && \ make_game2text && \ deactivate