Skip to content

Commit

Permalink
Port lua
Browse files Browse the repository at this point in the history
  • Loading branch information
konect-V committed Aug 28, 2024
1 parent 74dea75 commit 66cb440
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 0 deletions.
24 changes: 24 additions & 0 deletions bootstrap/sys-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions sources/core/apps/lua/source
Submodule source added at 902bf6
2 changes: 2 additions & 0 deletions sources/core/apps/lua/target/amd64/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/bin
**/lib
46 changes: 46 additions & 0 deletions sources/core/apps/lua/target/amd64/makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 66cb440

Please sign in to comment.