Skip to content

Latest commit

 

History

History
231 lines (159 loc) · 4.36 KB

File metadata and controls

231 lines (159 loc) · 4.36 KB

Setup Guide

Windows users: Use WSL (Windows Subsystem for Linux) for the build process. Native Windows builds are not supported.

Table of Contents

  1. Build with Docker (Recommended)
  2. Build Android APK
  3. Manual Build (Alternative)

Prerequisites

Clone the Astara repository:

git clone https://github.com/DesolateSea/Astara_stellarium-web-engine.git astara
cd astara

Clone the Emscripten SDK:

Note: Ensure it is installed in the astara root folder for the Docker method.

git clone https://github.com/emscripten-core/emsdk.git

1. Build with Docker (Recommended)

Ensure Docker is installed and running:

sudo systemctl status docker
# If not running:
sudo systemctl start docker

Navigate to the web frontend directory:

cd apps/web-frontend

Run the setup command. This will:

  1. Build the Docker image for Emscripten compilation.
  2. Compile the Stellarium Web Engine (WASM + JS) inside Docker.
  3. Build the Docker image for the Node.js environment.
  4. Install Node.js dependencies (using Yarn) inside Docker.
sudo -E make setup

Run frontend on dev server:

sudo -E make dev

Build the production frontend:

sudo -E make build

The build artifacts will be in dist.


2. Build Android APK

Set required environment variables:

export CAPACITOR_ANDROID_STUDIO_PATH=/path/to/android-studio/bin/studio.sh
export JAVA_HOME=/path/to/java-21-openjdk
export PATH=$JAVA_HOME/bin:$PATH

Sync with Capacitor:

make sync-android

Build the debug APK:

make build-apk

The APK will be located at:

android/app/build/outputs/apk/debug/app-debug.apk

Sign the Release APK

Generate a keystore in the android directory (one-time setup):

cd android
keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias

Build the release APK:

./gradlew assembleRelease

Sign the APK using apksigner:

Note: apksigner is located in $ANDROID_HOME/build-tools/<version>/. Use the full path if it's not in your PATH.

macOS/Linux:

$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks my-release-key.jks --out app-release-signed.apk app/build/outputs/apk/release/app-release.apk

Windows (PowerShell/CMD):

%LOCALAPPDATA%\Android\Sdk\build-tools\34.0.0\apksigner sign --ks my-release-key.jks --out app-release-signed.apk app\build\outputs\apk\release\app-release.apk

Verify the signature:

macOS/Linux:

$ANDROID_HOME/build-tools/34.0.0/apksigner verify app-release-signed.apk

Windows:

%LOCALAPPDATA%\Android\Sdk\build-tools\34.0.0\apksigner verify app-release-signed.apk

3. Manual Build (Alternative)

If you prefer to build web-frontend manually without Docker, follow these steps.

3.1. Setting Up Emscripten

Manually install and activate the Emscripten SDK:

cd emsdk
./emsdk install latest
./emsdk activate latest     # writes .emscripten file 
source ./emsdk_env.sh       # Active PATH and other environment variables in current terminal

Install additional versions required by Stellarium:

# Get a tip-of-tree
./emsdk install tot 

# Install required emscripten version
./emsdk install 1.40.1
./emsdk activate 1.40.1
source ./emsdk_env.sh

Note: Stellarium Web Engine is sensitive to Emscripten versions. Version 1.40.1 is known to work reliably.

Install scons (choose one):

sudo apt-get install scons        # Debian / Ubuntu
sudo dnf install scons            # Fedora
pip install scons                 # Python

3.2. Build Stellarium Web Engine (WASM + JS)

Activate Emscripten:

source /path/to/emsdk/emsdk_env.sh

Build the engine:

make

Copy the generated artifacts into the frontend:

cp build/stellarium-web-engine.* apps/web-frontend/src/assets/js/

This produces:

  • stellarium-web-engine.js
  • stellarium-web-engine.wasm

3.3. Build Web Frontend

cd apps/web-frontend
npm install --legacy-peer-deps

Workaround for OpenSSL compatibility:

export NODE_OPTIONS=--openssl-legacy-provider

Run the dev server:

npm run dev

Build the production frontend:

npm run build