From 581caff638e927f2041ab1d928e37ee01ad62e18 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 10 Dec 2024 16:44:59 +0200 Subject: [PATCH] BuildSystem: Install base sysroot only once Base sysroot is not only installed when creating the syroot directory for the first time. To get it installed again, you have to either delete the old sysroot diretory or run clean target This makes it so its actually possible to edit files specified in the base sysroot without random hacks. --- CMakeLists.txt | 7 ------- script/build.sh | 8 ++++++++ userspace/libraries/LibC/CMakeLists.txt | 1 - 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 250b5157..d262a1f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,6 @@ endif () project(banan-os CXX C ASM) -set(BANAN_BASE_SYSROOT ${CMAKE_SOURCE_DIR}/base-sysroot.tar.gz) - set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include) set(BANAN_LIB ${BANAN_SYSROOT}/usr/lib) set(BANAN_BIN ${BANAN_SYSROOT}/usr/bin) @@ -57,8 +55,3 @@ add_subdirectory(kernel) add_subdirectory(bootloader) add_subdirectory(BAN) add_subdirectory(userspace) - -add_custom_target(sysroot - COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_SYSROOT} - COMMAND cd ${BANAN_SYSROOT} && tar xf ${BANAN_BASE_SYSROOT} -) diff --git a/script/build.sh b/script/build.sh index aa4b3bd8..e31efe6f 100755 --- a/script/build.sh +++ b/script/build.sh @@ -66,6 +66,14 @@ run_bochs () { $BANAN_SCRIPT_DIR/bochs.sh $@ } +if [ ! -d $BANAN_SYSROOT ]; then + mkdir -p $BANAN_SYSROOT + + pushd $BANAN_SYSROOT + run_fakeroot tar xf ${BANAN_ROOT_DIR}/base-sysroot.tar.gz + popd +fi + if [ -v QEMU_ACCEL ]; then : elif type kvm-ok &> /dev/null; then diff --git a/userspace/libraries/LibC/CMakeLists.txt b/userspace/libraries/LibC/CMakeLists.txt index 8ff1a9d6..cf7ec1fc 100644 --- a/userspace/libraries/LibC/CMakeLists.txt +++ b/userspace/libraries/LibC/CMakeLists.txt @@ -58,7 +58,6 @@ target_compile_options(objlibc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usa function(add_crtx crtx) add_custom_target(${crtx} COMMAND ${CMAKE_CXX_COMPILER} -c -o ${CMAKE_INSTALL_LIBDIR}/${crtx}.o ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/${crtx}.S - DEPENDS sysroot ) add_dependencies(objlibc ${crtx}) endfunction()