From 008160036d323b467c439635a189a0dcbeea04cb Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Mon, 2 Dec 2024 22:21:45 +1100 Subject: [PATCH] feat(prefix): libtool Signed-off-by: Anhad Singh --- mk/prefix.mk | 59 ++++++++++++++++++++++++++++++--- mk/repo.mk | 4 +++ podman/redox-base-containerfile | 5 ++- 3 files changed, 61 insertions(+), 7 deletions(-) diff --git a/mk/prefix.mk b/mk/prefix.mk index 87ab8be..3bf9b10 100644 --- a/mk/prefix.mk +++ b/mk/prefix.mk @@ -1,12 +1,13 @@ -# Configuration file for the Rust/GCC cross-compilers and relibc +# Configuration file for the Rust/GCC cross-compilers, relibc and libtool PREFIX=prefix/$(TARGET) -PREFIX_INSTALL=$(PREFIX)/relibc-install +PREFIX_INSTALL=$(PREFIX)/sysroot/ PREFIX_PATH=$(ROOT)/$(PREFIX_INSTALL)/bin BINUTILS_BRANCH=redox-2.43.1 GCC_BRANCH=redox-13.2.0 +LIBTOOL_VERSION=2.5.4 export PREFIX_RUSTFLAGS=-L $(ROOT)/$(PREFIX_INSTALL)/$(TARGET)/lib export RUSTUP_TOOLCHAIN=$(ROOT)/$(PREFIX_INSTALL) @@ -21,7 +22,11 @@ else GCC_ARCH?= endif -prefix: $(PREFIX_INSTALL) +# TODO(andypython): Upstream libtool patches to remove the need to locally build libtool. +# Cannot be CI built, i.e. be a part of relibc-install.tar.gz, as the prefix has to be correctly +# set while building. Otherwise aclocal will not be able to find libtool's files. Furthermore, doing +# so would break non-podman builds (not sure if they are still supported though). +prefix: $(PREFIX)/sysroot PREFIX_STRIP=\ mkdir -p bin libexec "$(GCC_TARGET)/bin" && \ @@ -65,6 +70,51 @@ $(PREFIX)/relibc-install.tar.gz: $(PREFIX)/relibc-install --directory="$<" \ . +$(PREFIX)/libtool: + rm -rf "$@.partial" "$@" + mkdir -p "$@.partial" + + git clone \ + --recurse-submodules \ + "https://gitlab.redox-os.org/andypython/libtool/" \ + --branch "v$(LIBTOOL_VERSION)-redox" \ + --depth 1 \ + "$@.partial" + + touch "$@.partial" + mv "$@.partial" "$@" + +$(PREFIX)/libtool-build: $(PREFIX)/libtool $(CONTAINER_TAG) +ifeq ($(PODMAN_BUILD),1) + $(PODMAN_RUN) $(MAKE) $@ +else + mkdir -p "$@.partial" + cd "$(PREFIX)/libtool" && \ + ./bootstrap \ + --skip-po \ + --skip-git \ + --force \ + --gnulib-srcdir=./gnulib + cd "$@.partial" && \ + "$(ROOT)/$