-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide SDCC in Alpine- and Debian-based containers. They can be used to build EC if it was cloned standalone with podman, e.g.: make -C containers ec-alpine podman run -it --rm -v $PWD:/workspace:Z system76/ec-alpine:latest make BOARD=system76/oryp8 Signed-off-by: Tim Crawford <[email protected]>
- Loading branch information
Showing
4 changed files
with
143 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
|
||
# Disable built-in rules and variables | ||
MAKEFLAGS += -rR | ||
|
||
PODMAN := $(shell command -v podman) | ||
|
||
SDCC_REPO := https://svn.code.sf.net/p/sdcc/code | ||
# Last rev to trunk before tagging 4.3.3 | ||
SDCC_REV := 14376 | ||
|
||
.PHONY: ec-alpine | ||
ec-alpine: | ||
$(PODMAN) build \ | ||
--tag system76/$@:latest \ | ||
--build-arg=SDCC_REPO="$(SDCC_REPO)" \ | ||
--build-arg=SDCC_REV="$(SDCC_REV)" \ | ||
--file Containerfile \ | ||
$@ | ||
|
||
.PHONY: ec-debian | ||
ec-debian: | ||
$(PODMAN) build \ | ||
--tag system76/$@:latest \ | ||
--build-arg=SDCC_REPO="$(SDCC_REPO)" \ | ||
--build-arg=SDCC_REV="$(SDCC_REV)" \ | ||
--file Containerfile \ | ||
$@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# A container for Small Device C Compiler based on Alpine | ||
|
||
ARG CONTAINER_IMAGE="alpine:3.18.4" | ||
|
||
FROM ${CONTAINER_IMAGE} as sdcc-build | ||
ARG SDCC_REPO | ||
ARG SDCC_REV | ||
WORKDIR /tmp | ||
|
||
RUN apk update && \ | ||
apk add --no-cache \ | ||
autoconf \ | ||
automake \ | ||
bison \ | ||
boost-dev \ | ||
ca-certificates \ | ||
flex \ | ||
g++ \ | ||
gcc \ | ||
make \ | ||
subversion \ | ||
zlib-dev | ||
|
||
RUN svn checkout \ | ||
--depth infinity \ | ||
--revision ${SDCC_REV} \ | ||
${SDCC_REPO}/trunk/sdcc \ | ||
sdcc | ||
|
||
# PIC requires gputils, which is not available on Alpine | ||
RUN cd sdcc && \ | ||
sh ./configure \ | ||
--disable-pic14-port \ | ||
--disable-pic16-port \ | ||
--disable-non-free \ | ||
--prefix= && \ | ||
make -j $(nproc) && \ | ||
make install DESTDIR=/opt/sdcc | ||
|
||
FROM ${CONTAINER_IMAGE} | ||
ARG SDCC_REV | ||
COPY --from=sdcc-build /opt/sdcc /opt/sdcc | ||
ENV SDCC_REV "${SDCC_REV}" | ||
ENV SDCC_PATH "/opt/sdcc" | ||
ENV PATH "${SDCC_PATH}/bin:$PATH" | ||
|
||
# NOTE: Using SDCC requires libstdc++ installed | ||
RUN apk update && \ | ||
apk add --no-cache \ | ||
bash \ | ||
binutils \ | ||
git \ | ||
libstdc++ \ | ||
make \ | ||
xxd | ||
|
||
WORKDIR /workspace | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# A container for Small Device C Compiler based on Debian | ||
|
||
ARG CONTAINER_IMAGE="debian:12.2" | ||
|
||
FROM ${CONTAINER_IMAGE} as sdcc-build | ||
ARG SDCC_REPO | ||
ARG SDCC_REV | ||
WORKDIR /tmp | ||
|
||
RUN apt-get --quiet update && \ | ||
apt-get --quiet install --no-install-recommends --assume-yes \ | ||
autoconf \ | ||
automake \ | ||
bison \ | ||
ca-certificates \ | ||
flex \ | ||
g++ \ | ||
gcc \ | ||
gputils \ | ||
libboost-dev \ | ||
make \ | ||
subversion \ | ||
zlib1g-dev \ | ||
&& apt-get clean | ||
|
||
RUN svn checkout \ | ||
--depth infinity \ | ||
--revision ${SDCC_REV} \ | ||
${SDCC_REPO}/trunk/sdcc \ | ||
sdcc | ||
|
||
RUN cd sdcc && \ | ||
sh ./configure \ | ||
--disable-non-free \ | ||
--prefix= && \ | ||
make -j $(nproc) && \ | ||
make install DESTDIR=/opt/sdcc | ||
|
||
FROM ${CONTAINER_IMAGE} | ||
COPY --from=sdcc-build /opt/sdcc /opt/sdcc | ||
ENV SDCC_REV "${SDCC_REV}" | ||
ENV SDCC_PATH "/opt/sdcc" | ||
ENV PATH "${SDCC_PATH}/bin:$PATH" | ||
|
||
RUN apt-get --quiet update && \ | ||
apt-get --quiet install --no-install-recommends --assume-yes \ | ||
bash \ | ||
binutils \ | ||
git \ | ||
make \ | ||
xxd \ | ||
&& apt-get clean | ||
|
||
WORKDIR /workspace | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters