FROM alpine
RUN apk update && apk add \
	git \
	make \
	gcc \
	linux-headers \
	musl-dev
RUN git clone --depth 1 --recursive https://github.com/libsdl-org/SDL-1.2
WORKDIR /SDL-1.2
ARG PREFIX=/opt/spm/SDL-1.2.15
RUN ./configure \
    --prefix=$PREFIX \
    --enable-shared=no \
    CFLAGS='-ffunction-sections -fdata-sections'
RUN make -j$(nproc --all)
RUN make install
