From a0a8b3c0d679ef20e502eea8d22d385365738a11 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sat, 22 Jan 2022 03:46:48 +0100 Subject: [PATCH] build: 'install' portability fixes --- .github/workflows/release.yml | 3 +++ .gitignore | 1 + GNUmakefile.in | 29 ++++++++++++++++------------- README.md | 2 +- autogen.sh | 1 + configure.ac | 1 + limine-install/Makefile | 21 +++++++++++---------- make_toolchain.sh | 2 +- 8 files changed, 35 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4b3a6a27..9b183e29 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,6 +73,9 @@ jobs: - name: Copy LICENSE to bin run: cp LICENSE.md build/bin/ + - name: Copy install-sh to bin + run: cp install-sh build/bin/ + - name: Push binaries to binary branch run: | git config user.name 'mintsuki' diff --git a/.gitignore b/.gitignore index ab1c7561..3d1916be 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ stivale test_image !stage23/font.bin configure +install-sh *~ config.status config.log diff --git a/GNUmakefile.in b/GNUmakefile.in index 80ee50e4..b767d1f7 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -30,6 +30,9 @@ CC := @CC@ endif export CC +INSTALL ?= @INSTALL@ +export INSTALL + CFLAGS ?= @CFLAGS@ export CFLAGS @@ -205,24 +208,24 @@ clean: limine-bios-clean limine-uefi32-clean limine-uefi64-clean .PHONY: install-data install-data: - install -d '$(DESTDIR)$(PREFIX)/share' - install -d '$(DESTDIR)$(PREFIX)/share/limine' - install -m 644 '$(call SHESCAPE,$(BINDIR))/limine.sys' '$(DESTDIR)$(PREFIX)/share/limine/' || true - install -m 644 '$(call SHESCAPE,$(BINDIR))/limine-cd.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true - install -m 644 '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true - install -m 644 '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true - install -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true - install -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/share' + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/share/limine' + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/limine.sys' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/limine-cd.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/limine-eltorito-efi.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/limine-pxe.bin' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTX64.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true + $(INSTALL) -m 644 '$(call SHESCAPE,$(BINDIR))/BOOTIA32.EFI' '$(DESTDIR)$(PREFIX)/share/limine/' || true .PHONY: install-strip install-strip: install-data - install -d '$(DESTDIR)$(PREFIX)/bin' - install -s '$(call SHESCAPE,$(BINDIR))/limine-install' '$(DESTDIR)$(PREFIX)/bin/' || true + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin' + $(INSTALL) -s '$(call SHESCAPE,$(BINDIR))/limine-install' '$(DESTDIR)$(PREFIX)/bin/' || true .PHONY: install install: install-data - install -d '$(DESTDIR)$(PREFIX)/bin' - install '$(call SHESCAPE,$(BINDIR))/limine-install' '$(DESTDIR)$(PREFIX)/bin/' || true + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin' + $(INSTALL) '$(call SHESCAPE,$(BINDIR))/limine-install' '$(DESTDIR)$(PREFIX)/bin/' || true .PHONY: uninstall uninstall: @@ -301,7 +304,7 @@ distclean: clean .PHONY: maintainer-clean maintainer-clean: distclean - cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf stivale reduced-gnu-efi configure *'~' autom4te.cache *.tar.xz + cd '$(call SHESCAPE,$(SRCDIR))' && rm -rf stivale reduced-gnu-efi configure install-sh *'~' autom4te.cache *.tar.xz .PHONY: stage23-uefi64 stage23-uefi64: $(call MKESCAPE,$(SRCDIR))/stivale diff --git a/README.md b/README.md index bc8e2f88..06dbdfd9 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ paragraph, or `gcc` or `llvm/clang` must also be installed, alongside ### Configure -If checking out from the repository, run `./autogen.sh` (GNU autoconf required), +If checking out from the repository, run `./autogen.sh` (GNU automake and GNU autoconf required), else, if using a release tarball, run `./configure` directly. Both `./autogen.sh` and `./configure` take arguments and environment variables; diff --git a/autogen.sh b/autogen.sh index 4ea3f17a..9ef867e2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -12,6 +12,7 @@ cd "$srcdir" [ -d stivale ] || git clone https://github.com/stivale/stivale.git [ -d reduced-gnu-efi ] || git clone https://github.com/limine-bootloader/reduced-gnu-efi.git +automake --add-missing || true autoconf cd "$origdir" diff --git a/configure.ac b/configure.ac index f676783a..db4424c8 100644 --- a/configure.ac +++ b/configure.ac @@ -5,6 +5,7 @@ AC_PREREQ(2.69) AC_SUBST(limine_version, m4_esyscmd([./version.sh])) AC_PROG_CC +AC_PROG_INSTALL AC_ARG_VAR(TOOLCHAIN, [Alternative toolchain prefix [limine]]) test "x$TOOLCHAIN" = "x" && TOOLCHAIN='limine' diff --git a/limine-install/Makefile b/limine-install/Makefile index 0443ba1a..f0d89577 100644 --- a/limine-install/Makefile +++ b/limine-install/Makefile @@ -1,4 +1,5 @@ CC ?= cc +INSTALL ?= ./install-sh PREFIX ?= /usr/local DESTDIR ?= @@ -10,16 +11,16 @@ all: limine-install .PHONY: install install: all - install -d '$(DESTDIR)$(PREFIX)/bin' - install -s limine-install '$(DESTDIR)$(PREFIX)/bin/' - install -d '$(DESTDIR)$(PREFIX)/share' - install -d '$(DESTDIR)$(PREFIX)/share/limine' - install -m 644 limine.sys '$(DESTDIR)$(PREFIX)/share/limine/' - install -m 644 limine-cd.bin '$(DESTDIR)$(PREFIX)/share/limine/' - install -m 644 limine-eltorito-efi.bin '$(DESTDIR)$(PREFIX)/share/limine/' - install -m 644 limine-pxe.bin '$(DESTDIR)$(PREFIX)/share/limine/' - install -m 644 BOOTX64.EFI '$(DESTDIR)$(PREFIX)/share/limine/' - install -m 644 BOOTIA32.EFI '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/bin' + $(INSTALL) -s limine-install '$(DESTDIR)$(PREFIX)/bin/' + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/share' + $(INSTALL) -d '$(DESTDIR)$(PREFIX)/share/limine' + $(INSTALL) -m 644 limine.sys '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -m 644 limine-cd.bin '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -m 644 limine-eltorito-efi.bin '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -m 644 limine-pxe.bin '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -m 644 BOOTX64.EFI '$(DESTDIR)$(PREFIX)/share/limine/' + $(INSTALL) -m 644 BOOTIA32.EFI '$(DESTDIR)$(PREFIX)/share/limine/' .PHONY: clean clean: diff --git a/make_toolchain.sh b/make_toolchain.sh index a2a5bad1..e09db9e5 100755 --- a/make_toolchain.sh +++ b/make_toolchain.sh @@ -67,7 +67,7 @@ cd gcc-$GCCVERSION sed 's|http://gcc.gnu|https://gcc.gnu|g' < contrib/download_prerequisites > dp.sed mv dp.sed contrib/download_prerequisites chmod +x contrib/download_prerequisites -contrib/download_prerequisites --no-verify +./contrib/download_prerequisites --no-verify cd .. mkdir build-gcc cd build-gcc