:: commit 05b1a75fde9d009c6e869c0c0c5013f70e50d7de

Mintsuki <mintsuki@protonmail.com> — 2025-07-14 13:36

parents: eae4dfea61

misc: Update Flanterm to latest

diff --git a/.gitignore b/.gitignore
index d8d14946..6d51ecb5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,7 +28,7 @@
 /limine-protocol
 /nyu-efi
 /freestnd-c-hdrs
-/common/flanterm
+/flanterm
 /common/lib/stb_image.h.nopatch
 /common/lib/stb_image.h
 /common/cc-runtime.s2.c
diff --git a/GNUmakefile.in b/GNUmakefile.in
index d840a50e..6c9fe1a2 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -306,8 +306,8 @@ dist:
 	cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && git checkout .
 	cd '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)" && ./bootstrap
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/build-aux/freestanding-toolchain/.git"
-	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/common/flanterm/.git"
-	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/common/flanterm/.gitignore"
+	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.git"
+	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/flanterm/.gitignore"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/freestnd-c-hdrs/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/limine-protocol/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"$(DIST_OUTPUT)/nyu-efi/.git"
@@ -342,7 +342,7 @@ distclean: clean
 
 .PHONY: maintainer-clean
 maintainer-clean: distclean
-	cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/lib/stb_image.h.nopatch common/lib/stb_image.h decompressor/tinf tinf libfdt freestnd-c-hdrs cc-runtime common/cc-runtime.s2.c decompressor/cc-runtime.c limine-protocol nyu-efi configure timestamps build-aux *'~' autom4te.cache aclocal.m4 *.tar*
+	cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf flanterm common/lib/stb_image.h.nopatch common/lib/stb_image.h decompressor/tinf tinf libfdt freestnd-c-hdrs cc-runtime common/cc-runtime.s2.c decompressor/cc-runtime.c limine-protocol nyu-efi configure timestamps build-aux *'~' autom4te.cache aclocal.m4 *.tar*
 
 .PHONY: common-uefi-x86-64
 common-uefi-x86-64:
diff --git a/bootstrap b/bootstrap
index e50a448a..4724637d 100755
--- a/bootstrap
+++ b/bootstrap
@@ -108,8 +108,8 @@ if ! test -f version; then
 
     clone_repo_commit \
         https://codeberg.org/mintsuki/flanterm.git \
-        common/flanterm \
-        201100c968ad6db4f38632f9b6c3544854897788
+        flanterm \
+        fa3ee697b4a9d0a506e5249a791ae2f830a0bf4c
 
     download_by_hash \
         https://github.com/nothings/stb/raw/5c205738c191bcb0abc65c4febfa9bd25ff35234/stb_image.h \
diff --git a/common/common.mk b/common/common.mk
index f996ad8e..5fb5dca4 100644
--- a/common/common.mk
+++ b/common/common.mk
@@ -45,6 +45,7 @@ override CPPFLAGS_FOR_TARGET := \
     -I . \
     -I libc-compat \
     -I ../limine-protocol/include \
+    -I ../flanterm/src \
     -I ../libfdt/src \
     -I '$(call SHESCAPE,$(BUILDDIR))/..' \
     -isystem ../freestnd-c-hdrs/include \
@@ -52,13 +53,14 @@ override CPPFLAGS_FOR_TARGET := \
     -DCOM_OUTPUT=$(COM_OUTPUT) \
     -DE9_OUTPUT=$(E9_OUTPUT) \
     -DLIMINE_API_REVISION=3 \
+    -DFLANTERM_IN_FLANTERM \
     -MMD \
     -MP
 
 $(call MKESCAPE,$(BUILDDIR))/libfdt/src/fdt_overlay.o: override CFLAGS_FOR_TARGET += \
     -Wno-unused-parameter
 
-$(call MKESCAPE,$(BUILDDIR))/common/flanterm/backends/fb.o: override CPPFLAGS_FOR_TARGET += \
+$(call MKESCAPE,$(BUILDDIR))/flanterm/src/flanterm_backends/fb.o: override CPPFLAGS_FOR_TARGET += \
     -DFLANTERM_FB_DISABLE_BUMP_ALLOC
 
 override NASMFLAGS_FOR_TARGET += \
@@ -218,8 +220,8 @@ ifeq ($(TARGET),uefi-loongarch64)
 endif
 
 ifeq ($(TARGET),bios)
-    override C_FILES := $(shell cd .. && find common libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common -type f -name '*.S' | LC_ALL=C sort)
 
     override ASMX86_FILES := $(shell cd .. && find common -type f -name '*.asm_x86' | LC_ALL=C sort)
     override ASM32_FILES := $(shell cd .. && find common -type f -name '*.asm_ia32' | LC_ALL=C sort)
@@ -229,8 +231,8 @@ ifeq ($(TARGET),bios)
     override OBJ_S2 := $(filter %.s2.o,$(OBJ))
 endif
 ifeq ($(TARGET),uefi-x86-64)
