diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fb0415..1327cdc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,6 +17,7 @@ jobs: - hylo - iwyu - lc3 + - lua - misc - nasm - ncc-ng diff --git a/Dockerfile.lua b/Dockerfile.lua new file mode 100644 index 0000000..a12d13d --- /dev/null +++ b/Dockerfile.lua @@ -0,0 +1,16 @@ +FROM ubuntu:22.04 + +ARG DEBIAN_FRONTEND=noninteractive +RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \ + apt install -y -q \ + build-essential \ + curl \ + xz-utils \ + && \ + rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /root +COPY lua /root/ +COPY common.sh /root/ + +WORKDIR /root diff --git a/lua/build.sh b/lua/build.sh new file mode 100755 index 0000000..9f9b56e --- /dev/null +++ b/lua/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -ex +source common.sh + +VERSION=$1 + +URL=https://www.lua.org/ftp/lua-${VERSION}.tar.gz + +FULLNAME=lua-${VERSION} +OUTPUT=$2/${FULLNAME}.tar.xz + +REVISION="lua-${VERSION}" +LAST_REVISION="${3:-}" + +initialise "${REVISION}" "${OUTPUT}" "${LAST_REVISION}" + +STAGING_DIR=/opt/compiler-explorer/${FULLNAME} +rm -rf "${STAGING_DIR}" +mkdir -p "${STAGING_DIR}" + +BUILD_DIR=$(pwd)/build +rm -rf "${BUILD_DIR}" +mkdir -p "${BUILD_DIR}" +cd "${BUILD_DIR}" +curl -sL "${URL}" | tar zxf - --strip-components 1 + +# posix is supported by every released Lua version and avoids the readline +# dependency of the linux target; lua/luac are still fully functional. +make -j"$(nproc)" posix +make INSTALL_TOP="${STAGING_DIR}" install + +# Sanity-check the built binaries. +"${STAGING_DIR}/bin/lua" -v +"${STAGING_DIR}/bin/luac" -v + +complete "${STAGING_DIR}" "${FULLNAME}" "${OUTPUT}"