Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add info on cross-compiling with docker
- Loading branch information
Showing
4 changed files
with
100 additions
and
12 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
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 @@ | ||
FROM ev3dev/debian-jessie-armel-cross | ||
|
||
RUN sudo apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes --no-install-recommends \ | ||
cmake \ | ||
libgirepository1.0-dev \ | ||
libgrx-dev \ | ||
libgudev-1.0-dev \ | ||
libgudev-1.0-dev \ | ||
libncurses5-dev \ | ||
valac |
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 @@ | ||
FROM ev3dev/debian-jessie-armhf-cross | ||
|
||
RUN sudo apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive sudo apt-get install --yes --no-install-recommends \ | ||
cmake \ | ||
libgirepository1.0-dev \ | ||
libgrx-dev \ | ||
libgudev-1.0-dev \ | ||
libgudev-1.0-dev \ | ||
libncurses5-dev \ | ||
valac |
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,53 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
script_dir=$(dirname $(readlink -f "$0")) | ||
|
||
build_dir="$1" | ||
if [ ! -n "$build_dir" ]; then | ||
echo "Error: Must specify build directory" | ||
exit 1 | ||
fi | ||
|
||
case $2 in | ||
armel|armhf) | ||
arch=$2 | ||
;; | ||
*) | ||
echo "Error: Must specify 'armel' or 'armhf'" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if ! which docker >/dev/null; then | ||
echo "Error: Docker is not installed" | ||
exit 1 | ||
fi | ||
|
||
image_name="ev3devkit-$arch" | ||
container_name="ev3devkit_$arch" | ||
|
||
docker build \ | ||
--tag $image_name \ | ||
--no-cache \ | ||
--file "$script_dir/$arch.dockerfile" \ | ||
"$script_dir/" | ||
mkdir -p $build_dir | ||
|
||
docker rm --force $container_name >/dev/null 2>&1 || true | ||
docker run \ | ||
--volume "$build_dir:/build" \ | ||
--volume "$(pwd):/src" \ | ||
--workdir /build \ | ||
--name $container_name \ | ||
--env "TERM=$TERM" \ | ||
--env "DESTDIR=/build/dist" \ | ||
--tty \ | ||
--detach \ | ||
$image_name tail | ||
|
||
docker exec --tty $container_name cmake /src -DCMAKE_BUILD_TYPE=Debug \ | ||
-DCMAKE_TOOLCHAIN_FILE=/opt/gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux/toolchain.cmake | ||
|
||
echo "Done. You can now compile by running 'docker exec --tty $container_name make'" |