-    override C_FILES := $(shell cd .. && find common nyu-efi/x86_64 libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common nyu-efi/x86_64 libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common nyu-efi/x86_64 flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common nyu-efi/x86_64 -type f -name '*.S' | LC_ALL=C sort)
 
     override ASMX86_FILES := $(shell cd .. && find common -type f -name '*.asm_x86' | LC_ALL=C sort)
     override ASM64_FILES := $(shell cd .. && find common -type f -name '*.asm_x86_64' | LC_ALL=C sort)
@@ -239,8 +241,8 @@ ifeq ($(TARGET),uefi-x86-64)
     override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(S_FILES:.S=.o) $(ASM64_FILES:.asm_x86_64=.o) $(ASM64U_FILES:.asm_uefi_x86_64=.o) $(ASMX86_FILES:.asm_x86=.o))
 endif
 ifeq ($(TARGET),uefi-ia32)
-    override C_FILES := $(shell cd .. && find common nyu-efi/ia32 libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common nyu-efi/ia32 libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common nyu-efi/ia32 flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common nyu-efi/ia32 -type f -name '*.S' | LC_ALL=C sort)
 
     override ASMX86_FILES := $(shell cd .. && find common -type f -name '*.asm_x86' | LC_ALL=C sort)
     override ASM32_FILES := $(shell cd .. && find common -type f -name '*.asm_ia32' | LC_ALL=C sort)
@@ -249,8 +251,8 @@ ifeq ($(TARGET),uefi-ia32)
     override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(S_FILES:.S=.o) $(ASM32_FILES:.asm_ia32=.o) $(ASM32U_FILES:.asm_uefi_ia32=.o) $(ASMX86_FILES:.asm_x86=.o))
 endif
 ifeq ($(TARGET),uefi-aarch64)
-    override C_FILES := $(shell cd .. && find common nyu-efi/aarch64 libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common nyu-efi/aarch64 libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common nyu-efi/aarch64 flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common nyu-efi/aarch64 -type f -name '*.S' | LC_ALL=C sort)
 
     override ASM64_FILES := $(shell cd .. && find common -type f -name '*.asm_aarch64' | LC_ALL=C sort)
     override ASM64U_FILES := $(shell cd .. && find common -type f -name '*.asm_uefi_aarch64' | LC_ALL=C sort)
@@ -258,8 +260,8 @@ ifeq ($(TARGET),uefi-aarch64)
     override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(S_FILES:.S=.o) $(ASM64_FILES:.asm_aarch64=.o) $(ASM64U_FILES:.asm_uefi_aarch64=.o))
 endif
 ifeq ($(TARGET),uefi-riscv64)
-    override C_FILES := $(shell cd .. && find common nyu-efi/riscv64 libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common nyu-efi/riscv64 libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common nyu-efi/riscv64 flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common nyu-efi/riscv64 -type f -name '*.S' | LC_ALL=C sort)
 
     override ASM64_FILES := $(shell cd .. && find common -type f -name '*.asm_riscv64' | LC_ALL=C sort)
     override ASM64U_FILES := $(shell cd .. && find common -type f -name '*.asm_uefi_riscv64' | LC_ALL=C sort)
@@ -267,8 +269,8 @@ ifeq ($(TARGET),uefi-riscv64)
     override OBJ := $(addprefix $(call MKESCAPE,$(BUILDDIR))/, $(C_FILES:.c=.o) $(S_FILES:.S=.o) $(ASM64_FILES:.asm_riscv64=.o) $(ASM64U_FILES:.asm_uefi_riscv64=.o))
 endif
 ifeq ($(TARGET),uefi-loongarch64)
-    override C_FILES := $(shell cd .. && find common nyu-efi/loongarch64 libfdt -type f -name '*.c' | LC_ALL=C sort)
-    override S_FILES := $(shell cd .. && find common nyu-efi/loongarch64 libfdt -type f -name '*.S' | LC_ALL=C sort)
+    override C_FILES := $(shell cd .. && find common nyu-efi/loongarch64 flanterm/src libfdt/src -type f -name '*.c' | LC_ALL=C sort)
+    override S_FILES := $(shell cd .. && find common nyu-efi/loongarch64 -type f -name '*.S' | LC_ALL=C sort)
 
     override ASM64_FILES := $(shell cd .. && find common -type f -name '*.asm_loongarch64' | LC_ALL=C sort)
     override ASM64U_FILES := $(shell cd .. && find common -type f -name '*.asm_uefi_loongarch64' | LC_ALL=C sort)
diff --git a/common/drivers/vga_textmode.h b/common/drivers/vga_textmode.h
index f5dcfa52..c7bca53b 100644
--- a/common/drivers/vga_textmode.h
+++ b/common/drivers/vga_textmode.h
@@ -6,7 +6,7 @@
 #include <stdint.h>
 #include <stddef.h>
 #include <stdbool.h>
-#include <flanterm/flanterm.h>
+#include <flanterm.h>
 
 #define VD_COLS (80 * 2)
 #define VD_ROWS 25
