From 1b181a9ea01ea504f750df12619abb4e171d9f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arthur=20C=C3=A2mara?= Date: Wed, 12 Jul 2023 18:21:40 -0300 Subject: [PATCH] Add docker script to turn ceu into a binary file. This commit adds the following rules to makefile: * docker-build: builds the docker container. * docker-install: - creates a shared directory called bin in the repository root; - installs srlua (project responsible for converting lua scripts into binary files); - builds the binary and outputs to `bin`. --- .gitignore | 1 + Makefile | 18 ++++++++++++++++++ etc/ceu-binary/Dockerfile | 12 ++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 etc/ceu-binary/Dockerfile diff --git a/.gitignore b/.gitignore index d2bc6286..91bb6834 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc .*.swo .*.swp +srlua/ \ No newline at end of file diff --git a/Makefile b/Makefile index f110b150..bfd95596 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ LUA_EXE = lua5.3 CEU_EXE = /usr/local/bin/ceu CEU_ARGS_ = --ceu-features-trace=true --ceu-err-unused=pass $(CEU_ARGS) CC_ARGS_ = -llua5.3 -lpthread $(CC_ARGS) +GLUE_EXE = /usr/local/bin/glue +SRLUA_EXE = /usr/local/bin/srlua ############################################################################### # DO NOT EDIT @@ -17,6 +19,22 @@ compiler: install: install ./src/lua/ceu $(CEU_EXE) +docker-build: + sudo docker build -t ceu -f ./etc/ceu-binary/Dockerfile . + +docker-install: + sudo docker run -v $(shell pwd)/bin:/ceu/bin/:z ceu + +install-srlua: + git clone https://github.com/LuaDist/srlua.git + cd srlua && sed -i 's/-ansi//g; s/-llua/-llua5.3/g; s/gcc/gcc -static/g' Makefile && make + install ./srlua/glue $(GLUE_EXE) + install ./srlua/srlua $(SRLUA_EXE) + +binary: + glue ./srlua/srlua ./src/lua/ceu ./bin/ceu.bin + chmod +x ./bin/ceu.bin + one: ceu --pre --pre-input=$(CEU_SRC) --pre-args=\"-I./include\" \ --ceu $(CEU_ARGS_) --ceu-features-os=true \ diff --git a/etc/ceu-binary/Dockerfile b/etc/ceu-binary/Dockerfile new file mode 100644 index 00000000..055af482 --- /dev/null +++ b/etc/ceu-binary/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:23.10 + +WORKDIR /ceu + +RUN apt update +RUN apt install -y git lua5.3 lua-lpeg liblua5.3-0 liblua5.3-dev make + +COPY . . + +RUN ln -s /usr/include/lua5.3/* /usr/local/include/ + +CMD make && make install-srlua && make binary \ No newline at end of file