From 66cb440f181f663143fa249d26dce1a44e3d672d Mon Sep 17 00:00:00 2001 From: konect-V <66421869+konect-V@users.noreply.github.com> Date: Wed, 28 Aug 2024 20:27:14 +0200 Subject: [PATCH] Port lua --- bootstrap/sys-apps.yml | 24 ++++++++++ sources/core/apps/lua/source | 1 + sources/core/apps/lua/target/amd64/.gitignore | 2 + sources/core/apps/lua/target/amd64/makefile | 46 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 160000 sources/core/apps/lua/source create mode 100644 sources/core/apps/lua/target/amd64/.gitignore create mode 100644 sources/core/apps/lua/target/amd64/makefile diff --git a/bootstrap/sys-apps.yml b/bootstrap/sys-apps.yml index f8b0e7699..09eb390ce 100644 --- a/bootstrap/sys-apps.yml +++ b/bootstrap/sys-apps.yml @@ -404,6 +404,30 @@ packages: - '-r' - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@/bin/.' - '@SOURCE_ROOT@/target/boot_disk_kot_mount/.' + + - name: lua + source: + subdir: 'sources/core/apps' + tools_required: + - host-gcc + pkgs_required: + - mlibc + build: + - args: + - 'make' + - '-C' + - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@' + - 'build' + environ: + CC: "@OPTION:cc@" + CXX: "@OPTION:cxx@" + LD: "@OPTION:ld@" + ASMC: "@OPTION:asmc@" + - args: + - 'cp' + - '-r' + - '@THIS_SOURCE_DIR@/target/@OPTION:arch_name@/bin/.' + - '@SOURCE_ROOT@/target/boot_disk_kot_mount/.' - name: bash source: diff --git a/sources/core/apps/lua/source b/sources/core/apps/lua/source new file mode 160000 index 000000000..902bf60b6 --- /dev/null +++ b/sources/core/apps/lua/source @@ -0,0 +1 @@ +Subproject commit 902bf60b6145bf612aa3b20a27a8509ba424bdd4 diff --git a/sources/core/apps/lua/target/amd64/.gitignore b/sources/core/apps/lua/target/amd64/.gitignore new file mode 100644 index 000000000..6e576ecd2 --- /dev/null +++ b/sources/core/apps/lua/target/amd64/.gitignore @@ -0,0 +1,2 @@ +**/bin +**/lib diff --git a/sources/core/apps/lua/target/amd64/makefile b/sources/core/apps/lua/target/amd64/makefile new file mode 100644 index 000000000..101bb9703 --- /dev/null +++ b/sources/core/apps/lua/target/amd64/makefile @@ -0,0 +1,46 @@ +cyan = /bin/echo -e "\x1b[36m\#\# $1\x1b[0m" + +# Project Root +override HOME = ../.. + +# Project Resources +SYSROOT = $(HOME)/../../../../sysroot +INCLUDE = $(SYSROOT)/usr/include +LIBRARIES = $(SYSROOT)/usr/lib +SOURCE = $(HOME)/source +TOOLS = $(HOME)/../../tools +BIN = bin/usr/bin +LIB = lib + +# Tools Config +CFLAGS = -Werror + +LDFLAGS = -Wall \ + -lc + +# Recursive Wild Card +rwildcard = $(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d)) + +# Source Files +C_SRC = $(call rwildcard,$(SOURCE),*.c) + +OBJS = $(patsubst $(SOURCE)/%.c,$(LIB)/%_c.o,$(C_SRC)) + +# Target +$(LIB)/%_c.o: $(SOURCE)/%.c + @ mkdir -m 777 -p $(@D) + @ $(call cyan,"$(subst ../,,$^)") + @ $(CC) $(CFLAGS) -c $^ -o $@ + +git: + @ rm -rf $(SOURCE) + @ cd $(HOME) && git clone https://github.com/kot-org/lua source + +compile: + @ cd $(SOURCE) && make all + +copy_to_sysroot: + @ mkdir -m 777 -p $(BIN) + @ cp $(SOURCE)/lua $(BIN) + +build: git compile copy_to_sysroot