diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c346a37 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM fedora:31 + +LABEL description="Build environment for bemanitools" + +RUN yum -y install \ + git \ + make \ + zip \ + clang \ + mingw64-gcc.x86_64 \ + mingw32-gcc.x86_64 \ + wine.x86_64 + +RUN mkdir /bemanitools +WORKDIR /bemanitools + +# Order optimized for docker layer caching +COPY run-tests-wine.sh run-tests-wine.sh +COPY CHANGELOG.md CHANGELOG.md +COPY CONTRIBUTING.md CONTRIBUTING.md +COPY LICENSE LICENSE +COPY GNUmakefile GNUmakefile +COPY Module.mk Module.mk +COPY README.md README.md +COPY doc doc +COPY dist dist +COPY src src +# .git folder required or building fails when version is generated +COPY .git .git + +# Building +RUN make \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index 5d5550c..aa9cde1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,19 +11,24 @@ BUILDDIR ?= build # Internal variables # -depdir := $(BUILDDIR)/dep -objdir := $(BUILDDIR)/obj -bindir := $(BUILDDIR)/bin +builddir_docker := $(BUILDDIR)/docker -toolchain_32 := i686-w64-mingw32- -toolchain_64 := x86_64-w64-mingw32- +docker_container_name := "bemanitools-build" +docker_image_name := "bemanitools:build" -gitrev := $(shell git rev-parse HEAD) -cppflags := -I src -I src/main -I src/test -DGITREV=$(gitrev) -cflags := -O2 -pipe -ffunction-sections -fdata-sections \ - -Wall -std=c99 -cflags_release := -Werror -ldflags := -Wl,--gc-sections -static-libgcc +depdir := $(BUILDDIR)/dep +objdir := $(BUILDDIR)/obj +bindir := $(BUILDDIR)/bin + +toolchain_32 := i686-w64-mingw32- +toolchain_64 := x86_64-w64-mingw32- + +gitrev := $(shell git rev-parse HEAD) +cppflags := -I src -I src/main -I src/test -DGITREV=$(gitrev) +cflags := -O2 -pipe -ffunction-sections -fdata-sections \ + -Wall -std=c99 +cflags_release := -Werror +ldflags := -Wl,--gc-sections -static-libgcc # # The first target that GNU Make encounters becomes the default target. @@ -33,6 +38,7 @@ ldflags := -Wl,--gc-sections -static-libgcc all: build .PHONY: \ +build-docker \ clean \ code-format \ print-building \ @@ -74,6 +80,16 @@ run-tests: version: @echo "$(gitrev)" > version +build-docker: + $(V)docker rm -f $(docker_container_name) 2> /dev/null || true + $(V)docker build -t $(docker_image_name) -f Dockerfile . + $(V)docker create --name $(docker_container_name) $(docker_image_name) + $(V)rm -rf $(builddir_docker) + $(V)mkdir -p $(builddir_docker) + $(V)docker cp $(docker_container_name):/bemanitools/build $(builddir_docker) + $(V)mv $(builddir_docker)/build/* $(builddir_docker) + $(V)rm -r $(builddir_docker)/build + # # Pull in module definitions #