diff options
Diffstat (limited to '.github/dockerfiles/Dockerfile.cross-compile')
-rw-r--r-- | .github/dockerfiles/Dockerfile.cross-compile | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/.github/dockerfiles/Dockerfile.cross-compile b/.github/dockerfiles/Dockerfile.cross-compile new file mode 100644 index 0000000000..98f7f0e576 --- /dev/null +++ b/.github/dockerfiles/Dockerfile.cross-compile @@ -0,0 +1,56 @@ +## +## This docker file will build Erlang on 32-bit to 64-bit x86 +## +FROM docker.pkg.github.com/erlang/otp/i386-debian-base as build + +ARG MAKEFLAGS=-j4 +ENV MAKEFLAGS=$MAKEFLAGS \ + ERLC_USE_SERVER=yes \ + ERL_TOP=/buildroot/otp + +ARG ARCHIVE=./otp.tar.gz +COPY $ARCHIVE /buildroot/otp.tar.gz +RUN cd /buildroot && tar xzf ./otp.tar.gz + +WORKDIR /buildroot/otp/ + +## Build the bootstrap system +RUN ./configure && make && make install + +## Build pre-build tar ball +RUN scripts/build-otp-tar -o /buildroot/otp_clean_src.tar.gz /buildroot/otp_src.tar.gz \ + -b /buildroot/otp/ /buildroot/otp.tar.gz + +## Prepare for a new build using pre-built tar ball +RUN cd .. && rm -rf otp && tar -xzf ./otp_src.tar.gz + +ENV HOST=$HOST_TRIP \ + CC=$HOST_TRIP-gcc \ + CPP=$HOST_TRIP-cpp \ + CXX=$HOST_TRIP-g++ \ + LD=$CC \ + DED_LDFLAGS="-shared -Wl,-Bsymbolic" \ + RANLIB=$HOST_TRIP-ranlib \ + AR=$HOST_TRIP-ar \ + erl_xcomp_sysroot=/buildroot/sysroot + +## Build the cross system +RUN ./configure --prefix=/otp/ --host=$HOST --build=`erts/autoconf/config.guess` && \ + make && make install + +## Build the cross tests +RUN ./otp_build tests +RUN cd release/tests/test_server && \ + erl -sname test@docker -noshell \ + -eval "ts:install([{cross,\"yes\"},{crossflags,[{\"host\",\"$HOST\"}]},{crossroot,\"/$ERL_TOP\"}])." \ + -s ts compile_testcases -s init stop + +FROM debian as install + +# Install the released application +COPY --from=build /otp /otp +COPY --from=build /buildroot/otp/release/tests /tests + +ENV PATH=/otp/bin:$PATH + +ENTRYPOINT ["bash","-c"] |