diff --git a/packages/ocaml/Containerfile b/packages/ocaml/Containerfile new file mode 100644 index 0000000..26de073 --- /dev/null +++ b/packages/ocaml/Containerfile @@ -0,0 +1,41 @@ +FROM scratch AS base +ENV VERSION=5.2.0 +ENV SRC_HASH=48554abfd530fcdaa08f23f801b699e4f74c320ddf7d0bd56b0e8c24e55fc911 +ENV SRC_FILE=${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/ocaml/ocaml/archive/refs/tags/${SRC_FILE} +ENV SOURCE_DATE_EPOCH=1 + +FROM base AS fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . + +FROM fetch AS build +COPY --from=stagex/busybox . / +COPY --from=stagex/binutils . / +COPY --from=stagex/make . / +COPY --from=stagex/musl . / +COPY --from=stagex/gcc . / +COPY --from=stagex/libzstd . / +RUN tar -xf ${SRC_FILE} +WORKDIR /ocaml-${VERSION} +RUN --network=none <<-EOF + set -eux + + CFLAGS="-fPIC" \ + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var + make -j "$(nproc)" +EOF + +FROM build AS install +RUN --network=none <<-EOF + set -eux + + make install DESTDIR=/rootfs +EOF + +FROM stagex/filesystem AS package +COPY --from=install /rootfs/. / diff --git a/src/packages.mk b/src/packages.mk index 0864a3a..4d10fe5 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -2038,6 +2038,19 @@ out/nuspell/index.json: \ out/samurai/index.json $(call build,nuspell) +.PHONY: ocaml +ocaml: out/ocaml/index.json +out/ocaml/index.json: \ + packages/ocaml/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/filesystem/index.json \ + out/gcc/index.json \ + out/libzstd/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,ocaml) + .PHONY: ocismack ocismack: out/ocismack/index.json out/ocismack/index.json: \