Skip to content

Commit 1c984f4

Browse files
committed
Fix ocaml build
1 parent e3fa90d commit 1c984f4

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.docker/ml.Dockerfile

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
FROM gcc:8.5.0
1+
FROM ubuntu:24.04
22

3-
ENV OCAML_VERSION 4.01.0
3+
ENV OCAML_VERSION 4.05.0
44

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

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

11-
RUN mkdir /code
10+
RUN opam install -y ocaml=${OCAML_VERSION}
11+
RUN opam switch create ${OCAML_VERSION}
12+
13+
RUN mkdir code
1214
WORKDIR /code
1315

1416
CMD /code/scripts/docker/run-ml.sh

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ SUPPORTED_LANGUAGES = \
4646
$(JAVA) \
4747
$(JS) \
4848
$(LUA) \
49+
$(ML) \
4950
$(PHP) \
5051
$(PY) \
5152
$(R) \
@@ -54,7 +55,6 @@ SUPPORTED_LANGUAGES = \
5455
$(SCALA) \
5556
$(SQL) \
5657
$(TS)
57-
# $(ML)
5858
# $(PAS)
5959

6060
ifdef LANGUAGES

scripts/docker/run-ml.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@ echo
99
for folder in ${FOLDERS}; do
1010
[[ -f "${folder}WRONG" ]] && continue
1111

12-
if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -eq 1 ]]; then
12+
rm -rf "${folder}main.ml" 2> /dev/null
13+
14+
if [[ "$(find "${folder}" -name '*.ml' | wc -l)" -ge 1 ]]; then
1315
echo "${folder}"
1416
cd "${folder}" || exit 1
1517

18+
rm -rf "${folder}main.ml" 2> /dev/null
19+
1620
cp ./*.ml main.ml
17-
ocamlc -o ml.out main.ml
21+
ocamlc -o ml main.ml
1822

1923
if [[ -f in.txt ]]; then
20-
./ml.out < in.txt > result-ml.txt
24+
./ml < in.txt > result-ml.txt
2125
else
22-
./ml.out > result-ml.txt
26+
./ml > result-ml.txt
2327
fi
2428

25-
rm -rf ml.out main.ml main.cmi main.cmo
29+
rm -rf ml main.ml main.cmi main.cmo
2630

2731
diff result-ml.txt out.txt
2832

0 commit comments

Comments
 (0)