-
Notifications
You must be signed in to change notification settings - Fork 817
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b29d9ca
Showing
8 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bazel-* |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Set up Android NDK | ||
android_ndk_repository( | ||
name = "androidndk", | ||
# Android 5.0 | ||
api_level = 21 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
FROM ubuntu:16.04 | ||
|
||
# Update source | ||
RUN sed -i 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//http:\/\/mirrors\.163\.com\/ubuntu\//g' /etc/apt/sources.list | ||
RUN apt-get update -y | ||
|
||
## Basic tools | ||
RUN apt-get install -y --no-install-recommends apt-utils | ||
RUN apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
libcurl3-dev \ | ||
libgoogle-glog-dev \ | ||
libfreetype6-dev \ | ||
libpng12-dev \ | ||
libprotobuf-dev \ | ||
libzmq3-dev \ | ||
pkg-config \ | ||
python-dev \ | ||
python-pip \ | ||
protobuf-compiler \ | ||
rsync \ | ||
software-properties-common \ | ||
unzip \ | ||
zip \ | ||
zlib1g-dev \ | ||
openjdk-8-jdk \ | ||
openjdk-8-jre-headless \ | ||
wget | ||
|
||
ENV ANDROID_NDK_HOME /opt/android-ndk | ||
ENV ANDROID_NDK_VERSION r15c | ||
|
||
# Android NDK | ||
# download | ||
RUN mkdir /opt/android-ndk-tmp && \ | ||
cd /opt/android-ndk-tmp && \ | ||
wget https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
# uncompress | ||
unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
# move to its final location | ||
mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} && \ | ||
# remove temp dir | ||
cd ${ANDROID_NDK_HOME} && \ | ||
rm -rf /opt/android-ndk-tmp | ||
|
||
# add to PATH | ||
ENV PATH ${PATH}:${ANDROID_NDK_HOME} | ||
|
||
# Set up Bazel. | ||
|
||
# We need to add a custom PPA to pick up JDK8, since trusty doesn't | ||
# have an openjdk8 backport. openjdk-r is maintained by a reliable contributor: | ||
# Matthias Klose (https://launchpad.net/~doko). It will do until | ||
# we either update the base image beyond 14.04 or openjdk-8 is | ||
# finally backported to trusty; see e.g. | ||
# https://bugs.launchpad.net/trusty-backports/+bug/1368094 | ||
RUN add-apt-repository -y ppa:openjdk-r/ppa && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends openjdk-8-jdk openjdk-8-jre-headless && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Running bazel inside a `docker build` command causes trouble, cf: | ||
# https://github.com/bazelbuild/bazel/issues/134 | ||
# The easiest solution is to set up a bazelrc file forcing --batch. | ||
RUN echo "startup --batch" >>/etc/bazel.bazelrc | ||
# Similarly, we need to workaround sandboxing issues: | ||
# https://github.com/bazelbuild/bazel/issues/418 | ||
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \ | ||
>>/etc/bazel.bazelrc | ||
# Install the most recent bazel release. | ||
ENV BAZEL_VERSION 0.4.5 | ||
WORKDIR / | ||
RUN mkdir /bazel && \ | ||
cd /bazel && \ | ||
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ | ||
curl -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36" -fSsL -o /bazel/LICENSE.txt https://raw.githubusercontent.com/bazelbuild/bazel/master/LICENSE && \ | ||
chmod +x bazel-*.sh && \ | ||
./bazel-$BAZEL_VERSION-installer-linux-x86_64.sh && \ | ||
cd / && \ | ||
rm -f /bazel/bazel-$BAZEL_VERSION-installer-linux-x86_64.sh | ||
|
||
# Setup vim | ||
RUN apt-get update -y | ||
RUN apt-get install -y --no-install-recommends \ | ||
locales \ | ||
vim | ||
|
||
RUN mkdir -p ~/.vim/autoload ~/.vim/bundle && \ | ||
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | ||
|
||
RUN mkdir -p ~/.vim/bundle | ||
RUN cd ~/.vim/bundle && \ | ||
git clone https://github.com/scrooloose/nerdtree.git && \ | ||
git clone https://github.com/vim-syntastic/syntastic.git && \ | ||
git clone https://github.com/vim-airline/vim-airline.git && \ | ||
git clone https://github.com/altercation/vim-colors-solarized.git && \ | ||
git clone https://github.com/bazelbuild/vim-ft-bzl.git && \ | ||
git clone https://github.com/google/vim-maktaba.git && \ | ||
git clone https://github.com/google/vim-codefmt.git | ||
|
||
RUN curl -LSso ~/.vimrc https://gist.githubusercontent.com/llhe/71c5802919debd5825c100c0135478a7/raw/16a35020cc65f9c25d0cf8f11a3ba7b345a1271d/.vimrc | ||
|
||
RUN locale-gen en_US.UTF-8 | ||
ENV LC_CTYPE=en_US.UTF-8 | ||
ENV LC_ALL=en_US.UTF-8 | ||
ENV TERM xterm-256color | ||
|
||
# Extra packges | ||
RUN apt-get install -y --no-install-recommends \ | ||
telnet \ | ||
net-tools \ | ||
inetutils-ping \ | ||
screen \ | ||
android-tools-adb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Examples | ||
|
||
cc_binary( | ||
name = "helloworld", | ||
srcs = [ | ||
"helloworld.cc", | ||
], | ||
linkopts = [ | ||
"-pie", | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Examples | ||
======= | ||
|
||
To build the example: | ||
``` | ||
bazel build mace/examples:helloworld \ | ||
--crosstool_top=//external:android/crosstool \ | ||
--host_crosstool_top=@bazel_tools//tools/cpp:toolchain \ | ||
--cpu=armeabi-v7a | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <cstdio> | ||
|
||
int main() { | ||
printf("Hello world\n"); | ||
return 0; | ||
} |