WindowsXPKg/Dockerfile.djgpp

111 lines
2.8 KiB
Docker

# This file is a part of the UMSKT Project
#
# Copyleft (C) 2019-2023 UMSKT Contributors (et.al.)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# @FileCreated by Neo on 06/19/2023
# @Maintainer Neo
# Stage 1: Install Prerequisites
FROM alpine:latest as prerequisites
# Stage 1: Install build dependencies
RUN apk add --no-cache \
autoconf \
automake \
bash \
bison \
build-base \
clang \
cmake \
coreutils \
curl \
elfutils-dev \
findutils \
git \
gawk \
flex \
libelf \
libslirp-dev \
linux-headers \
nasm \
sed \
slang-dev \
texinfo \
unzip \
zlib-dev
FROM prerequisites as djgpp
WORKDIR /tmp
# Stage 2: compile djgpp for muslc
ENV DJGPP_PREFIX=/djgpp BUILD_VER=12.2.0-i386
RUN git clone https://github.com/UMSKT/build-djgpp.git djgpp \
&& cd djgpp \
&& chmod +x script/$BUILD_VER \
&& ./build-djgpp.sh $BUILD_VER \
&& rm -rf /tmp/djgpp
# Stage 3: compile watt32 for djgpp-i386
FROM djgpp as watt32
WORKDIR /djgpp
ENV WATT_ROOT=/djgpp/watt32 DJGPP_PREFIX=i386-pc-msdosdjgpp
SHELL ["/bin/bash", "-c"]
RUN git clone https://github.com/UMSKT/Watt-32.git watt32 \
&& cd watt32/util \
&& make clean && make linux \
&& cd ../src \
&& source /djgpp/setenv \
&& ./configur.sh djgpp \
&& make -f djgpp.mak \
&& ln -s /djgpp/watt32/lib/libwatt.a /djgpp/lib
# Stage 4: compile OpenSSL for djgpp-i386/watt32
FROM watt32 as openssl
WORKDIR /tmp
SHELL ["/bin/bash", "-c"]
RUN git clone https://github.com/umskt/openssl.git openssl \
&& cd openssl \
&& source /djgpp/setenv \
&& ./Configure no-threads -DOPENSSL_DEV_NO_ATOMICS --prefix=/djgpp DJGPP \
&& make && make install
# Stage 5: compile UMSKT
FROM openssl as build
WORKDIR /src
COPY . /src
ENV CC=/djgpp/bin/i386-pc-msdosdjgpp-gcc CXX=/djgpp/bin/i386-pc-msdosdjgpp-g++ PKG_CONFIG_PATH=/djgpp/lib/pkgconfig VERBOSE=1
SHELL ["/bin/bash", "-c"]
# Build UMSKT from the local directory
RUN mkdir /src/build \
&& cd /src/build \
&& source /djgpp/setenv \
&& cmake -DDJGPP_WATT32=${WATT_ROOT}/lib/libwatt.a .. \
&& make
CMD ["bash"]
# Stage 6: Output
FROM scratch as output
COPY --from=build /src/build/umskt.exe /umskt.exe
# invoke via
# docker build -f Dockerfile.djgpp -o type=tar,dest=umskt-dos.tar .