Skip to content

Commit

Permalink
Fix ocaml build
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Dec 25, 2024
1 parent e3fa90d commit 1c984f4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
16 changes: 9 additions & 7 deletions .docker/ml.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM gcc:8.5.0
FROM ubuntu:24.04

ENV OCAML_VERSION 4.01.0
ENV OCAML_VERSION 4.05.0

RUN apt update && apt upgrade -y && apt install -y --force-yes make
RUN apt update && apt upgrade -y && apt install -y --force-yes opam

RUN wget https://github.com/ocaml/ocaml/archive/refs/tags/${OCAML_VERSION}.zip
RUN unzip ${OCAML_VERSION}.zip
RUN cd ocaml-${OCAML_VERSION} && ./configure && make world.opt && make install
RUN opam init --disable-sandboxing
RUN opam update

RUN mkdir /code
RUN opam install -y ocaml=${OCAML_VERSION}
RUN opam switch create ${OCAML_VERSION}

RUN mkdir code
WORKDIR /code

CMD /code/scripts/docker/run-ml.sh
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SUPPORTED_LANGUAGES = \
$(JAVA) \
$(JS) \
$(LUA) \
$(ML) \
$(PHP) \
$(PY) \
$(R) \
Expand All @@ -54,7 +55,6 @@ SUPPORTED_LANGUAGES = \
$(SCALA) \
$(SQL) \
$(TS)
# $(ML)
# $(PAS)

ifdef LANGUAGES
Expand Down
14 changes: 9 additions & 5 deletions scripts/docker/run-ml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ echo
for folder in ${FOLDERS}; do
[[ -f "${folder}WRONG" ]] && continue

if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -eq 1 ]]; then
rm -rf "${folder}main.ml" 2> /dev/null

if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -ge 1 ]]; then
echo "${folder}"
cd "${folder}" || exit 1

rm -rf "${folder}main.ml" 2> /dev/null

cp ./*.ml main.ml
ocamlc -o ml.out main.ml
ocamlc -o ml main.ml

if [[ -f in.txt ]]; then
./ml.out < in.txt > result-ml.txt
./ml < in.txt > result-ml.txt
else
./ml.out > result-ml.txt
./ml > result-ml.txt
fi

rm -rf ml.out main.ml main.cmi main.cmo
rm -rf ml main.ml main.cmi main.cmo

diff result-ml.txt out.txt

Expand Down

0 comments on commit 1c984f4

Please sign in to comment.