feat(userspace/libs): add libexpat, libffi and libxml2

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-03-24 00:42:47 +00:00
parent 0d8c65e44b
commit 1286c4cd90
No known key found for this signature in database
GPG Key ID: 2EE20AF089811A5A
11 changed files with 170 additions and 19 deletions

View File

@ -32,6 +32,7 @@ create_out:
mkdir -p out/lib
mkdir -p out/include/fennix
mkdir -p out/usr/bin
mkdir -p out/usr/lib
mkdir -p out/usr/share/doc
mkdir -p out/usr/share/info
mkdir -p out/usr/include
@ -46,8 +47,8 @@ build_coreutils:
-DCMAKE_C_STANDARD_INCLUDE_DIRECTORIES=$(WORKSPACE_DIR)/out/include \
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=$(WORKSPACE_DIR)/out/include \
&& \
make -j$(shell nproc) && \
make install
$(MAKE) -j$(shell nproc) && \
$(MAKE) install
define copy_generic_header
cp -f $(WORKSPACE_DIR)/../Kernel/include/interface/$(1) $(WORKSPACE_DIR)/libc/abis/fennix/generic/bits/$(1)
@ -66,22 +67,22 @@ build_libc:
-DTARGET_OS=fennix \
-DTARGET_ARCH=$(OSARCH) \
&& \
make -j$(shell nproc) && \
make install
$(MAKE) -j$(shell nproc) && \
$(MAKE) install
build: create_out
$(MAKE) build_libc
make -C libs build
$(MAKE) -C libs build
$(MAKE) build_coreutils
make -C apps build
$(MAKE) -C apps build
prepare:
$(info Nothing to prepare)
$(MAKE) -C libs prepare
clean:
rm -rf out cache
mkdir -p cache
touch cache/.gitkeep
make -C libs clean
make -C apps clean
make -C docker clean
$(MAKE) -C libs clean
$(MAKE) -C apps clean
$(MAKE) -C docker clean

View File

@ -1,8 +1,51 @@
build:
cp -a $(CURDIR)/include/. $(WORKSPACE_DIR)/out/include
make -C libgcc build
make -C libexample build
MAKE_TARGETS := build clean
DIRECTORIES := $(sort $(filter-out ./include/,$(dir $(wildcard ./*/))))
clean:
make -C libgcc clean
make -C libexample clean
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
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)
$(DIRECTORIES):
$(MAKE) -C $@ $(MAKECMDGOALS)

View File

@ -1,8 +1,8 @@
default:
$(error Do not run this Makefile directly!)
DYNAMIC_NAME := $(notdir $(shell pwd)).so
STATIC_NAME := $(notdir $(shell pwd)).a
DYNAMIC_NAME := lib$(notdir $(shell pwd)).so
STATIC_NAME := lib$(notdir $(shell pwd)).a
OUTPUT_DIR=$(WORKSPACE_DIR)/out/lib/
SYSROOT = --sysroot=$(WORKSPACE_DIR)/out/

1
Userspace/libs/expat/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,29 @@
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)

1
Userspace/libs/ffi/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,27 @@
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)

2
Userspace/libs/xml2/.gitignore vendored Normal file
View File

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

View File

@ -0,0 +1,47 @@
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)