From 6bcc3209a8699e3eaefaa6145f369dc9595f4cc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20T=C3=B6rnblom?= Date: Tue, 13 Aug 2024 23:07:14 +0200 Subject: [PATCH] move homebrew stuff to user/homebrew --- crt/Makefile | 4 ++-- host/bin/prospero-clang | 3 ++- host/bin/prospero-clang++ | 4 +++- host/bin/prospero-lld | 4 +++- host/bin/prospero-pkg-config | 6 +++--- host/toolchain/prospero.mk | 4 +++- host/toolchain/prospero.sh | 2 ++ include/Makefile | 8 ++++---- libc/Makefile | 4 ++-- libcxx.sh | 4 ++-- sce_stubs/Makefile | 4 ++-- 11 files changed, 28 insertions(+), 19 deletions(-) diff --git a/crt/Makefile b/crt/Makefile index b91bb88..e463bdc 100644 --- a/crt/Makefile +++ b/crt/Makefile @@ -48,5 +48,5 @@ clean: rm -f *.o install: crt1.o - install -d $(DESTDIR)/target/lib - install $^ $(DESTDIR)/target/lib + install -d $(DESTDIR)/target/user/homebrew/lib + install $^ $(DESTDIR)/target/user/homebrew/lib diff --git a/host/bin/prospero-clang b/host/bin/prospero-clang index 6ebab2b..2033a8c 100755 --- a/host/bin/prospero-clang +++ b/host/bin/prospero-clang @@ -20,6 +20,7 @@ SCRIPT_NAME="$(basename "${SCRIPT_PATH}")" SCRIPT_DIR="$(dirname "${SCRIPT_PATH}")" PS5_PAYLOAD_SDK="$(realpath "${SCRIPT_DIR}/..")" +PS5_PAYLOAD_HBROOT="${PS5_PAYLOAD_SDK}/target/user/homebrew" LIBS="-lc" DEPS="-lSceLibcInternal -lSceNet" @@ -35,6 +36,6 @@ export PATH=${SCRIPT_DIR}:$PATH exec -a "${SCRIPT_NAME}" "${SCRIPT_DIR}/clang" \ -target x86_64-sie-ps5 \ -isysroot "${PS5_PAYLOAD_SDK}" \ - -isystem "${PS5_PAYLOAD_SDK}/target/include" \ + -resource-dir "${PS5_PAYLOAD_HBROOT}" \ -fno-stack-protector -fno-plt -femulated-tls \ $LIBS "$@" $DEPS diff --git a/host/bin/prospero-clang++ b/host/bin/prospero-clang++ index c547653..c737330 100755 --- a/host/bin/prospero-clang++ +++ b/host/bin/prospero-clang++ @@ -20,6 +20,7 @@ SCRIPT_NAME="$(basename "${SCRIPT_PATH}")" SCRIPT_DIR="$(dirname "${SCRIPT_PATH}")" PS5_PAYLOAD_SDK="$(realpath "${SCRIPT_DIR}/..")" +PS5_PAYLOAD_HBROOT="${PS5_PAYLOAD_SDK}/target/user/homebrew" LIBS_C="-lc" LIBS_CXX="-lunwind -lc++abi -lc++" @@ -41,7 +42,8 @@ export PATH=${SCRIPT_DIR}:$PATH exec -a "${SCRIPT_NAME}" "${SCRIPT_DIR}/clang++" \ -target x86_64-sie-ps5 \ -isysroot "${PS5_PAYLOAD_SDK}" \ - -stdlib++-isystem "${PS5_PAYLOAD_SDK}/target/include/c++/v1" \ + -resource-dir "${PS5_PAYLOAD_HBROOT}" \ + -stdlib++-isystem "${PS5_PAYLOAD_HBROOT}/include/c++/v1" \ -fno-stack-protector -fno-plt -femulated-tls \ -frtti -fexceptions \ $LIBS_C $LIBS_CXX "$@" $LIBS_DEPS diff --git a/host/bin/prospero-lld b/host/bin/prospero-lld index 8f7dfce..9f98e73 100755 --- a/host/bin/prospero-lld +++ b/host/bin/prospero-lld @@ -20,6 +20,7 @@ SCRIPT_NAME="$(basename "${SCRIPT_PATH}")" SCRIPT_DIR="$(dirname "${SCRIPT_PATH}")" PS5_PAYLOAD_SDK="$(realpath "${SCRIPT_DIR}/..")" +PS5_PAYLOAD_HBROOT="${PS5_PAYLOAD_SDK}/target/user/homebrew" LLVM_CONFIG="${SCRIPT_DIR}/llvm-config" LLVM_BINDIR=$("${LLVM_CONFIG}" --bindir) @@ -38,6 +39,7 @@ exec "${BIN_PATH}" \ -z max-page-size=0x4000 \ -T "${PS5_PAYLOAD_SDK}/ldscripts/elf_x86_64.x" \ -L "${PS5_PAYLOAD_SDK}/target/lib" \ + -L "${PS5_PAYLOAD_HBROOT}/lib" \ "$@" \ "${LIBKERNEL}" \ - "${PS5_PAYLOAD_SDK}/target/lib/crt1.o" + "${PS5_PAYLOAD_HBROOT}/lib/crt1.o" diff --git a/host/bin/prospero-pkg-config b/host/bin/prospero-pkg-config index e360fc1..96a6973 100755 --- a/host/bin/prospero-pkg-config +++ b/host/bin/prospero-pkg-config @@ -22,8 +22,8 @@ SCRIPT_DIR="$(dirname "${SCRIPT_PATH}")" PS5_PAYLOAD_SDK="$(realpath "${SCRIPT_DIR}/..")" export PKG_CONFIG_DIR= -export PKG_CONFIG_SYSROOT_DIR=${PS5_PAYLOAD_SDK}/target -export PKG_CONFIG_LIBDIR=${PS5_PAYLOAD_SDK}/target/lib/pkgconfig -export PKG_CONFIG_PATH=${PS5_PAYLOAD_SDK}/target/libdata/pkgconfig +export PKG_CONFIG_SYSROOT_DIR=${PS5_PAYLOAD_SDK}/target/user/homebrew +export PKG_CONFIG_LIBDIR=${PKG_CONFIG_SYSROOT_DIR}/lib/pkgconfig +export PKG_CONFIG_PATH=${PKG_CONFIG_SYSROOT_DIR}/libdata/pkgconfig exec -a "${SCRIPT_NAME}" pkg-config --static "$@" diff --git a/host/toolchain/prospero.mk b/host/toolchain/prospero.mk index 9bc7be5..84ba09a 100644 --- a/host/toolchain/prospero.mk +++ b/host/toolchain/prospero.mk @@ -16,7 +16,9 @@ PS5_PAYLOAD_SDK := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))..) PS5_SYSROOT := $(PS5_PAYLOAD_SDK)/target -PS5_DEPLOY := $(PS5_PAYLOAD_SDK)/bin/prospero-deploy +PS5_HBROOT := /user/homebrew + +PS5_DEPLOY := $(PS5_PAYLOAD_SDK)/bin/prospero-deploy AS := $(PS5_PAYLOAD_SDK)/bin/prospero-clang CC := $(PS5_PAYLOAD_SDK)/bin/prospero-clang diff --git a/host/toolchain/prospero.sh b/host/toolchain/prospero.sh index 7a59f74..1ba6d39 100644 --- a/host/toolchain/prospero.sh +++ b/host/toolchain/prospero.sh @@ -22,6 +22,8 @@ PS5_PAYLOAD_SDK="$(realpath "${PS5_PAYLOAD_SDK}")" export PS5_PAYLOAD_SDK=${PS5_PAYLOAD_SDK} export PS5_SYSROOT=${PS5_PAYLOAD_SDK}/target +export PS5_HBROOT=/user/homebrew + export PS5_DEPLOY=${PS5_PAYLOAD_SDK}/bin/prospero-deploy export CC=${PS5_PAYLOAD_SDK}/bin/prospero-clang diff --git a/include/Makefile b/include/Makefile index dbe6953..382f9fc 100644 --- a/include/Makefile +++ b/include/Makefile @@ -21,7 +21,7 @@ all: clean: install: - install -d $(DESTDIR)/target - cp -r freebsd/. $(DESTDIR)/target/include - cp -r khronos/. $(DESTDIR)/target/include - cp -r ps5/. $(DESTDIR)/target/include/ps5 + install -d $(DESTDIR)/target/user/homebrew/include + cp -r freebsd/. $(DESTDIR)/target/user/homebrew/include + cp -r khronos/. $(DESTDIR)/target/user/homebrew/include + cp -r ps5/. $(DESTDIR)/target/user/homebrew/include/ps5 diff --git a/libc/Makefile b/libc/Makefile index 95069bf..adeef9b 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -47,6 +47,6 @@ clean: rm -f *.a *.o install: $(ARCHIVE) - install -d $(DESTDIR)/target/lib - install $^ $(DESTDIR)/target/lib + install -d $(DESTDIR)/target/user/homebrew/lib + install $^ $(DESTDIR)/target/user/homebrew/lib diff --git a/libcxx.sh b/libcxx.sh index bc80e46..fdd4f66 100755 --- a/libcxx.sh +++ b/libcxx.sh @@ -34,7 +34,7 @@ tar xf $TEMPDIR/llvm.tar.xz -C $TEMPDIR || exit 1 ${CMAKE} -S $TEMPDIR/llvm-project-$LLVM_VER.src/runtimes \ -B $TEMPDIR/build \ - -DCMAKE_INSTALL_PREFIX="${PS5_SYSROOT}" \ + -DCMAKE_INSTALL_PREFIX="${PS5_HBROOT}" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="-nostdlib++" \ -DLLVM_ENABLE_RUNTIMES="libunwind;libcxxabi;libcxx" \ @@ -56,4 +56,4 @@ ${CMAKE} -S $TEMPDIR/llvm-project-$LLVM_VER.src/runtimes \ -DLIBUNWIND_IS_BAREMETAL=YES \ -DLIBUNWIND_ENABLE_SHARED=NO \ -DLIBUNWIND_USE_COMPILER_RT=NO || exit 1 -${MAKE} -C $TEMPDIR/build install DESTDIR="/" +${MAKE} -C $TEMPDIR/build install DESTDIR="${PS5_SYSROOT}" diff --git a/sce_stubs/Makefile b/sce_stubs/Makefile index c346b6b..7682a2a 100644 --- a/sce_stubs/Makefile +++ b/sce_stubs/Makefile @@ -64,5 +64,5 @@ clean: rm -f *.o *.so $(NID_DB) install: $(SHARED) - install -d $(DESTDIR)/target/lib - install $(SHARED) $(DESTDIR)/target/lib + install -d $(DESTDIR)/target/user/homebrew/lib + install $(SHARED) $(DESTDIR)/target/user/homebrew/lib