From 80ff7a4f8aca11119def96f05a4ec0a94fa96cc0 Mon Sep 17 00:00:00 2001 From: Nikita Hasert Date: Fri, 23 May 2025 23:54:06 +0200 Subject: [PATCH] Add rough first attempt to build game2text from source --- .gitignore | 1 + scripts/install_game2text | 41 +++++++++++++++++++++++++++++++++++ scripts/install_tesseract_jpn | 10 +++++++++ scripts/install_virtualenv | 11 ++++++++++ 4 files changed, 63 insertions(+) create mode 100644 .gitignore create mode 100644 scripts/install_game2text create mode 100644 scripts/install_tesseract_jpn create mode 100644 scripts/install_virtualenv diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3f85b5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Game2Text/ diff --git a/scripts/install_game2text b/scripts/install_game2text new file mode 100644 index 0000000..6803e9a --- /dev/null +++ b/scripts/install_game2text @@ -0,0 +1,41 @@ +#!/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/ + pip install -r requirements.txt +} + +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 && \ +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 && \ +make_game2text && \ +deactivate + +# TODO: Create a script for this and put it on the path +echo 'Run "source venv/bin/activate && python game2text.py ; deactivate" to start game2text' diff --git a/scripts/install_tesseract_jpn b/scripts/install_tesseract_jpn new file mode 100644 index 0000000..91dffac --- /dev/null +++ b/scripts/install_tesseract_jpn @@ -0,0 +1,10 @@ +#!/bin/bash + +function install_tesseract { + echo "Installing tesseract, tesseract-data-jpn and tesseract-data-jpn_vert..." + sudo pacman -S tesseract-data-jpn tesseract-data-jpn_vert +} + +sudo steamos-readonly disable +install_tesseract +sudo steamos-readonly enable diff --git a/scripts/install_virtualenv b/scripts/install_virtualenv new file mode 100644 index 0000000..b96bb99 --- /dev/null +++ b/scripts/install_virtualenv @@ -0,0 +1,11 @@ +#!/bin/bash + +function install_virtualenv { + echo "Installing virtualenv..." + sudo pacman -S python-virtualenv +} + +sudo steamos-readonly disable +install_virtualenv +sudo steamos-readonly enable +