Skip to content

Commit

Permalink
io: Update Dockerfile
Browse files Browse the repository at this point in the history
Build Io interpreter and packages from source in latest Ubuntu.

The interpreter looks for packages under `eerie` in the current
directory, so create the symlink in the Makefile that is "building" each
step.

Now the Regex package no longer prints a message when loaded, so no need
for the special treatment in `run`.
  • Loading branch information
dubek authored and kanaka committed Oct 14, 2024
1 parent 7ec60da commit 9416545
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 16 deletions.
44 changes: 34 additions & 10 deletions impls/io/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:xenial
FROM ubuntu:24.04 AS base
MAINTAINER Joel Martin <[email protected]>

##########################################################
Expand All @@ -9,25 +9,49 @@ MAINTAINER Joel Martin <[email protected]>
RUN apt-get -y update

# Required for running tests
RUN apt-get -y install make python
RUN apt-get -y install make python3
RUN ln -fs /usr/bin/python3 /usr/local/bin/python

# Some typical implementation and test requirements
RUN apt-get -y install curl libreadline-dev libedit-dev

RUN apt-get -y install libpcre3-dev

RUN mkdir -p /mal
WORKDIR /mal

##########################################################
# Compile the io interpreter
##########################################################

FROM base AS builder

RUN apt-get -y install git cmake gcc

RUN cd /tmp \
&& git clone --recursive -q --depth=1 https://github.com/IoLanguage/io.git \
&& cd /tmp/io \
&& mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=release .. && make && make install

# Force eerie (Io package manager) to install itself and the packages in /opt/.eerie
ENV HOME=/opt

RUN cd /tmp/io/eerie \
&& mkdir -p /opt \
&& . ./install_unix.sh --notouch \
&& eerie install https://github.com/IoLanguage/Range.git \
&& eerie install https://github.com/IoLanguage/ReadLine.git \
&& eerie install https://github.com/IoLanguage/Regex.git

##########################################################
# Specific implementation requirements
##########################################################

# Zip
RUN apt-get -y install unzip
FROM base AS io

RUN cd /tmp && curl -O -J -L http://iobin.suspended-chord.info/linux/iobin-linux-x64-deb-current.zip \
&& unzip iobin-linux-x64-deb-current.zip IoLanguage-2013.11.04-Linux-x64.deb \
&& dpkg -i IoLanguage-2013.11.04-Linux-x64.deb \
&& ldconfig \
&& rm -f iobin-linux-x64-deb-current.zip IoLanguage-2013.11.04-Linux-x64.deb
COPY --from=builder /usr/local/lib/ /usr/lib/
COPY --from=builder /usr/local/bin/ /usr/bin/
COPY --from=builder /opt/.eerie/ /opt/.eerie/

ENV HOME /mal
ENV HOME=/mal
11 changes: 9 additions & 2 deletions impls/io/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
all:
@true
STEPS = step0_repl.io step1_read_print.io step2_eval.io step3_env.io step4_if_fn_do.io step5_tco.io \
step6_file.io step7_quote.io step8_macros.io step9_try.io stepA_mal.io

all: eerie

eerie:
ln -s /opt/.eerie eerie

$(STEPS): eerie

clean:
5 changes: 1 addition & 4 deletions impls/io/run
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/bin/bash

# Io prints the line "Registering Regex: Regex" when loading the Regex module
# for the first time, and there's no way to suppress it. To avoid polluting
# the Mal script output, we swallow the first 25 bytes.
io $(dirname $0)/${STEP:-stepA_mal}.io "$@" | (read -N 25 -t 10 ; cat)
io $(dirname $0)/${STEP:-stepA_mal}.io "$@"

0 comments on commit 9416545

Please sign in to comment.