Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ commands:
ls -l ~/cache/sysroot/include/emscripten/heap.h
cat ~/cache/sysroot/lib/wasm32-emscripten/crtbegin-mt.o.ccache-log
date
cat ~/cache/build/libclang_rt.builtins/absvdi2.o.ccache-log
cat ~/cache/build/wasm32-emscripten/libclang_rt.builtins/absvdi2.o.ccache-log
ccache -s
ccache --print-stats
ccache -p
Expand Down
13 changes: 8 additions & 5 deletions tools/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,13 @@ def get_sysroot_dir(*parts):
return str(Path(get_sysroot(absolute=True), *parts))


def get_lib_dir(absolute):
def get_lib_dir_relative():
from .cmdline import options

ensure_setup()
path = Path(get_sysroot(absolute=absolute), 'lib')
if settings.MEMORY64:
path = Path(path, 'wasm64-emscripten')
path = Path('wasm64-emscripten')
else:
path = Path(path, 'wasm32-emscripten')
path = Path('wasm32-emscripten')
# if relevant, use a subdir of the cache
subdir = []
if options.lto:
Expand All @@ -132,6 +130,11 @@ def get_lib_dir(absolute):
return path


def get_lib_dir(absolute):
ensure_setup()
return Path(get_sysroot(absolute=absolute), 'lib', get_lib_dir_relative())


def get_lib_name(name, absolute=False):
return str(get_lib_dir(absolute=absolute).joinpath(name))

Expand Down
2 changes: 1 addition & 1 deletion tools/ports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def erase():

@staticmethod
def get_build_dir():
return system_libs.get_build_dir()
return cache.get_path('build')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ports system has its own method of mangling library build paths (see the top lines of build_port above) and I wasn't intending to change that in this PR.

We could further merge the logic to standardize on the structure used by the system libs; one thing that would have to change is that when a port is upgraded or redownloaded, it deletes all the builds at once from the shared build directory, so we'd have to update that logic. It might be better as a separate PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, sg.


name_cache: set[str] = set()

Expand Down
4 changes: 3 additions & 1 deletion tools/system_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import textwrap
from enum import IntEnum, auto
from glob import iglob
from pathlib import Path
from time import time

from . import building, cache, diagnostics, shared, utils
Expand Down Expand Up @@ -84,7 +85,7 @@ def get_base_cflags(build_dir, force_object_files=False, preprocess=True):


def get_build_dir():
return cache.get_path('build')
return cache.get_path(Path('build', cache.get_lib_dir_relative()))


def clean_env():
Expand Down Expand Up @@ -179,6 +180,7 @@ def run_ninja(build_dir):
def ensure_target_in_ninja_file(ninja_file, target):
if os.path.isfile(ninja_file) and target in read_file(ninja_file):
return
utils.safe_ensure_dirs(os.path.dirname(ninja_file))
with open(ninja_file, 'a', encoding='utf-8') as f:
f.write(target + '\n')

Expand Down
Loading