1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2025-01-31 04:03:43 +01:00

Add Dockerfile for building bemanitools with docker

This commit is contained in:
icex2 2020-05-11 00:23:53 +02:00
parent bf48715466
commit 13d29cb62e
2 changed files with 59 additions and 11 deletions

32
Dockerfile Normal file
View File

@ -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

View File

@ -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
#