:: commit dbbede616b7691dd07e44caaf2aa4b0861deea40

mintsuki <mintsuki@protonmail.com> — 2024-01-26 00:13

parents: 92b554af43

build: Use git for all subprojects

diff --git a/.gitignore b/.gitignore
index c4f15781..c530c463 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,11 +4,12 @@
 /limine-efi
 /freestanding-headers
 /common/flanterm
-/common/stb/stb_image.h*
+/common/lib/stb_image.h
 /common/cc-runtime
 /decompressor/tinf
 /decompressor/cc-runtime
 /tinf
+/stb
 /ovmf*
 *.o
 *.d
diff --git a/GNUmakefile.in b/GNUmakefile.in
index 1868ec81..c7b72c77 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -305,11 +305,13 @@ dist:
 	cd '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)" && ./bootstrap
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/common/flanterm/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/freestanding-headers/.git"
+	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/build-aux/freestanding-toolchain/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/common/cc-runtime/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/decompressor/cc-runtime/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/limine-efi/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/limine-efi/.gitignore"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/tinf"
+	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/stb"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.git"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.gitignore"
 	rm -rf '$(call SHESCAPE,$(BUILDDIR))'/"limine-$(LIMINE_VERSION)/.github"
@@ -329,7 +331,7 @@ distclean: clean
 
 .PHONY: maintainer-clean
 maintainer-clean: distclean
-	cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/stb/stb_image.h* decompressor/tinf tinf freestanding-headers common/cc-runtime decompressor/cc-runtime limine-efi freestanding-toolchain configure build-aux *'~' autom4te.cache aclocal.m4 *.tar.xz *.tar.gz
+	cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf common/flanterm common/lib/stb_image.h decompressor/tinf tinf stb freestanding-headers common/cc-runtime decompressor/cc-runtime limine-efi build-aux/freestanding-toolchain configure build-aux *'~' autom4te.cache aclocal.m4 *.tar.xz *.tar.gz
 
 .PHONY: common-uefi-x86-64
 common-uefi-x86-64:
diff --git a/bootstrap b/bootstrap
index 92ef7797..f4a0249d 100755
--- a/bootstrap
+++ b/bootstrap
@@ -41,58 +41,30 @@ clone_repo_commit() {
 }
 
 clone_repo_commit https://github.com/mintsuki/flanterm.git common/flanterm $FLANTERM_COMMIT_HASH
+
 clone_repo_commit https://github.com/mintsuki/freestanding-headers.git freestanding-headers $FREESTANDING_HEADERS_COMMIT_HASH
+
+clone_repo_commit https://github.com/mintsuki/freestanding-toolchain.git build-aux/freestanding-toolchain $FREESTANDING_TOOLCHAIN_COMMIT_HASH
+
 clone_repo_commit https://github.com/mintsuki/cc-runtime.git decompressor/cc-runtime $CC_RUNTIME_COMMIT_HASH
 rm -rf common/cc-runtime
 cp -rp decompressor/cc-runtime common/
 for f in common/cc-runtime/*.c; do
     mv "$f" "$(echo "$f" | sed 's/\.c/.s2.c/g')"
 done
-clone_repo_commit https://github.com/limine-bootloader/limine-efi.git limine-efi $LIMINE_EFI_COMMIT_HASH
-clone_repo_commit https://github.com/jibsen/tinf.git tinf $TINF_COMMIT_HASH
-
-########################################################
-########################################################
-
-[ -f common/stb/stb_image.h ] && (
-    set -e
-    b2sum common/stb/stb_image.h | grep $STB_IMAGE_H_HASH >/dev/null 2>&1 || (
-        set -e
-        rm -f common/stb/stb_image.h
-    )
-)
-[ -f common/stb/stb_image.h ] || (
-    set -e
-    curl -Lo common/stb/stb_image.h https://github.com/nothings/stb/raw/$STB_COMMIT_HASH/stb_image.h
-    patch -p0 < common/stb_image.patch
-    rm -f common/stb/stb_image.h.orig
-)
 
-########################################################
-########################################################
+clone_repo_commit https://github.com/limine-bootloader/limine-efi.git limine-efi $LIMINE_EFI_COMMIT_HASH
 
+clone_repo_commit https://github.com/jibsen/tinf.git tinf $TINF_COMMIT_HASH
 mkdir -p decompressor/tinf
 cp tinf/src/tinf.h tinf/src/tinflate.c tinf/src/tinfgzip.c decompressor/tinf/
 patch -p0 < decompressor/tinf.patch
+rm -f tinf/src/tinf.h.orig tinf/src/tinflate.c.orig tinf/src/tinfgzip.c.orig
 
-########################################################
-########################################################
-
-[ -f freestanding-toolchain ] && (
-    set -e
-    b2sum freestanding-toolchain | grep $FREESTANDING_TOOLCHAIN_HASH >/dev/null 2>&1 || (
-        set -e
-        rm -f freestanding-toolchain
-    )
-)
-[ -f freestanding-toolchain ] || (
-    set -e
-    curl -Lo freestanding-toolchain https://github.com/mintsuki/freestanding-toolchain/raw/$FREESTANDING_TOOLCHAIN_COMMIT_HASH/freestanding-toolchain
-    chmod +x freestanding-toolchain
-)
-
-########################################################
-########################################################
+clone_repo_commit https://github.com/nothings/stb.git stb $STB_COMMIT_HASH
+cp stb/stb_image.h common/lib/
+patch -p0 < common/stb_image.patch
+rm -f common/lib/stb_image.h.orig
 
 autoreconf -fvi -Wall
 
diff --git a/common/compress/gzip.c b/common/compress/gzip.c
index 00013139..6e4b4544 100644
--- a/common/compress/gzip.c
+++ b/common/compress/gzip.c
@@ -25,7 +25,7 @@
  */
 
 #include <stdint.h>
