Skip to content

Building MOAI on Ubuntu 16.04

halfnelson edited this page Aug 12, 2017 · 29 revisions

Tested on fresh ubuntu 16.04 installation (as root)

Building linux Host (needed for pito)

Install Prerequisites

apt-get update
apt-get install cmake git-core build-essential libglu1-mesa-dev 
apt-get install libxmu-dev libxi-dev libxxf86vm-dev libxcb-util0-dev
apt-get install autoconf libtool unzip

Grab moai community and checkout the pull-180 branch

git clone https://github.com/moai/moai-community.git --recursive
cd moai-community

Submodules are a pain, lets get on the right branch and ensure the submodules are happy

git checkout pull-180
git submodule update
cd sdk/moai
git submodule init
git submodule update --recursive
cd ../..

setup our local environment (and helper script)

cp scripts/env-local.sh.template scripts/env-local.sh
source ./scripts/env-linux.sh

build moai binary for linux

./scripts/build-linux.sh

add pito and moai to path

cd bin
export PATH=$PATH:$(pwd)
cd ..

Testing linux Host (needed for pito)

Test pito

pito

If that worked, lets make a project

cd ~
pito new-project moaiproj
cd moaiproj
pito run

you should see a moai window with an example app. Lets get ready to add an android host

Building Android Libs/Host

Grab the NDK

wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip
unzip android-ndk-r12b-linux-x86_64.zip

grab jdk

apt-get install default-jdk

grab the SDK

wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
unzip -d android-sdk sdk-tools-linux-3859397.zip

cd android-sdk/tools/bin
./sdkmanager platform-tools
./sdkmanager "build-tools;26.0.1"
./sdkmanager "platforms;android-22"
./sdkmanager "extras;android;m2repository"
./sdkmanager "extras;google;m2repository"

now to tell our environment where these things are edit the moai-community/scripts/env-local.sh to set the path to ANDROID_NDK

vi ./scripts/env-local.sh
source ./scripts/env-linux.sh

Build android native shared libraries

./scripts/build-android.sh

build an android host

cd ~/moaiproj
pito host create android
Clone this wiki locally