From 0c06f5c142f6a944fa8866c87bbb03c2dd0bb22b Mon Sep 17 00:00:00 2001 From: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com> Date: Sun, 25 Jul 2021 13:18:47 +0200 Subject: [PATCH] Add a Dockerfile --- Dockerfile | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +++ 2 files changed, 83 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a2f2d324 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,79 @@ +# build wut +FROM devkitpro/devkitppc:latest AS wutbuild + +ENV PATH=$DEVKITPPC/bin:$PATH + +WORKDIR / +RUN git clone https://github.com/devkitPro/wut +WORKDIR /wut +RUN make -j +RUN make install +WORKDIR / + +# set up builder image +FROM devkitpro/devkitppc:latest AS builder + +RUN apt-get update && apt-get -y install --no-install-recommends python wget tar autoconf autogen automake libtool && rm -rf /var/lib/apt/lists/* +COPY --from=wutbuild /opt/devkitpro/wut /opt/devkitpro/wut + +# build SDL2 +FROM builder AS sdlbuild +ENV WUT_ROOT=$DEVKITPRO/wut + +RUN git clone -b wiiu-2.0.9 --single-branch https://github.com/yawut/SDL +WORKDIR /SDL +RUN mkdir build +WORKDIR /SDL/build +RUN cmake .. -DCMAKE_TOOLCHAIN_FILE=$WUT_ROOT/share/wut.toolchain.cmake -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wiiu +RUN make -j && make install +WORKDIR / + +# build sndfile +FROM builder as sndfilebuild +ENV WUT_ROOT=$DEVKITPRO/wut + +RUN wget https://github.com/libsndfile/libsndfile/archive/refs/tags/1.0.31.tar.gz && mkdir /libsndfile && tar xf 1.0.31.tar.gz -C /libsndfile --strip-components=1 +WORKDIR /libsndfile + +RUN echo '--- configure2.ac 2021-07-25 12:41:14.205082892 +0200\n\ ++++ "configure.ac" 2021-07-25 12:40:43.604738000 +0200\n\ +@@ -593,7 +593,6 @@\n\ + dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always\n\ + dnl enabled. We test for this situation in order to prevent polluting\n\ + dnl the console with messages of macro redefinitions.\n\ +-AX_ADD_FORTIFY_SOURCE\n\ + \n\ + AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [\n\ + dnl OS specific tweaks.' >> wiiu.patch && git apply wiiu.patch + +RUN ./autogen.sh && ./configure \ +--prefix=$DEVKITPRO/portlibs/wiiu/ \ +--host=powerpc-eabi \ +--enable-static \ +--disable-full-suite \ +CC=$DEVKITPPC/bin/powerpc-eabi-gcc \ +AR=$DEVKITPPC/bin/powerpc-eabi-ar \ +RANLIB=$DEVKITPPC/bin/powerpc-eabi-ranlib \ +PKG_CONFIG=$DEVKITPRO/portlibs/wiiu/bin/powerpc-eabi-pkg-config \ +CFLAGS="-Wall -O2 -ffunction-sections -DESPRESSO -mcpu=750 -meabi -mhard-float -D__WIIU__ -D__WUT__" \ +LDFLAGS="-Wl,-q -Wl,-z,nocopyreloc -specs=$WUT_ROOT/share/wut.specs" + +RUN make -j +RUN make install + +# build final container +FROM devkitpro/devkitppc:latest AS final + +# copy in wut +COPY --from=wutbuild /opt/devkitpro/wut /opt/devkitpro/wut + +# copy in SDL2 +COPY --from=sdlbuild /opt/devkitpro/portlibs/wiiu/lib/libSDL2.a /opt/devkitpro/portlibs/wiiu/lib/ +COPY --from=sdlbuild /opt/devkitpro/portlibs/wiiu/include/SDL2 /opt/devkitpro/portlibs/wiiu/include/SDL2/ + +# copy in libsndfile +COPY --from=sndfilebuild /opt/devkitpro/portlibs/wiiu/lib/libsndfile.a /opt/devkitpro/portlibs/wiiu/lib/ +COPY --from=sndfilebuild /opt/devkitpro/portlibs/wiiu/include/sndfile.h /opt/devkitpro/portlibs/wiiu/include/ +COPY --from=sndfilebuild /opt/devkitpro/portlibs/wiiu/include/sndfile.hh /opt/devkitpro/portlibs/wiiu/include/ + +WORKDIR /project diff --git a/README.md b/README.md index 4772190e..ce61f3f9 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ You also need to build [libsndfile](https://github.com/libsndfile/libsndfile). T Then clone this repo using `git clone --recursive https://github.com/GaryOderNichts/re3` and build using `make`. To build the channel edit `CHANNEL_BUILD := 0` to `CHANNEL_BUILD := 1` in the `Makefile`. +### Dockerfile +You can build a docker container using `docker build -t re3builder .` +Then you can build the project with `docker run -it --rm -v ${PWD}:/project re3builder make` + # Original README [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmiami&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=miami)