-#include <stb/stb_image.h>
+#include <lib/stb_image.h>
 
 typedef enum {
     FTEXT    = 1,
diff --git a/common/lib/image.c b/common/lib/image.c
index 72092b25..129bfa2e 100644
--- a/common/lib/image.c
+++ b/common/lib/image.c
@@ -4,7 +4,7 @@
 #include <lib/config.h>
 #include <lib/misc.h>
 #include <mm/pmm.h>
-#include <stb/stb_image.h>
+#include <lib/stb_image.h>
 
 void image_make_centered(struct image *image, int frame_x_size, int frame_y_size, uint32_t back_colour) {
     image->type = IMAGE_CENTERED;
diff --git a/common/stb/stb_image.c b/common/lib/stb_image.c
similarity index 83%
rename from common/stb/stb_image.c
rename to common/lib/stb_image.c
index 9ddbbd2f..419ab754 100644
--- a/common/stb/stb_image.c
+++ b/common/lib/stb_image.c
@@ -3,4 +3,4 @@
 
 #define STB_IMAGE_IMPLEMENTATION
 
-#include <stb/stb_image.h>
+#include <lib/stb_image.h>
diff --git a/common/stb_image.patch b/common/stb_image.patch
index b88af848..13128b47 100644
--- a/common/stb_image.patch
+++ b/common/stb_image.patch
@@ -1,5 +1,5 @@
---- common/stb/stb_image.h	2023-03-05 18:57:03.930649341 +0100
-+++ common/stb/stb_image.h	2023-03-05 18:55:53.767318782 +0100
+--- common/lib/stb_image.h	2023-03-05 18:57:03.930649341 +0100
++++ common/lib/stb_image.h	2023-03-05 18:55:53.767318782 +0100
 @@ -127,6 +127,54 @@
  #ifndef STBI_INCLUDE_STB_IMAGE_H
  #define STBI_INCLUDE_STB_IMAGE_H
diff --git a/configure.ac b/configure.ac
index 876901d1..c7b81e47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -171,7 +171,7 @@ else
         FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
         WANT_FREESTANDING_READELF=yes \
         FREESTANDING_READELF="$READELF_FOR_TARGET" \
-        "$SRCDIR/freestanding-toolchain" 2>"toolchain-files/bios-i686-toolchain.mk" || exit 1
+        "$SRCDIR/build-aux/freestanding-toolchain/freestanding-toolchain" 2>"toolchain-files/bios-i686-toolchain.mk" || exit 1
     BUILD_BIOS="limine-bios"
     NEED_NASM=yes
     NEED_GZIP=yes
@@ -201,7 +201,7 @@ else
         FREESTANDING_OBJCOPY="$OBJCOPY_FOR_TARGET" \
         WANT_FREESTANDING_OBJDUMP=yes \
         FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
-        "$SRCDIR/freestanding-toolchain" 2>"toolchain-files/uefi-i686-toolchain.mk" || exit 1
+        "$SRCDIR/build-aux/freestanding-toolchain/freestanding-toolchain" 2>"toolchain-files/uefi-i686-toolchain.mk" || exit 1
     BUILD_UEFI_IA32="limine-uefi-ia32"
     NEED_NASM=yes
 fi
@@ -230,7 +230,7 @@ else
         FREESTANDING_OBJCOPY="$OBJCOPY_FOR_TARGET" \
         WANT_FREESTANDING_OBJDUMP=yes \
         FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
-        "$SRCDIR/freestanding-toolchain" 2>"toolchain-files/uefi-x86_64-toolchain.mk" || exit 1
+        "$SRCDIR/build-aux/freestanding-toolchain/freestanding-toolchain" 2>"toolchain-files/uefi-x86_64-toolchain.mk" || exit 1
     BUILD_UEFI_X86_64="limine-uefi-x86-64"
     NEED_NASM=yes
 fi
@@ -259,7 +259,7 @@ else
         FREESTANDING_OBJCOPY="$OBJCOPY_FOR_TARGET" \
         WANT_FREESTANDING_OBJDUMP=yes \
         FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
-        "$SRCDIR/freestanding-toolchain" 2>"toolchain-files/uefi-aarch64-toolchain.mk" || exit 1
+        "$SRCDIR/build-aux/freestanding-toolchain/freestanding-toolchain" 2>"toolchain-files/uefi-aarch64-toolchain.mk" || exit 1
     BUILD_UEFI_AARCH64="limine-uefi-aarch64"
 fi
 
@@ -287,7 +287,7 @@ else
         FREESTANDING_OBJCOPY="$OBJCOPY_FOR_TARGET" \
         WANT_FREESTANDING_OBJDUMP=yes \
         FREESTANDING_OBJDUMP="$OBJDUMP_FOR_TARGET" \
-        "$SRCDIR/freestanding-toolchain" 2>"toolchain-files/uefi-riscv64-toolchain.mk" || exit 1
+        "$SRCDIR/build-aux/freestanding-toolchain/freestanding-toolchain" 2>"toolchain-files/uefi-riscv64-toolchain.mk" || exit 1
     BUILD_UEFI_RISCV64="limine-uefi-riscv64"
 fi
 
tab: 248 wrap: offon