From ea76ed0d2d566e4d511ad783ca7e7d48caa7245f Mon Sep 17 00:00:00 2001 From: Fabien LOISON Date: Wed, 20 Mar 2024 14:04:17 +0100 Subject: [PATCH] feat: Added scripts to build a redistribuable Linux binary --- .gitignore | 1 + linux-bin/README-linux-dist.md | 38 ++++++++++++++++++++++++++++++++++ linux-bin/README.md | 28 +++++++++++++++++++++++++ linux-bin/build.sh | 31 +++++++++++++++++++++++++++ linux-bin/requirements.txt | 1 + 5 files changed, 99 insertions(+) create mode 100644 linux-bin/README-linux-dist.md create mode 100644 linux-bin/README.md create mode 100755 linux-bin/build.sh create mode 100644 linux-bin/requirements.txt diff --git a/.gitignore b/.gitignore index 5300fcd..69cfb5a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ _*.c* .pytest_cache/ *.tags /__misc__/ +yoga-bin.* diff --git a/linux-bin/README-linux-dist.md b/linux-bin/README-linux-dist.md new file mode 100644 index 0000000..5ea8fb2 --- /dev/null +++ b/linux-bin/README-linux-dist.md @@ -0,0 +1,38 @@ +# YOGA binary for Linux + +> YOGA: Yummy Optimizer for Gorgeous Assets + +YOGA is a command-line tool that: + +* converts and optimizes images from various format to JPEG, PNG and WebP, +* converts and optimizes 3D models from various formats to glTF and GLB. + + +## Install + +YOGA does not need any installation. Just unzip the content of this archive +and you are ready to go! :) + + +## Usage + +YOGA is a CLI (command line) program. To use it, open a terminal in this folder +and just use one of the following commands, depending on the terminal you are +using. + + ./yoga.bin -h + + +## Links + +Project page and source code: + +* https://github.com/wanadev/yoga + +Documentation: + +* https://wanadev.github.io/yoga/ + +Please report any issue on our bug tracker: + +* https://github.com/wanadev/yoga/issues diff --git a/linux-bin/README.md b/linux-bin/README.md new file mode 100644 index 0000000..a8d6a61 --- /dev/null +++ b/linux-bin/README.md @@ -0,0 +1,28 @@ +# YOGA Linux binary + +This forlder contains scripts to compile yoga as an executable binary for Linux. + +## Requirements + +* Python 3.x +* Python 3 headers (Debian/Ubuntu: `apt install python3-dev`) +* Virtualenv (Debian/Ubuntu: `apt install python3-venv`) +* Build tools and CMake (Debian/Ubuntu: `apt install build-essential cmake`) + + +## Build standalone version from source + +Clone this repository: + + git clone https://github.com/wanadev/yoga.git + cd yoga + git submodule init + git submodule update + +Run the build script (from the root directory of this repository): + + ./linux-bin/build.sh + +Once the build finished, you will find the result in the `yoga-bin.dist` folder. To run YOGA, use the `yoga` executable: + + ./yoga-bin.dist/yoga.bin -h diff --git a/linux-bin/build.sh b/linux-bin/build.sh new file mode 100755 index 0000000..9c021a0 --- /dev/null +++ b/linux-bin/build.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + +# Create and/or activate the virtual env +mkdir -p build/ + +if [ ! -d build/__env__/ ] ; then + python3 -m venv build/__env__/ + source build/__env__/bin/activate + pip install -r linux-bin/requirements.txt + pip install -e . +else + source build/__env__/bin/activate +fi + + +# Build YOGA +python -m nuitka \ + --standalone \ + --follow-imports \ + --include-package=PIL \ + linux-bin/yoga-bin.py + + +# Rename YOGA binary +mv yoga-bin.dist/yoga-bin.bin yoga-bin.dist/yoga.bin + + +# Copy additional files +cp LICENSE yoga-bin.dist/LICENSE +cp linux-bin/README-linux-dist.md yoga-bin.dist/README.md diff --git a/linux-bin/requirements.txt b/linux-bin/requirements.txt new file mode 100644 index 0000000..63d3478 --- /dev/null +++ b/linux-bin/requirements.txt @@ -0,0 +1 @@ +nuitka==2.1.2