Support building with docker.
authorAnthony Romano <anthony.romano@coreos.com>
Mon, 17 Jul 2017 04:08:46 +0000 (21:08 -0700)
committerNIIBE Yutaka <gniibe@fsij.org>
Tue, 18 Jul 2017 04:38:46 +0000 (13:38 +0900)
Signed-off-by: Anthony Romano <anthony.romano@coreos.com>
ChangeLog
docker/Dockerfile.debug [new file with mode: 0644]
docker/Dockerfile.release [new file with mode: 0644]
docker/Makefile [new file with mode: 0644]
src/configure

index ca5a387..2b4f048 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-18  Anthony Romano <anthony.romano@coreos.com>
+
+       * docker: New.
+
 2017-07-18  Anthony Romano <anthony.romano@coreos.com>
 
        * src/main.c (MEMORY_SIZE, MEM_HEAD_IS_CORRUPT, MEM_HEAD_CHECK):
diff --git a/docker/Dockerfile.debug b/docker/Dockerfile.debug
new file mode 100644 (file)
index 0000000..5aa8a09
--- /dev/null
@@ -0,0 +1,4 @@
+FROM gnuk:latest
+LABEL Description="Image for building gnuK with debugging"
+
+RUN apt install -y gdb-arm-none-eabi && apt clean
diff --git a/docker/Dockerfile.release b/docker/Dockerfile.release
new file mode 100644 (file)
index 0000000..0c933f1
--- /dev/null
@@ -0,0 +1,6 @@
+FROM debian:latest
+LABEL Description="Image for building gnuK"
+
+RUN apt update -y && apt install -y make gcc-arm-none-eabi && apt clean
+
+CMD ["/bin/sh", "-c", "cd /gnuk/src && make clean && ./configure $GNUK_CONFIG && make"]
diff --git a/docker/Makefile b/docker/Makefile
new file mode 100644 (file)
index 0000000..41dff4d
--- /dev/null
@@ -0,0 +1,20 @@
+ifndef GNUK_CONFIG
+$(warning configuration flags not set in GNUK_CONFIG)
+endif
+
+all: ../chopstx docker-build-release
+       docker run --user=`id -u` --env GNUK_CONFIG --rm -v `pwd`/..:/gnuk/ -t gnuk:latest
+
+gdb: docker-build-debug
+       docker run --net host  --rm -i -v `pwd`/..:/gnuk/ -t gnuk:latest-debug arm-none-eabi-gdb /gnuk/src/build/gnuk.elf
+
+../chopstx:
+       git submodule update --init
+
+docker-build-release:
+       docker build -t gnuk:latest -f `pwd`/Dockerfile.release ..
+
+docker-build-debug: docker-build-release
+       docker build -t gnuk:latest-debug -f `pwd`/Dockerfile.debug ..
+
+.PHONY: all gdb debug docker-build docker-build-releaes docker-build-debug
index 155660f..f0d471b 100755 (executable)
@@ -46,7 +46,7 @@ hid_card_change=no
 factory_reset=no
 
 # Revision number
-if test -e ../.git; then
+if which git >/dev/null 2>&1 && test -e ../.git; then
   REVISION=`git describe --dirty="-modified"` 
 else
   REVISION=`cat ../VERSION`