casio-docker/Dockerfile

67 lines
2.0 KiB
Docker

# linux base image
FROM alpine
# set up environment variables
ENV TARGET="sh3eb-elf" \
PREFIX="$HOME/opt/sh3eb-elf-2.31.1-8.2.0" \
PATH="$PATH:/opt/sh3eb-elf-2.31.1-8.2.0/bin:/opt/sh3eb-elf-2.31.1-8.2.0/fxsdk/bin"
# dependencies
RUN apk update && apk add --update --no-cache \
bash \
git \
build-base \
gmp-dev \
mpfr-dev \
mpc1-dev \
pcre-dev \
libpng-dev \
python3 \
py3-pillow \
flex
# extract archives (binutils & gcc)
ADD binutils-2.31.1.tar.xz gcc-8.2.0.tar.xz $PREFIX/
# binutils
RUN cd $PREFIX && mkdir build-binutils && cd build-binutils && \
../binutils-2.31.1/configure --prefix=$PREFIX --target=$TARGET --disable-nls && \
make && make install
# gcc
RUN cd $PREFIX && mkdir build-gcc && cd build-gcc && \
../gcc-8.2.0/configure --prefix=$PREFIX --target=$TARGET --enable-languages=c,c++ --without-headers --with-newlib --disable-nls && \
make all-gcc && make install-gcc
# link gcc with libgcc
# need to fix the contrib/dl script : https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg549371.html
RUN cd $PREFIX/gcc-8.2.0 && \
sed -i 's/sha512sum --check/sha512sum -c/g' ./contrib/download_prerequisites && \
./contrib/download_prerequisites && \
cd $PREFIX/build-gcc && \
make all-target-libgcc && make install-target-libgcc
# TODO git clone with commit number (or find a better way to rebuild from this)
# fxsdk
RUN cd $PREFIX && \
git clone https://gitea.planet-casio.com/Lephenixnoir/fxsdk.git && \
cd fxsdk && bash configure --prefix=$PREFIX && make && make install
# gint
RUN cd $PREFIX && \
git clone --single-branch --branch compat https://gitea.planet-casio.com/Lephenixnoir/gint.git && \
cd gint && mkdir build.fx && cd build.fx && \
../configure --target=fx9860g && make && make install
WORKDIR /casio
# Build :
# docker build -t casio .
# Run :
# - Linux
# docker run -u 0 -it --rm -v $(pwd):/casio casio
# - Windows
# docker run -u 0 -it --rm -v "/$(pwd)":/casio casio