GAPID uses the Bazel build system. The current minimum required version of bazel is 0.12.0.
Bazel is able to fetch most of the dependencies required to build GAPID, but currently the Android SDK and NDK both need to be downloaded and installed by hand.
Please see the following OS specific guides for setting up the build environment.
After setting up the build environment, GAPID can be built in a terminal with:
cd <path-to-gapid-source>
bazel build pkg
The build output will be at <path-to-gapid-source>/bazel-bin/pkg
.
Follow these instructions to install Chocolatey.
In the console type:
choco install bazel
Note: Installing bazel will also install MSYS into C:\tools\msys64
and Python into C:\tools\python27
.
Using the msys64 shell at C:\tools\msys64\mingw64
:
- Update MSYS with:
pacman -Syu
. - If the update ends with “close the window and run it again”, close and reopen the window and repeat 1.
- Fetch required tools with:
pacman -S mingw-w64-x86_64-gcc curl git zip unzip patch
- Close the MSYS terminal
A JRE is required by the Android SDK tools. If you do not already have a JRE installed, please install the Java Runtime Environment from here.
Unzip the Android SDK to a directory of your choosing.
To fetch the required packages, using a console type:
cd <sdk-path>
tools\bin\sdkmanager platforms;android-21 build-tools;26.0.1 ndk-bundle
Note: this will install the latest NDK in <sdk-path>\ndk-bundle
. The minimum required version of the NDK is r16b.
If you do not have adb installed you can do so with:
cd <sdk-path>
tools\bin\sdkmanager platform-tools
Either do this globally or in your shell every time.
Make sure the environment is setup before you run bazel (bazel shutdown
will shut it down).
-
Add
C:\tools\msys64\mingw64
to the PATH:set PATH=C:\tools\msys64\mingw64\bin;%PATH%
Runningwhere gcc
should now find mingw’s gcc. -
Add
C:\tools\python27
to the PATH:set PATH=C:\tools\python27;%PATH%
Alternatively, pass the path to python via the--python_path
to bazel. See the bazel documentation for more info. -
Set TMP to something very short.
C:\tmp
is known to work. For faster builds, add this folder to the excemptions of the Windows Defender anti-malware scanner.
The following environment variables will need to be set prior to building:
Variable | Target |
---|---|
ANDROID_HOME |
Path to Android SDK |
ANDROID_NDK_HOME |
Path to Android NDK |
BAZEL_SH |
C:\tools\msys64\usr\bin\bash.exe |
TMP |
C:\tmp |
Follow the MacOS Bazel Install directions to install bazel.
A JRE is required by the Android SDK tools. If you do not already have a JRE installed, please install the Java Runtime Environment from here.
Unzip the Android SDK to a directory of your choosing.
To fetch the required packages, using a console type:
cd <sdk-path>
tools/bin/sdkmanager "platforms;android-21" "build-tools;26.0.1" ndk-bundle
Note: this will install the latest NDK in <sdk-path>/ndk-bundle
. The minimum required version of the NDK is r16b.
If you do not have adb installed you can do so with:
cd <sdk-path>
tools/bin/sdkmanager platform-tools
After installing, ensure the XCode license is signed with:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
Bazel can concurrently use more file handles than the OS supports by default. This can be easily fixed by typing:
sudo sysctl -w kern.maxfiles=122880
sudo sysctl -w kern.maxfilesperproc=102400
echo ulimit -S -n 102400 >> ~/.bashrc
Either do this globally or in your shell every time.
Make sure the environment is setup before you run bazel (bazel shutdown
will shut it down).
The following environment variables will need to be set prior to building:
Variable | Target |
---|---|
ANDROID_HOME |
Path to Android SDK |
ANDROID_NDK_HOME |
Path to Android NDK |
Follow the Ubuntu Bazel Install or theFedora/CentOS Bazel Install directions to install bazel.
Alternatively, bazel can be downloaded from its GitHub Releases Page.
Unzip the Android SDK to a directory of your choosing.
To fetch the required packages, using a console type:
cd <sdk-path>
tools/bin/sdkmanager "platforms;android-21" "build-tools;26.0.1" ndk-bundle
Note: this will install the latest NDK in <sdk-path>/ndk-bundle
. The minimum required version of the NDK is r16b.
If you do not have adb installed you can do so with:
cd <sdk-path>
tools/bin/sdkmanager platform-tools
sudo apt-get update
sudo apt-get install mesa-common-dev libncurses5-dev libgl1-mesa-dev
Either do this globally or in your shell every time.
Make sure the environment is setup before you run bazel (bazel shutdown
will shut it down).
The following environment variables will need to be set prior to building:
Variable | Target |
---|---|
ANDROID_HOME |
Path to Android SDK |
ANDROID_NDK_HOME |
Path to Android NDK |