Experimental Docker image for godot

This commit is contained in:
mrezai 2016-02-16 21:23:56 +03:30
parent 4df8b7b02f
commit c5aab4e401
3 changed files with 143 additions and 0 deletions

13
tools/docker/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM ubuntu:14.04
MAINTAINER Mohammad Rezai, https://github.com/mrezai
WORKDIR /godot-dev
COPY scripts/install-android-tools /godot-dev/
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get upgrade -y && \
apt-get install --no-install-recommends -y -q \
build-essential gcc-multilib g++-multilib mingw32 mingw-w64 scons pkg-config libx11-dev libxcursor-dev \
libasound2-dev libfreetype6-dev libgl1-mesa-dev libglu-dev libssl-dev libxinerama-dev libudev-dev \
git wget openjdk-7-jdk libbcprov-java libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 lib32z1

40
tools/docker/README.md Normal file
View File

@ -0,0 +1,40 @@
## A Docker image to build Linux, Windows and Android godot binaries.
The main reason to write this, is to provide a simple way in all platforms to integrate external godot modules and build a custom version of godot.
## usage
1. Install docker on Linux or docker toolbox on Windows or Mac.
2. Open a terminal on linux or "Docker Quickstart Terminal" on Windows or Mac.
3. Run command:
- Linux: `cd`
- Windows: `cd /c/Users/YOUR_USERNAME`
- Mac: `cd /Users/YOUR_USERNAME`
4. Get godot source code: `git clone https://github.com/godotengine/godot.git`
5. Run command: `cd godot/tools/docker`
6. Run command: `docker build -t godot .`(In Linux run Docker commands with `sudo` or add your user to docker group before run the Docker commands). The godot docker image will be build after a while.
7. Run command:
- Linux: `docker run -it --name=godot-dev -v /home/YOUR_USERNAME/godot:/godot-dev/godot godot`
- Windows: `docker run -it --name=godot-dev -v /c/Users/YOUR_USERNAME/godot:/godot-dev/godot godot`
- Mac: `docker run -it --name=godot-dev -v /Users/YOUR_USERNAME/godot:/godot-dev/godot godot`
You are in the godot-dev container and /godot-dev directory now.
8. Run `./install-android-tools` to download and install all android development tools.
9. Run command: `source ~/.bashrc`
10. Run command: `cd godot`
11. Run command: `scons p=android target=release` to test everything is ok. You can set platform to x11, windows, android, haiku and server.
After use and exit, you can use this environment again by open terminal and type commands: `docker start godot-dev && docker attach godot-dev`.
### Windows and Mac stuffs:
- Speed up compilation:
- Exit from container.
- Run command: `docker-machine stop`
- Open "Oracle VM VirtualBox".
- In settings of default VM increase CPU cores and RAM to suitable values.
- Run command: `docker-machine start`
- Run command: `docker start godot-dev && docker attach godot-dev`
- ssh to VM(can be useful sometimes):
- `docker-machine ssh`
Check docker and boot2docker projects for more details.

View File

@ -0,0 +1,90 @@
#!/bin/bash
BASH_RC=~/.bashrc
GODOT_BUILD_TOOLS_PATH=/godot-dev/build-tools
mkdir -p $GODOT_BUILD_TOOLS_PATH
cd $GODOT_BUILD_TOOLS_PATH
ANDROID_BASE_URL=http://dl.google.com/android
ANDROID_SDK_RELEASE=android-sdk_r24.4.1
ANDROID_SDK_DIR=android-sdk-linux
ANDROID_SDK_FILENAME=$ANDROID_SDK_RELEASE-linux.tgz
ANDROID_SDK_URL=$ANDROID_BASE_URL/$ANDROID_SDK_FILENAME
ANDROID_SDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_SDK_DIR
ANDROID_SDK_SHA1=725bb360f0f7d04eaccff5a2d57abdd49061326d
ANDROID_NDK_RELEASE=android-ndk-r10e
ANDROID_NDK_DIR=$ANDROID_NDK_RELEASE
ANDROID_NDK_FILENAME=$ANDROID_NDK_RELEASE-linux-x86_64.bin
ANDROID_NDK_URL=$ANDROID_BASE_URL/ndk/$ANDROID_NDK_FILENAME
ANDROID_NDK_PATH=$GODOT_BUILD_TOOLS_PATH/$ANDROID_NDK_DIR
ANDROID_NDK_MD5=19af543b068bdb7f27787c2bc69aba7f
echo
echo "Download and install Android development tools ..."
echo
if [ ! -e $ANDROID_SDK_FILENAME ]; then
echo "Downloading: Android SDK ..."
wget $ANDROID_SDK_URL
else
echo $ANDROID_SDK_SHA1 $ANDROID_SDK_FILENAME > $ANDROID_SDK_FILENAME.sha1
sha1sum --check --strict $ANDROID_SDK_FILENAME.sha1
if [ ! $? -eq 0 ]; then
echo "Downloading: Android SDK ..."
wget $ANDROID_SDK_URL
fi
fi
if [ ! -d $ANDROID_SDK_DIR ]; then
tar -xvzf $ANDROID_SDK_FILENAME
fi
if [ ! -e $ANDROID_NDK_FILENAME ]; then
echo "Downloading: Android NDK ..."
wget $ANDROID_NDK_URL
else
echo $ANDROID_NDK_MD5 $ANDROID_NDK_FILENAME > $ANDROID_NDK_FILENAME.md5
md5sum --check --strict $ANDROID_NDK_FILENAME.md5
if [ ! $? -eq 0 ]; then
echo "Downloading: Android NDK ..."
wget $ANDROID_NDK_URL
fi
fi
if [ ! -d $ANDROID_NDK_DIR ]; then
chmod a+x $ANDROID_NDK_FILENAME
./$ANDROID_NDK_FILENAME
echo
fi
cd $ANDROID_SDK_DIR/tools
chmod a+x android
if ! ./android list target | grep -q 'android-19'; then
echo "Installing: Android Tools ..."
echo y | ./android update sdk --no-ui --all --filter "platform-tools,android-19,build-tools-19.1.0,\
extra-android-m2repository,extra-android-support,extra-google-google_play_services,extra-google-m2repository,\
extra-google-play_apk_expansion,extra-google-play_billing,extra-google-play_licensing"
fi
EXPORT_VAL="export ANDROID_HOME=$ANDROID_SDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
EXPORT_VAL="export ANDROID_NDK_ROOT=$ANDROID_NDK_PATH"
if ! grep -q "^$EXPORT_VAL" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
EXPORT_VAL="export PATH=$PATH:$ANDROID_SDK_PATH/tools"
if ! grep -q "^export PATH=.*$ANDROID_SDK_PATH/tools.*" $BASH_RC; then
echo $EXPORT_VAL >> ~/.bashrc
fi
echo
echo "Done!"
echo