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
Notes: github-actions[bot] 2026-04-23 16:50:11 +00:00
17 changed files with 51 additions and 48 deletions

View File

@@ -223,7 +223,7 @@ runs:
- name: 'Install vcpkg'
if: ${{ inputs.type == 'build' }}
shell: bash
run: ./Meta/build_vcpkg.py
run: ./Meta/Utils/build_vcpkg.py
- name: 'Export installed 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/).
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.

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)
set(_possible_guis "Android")
set(_default_gui "Android")

View File

@@ -7,14 +7,18 @@
import argparse
import sys
from dataclasses import dataclass
from dataclasses import field
from pathlib import Path
from typing import List
from typing import TextIO
from lexer import Lexer
from string_hash import string_hash
sys.path.append(str(Path(__file__).resolve().parent.parent))
from Utils.lexer import Lexer
from Utils.utils import string_hash
PRIMITIVE_TYPES = {
"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?
echo "Building Lagom Tools..."
. "../find_compiler.sh"
. "../Utils/find_compiler.sh"
pick_host_compiler --clang-only
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 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 Meta.host_platform import Platform
from Meta.utils import run_command
from Utils.host_platform import HostSystem
from Utils.host_platform import Platform
from Utils.utils import run_command
CLANG_FORMAT_MAJOR_VERSION = 21
CLANG_FORMAT_EXECUTABLE = "clang-format"

View File

@@ -13,9 +13,9 @@ from pathlib import Path
from typing import Dict
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 "

View File

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

View File

@@ -14,9 +14,9 @@ from typing import Optional
sys.path.append(str(Path(__file__).resolve().parent.parent))
from Meta.host_platform import HostSystem
from Meta.host_platform import Platform
from Meta.utils import run_command
from Utils.host_platform import HostSystem
from Utils.host_platform import Platform
from Utils.utils import run_command
CLANG_MINIMUM_VERSION = 19
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
@@ -41,3 +41,19 @@ def run_command(
return output.strip()
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 )"
# shellcheck source=/dev/null
. "${DIR}/shell_include.sh"
. "${DIR}/Utils/shell_include.sh"
ensure_ladybird_source_dir

View File

@@ -15,15 +15,15 @@ import sys
from pathlib import Path
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 Meta.find_compiler import pick_host_compiler
from Meta.host_platform import GUIFramework
from Meta.host_platform import HostArchitecture
from Meta.host_platform import HostSystem
from Meta.host_platform import Platform
from Meta.utils import run_command
from Utils.build_vcpkg import build_vcpkg
from Utils.find_compiler import pick_host_compiler
from Utils.host_platform import GUIFramework
from Utils.host_platform import HostArchitecture
from Utils.host_platform import HostSystem
from Utils.host_platform import Platform
from Utils.utils import run_command
def main():