From 8a43b5a3e5bcab8a914d36520edc13a9f8f798a4 Mon Sep 17 00:00:00 2001 From: Jose Narvaez Date: Thu, 13 Jul 2017 21:00:55 +0100 Subject: [PATCH] Small fixes to Makefiles to be able to build the kernel on macOS again. Details - We are using the toolchain compiler and archiver in order to generate a proper ELF file when building the 'raw-cpuid' crate C code which is currently being compiled by the macOS toolchain. - I added the 'findutils' and 'coreutils' Homebrew/MacPorts packages to the bootstrap script in order to setup the proper environment for the cookbook scripts (as the assume GNU tools). This should be temporary until the cookbook scripts get migrated to Rust. --- bootstrap.sh | 8 ++++++-- mk/kernel.mk | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 07fe288..696f8d0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -93,6 +93,8 @@ osx_macports() install_macports_pkg "virtualbox" fi + install_macports_pkg "coreutils" + install_macports_pkg "findutils" install_macports_pkg "gcc49" "gcc-4.9" install_macports_pkg "nasm" install_macports_pkg "pkgconfig" @@ -120,6 +122,8 @@ osx_homebrew() install_brew_pkg "virtualbox" fi + install_macports_pkg "coreutils" + install_macports_pkg "findutils" install_brew_pkg "gcc49" "gcc-4.9" install_brew_pkg "nasm" install_brew_pkg "pkg-config" @@ -298,7 +302,7 @@ gentoo() solus() { echo "Detected SolusOS" - + if [ "$1" == "qemu" ]; then if [ -z "$(which qemu-system-x86_64)" ]; then sudo eopkg it qemu @@ -314,7 +318,7 @@ solus() echo "Virtualbox already installed!" fi fi - + echo "Installing necessary build tools..." #if guards are not necessary with eopkg since it does nothing if latest version is already installed sudo eopkg it fuse-devel git gcc g++ libgcc-32bit libstdc++-32bit nasm make diff --git a/mk/kernel.mk b/mk/kernel.mk index 0475f12..32491e3 100644 --- a/mk/kernel.mk +++ b/mk/kernel.mk @@ -1,5 +1,10 @@ build/libkernel.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag +# Temporary fix for https://github.com/redox-os/redox/issues/963 allowing to build on macOS +ifeq ($(UNAME),Darwin) + cd kernel && CC=$(ARCH)-elf-gcc AR=$(ARCH)-elf-ar CFLAGS=-ffreestanding xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@ +else cd kernel && xargo rustc --lib --target $(KTARGET) --release -- -C soft-float --emit link=../$@ +endif build/libkernel_live.a: kernel/Cargo.toml kernel/src/* kernel/src/*/* kernel/src/*/*/* build/initfs.tag build/filesystem.bin cd kernel && FILESYSTEM="$(PWD)/build/filesystem.bin" xargo rustc --lib --features live --target $(KTARGET) --release -- -C soft-float --emit link=../$@