Meta: Move utility scripts to a subfolder

The idea is that scripts directly under Meta are meant to be run by
people. Scripts that are only imported or run by other scripts are
moved to a subdirectory.
This commit is contained in:
Timothy Flynn 2026-04-23 10:10:23 -04:00 committed by Tim Flynn
parent 59d320a1d3
commit ce7b69ff31
17 changed files with 51 additions and 48 deletions

View file

@ -223,7 +223,7 @@ runs:
- name: 'Install vcpkg' - name: 'Install vcpkg'
if: ${{ inputs.type == 'build' }} if: ${{ inputs.type == 'build' }}
shell: bash shell: bash
run: ./Meta/build_vcpkg.py run: ./Meta/Utils/build_vcpkg.py
- name: 'Export installed versions' - name: 'Export installed versions'
id: 'export-versions' id: 'export-versions'

View file

@ -7,7 +7,7 @@ Qt6 development packages, nasm, additional build tools, and a C++23 capable comp
A Rust toolchain is also required. You can install it via [rustup](https://rustup.rs/). A Rust toolchain is also required. You can install it via [rustup](https://rustup.rs/).
We currently use gcc-14 and clang-21 in our CI pipeline. If these versions are not available on your system, see We currently use gcc-14 and clang-21 in our CI pipeline. If these versions are not available on your system, see
[`Meta/find_compiler.py`](../Meta/find_compiler.py) for the minimum compatible version. [`find_compiler.py`](../Meta/Utils/find_compiler.py) for the minimum compatible version.
CMake 3.30 or newer must be available in $PATH. CMake 3.30 or newer must be available in $PATH.

View file

@ -1,4 +1,4 @@
# Keep the lists here in sync with Meta/host_platform.py # Keep the lists here in sync with Meta/Utils/host_platform.py
if (ANDROID OR VCPKG_TARGET_ANDROID) if (ANDROID OR VCPKG_TARGET_ANDROID)
set(_possible_guis "Android") set(_possible_guis "Android")
set(_default_gui "Android") set(_default_gui "Android")

View file

@ -7,14 +7,18 @@
import argparse import argparse
import sys
from dataclasses import dataclass from dataclasses import dataclass
from dataclasses import field from dataclasses import field
from pathlib import Path
from typing import List from typing import List
from typing import TextIO from typing import TextIO
from lexer import Lexer sys.path.append(str(Path(__file__).resolve().parent.parent))
from string_hash import string_hash
from Utils.lexer import Lexer
from Utils.utils import string_hash
PRIMITIVE_TYPES = { PRIMITIVE_TYPES = {
"i8", "i8",

View file

@ -1,19 +0,0 @@
# Copyright (c) 2026-present, the Ladybird developers.
#
# SPDX-License-Identifier: BSD-2-Clause
def string_hash(string: str) -> int:
"""Port of AK::string_hash that produces the same u32 value."""
h = 0
for ch in string:
h = (h + ord(ch)) & 0xFFFFFFFF
h = (h + (h << 10)) & 0xFFFFFFFF
h ^= h >> 6
h = (h + (h << 3)) & 0xFFFFFFFF
h ^= h >> 11
h = (h + (h << 15)) & 0xFFFFFFFF
return h

View file

@ -25,7 +25,7 @@ fi
# FIXME: Replace these CMake invocations with a CMake superbuild? # FIXME: Replace these CMake invocations with a CMake superbuild?
echo "Building Lagom Tools..." echo "Building Lagom Tools..."
. "../find_compiler.sh" . "../Utils/find_compiler.sh"
pick_host_compiler --clang-only pick_host_compiler --clang-only
cmake -S ../.. -GNinja --preset=Distribution -B Build/tools \ cmake -S ../.. -GNinja --preset=Distribution -B Build/tools \

View file

@ -13,11 +13,11 @@ from pathlib import Path
from typing import List from typing import List
from typing import Optional from typing import Optional
sys.path.append(str(Path(__file__).resolve().parent.parent.parent)) sys.path.append(str(Path(__file__).resolve().parent.parent))
from Meta.host_platform import HostSystem from Utils.host_platform import HostSystem
from Meta.host_platform import Platform from Utils.host_platform import Platform
from Meta.utils import run_command from Utils.utils import run_command
CLANG_FORMAT_MAJOR_VERSION = 21 CLANG_FORMAT_MAJOR_VERSION = 21
CLANG_FORMAT_EXECUTABLE = "clang-format" CLANG_FORMAT_EXECUTABLE = "clang-format"

View file

@ -13,9 +13,9 @@ from pathlib import Path
from typing import Dict from typing import Dict
from typing import List from typing import List
sys.path.append(str(Path(__file__).resolve().parent.parent.parent)) sys.path.append(str(Path(__file__).resolve().parent.parent))
from Meta.Generators.string_hash import string_hash from Utils.utils import string_hash
ENDPOINT_PREFIX = "endpoint " ENDPOINT_PREFIX = "endpoint "

View file

@ -10,11 +10,13 @@ import pathlib
import subprocess import subprocess
import sys import sys
LADYBIRD_SOURCE_DIR = pathlib.Path(__file__).resolve().parent.parent META_SOURCE_DIR = pathlib.Path(__file__).resolve().parent.parent
sys.path.append(str(LADYBIRD_SOURCE_DIR)) LADYBIRD_SOURCE_DIR = META_SOURCE_DIR.parent
from Meta.host_platform import HostSystem # noqa: E402 sys.path.append(str(META_SOURCE_DIR))
from Meta.host_platform import Platform # noqa: E402
from Utils.host_platform import HostSystem # noqa: E402
from Utils.host_platform import Platform # noqa: E402
def build_vcpkg(): def build_vcpkg():

View file

@ -14,9 +14,9 @@ from typing import Optional
sys.path.append(str(Path(__file__).resolve().parent.parent)) sys.path.append(str(Path(__file__).resolve().parent.parent))
from Meta.host_platform import HostSystem from Utils.host_platform import HostSystem
from Meta.host_platform import Platform from Utils.host_platform import Platform
from Meta.utils import run_command from Utils.utils import run_command
CLANG_MINIMUM_VERSION = 19 CLANG_MINIMUM_VERSION = 19
GCC_MINIMUM_VERSION = 14 GCC_MINIMUM_VERSION = 14

View file

@ -1,4 +1,4 @@
# Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org> # Copyright (c) 2025-2026, Tim Flynn <trflynn89@ladybird.org>
# #
# SPDX-License-Identifier: BSD-2-Clause # SPDX-License-Identifier: BSD-2-Clause
@ -41,3 +41,19 @@ def run_command(
return output.strip() return output.strip()
return None return None
def string_hash(string: str) -> int:
"""Port of AK::string_hash that produces the same u32 value."""
h = 0
for ch in string:
h = (h + ord(ch)) & 0xFFFFFFFF
h = (h + (h << 10)) & 0xFFFFFFFF
h ^= h >> 6
h = (h + (h << 3)) & 0xFFFFFFFF
h ^= h >> 11
h = (h + (h << 15)) & 0xFFFFFFFF
return h

View file

@ -5,7 +5,7 @@ set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=/dev/null # shellcheck source=/dev/null
. "${DIR}/shell_include.sh" . "${DIR}/Utils/shell_include.sh"
ensure_ladybird_source_dir ensure_ladybird_source_dir

View file

@ -15,15 +15,15 @@ import sys
from pathlib import Path from pathlib import Path
from typing import Optional from typing import Optional
sys.path.append(str(Path(__file__).resolve().parent.parent)) sys.path.append(str(Path(__file__).resolve().parent))
from Meta.build_vcpkg import build_vcpkg from Utils.build_vcpkg import build_vcpkg
from Meta.find_compiler import pick_host_compiler from Utils.find_compiler import pick_host_compiler
from Meta.host_platform import GUIFramework from Utils.host_platform import GUIFramework
from Meta.host_platform import HostArchitecture from Utils.host_platform import HostArchitecture
from Meta.host_platform import HostSystem from Utils.host_platform import HostSystem
from Meta.host_platform import Platform from Utils.host_platform import Platform
from Meta.utils import run_command from Utils.utils import run_command
def main(): def main():