This change addresses the code review comments. We don't want emscripten to be in `PATH` and instead set the `EMSCRIPTEN_BASE` environment variable.
4.6 KiB
Setup your Keyman build environment on Ubuntu
Target Projects
On Linux, you can build the following projects:
- Keyman for Linux
- Keyman Core (Linux only) (aka core)
- Keyman for Android
- Keyman Core (wasm targets)
- Common/Web
- KeymanWeb
The following projects cannot be built on Linux:
- Keyman for Windows
- Keyman Developer
- Keyman for macOS
- Keyman for iOS
System Requirements
- Minimum Ubuntu version: Ubuntu 20.04
Other Linux distributions will also work if appropriate dependencies are installed.
Repository Paths
Recommended filesystem layout:
$HOME/keyman/
keyman/ this repository (https://github.com/keymanapp/keyman)
keyboards/ https://github.com/keymanapp/keyboards
sites/
keyman.com/ https://github.com/keymanapp/keyman.com
...
Prerequisites
The current list of dependencies can be found in the Build-Depends section of linux/debian/control.
They are most easily installed with the mk-build-deps tool:
sudo apt update
sudo apt install devscripts equivs
sudo mk-build-deps --install linux/debian/control
Node.js
Node.js v18 is required for Core build, Web tests, and Developer command line tools.
You can install it with:
curl -sL https://deb.nodesource.com/setup_18.x | bash
apt-get -q -y install nodejs
Keyman for Linux
All dependencies are already installed if you followed the instructions under Prerequisites.
Building Keyman for Linux
Keyman Core
Most dependencies are already installed if you followed the instructions under
Prerequisites. You'll still have to install emscripten:
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
export EMSCRIPTEN_BASE=$(pwd)/upstream/emscripten
NOTE: Don't put EMSDK on the path, i.e. don't source emsdk_env.sh.
Building Keyman Core
Docker Builder
The Docker builder allows you to perform a linux build from anywhere Docker is supported. To build the docker image:
cd linux
docker pull ubuntu:latest
docker build . -t keymanapp/keyman-linux-builder:latest
Once the image is built, it may be used to build parts of Keyman.
- core
# build 'core' in docker
cd $(git rev-parse --show-toplevel)/core
# keep linux build artifacts separate
mkdir -p build/linux
docker run -it --rm -v $(pwd)/..:/home/build/build \
-v $(pwd)/build/linux:/home/build/build/core/build \
keymanapp/keyman-linux-builder:latest \
wrapper core/build.sh --debug
- linux
# build 'linux' installation in docker
cd $(git rev-parse --show-toplevel)
docker run -it --rm -v $(pwd):/home/build/build \
keymanapp/keyman-linux-builder:latest \
wrapper 'DESTDIR=/home/build linux/build.sh --debug build install'
Keyman for Android
Dependencies:
Additional requirements:
- Android SDK
- Android Studio
- Gradle
- Maven
- OpenJDK 11 (for Keyman 17.0+)
- pandoc
Run Android Studio once after installation to install additional components such as emulator images and SDK updates.
Required environment variable:
ANDROID_HOMEpointing to Android SDK ($HOME/Android/Sdk)
Recommended environment variable:
Building:
Prerequisites
Many dependencies are only required for specific projects.
Base Dependencies
Environment variables:
Notes on Environment Variables
JAVA_HOME
This environment variable tells Gradle what version of Java to use for building Keyman for Android. OpenJDK 11 is used for master.
It's recommended to set the environment variables to:
export JAVA_HOME="[path to OpenJDK 11]"
Also edit /etc/profile.d/jvm.sh as sudo:
export JAVA_HOME="[path to OpenJDK 11]"
Multiple versions of Java: If you need to build Keyman for Android 16.0 or
older versions, you can set JAVA_HOME_11 to the OpenJDK 11 path and
JAVA_HOME to the OpenJDK 8 path. This will build both versions correctly
from command line. But note that you do need to update your JAVA_HOME env
var to the associated version before opening Android Studio and loading any
Android projects. JAVA_HOME_11 is mostly used by CI.