From 28268bf7033499b87400a7c7ca99daed90adddca Mon Sep 17 00:00:00 2001 From: uuuvn Date: Tue, 6 Jun 2023 14:20:02 +0000 Subject: [PATCH] Add support for non-x86 hosts --- mk/config.mk | 17 +++++++++++------ scripts/changelog.sh | 2 +- scripts/find-recipe.sh | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/mk/config.mk b/mk/config.mk index 0756ca4..b9e256b 100644 --- a/mk/config.mk +++ b/mk/config.mk @@ -1,8 +1,10 @@ -include .config +HOST_ARCH?=$(shell uname -m) + # Configuration -## Architecture to build Redox for (aarch64, i686, or x86_64) -ARCH?=x86_64 +## Architecture to build Redox for (aarch64, i686, or x86_64). Defaults to a host one +ARCH?=$(HOST_ARCH) ## Enable to use binary prefix (much faster) PREFIX_BINARY?=1 ## Enable to use binary packages (much faster) @@ -21,15 +23,12 @@ PODMAN_BUILD?=0 CONTAINERFILE?=podman/redox-base-containerfile # Per host variables -# TODO: get host arch automatically -HOST_ARCH=x86_64 HOST_CARGO=env -u RUSTUP_TOOLCHAIN cargo UNAME := $(shell uname) ifeq ($(UNAME),Darwin) FUMOUNT=umount export NPROC=sysctl -n hw.ncpu export REDOX_MAKE=make - PREFIX_BINARY=0 VB_AUDIO=coreaudio VBM=/Applications/VirtualBox.app/Contents/MacOS/VBoxManage HOST_TARGET ?= $(HOST_ARCH)-apple-darwin @@ -38,7 +37,6 @@ else ifeq ($(UNAME),FreeBSD) FUMOUNT=sudo umount export NPROC=sysctl -n hw.ncpu export REDOX_MAKE=gmake - PREFIX_BINARY=0 VB_AUDIO=pulse # To check, will probaly be OSS on most setups VBM=VBoxManage HOST_TARGET ?= $(HOST_ARCH)-unknown-freebsd @@ -59,6 +57,13 @@ else ALLOC_FILE=fallocate --posix --length "$(FILESYSTEM_SIZE)MiB" endif +ifneq ($(UNAME),Linux) + PREFIX_BINARY=0 +endif +ifneq ($(HOST_ARCH),x86_64) + PREFIX_BINARY=0 +endif + # Automatic variables ROOT=$(CURDIR) export RUST_COMPILER_RT_ROOT=$(ROOT)/rust/src/llvm-project/compiler-rt diff --git a/scripts/changelog.sh b/scripts/changelog.sh index 10348a8..0475665 100755 --- a/scripts/changelog.sh +++ b/scripts/changelog.sh @@ -12,7 +12,7 @@ REPOS=( rust=rust ) -for package in $(installer/target/release/redox_installer --list-packages -c config/x86_64/desktop.toml) +for package in $(installer/target/release/redox_installer --list-packages -c config/$(uname -m)/desktop.toml) do REPOS+=("${package}=cookbook/recipes/${package}/source") done diff --git a/scripts/find-recipe.sh b/scripts/find-recipe.sh index aa371b0..61fb277 100755 --- a/scripts/find-recipe.sh +++ b/scripts/find-recipe.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Ensure arch and config are set as desired, we use these to find the build dir -export ARCH=x86_64 +export ARCH=$(uname -m) export CONFIG_NAME=desktop # Make sure to unmount the image first