diff --git a/common/lib/gterm.c b/common/lib/gterm.c
index 09f3d9d0..38a4b5fe 100644
--- a/common/lib/gterm.c
+++ b/common/lib/gterm.c
@@ -10,8 +10,8 @@
 #include <lib/image.h>
 #include <lib/rand.h>
 #include <mm/pmm.h>
-#include <flanterm/flanterm.h>
-#include <flanterm/backends/fb.h>
+#include <flanterm.h>
+#include <flanterm_backends/fb.h>
 #include <lib/term.h>
 
 // Builtin font originally taken from:
diff --git a/common/lib/term.c b/common/lib/term.c
index fc547643..7e050759 100644
--- a/common/lib/term.c
+++ b/common/lib/term.c
@@ -7,7 +7,7 @@
 #include <lib/fb.h>
 #include <mm/pmm.h>
 #include <drivers/vga_textmode.h>
-#include <flanterm/backends/fb.h>
+#include <flanterm_backends/fb.h>
 
 #if defined (BIOS)
 int current_video_mode = -1;
diff --git a/common/lib/term.h b/common/lib/term.h
index 16dade5a..18fd4ddd 100644
--- a/common/lib/term.h
+++ b/common/lib/term.h
@@ -4,7 +4,7 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <lib/print.h>
-#include <flanterm/flanterm.h>
+#include <flanterm.h>
 
 enum {
     _NOT_READY,
diff --git a/common/protos/limine.c b/common/protos/limine.c
index bd441fab..7b6352de 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -21,7 +21,7 @@
 #include <sys/gdt.h>
 #include <lib/fb.h>
 #include <lib/term.h>
-#include <flanterm/backends/fb.h>
+#include <flanterm_backends/fb.h>
 #include <sys/pic.h>
 #include <sys/lapic.h>
 #include <sys/idt.h>
diff --git a/test/.gitignore b/test/.gitignore
index 7db6f164..4ce83ce5 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -1,3 +1,2 @@
 test.o
 test.elf
-flanterm
diff --git a/test/e9print.c b/test/e9print.c
index a969d4e0..00d6fb49 100644
--- a/test/e9print.c
+++ b/test/e9print.c
@@ -3,7 +3,7 @@
 #include <stdint.h>
 
 #if defined (_LIMINE_PROTO)
-#include <flanterm/flanterm.h>
+#include <flanterm.h>
 extern struct flanterm_context *ft_ctx;
 #endif
 
diff --git a/test/limine.c b/test/limine.c
index d9642fdd..d8196e60 100644
--- a/test/limine.c
+++ b/test/limine.c
@@ -3,8 +3,8 @@
 #include <stdbool.h>
 #include <limine.h>
 #include <e9print.h>
-#include <flanterm/flanterm.h>
-#include <flanterm/backends/fb.h>
+#include <flanterm.h>
+#include <flanterm_backends/fb.h>
 
 __attribute__((section(".limine_requests")))
 static volatile LIMINE_BASE_REVISION(3);
diff --git a/test/test.mk b/test/test.mk
index 90f8238b..84290bec 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -60,6 +60,7 @@ override CFLAGS += \
     -fPIE \
     -I. \
     -I../limine-protocol/include \
+    -I../flanterm/src \
     -isystem ../freestnd-c-hdrs/include \
     -D_LIMINE_PROTO \
     -DLIMINE_API_REVISION=3
@@ -115,11 +116,13 @@ else
 all: test.elf device_tree.dtb
 endif
 
-flanterm:
-	mkdir -p flanterm
-	cp -rv ../common/flanterm/* ./flanterm/
+flanterm.o: ../flanterm/src/flanterm.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+flanterm_fb.o: ../flanterm/src/flanterm_backends/fb.c
+	$(CC) $(CFLAGS) -c $< -o $@
 
-test.elf: limine.o e9print.o memory.o flanterm/flanterm.o flanterm/backends/fb.o
+test.elf: limine.o e9print.o memory.o flanterm.o flanterm_fb.o
 	$(LD) $^ $(LDFLAGS) -o $@
 
 multiboot2.elf: multiboot2_trampoline.o
@@ -134,7 +137,7 @@ multiboot.elf: multiboot_trampoline.o
 	$(CC) $(CFLAGS_MB) -c e9print.c -o e9print.o
 	$(LD) $^ memory.o multiboot.o e9print.o $(LDFLAGS_MB1) -o $@
 
-%.o: %.c flanterm
+%.o: %.c
 	$(CC) $(CFLAGS) -c $< -o $@
 
 %.o: %.asm
@@ -145,6 +148,7 @@ multiboot.elf: multiboot_trampoline.o
 
 clean:
 	rm -rf test.elf limine.o e9print.o memory.o
+	rm -rf flanterm.o flanterm_fb.o
 	rm -rf multiboot2.o multiboot2.elf multiboot2_trampoline.o
 	rm -rf multiboot.o multiboot_trampoline.o multiboot.elf
-	rm -rf flanterm device_tree.dtb
+	rm -rf device_tree.dtb
tab: 248 wrap: offon