From 699d531eea9f47ef6b663375980642a10b7ee14c Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 10 Feb 2022 14:47:38 +0100 Subject: [PATCH] limine-install: Make hgen a shell script --- .gitignore | 1 - GNUmakefile.in | 13 +++---------- configure.ac | 3 --- limine-install/hgen.c | 42 ------------------------------------------ limine-install/hgen.sh | 14 ++++++++++++++ version.sh | 3 +++ 6 files changed, 20 insertions(+), 56 deletions(-) delete mode 100644 limine-install/hgen.c create mode 100755 limine-install/hgen.sh diff --git a/.gitignore b/.gitignore index 879dc0c9..bd764927 100644 --- a/.gitignore +++ b/.gitignore @@ -35,4 +35,3 @@ /common-uefi64 /decompressor-build /stage1.stamp -/hgen diff --git a/GNUmakefile.in b/GNUmakefile.in index fcb7d6ef..8ed79a29 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -26,9 +26,6 @@ CC := @CC@ endif export CC -HOST_CC ?= @HOST_CC@ -export HOST_CC - INSTALL ?= @INSTALL@ export INSTALL @@ -80,15 +77,11 @@ override STAGE1_FILES := $(shell find '$(call SHESCAPE,$(SRCDIR))/stage1' -type .PHONY: all all: limine-uefi limine-bios -$(call MKESCAPE,$(BUILDDIR))/hgen: $(call MKESCAPE,$(SRCDIR))/limine-install/hgen.c - mkdir -p '$(call SHESCAPE,$(BUILDDIR))' - $(HOST_CC) $(CFLAGS) -std=c11 '$(call SHESCAPE,$(SRCDIR))/limine-install/hgen.c' -o '$(call SHESCAPE,$(BUILDDIR))/hgen' - .PHONY: limine-hdd.h limine-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-hdd.h -$(call MKESCAPE,$(BINDIR))/limine-hdd.h: $(call MKESCAPE,$(BUILDDIR))/hgen $(call MKESCAPE,$(BINDIR))/limine-hdd.bin - cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(BUILDDIR))/hgen' >limine-hdd.h +$(call MKESCAPE,$(BINDIR))/limine-hdd.h: $(call MKESCAPE,$(BINDIR))/limine-hdd.bin + cd '$(call SHESCAPE,$(BINDIR))' && '$(call SHESCAPE,$(SRCDIR))/limine-install/hgen.sh' >limine-hdd.h .PHONY: limine-install limine-install: @@ -99,7 +92,7 @@ limine-install: .PHONY: clean clean: limine-bios-clean limine-uefi32-clean limine-uefi64-clean - rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' '$(call SHESCAPE,$(BUILDDIR))/hgen' + rm -rf '$(call SHESCAPE,$(BINDIR))' '$(call SHESCAPE,$(BUILDDIR))/stage1.stamp' .PHONY: install-data install-data: diff --git a/configure.ac b/configure.ac index c3bd144c..522db57f 100644 --- a/configure.ac +++ b/configure.ac @@ -62,9 +62,6 @@ if ! test "x$BUILD_ELTORITO_EFI" = "xno"; then AC_SUBST(build_eltorito_efi, [yes]) fi -AC_ARG_VAR(HOST_CC, [C compiler for the build host [default: $CC]]) -test "x$HOST_CC" = "x" && HOST_CC="$CC" - AC_ARG_VAR(TOOLCHAIN, [Alternative toolchain prefix [default: limine]]) test "x$TOOLCHAIN" = "x" && TOOLCHAIN='limine' diff --git a/limine-install/hgen.c b/limine-install/hgen.c deleted file mode 100644 index 02834d07..00000000 --- a/limine-install/hgen.c +++ /dev/null @@ -1,42 +0,0 @@ -#include - -int main(void) { - int ok = 0; - - FILE *limine_hdd = fopen("limine-hdd.bin", "r+b"); - if (limine_hdd == NULL) { - goto err; - } - - printf("const uint8_t _binary_limine_hdd_bin_data[] = {\n\t"); - - int c = fgetc(limine_hdd); - for (size_t i = 0; ; i++) { - printf("0x%02x", c); - - c = fgetc(limine_hdd); - if (c == EOF) { - break; - } - - printf(", "); - if (i % 12 == 11) { - printf("\n\t"); - } - } - - printf("\n};\n"); - - goto cleanup; - -err: - perror("ERROR"); - ok = 1; - -cleanup: - if (limine_hdd != NULL) { - fclose(limine_hdd); - } - - return ok; -} diff --git a/limine-install/hgen.sh b/limine-install/hgen.sh new file mode 100755 index 00000000..c4a044d4 --- /dev/null +++ b/limine-install/hgen.sh @@ -0,0 +1,14 @@ +#! /bin/sh + +LC_ALL=C +export LC_ALL + +cat </dev/null || git log -n1 --pretty='%h' ) | sed 's/^v//g' | xargs printf '%s' [ -f version ] && ( cat version 2>/dev/null ) | xargs printf '%s'