diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-10-16 02:39:56 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-10-16 02:39:56 +0800 |
| commit | 8cace3f05003c6cb4d38c36890055f03151c2ad4 (patch) | |
| tree | aa739deaac0266f17c4e91b333957501cb1ea2e9 /scripts/build | |
| parent | 3ad39e9878310e5317ee73c9b353c1e2c1c5c4ee (diff) | |
| download | lume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.gz lume-8cace3f05003c6cb4d38c36890055f03151c2ad4.tar.xz | |
Remove old code
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'scripts/build')
| -rw-r--r-- | scripts/build/Build.mk | 10 | ||||
| -rwxr-xr-x | scripts/build/archive.sh | 10 | ||||
| -rwxr-xr-x | scripts/build/check-kernel-elf.sh | 47 | ||||
| -rw-r--r-- | scripts/build/environments/host.mk | 8 | ||||
| -rw-r--r-- | scripts/build/environments/kernel.mk | 28 | ||||
| -rw-r--r-- | scripts/build/environments/phys.mk | 12 | ||||
| -rwxr-xr-x | scripts/build/generate-asm-offsets.sh | 25 | ||||
| -rwxr-xr-x | scripts/build/generate-autoconf.sh | 29 | ||||
| -rwxr-xr-x | scripts/build/generate-initramfs.sh | 12 | ||||
| -rwxr-xr-x | scripts/build/link-kernel.sh | 10 | ||||
| -rwxr-xr-x | scripts/build/probe-toolchain.sh | 72 | ||||
| -rw-r--r-- | scripts/build/probes/libc_headers.c | 10 | ||||
| -rw-r--r-- | scripts/build/probes/libc_headers.cc | 12 | ||||
| -rw-r--r-- | scripts/build/probes/libcxx.cc | 16 | ||||
| -rwxr-xr-x | scripts/build/run-if-changed.sh | 45 | ||||
| -rw-r--r-- | scripts/build/targets.mk | 81 | ||||
| -rw-r--r-- | scripts/build/tests/host_library.cc | 8 | ||||
| -rw-r--r-- | scripts/build/tests/host_test.cc | 7 | ||||
| -rw-r--r-- | scripts/build/tests/phys_library.cc | 5 | ||||
| -rw-r--r-- | scripts/build/toolchain.mk | 130 | ||||
| -rwxr-xr-x | scripts/build/write-compdb.py | 26 |
21 files changed, 0 insertions, 603 deletions
diff --git a/scripts/build/Build.mk b/scripts/build/Build.mk deleted file mode 100644 index 0a15b38..0000000 --- a/scripts/build/Build.mk +++ /dev/null @@ -1,10 +0,0 @@ -targets += build/host-library-smoke build/host-test-smoke build/phys-library-smoke -target.build/host-library-smoke.kind := host-library -target.build/host-library-smoke.sources := scripts/build/tests/host_library.cc - -target.build/host-test-smoke.kind := host-test -target.build/host-test-smoke.sources := scripts/build/tests/host_test.cc -target.build/host-test-smoke.private-deps := build/host-library-smoke - -target.build/phys-library-smoke.kind := phys-library -target.build/phys-library-smoke.sources := scripts/build/tests/phys_library.cc diff --git a/scripts/build/archive.sh b/scripts/build/archive.sh deleted file mode 100755 index 79f0bb9..0000000 --- a/scripts/build/archive.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -archive=$1 -ar=$2 -shift 2 -rm -f "$archive" -"$ar" rcs "$archive" "$@" - diff --git a/scripts/build/check-kernel-elf.sh b/scripts/build/check-kernel-elf.sh deleted file mode 100755 index eb92b33..0000000 --- a/scripts/build/check-kernel-elf.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -elf=$1 -readelf=$2 -nm=$3 -arch=$4 - -case "$arch" in - riscv) expected_machine='RISC-V' ;; - aarch64) expected_machine='AArch64' ;; - x86_64) expected_machine='Advanced Micro Devices X86-64' ;; - *) echo "ELF check: unsupported architecture: $arch" >&2; exit 2 ;; -esac - -machine=$($readelf -h "$elf" | sed -n 's/^[[:space:]]*Machine:[[:space:]]*//p') -[ "$machine" = "$expected_machine" ] || { - echo "ELF check: expected machine '$expected_machine', got '$machine'" >&2 - exit 1 -} - -entry=$($readelf -h "$elf" | sed -n 's/^[[:space:]]*Entry point address:[[:space:]]*//p') -[ -n "$entry" ] && [ "$entry" != 0x0 ] || { - echo "ELF check: kernel has no entry point" >&2 - exit 1 -} - -undefined=$($nm -u "$elf" || true) -[ -z "$undefined" ] || { - echo "ELF check: undefined symbols:" >&2 - printf '%s\n' "$undefined" >&2 - exit 1 -} - -if $readelf -W -l "$elf" | awk '$1 == "LOAD" && $0 ~ /W/ && $0 ~ /E/ { found=1 } END { exit !found }'; then - echo "ELF check: writable and executable LOAD segment" >&2 - exit 1 -fi - -$readelf -S "$elf" | grep -q '[.]rela[.]dyn' || { - echo "ELF check: missing relocation section .rela.dyn" >&2 - exit 1 -} - -echo "Kernel ELF OK: $machine, entry $entry" - diff --git a/scripts/build/environments/host.mk b/scripts/build/environments/host.mk deleted file mode 100644 index 0911ad3..0000000 --- a/scripts/build/environments/host.mk +++ /dev/null @@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -HOSTCC ?= cc -HOSTCXX ?= c++ -HOSTAR ?= ar -HOSTCFLAGS ?= -O2 -g -Wall -Wextra -HOSTCXXFLAGS ?= $(HOSTCFLAGS) -std=c++23 - diff --git a/scripts/build/environments/kernel.mk b/scripts/build/environments/kernel.mk deleted file mode 100644 index 1d6c8cf..0000000 --- a/scripts/build/environments/kernel.mk +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -WARNINGS ?= -Wall -Wextra -Wno-unused-parameter - -ifeq ($(BUILD_VARIANT),release) -KERNEL_OPT_FLAGS := -O2 -g0 -DNDEBUG -else -KERNEL_OPT_FLAGS := -O2 -g -endif - -CFLAGS := $(WARNINGS) $(KERNEL_OPT_FLAGS) \ - -ffreestanding -nostdlib \ - -mcmodel=medany -fPIE -MMD -MP \ - $(TOOLCHAIN_CFLAGS) $(KCPPFLAGS) $(INCLUDES) \ - -I$(BUILD)/generated - -CFLAGS_LIBC := -Iinclude/libc-shim $(CFLAGS) -std=gnu23 \ - -Wno-parentheses -Wno-sign-compare - -CXXFLAGS := $(CFLAGS) $(TOOLCHAIN_CXXFLAGS) -std=c++23 \ - -fno-exceptions -fno-rtti -fno-use-cxa-atexit \ - -fno-threadsafe-statics - -# Pre-MMU assembly must never use GOT-indirect addressing. -ASFLAGS := $(filter-out -fPIE,$(CFLAGS)) -fno-pie - -LDFLAGS := -nostdlib -shared -Bsymbolic -z notext -z norelro \ - --no-dynamic-linker diff --git a/scripts/build/environments/phys.mk b/scripts/build/environments/phys.mk deleted file mode 100644 index 6a11c12..0000000 --- a/scripts/build/environments/phys.mk +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later - -# Early physical-address execution environment. It deliberately has no heap, -# exceptions, RTTI, thread-safe statics, or PIE/GOT assumptions. -PHYS_CFLAGS := $(WARNINGS) -Os -g -ffreestanding -nostdlib \ - -fno-pie -fno-stack-protector $(TOOLCHAIN_CFLAGS) \ - $(KCPPFLAGS) $(INCLUDES) -I$(BUILD)/generated -PHYS_CXXFLAGS := $(PHYS_CFLAGS) $(TOOLCHAIN_CXXFLAGS) -std=c++23 \ - -fno-exceptions -fno-rtti -fno-use-cxa-atexit \ - -fno-threadsafe-statics -PHYS_ASFLAGS := $(PHYS_CFLAGS) - diff --git a/scripts/build/generate-asm-offsets.sh b/scripts/build/generate-asm-offsets.sh deleted file mode 100755 index 4e90f94..0000000 --- a/scripts/build/generate-asm-offsets.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -output=$1 -assembly=$2 -sed_script=$3 -source=$4 -tmp="$output.tmp.$$" -{ - echo '/* AUTO-GENERATED — DO NOT EDIT */' - echo "/* Generated from $source */" - echo '#ifndef _LUME_GENERATED_ASM_OFFSETS_H' - echo '#define _LUME_GENERATED_ASM_OFFSETS_H' - echo - sed -n -f "$sed_script" "$assembly" - echo - echo '#endif /* _LUME_GENERATED_ASM_OFFSETS_H */' -} > "$tmp" -if [ -e "$output" ] && cmp -s "$tmp" "$output"; then - rm -f "$tmp" -else - mv -f "$tmp" "$output" -fi - diff --git a/scripts/build/generate-autoconf.sh b/scripts/build/generate-autoconf.sh deleted file mode 100755 index 493d630..0000000 --- a/scripts/build/generate-autoconf.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -output=$1 -shift -tmp="$output.tmp.$$" -mkdir -p "$(dirname "$output")" -{ - echo '/* AUTO-GENERATED — DO NOT EDIT */' - echo '#pragma once' - while [ "$#" -gt 0 ]; do - name=$1 - value=$2 - kind=$3 - shift 3 - if [ "$kind" = bool ]; then - [ "$value" = y ] && echo "#define $name 1" - else - echo "#define $name $value" - fi - done -} > "$tmp" -if [ -e "$output" ] && cmp -s "$tmp" "$output"; then - rm -f "$tmp" -else - mv -f "$tmp" "$output" -fi - diff --git a/scripts/build/generate-initramfs.sh b/scripts/build/generate-initramfs.sh deleted file mode 100755 index 194e206..0000000 --- a/scripts/build/generate-initramfs.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -generator=$1 -wrapper=$2 -output=$3 -uid=$4 -gid=$5 -source=$6 -GEN_INIT_CPIO=$generator "$wrapper" -o "$output" -u "$uid" -g "$gid" "$source" - diff --git a/scripts/build/link-kernel.sh b/scripts/build/link-kernel.sh deleted file mode 100755 index 31164e7..0000000 --- a/scripts/build/link-kernel.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -output=$1 -size_tool=$2 -shift 2 -"$@" -"$size_tool" "$output" - diff --git a/scripts/build/probe-toolchain.sh b/scripts/build/probe-toolchain.sh deleted file mode 100755 index 218a821..0000000 --- a/scripts/build/probe-toolchain.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu -output=$1 -cc=$2 -cxx=$3 -ld=$4 -family=$5 -target=$6 -gcc_toolchain=$7 -sysroot=$8 -ktl_include=$9 -ktl_after_include=${10} -libc_include=${11} -libc_after_include=${12} -libcxx_include=${13} -compiler_resource_include=${14} - -set -- -if [ "$family" = clang ]; then - set -- "$@" "--target=$target" - [ -z "$gcc_toolchain" ] || set -- "$@" "--gcc-toolchain=$gcc_toolchain" - [ -z "$sysroot" ] || set -- "$@" "--sysroot=$sysroot" -fi - -probe() { - language=$1 - standard=$2 - shift 2 - compiler=$cc - [ "$language" = c++ ] && compiler=$cxx - printf '' | "$compiler" "$@" "-std=$standard" -x "$language" \ - -fsyntax-only - >/dev/null 2>&1 -} - -probe_libcxx() { - printf '%s\n' \ - '#include <ktl/array.h>' \ - '#include <ktl/atomic.h>' \ - '#include <ktl/optional.h>' \ - '#include <ktl/span.h>' \ - '#include <ktl/string_view.h>' \ - 'constexpr ktl::array<int, 2> values{1, 2};' \ - 'static_assert(values[1] == 2);' | \ - "$cxx" "$@" -std=c++23 -ffreestanding -fno-exceptions -fno-rtti \ - -nostdinc -I include -I "$ktl_include" -I "$libc_include" \ - -isystem "$compiler_resource_include" \ - -isystem "$libcxx_include" -idirafter "$ktl_after_include" \ - -idirafter "$libc_after_include" -fsyntax-only -x c++ - >/dev/null 2>&1 -} - -tmp="$output.tmp.$$" -mkdir -p "$(dirname "$output")" -{ - echo "cc=$($cc --version | head -n 1)" - echo "cxx=$($cxx --version | head -n 1)" - echo "ld=$($ld --version | head -n 1)" - echo "target=$target" - printf 'c23='; if probe c gnu23 "$@"; then echo yes; else echo no; fi - printf 'cxx23='; if probe c++ c++23 "$@"; then echo yes; else echo no; fi - printf 'libcxx-headers='; if probe_libcxx "$@"; then echo yes; else echo no; fi - printf 'fno-pie='; if probe c++ c++23 "$@" -fno-pie; then echo yes; else echo no; fi - printf 'mcmodel-medany='; if probe c++ c++23 "$@" -mcmodel=medany; then echo yes; else echo no; fi -} > "$tmp" -mv -f "$tmp" "$output" - -grep -q '^c23=yes$' "$output" -grep -q '^cxx23=yes$' "$output" -grep -q '^libcxx-headers=yes$' "$output" -grep -q '^fno-pie=yes$' "$output" -grep -q '^mcmodel-medany=yes$' "$output" diff --git a/scripts/build/probes/libc_headers.c b/scripts/build/probes/libc_headers.c deleted file mode 100644 index e4bdd20..0000000 --- a/scripts/build/probes/libc_headers.c +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -#include <assert.h> -#include <inttypes.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -_Static_assert(sizeof(uintptr_t) == sizeof(void*), "uintptr_t must hold a pointer"); diff --git a/scripts/build/probes/libc_headers.cc b/scripts/build/probes/libc_headers.cc deleted file mode 100644 index 1085cd3..0000000 --- a/scripts/build/probes/libc_headers.cc +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include <assert.h> -#include <inttypes.h> -#include <multi-file.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string-file.h> -#include <string.h> - -static_assert(sizeof(uintptr_t) == sizeof(void*)); diff --git a/scripts/build/probes/libcxx.cc b/scripts/build/probes/libcxx.cc deleted file mode 100644 index 8237151..0000000 --- a/scripts/build/probes/libcxx.cc +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -#include <array> -#include <atomic> -#include <optional> -#include <span> -#include <string_view> -#include <type_traits> - -constexpr std::array<int, 3> kValues{1, 2, 3}; -static_assert(kValues[2] == 3); -static_assert(std::is_same_v<std::span<const int>::element_type, const int>); -static_assert(std::string_view{"libc++"}.size() == 6); - -using Optional = std::optional<unsigned long>; -using Atomic = std::atomic<unsigned long>; diff --git a/scripts/build/run-if-changed.sh b/scripts/build/run-if-changed.sh deleted file mode 100755 index 6cdc7c4..0000000 --- a/scripts/build/run-if-changed.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0-or-later - -set -eu - -cmdfile=$1 -output=$2 -description=$3 -shift 3 - -rebuild=false -if [ ! -e "$output" ] || [ ! -e "$cmdfile" ]; then - rebuild=true -fi - -while [ "$#" -gt 0 ] && [ "$1" != "--" ]; do - prerequisite=$1 - shift - if [ "$prerequisite" != FORCE ] && [ -e "$prerequisite" ] && \ - [ "$prerequisite" -nt "$output" ]; then - rebuild=true - fi -done - -[ "$#" -gt 0 ] || { echo "run-if-changed: missing --" >&2; exit 2; } -shift - -signature=$(printf '%s\0' "$@" | cksum) -old_signature= -if [ -e "$cmdfile" ]; then - old_signature=$(cat "$cmdfile") -fi -if [ "$signature" != "$old_signature" ]; then - rebuild=true -fi - -if [ "$rebuild" = true ]; then - printf ' %s\n' "$description" - mkdir -p "$(dirname "$output")" "$(dirname "$cmdfile")" - "$@" - tmp="$cmdfile.tmp.$$" - printf '%s\n' "$signature" > "$tmp" - mv -f "$tmp" "$cmdfile" -fi - diff --git a/scripts/build/targets.mk b/scripts/build/targets.mk deleted file mode 100644 index 1a66379..0000000 --- a/scripts/build/targets.mk +++ /dev/null @@ -1,81 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (C) 2026 Richard Qin - -# Declarative target registry for the LumeOS build. -# -# Build.mk files populate target.<name>.* and append the name to targets. A -# target name is metadata, not a Make rule, so names may contain '/' and ':'. - -target-kinds := \ - interface-library header-library object-library source-set \ - static-library whole-archive host-library phys-library host-tool generated \ - binary-blob kernel-test host-test product -targets := -generated-actions := autoconf asm-offsets linker-script initramfs - -empty := -space := $(empty) $(empty) -comma := , - -# Convert a logical target/source name into a path-safe component. -target-key = $(subst :,_,$(subst /,_,$(1))) - -# Recursively collect a target and all of its dependencies. Dependency cycles -# are rejected separately before this is evaluated for build roots. -target-deps = $(sort $(target.$(1).deps) $(target.$(1).public-deps) \ - $(target.$(1).private-deps) $(target.$(1).interface-deps) \ - $(target.$(1).link-deps) $(target.$(1).tool-deps) \ - $(target.$(1).generated-deps) $(target.$(1).runtime-deps) \ - $(target.$(1).order-only-deps)) -target-closure = $(strip \ - $(if $(filter $(1),$(2)),$(error target dependency cycle: $(2) -> $(1))) \ - $(1) $(foreach dep,$(call target-deps,$(1)),$(call target-closure,$(dep),$(2) $(1)))) -target-link-deps = $(sort $(target.$(1).deps) $(target.$(1).public-deps) \ - $(target.$(1).private-deps) $(target.$(1).interface-deps) \ - $(target.$(1).link-deps)) -target-link-order = $(strip $(1) $(foreach dep,$(call target-link-deps,$(1)),\ - $(call target-link-order,$(dep)))) -unique-words = $(if $(strip $(1)),$(firstword $(1)) \ - $(call unique-words,$(filter-out $(firstword $(1)),$(1)))) - -duplicate-words = $(sort $(foreach word,$(1),\ - $(if $(word 2,$(filter $(word),$(1))),$(word)))) -all-target-sources = $(foreach target,$(targets),$(target.$(target).sources)) -duplicate-target-sources = $(call duplicate-words,$(all-target-sources)) - -define validate-target -$(if $(filter $(target.$(1).kind),$(target-kinds)),,$(error target '$(1)' has invalid kind '$(target.$(1).kind)')) -$(if $(filter header-library interface-library product generated binary-blob,$(target.$(1).kind)),$(if $(strip $(target.$(1).sources)),$(error target '$(1)' of kind $(target.$(1).kind) declares sources),),) -$(if $(filter host-tool,$(target.$(1).kind)),$(if $(word 2,$(target.$(1).sources)),$(error host-tool '$(1)' currently requires exactly one source),),) -$(foreach src,$(target.$(1).sources),$(if $(wildcard $(src)),,$(error target '$(1)' references missing source '$(src)'))) -$(foreach dep,$(call target-deps,$(1)),$(if $(filter $(dep),$(targets)),,$(error target '$(1)' references unknown dependency '$(dep)'))) -$(foreach dep,$(call target-deps,$(1)),$(if $(strip $(target.$(dep).visibility)),\ - $(if $(filter all $(1),$(target.$(dep).visibility)),,\ - $(error target '$(1)' cannot depend on '$(dep)': visibility is '$(target.$(dep).visibility)')),)) -$(if $(filter generated,$(target.$(1).kind)),$(if $(strip $(target.$(1).outputs)),,$(error generated target '$(1)' has no outputs)),) -$(if $(filter generated,$(target.$(1).kind)),$(if $(filter $(target.$(1).action),$(generated-actions)),,$(error generated target '$(1)' has invalid action '$(target.$(1).action)')),) -endef - -define validate-targets -$(if $(strip $(targets)),,$(error no build targets were registered)) -$(if $(filter-out $(words $(sort $(targets))),$(words $(targets))),$(error duplicate build target name),) -$(foreach target,$(targets),$(call validate-target,$(target))) -endef - -# Usage requirements are deliberately separate from link inputs. Public -# include paths and defines propagate through deps; private values apply only -# while compiling the target itself. -target-public-closure = $(sort $(1) $(foreach dep,$(target.$(1).public-deps) \ - $(target.$(1).deps),$(call target-public-closure,$(dep)))) -target-public-includes = $(sort $(foreach target,$(call target-public-closure,$(1)),$(target.$(target).public-includes))) -target-public-after-includes = $(sort $(foreach target,$(call target-public-closure,$(1)),$(target.$(target).public-after-includes))) -target-public-defines = $(sort $(foreach target,$(call target-public-closure,$(1)),$(target.$(target).public-defines))) - -target-usage-roots = $(sort $(1) $(target.$(1).deps) $(target.$(1).public-deps) \ - $(target.$(1).private-deps) $(target.$(1).interface-deps)) -target-compile-includes = $(sort $(target.$(1).private-includes) \ - $(foreach root,$(call target-usage-roots,$(1)),$(call target-public-includes,$(root)))) -target-compile-after-includes = $(sort $(target.$(1).private-after-includes) \ - $(foreach root,$(call target-usage-roots,$(1)),$(call target-public-after-includes,$(root)))) -target-compile-defines = $(sort $(target.$(1).private-defines) \ - $(foreach root,$(call target-usage-roots,$(1)),$(call target-public-defines,$(root)))) diff --git a/scripts/build/tests/host_library.cc b/scripts/build/tests/host_library.cc deleted file mode 100644 index c545815..0000000 --- a/scripts/build/tests/host_library.cc +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -namespace lume::build::test { - -int HostLibrarySmokeTestSymbol() { return 0; } - -} // namespace lume::build::test - diff --git a/scripts/build/tests/host_test.cc b/scripts/build/tests/host_test.cc deleted file mode 100644 index 6b13417..0000000 --- a/scripts/build/tests/host_test.cc +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -namespace lume::build::test { -int HostLibrarySmokeTestSymbol(); -} - -int main() { return lume::build::test::HostLibrarySmokeTestSymbol(); } diff --git a/scripts/build/tests/phys_library.cc b/scripts/build/tests/phys_library.cc deleted file mode 100644 index 2cf1596..0000000 --- a/scripts/build/tests/phys_library.cc +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later - -extern "C" unsigned long LumePhysBuildSmoke(unsigned long value) { - return value ^ 0x4c554d45UL; -} diff --git a/scripts/build/toolchain.mk b/scripts/build/toolchain.mk deleted file mode 100644 index d244981..0000000 --- a/scripts/build/toolchain.mk +++ /dev/null @@ -1,130 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# Copyright (C) 2026 Richard Qin - -# Toolchain selection: -# make GCC + GNU ld -# make LLVM=1 Clang + GNU ld -# make LLVM=1 LD_TYPE=lld Clang + LLD - -LLVM ?= 0 -LLVM_VERSION ?= 20 -LD_TYPE ?= bfd -LLVM_BINUTILS ?= 0 -CXX_STDLIB ?= libc++ -CXX_ABI ?= lume -COMPILER_RUNTIME ?= compiler-default - -# One pinned libc++ header snapshot is shared by GCC and Clang. Platform C -# declarations and libc++ configuration come from the Zircon libc/KTL layer, -# not from a Linux or Fuchsia userland __config_site. -LIBCXX_ROOT ?= third_party/libcxx -LIBCXX_INCLUDE := $(LIBCXX_ROOT)/include/c++/v1 -KTL_INCLUDE := lib/ktl/include -KTL_AFTER_INCLUDE := lib/ktl/include-after -KERNEL_LIBC_INCLUDE := lib/libc/include -KERNEL_LIBC_AFTER_INCLUDE := lib/libc/include-after - -ifeq ($(wildcard $(LIBCXX_INCLUDE)/__config),) -$(error missing pinned libc++ headers under '$(LIBCXX_INCLUDE)') -endif -ifeq ($(wildcard $(KTL_INCLUDE)/__config_site),) -$(error missing KTL libc++ configuration under '$(KTL_INCLUDE)') -endif -ifneq ($(CXX_STDLIB),libc++) -$(error unsupported CXX_STDLIB '$(CXX_STDLIB)' (LumeOS uses its pinned libc++ headers)) -endif - -GCC_TOOLCHAIN ?= -CROSS_COMPILE ?= - -ifeq ($(ARCH),riscv) -TARGET_TRIPLE := riscv64-unknown-linux-gnu -ifeq ($(strip $(GCC_TOOLCHAIN)),) -ifneq ($(wildcard /opt/riscv64-glibc/bin/riscv64-unknown-linux-gnu-g++),) -GCC_TOOLCHAIN := /opt/riscv64-glibc -endif -endif -ifeq ($(strip $(CROSS_COMPILE)),) -ifneq ($(strip $(GCC_TOOLCHAIN)),) -CROSS_COMPILE := $(GCC_TOOLCHAIN)/bin/$(TARGET_TRIPLE)- -else -CROSS_COMPILE := $(TARGET_TRIPLE)- -endif -endif -else ifeq ($(ARCH),aarch64) -TARGET_TRIPLE := aarch64-linux-gnu -else ifeq ($(ARCH),x86_64) -TARGET_TRIPLE := x86_64-linux-gnu -endif - -ifeq ($(strip $(CROSS_COMPILE)),) -CROSS_COMPILE := $(TARGET_TRIPLE)- -endif -ifeq ($(strip $(GCC_TOOLCHAIN)),) -GCC_TOOLCHAIN := $(patsubst %/bin/,%, $(dir $(CROSS_COMPILE))) -endif - -GCC_SYSROOT := $(strip $(shell $(CROSS_COMPILE)g++ -print-sysroot 2>/dev/null)) - -CLANG_SUFFIX := $(if $(LLVM_VERSION),-$(LLVM_VERSION),) -CLANG ?= clang$(CLANG_SUFFIX) -CLANGXX ?= clang++$(CLANG_SUFFIX) -LLD ?= ld.lld$(CLANG_SUFFIX) - -CLANG_TARGET_FLAGS := --target=$(TARGET_TRIPLE) -ifneq ($(strip $(GCC_TOOLCHAIN)),) -CLANG_TARGET_FLAGS += --gcc-toolchain=$(GCC_TOOLCHAIN) -endif -ifneq ($(strip $(GCC_SYSROOT)),) -CLANG_TARGET_FLAGS += --sysroot=$(GCC_SYSROOT) -endif - -ifeq ($(LLVM),1) -CC := $(CLANG) -CXX := $(CLANGXX) -COMPILER_FAMILY := clang -TOOLCHAIN_CFLAGS := $(CLANG_TARGET_FLAGS) -TOOLCHAIN_CXXFLAGS := -COMPILER_RESOURCE_DIR := $(strip $(shell $(CXX) $(CLANG_TARGET_FLAGS) -print-resource-dir 2>/dev/null)) -COMPILER_RESOURCE_INCLUDE := $(COMPILER_RESOURCE_DIR)/include -ifeq ($(LD_TYPE),lld) -LD := $(LLD) -LINKER_FAMILY := lld -else -LD := $(CROSS_COMPILE)ld -LINKER_FAMILY := bfd -endif - -else -CC := $(CROSS_COMPILE)gcc -CXX := $(CROSS_COMPILE)g++ -LD := $(CROSS_COMPILE)ld -COMPILER_FAMILY := gcc -LINKER_FAMILY := bfd -COMPILER_RESOURCE_INCLUDE := $(strip $(shell $(CXX) -print-file-name=include 2>/dev/null)) -endif - -ifeq ($(wildcard $(COMPILER_RESOURCE_INCLUDE)/stddef.h),) -$(error missing compiler resource headers under '$(COMPILER_RESOURCE_INCLUDE)') -endif - -# Kernel and phys code must not observe the Linux target sysroot. Supply only -# compiler intrinsic headers explicitly; the target graph provides the kernel -# libc and KTL layers, followed by the pinned libc++ headers for C++. -TOOLCHAIN_CFLAGS += -nostdinc -isystem $(COMPILER_RESOURCE_INCLUDE) -TOOLCHAIN_CXXFLAGS += -isystem $(LIBCXX_INCLUDE) - -ifeq ($(LLVM_BINUTILS),1) -AR := llvm-ar$(CLANG_SUFFIX) -NM := llvm-nm$(CLANG_SUFFIX) -OBJCOPY := llvm-objcopy$(CLANG_SUFFIX) -OBJDUMP := llvm-objdump$(CLANG_SUFFIX) -READELF := llvm-readelf$(CLANG_SUFFIX) -else -AR := $(CROSS_COMPILE)ar -NM := $(CROSS_COMPILE)nm -OBJCOPY := $(CROSS_COMPILE)objcopy -OBJDUMP := $(CROSS_COMPILE)objdump -READELF := $(CROSS_COMPILE)readelf -endif -SIZE := $(CROSS_COMPILE)size diff --git a/scripts/build/write-compdb.py b/scripts/build/write-compdb.py deleted file mode 100755 index 9ec5a49..0000000 --- a/scripts/build/write-compdb.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 -# SPDX-License-Identifier: GPL-2.0-or-later - -import json -import pathlib -import sys - -source = pathlib.Path(sys.argv[1]) -output = pathlib.Path(sys.argv[2]) -directory = pathlib.Path.cwd() -entries = [] -for line in source.read_text().splitlines(): - file_name, object_name, command = line.split("\t", 2) - entries.append( - { - "directory": str(directory), - "file": file_name, - "output": object_name, - "command": command, - } - ) -output.parent.mkdir(parents=True, exist_ok=True) -temporary = output.with_suffix(output.suffix + ".tmp") -temporary.write_text(json.dumps(entries, indent=2) + "\n") -temporary.replace(output) - |
