refactor(rootfs): reorganize file structure and remove unnecessary .gitkeep files

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
2025-03-24 15:33:07 +00:00
parent 8f88d9028e
commit d251d9d03f
55 changed files with 622 additions and 596 deletions

View File

@ -1,51 +1,16 @@
MAKE_TARGETS := build clean
DIRECTORIES := $(sort $(filter-out ./include/,$(dir $(wildcard ./*/))))
FFI_VERSION = 3.4.4
XML2_VERSION = 2.12.10
EXPAT_VERSION = 2.7.0
FFI_ARCHIVE = /tmp/libffi-$(FFI_VERSION).tar.gz
XML2_ARCHIVE = /tmp/libxml2-$(XML2_VERSION).tar.xz
EXPAT_ARCHIVE = /tmp/expat-$(EXPAT_VERSION).tar.gz
.PHONY: $(MAKE_TARGETS) $(DIRECTORIES) prepare
build: copy_includes $(DIRECTORIES)
clean: $(DIRECTORIES)
copy_includes:
cp -a $(CURDIR)/include/. $(WORKSPACE_DIR)/out/include
cp -a $(CURDIR)/include/. $(WORKSPACE_DIR)/out/usr/include
prepare:
rm -rf ffi/libffi-src xml2/libxml2-src expat/libexpat-src
mkdir -p ffi/libffi-src
if [ ! -f $(FFI_ARCHIVE) ]; then \
wget https://github.com/libffi/libffi/releases/download/v$(FFI_VERSION)/libffi-$(FFI_VERSION).tar.gz -O $(FFI_ARCHIVE); \
fi
cd ffi && \
tar xf $(FFI_ARCHIVE) && \
cp -r libffi-$(FFI_VERSION)/* libffi-src/ && \
rm -rf libffi-$(FFI_VERSION)
mkdir -p xml2/libxml2-src
if [ ! -f $(XML2_ARCHIVE) ]; then \
wget https://download.gnome.org/sources/libxml2/2.12/libxml2-$(XML2_VERSION).tar.xz -O $(XML2_ARCHIVE); \
fi
cd xml2 && \
tar xf $(XML2_ARCHIVE) && \
cp -r libxml2-$(XML2_VERSION)/* libxml2-src/ && \
rm -rf libxml2-$(XML2_VERSION)
mkdir -p expat/libexpat-src
if [ ! -f $(EXPAT_ARCHIVE) ]; then \
wget https://github.com/libexpat/libexpat/releases/download/R_2_7_0/expat-$(EXPAT_VERSION).tar.gz -O $(EXPAT_ARCHIVE); \
fi
cd expat && \
tar xf $(EXPAT_ARCHIVE) && \
cp -r expat-$(EXPAT_VERSION)/* libexpat-src/ && \
rm -rf expat-$(EXPAT_VERSION)
$(info Nothing to prepare)
$(DIRECTORIES):
$(MAKE) -C $@ $(MAKECMDGOALS)

View File

@ -4,7 +4,7 @@ default:
DYNAMIC_NAME := lib$(notdir $(shell pwd)).so
STATIC_NAME := lib$(notdir $(shell pwd)).a
OUTPUT_DIR=$(WORKSPACE_DIR)/out/lib/
OUTPUT_DIR=$(WORKSPACE_DIR)/out/usr/lib/
SYSROOT = --sysroot=$(WORKSPACE_DIR)/out/
S_SOURCES = $(shell find ./ -type f -name '*.S')
@ -12,7 +12,7 @@ C_SOURCES = $(shell find ./ -type f -name '*.c')
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
OBJ = ${S_SOURCES:.S=.o} ${C_SOURCES:.c=.o} ${CXX_SOURCES:.cpp=.o}
CFLAGS := -fvisibility=hidden -fPIC -I../include -I$(WORKSPACE_DIR)/out/include -DLIBC_GIT_COMMIT='"$(shell git rev-parse HEAD)"'
CFLAGS := -fvisibility=hidden -fPIC -I../include -I$(WORKSPACE_DIR)/out/sys/inc -DLIBC_GIT_COMMIT='"$(shell git rev-parse HEAD)"'
ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always

View File

@ -1 +0,0 @@
libexpat-src

View File

@ -1,29 +0,0 @@
build:
mkdir -p $(WORKSPACE_DIR)/cache/expat
if [ ! -f "$(WORKSPACE_DIR)/cache/expat/.configured" ]; then \
cd $(WORKSPACE_DIR)/cache/expat && \
$(CURDIR)/libexpat-src/configure \
--host=x86_64-none-elf \
--prefix=/usr \
--libdir=/usr/lib \
--enable-static \
--disable-shared \
--without-docbook \
--without-xmlwf \
--without-examples \
--without-tests \
CC="$(CC)" \
CXX="$(CXX)" \
AR="$(AR)" \
CFLAGS="-nostdinc -I$(WORKSPACE_DIR)/out/include" \
CXXFLAGS="-nostdinc++ -I$(WORKSPACE_DIR)/out/include" \
LDFLAGS="-nostdlib -L$(WORKSPACE_DIR)/out/lib -lc" && \
touch .configured; \
fi
$(MAKE) -C $(WORKSPACE_DIR)/cache/expat -j$(shell nproc)
$(MAKE) -C $(WORKSPACE_DIR)/cache/expat install DESTDIR=$(WORKSPACE_DIR)/out
cd $(WORKSPACE_DIR)/cache/expat && \
./libtool --finish $(WORKSPACE_DIR)/out/usr/lib
clean:
$(info Nothing to clean)

View File

@ -1 +0,0 @@
libffi-src

View File

@ -1,27 +0,0 @@
build:
mkdir -p $(WORKSPACE_DIR)/cache/ffi
if [ ! -f "$(WORKSPACE_DIR)/cache/ffi/.configured" ]; then \
cd $(WORKSPACE_DIR)/cache/ffi && \
$(CURDIR)/libffi-src/configure \
--host=x86_64-none-elf \
--prefix=/usr \
--libdir=/usr/lib \
--enable-static \
--disable-shared \
--disable-docs \
--disable-multi-os-directory \
CC="$(CC)" \
CXX="$(CXX)" \
AR="$(AR)" \
CFLAGS="-nostdinc -I$(WORKSPACE_DIR)/out/include" \
CXXFLAGS="-nostdinc++ -I$(WORKSPACE_DIR)/out/include" \
LDFLAGS="-nostdlib -L$(WORKSPACE_DIR)/out/lib -lc" && \
touch .configured; \
fi
$(MAKE) -C $(WORKSPACE_DIR)/cache/ffi -j$(shell nproc)
$(MAKE) -C $(WORKSPACE_DIR)/cache/ffi install DESTDIR=$(WORKSPACE_DIR)/out
cd $(WORKSPACE_DIR)/cache/ffi && \
./libtool --finish $(WORKSPACE_DIR)/out/usr/lib
clean:
$(info Nothing to clean)

View File

@ -1,6 +1,6 @@
NAME=gcc
OBJECT_NAME=lib$(NAME).a
OUTPUT_DIR=$(WORKSPACE_DIR)/out/lib/
OUTPUT_DIR=$(WORKSPACE_DIR)/out/sys/lib/
CRTBEGIN_PATH = $(shell $(CC) -print-file-name=libgcc.a)
build: $(OBJECT_NAME)

View File

@ -1,2 +0,0 @@
libxml2-src

View File

@ -1,47 +0,0 @@
build:
mkdir -p $(WORKSPACE_DIR)/cache/xml2
if [ ! -f "$(WORKSPACE_DIR)/cache/xml2/.configured" ]; then \
cd $(WORKSPACE_DIR)/cache/xml2 && \
$(CURDIR)/libxml2-src/configure \
--host=x86_64-none-elf \
--prefix=/usr \
--libdir=/usr/lib \
--enable-static \
--disable-shared \
--without-python \
--without-debug \
--without-docbook \
--without-ftp \
--without-http \
--without-html \
--without-legacy \
--without-pattern \
--without-push \
--without-regexps \
--without-sax1 \
--without-schemas \
--without-schematron \
--without-threads \
--without-valid \
--without-xinclude \
--without-xpath \
--without-xptr \
--without-modules \
--without-zlib \
--without-lzma \
--without-coverage \
CC="$(CC)" \
CXX="$(CXX)" \
AR="$(AR)" \
CFLAGS="-nostdinc -I$(WORKSPACE_DIR)/out/include" \
CXXFLAGS="-nostdinc++ -I$(WORKSPACE_DIR)/out/include" \
LDFLAGS="-nostdlib -L$(WORKSPACE_DIR)/out/lib -lc" && \
touch .configured; \
fi
$(MAKE) -C $(WORKSPACE_DIR)/cache/xml2 -j$(shell nproc)
$(MAKE) -C $(WORKSPACE_DIR)/cache/xml2 install DESTDIR=$(WORKSPACE_DIR)/out
cd $(WORKSPACE_DIR)/cache/xml2 && \
./libtool --finish $(WORKSPACE_DIR)/out/usr/lib
clean:
$(info Nothing to clean)