summaryrefslogtreecommitdiff
path: root/.github/dockerfiles/Dockerfile.cross-compile
blob: 98f7f0e576f766b693a6500aa75af8f1b9c6d1f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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"]