Skip to content

Commit 5317e44

Browse files
authored
Use common build directory for ports and system libs. NFC (#23932)
Split out from #23924
1 parent c411c74 commit 5317e44

File tree

6 files changed

+7
-16
lines changed

6 files changed

+7
-16
lines changed

tools/ports/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def erase():
233233

234234
@staticmethod
235235
def get_build_dir():
236-
return cache.get_path('ports-builds')
236+
return system_libs.get_build_dir()
237237

238238
name_cache: Set[str] = set()
239239

tools/ports/sdl2_gfx.py

-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# University of Illinois/NCSA Open Source License. Both these licenses can be
44
# found in the LICENSE file.
55

6-
import os
7-
86
TAG = '2b147ffef10ec541d3eace326eafe11a54e635f8'
97
HASH = 'f39f1f50a039a1667fe92b87d28548d32adcf0eb8526008656de5315039aa21f29d230707caa47f80f6b3a412a577698cd4bbfb9458bb92ac47e6ba993b8efe6'
108

@@ -16,8 +14,6 @@ def needed(settings):
1614

1715

1816
def get(ports, settings, shared):
19-
sdl_build = os.path.join(ports.get_build_dir(), 'sdl2')
20-
assert os.path.exists(sdl_build), 'You must use SDL2 to use SDL2_gfx'
2117
ports.fetch_project('sdl2_gfx', f'https://github.com/svn2github/sdl2_gfx/archive/{TAG}.zip', sha512hash=HASH)
2218

2319
def create(final):

tools/ports/sdl2_image.py

-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# University of Illinois/NCSA Open Source License. Both these licenses can be
44
# found in the LICENSE file.
55

6-
import os
76
from typing import Dict, Set
87

98
TAG = 'release-2.6.0'
@@ -52,8 +51,6 @@ def get_lib_name(settings):
5251

5352

5453
def get(ports, settings, shared):
55-
sdl_build = os.path.join(ports.get_build_dir(), 'sdl2')
56-
assert os.path.exists(sdl_build), 'You must use SDL2 to use SDL2_image'
5754
ports.fetch_project('sdl2_image', f'https://github.com/libsdl-org/SDL_image/archive/refs/tags/{TAG}.zip', sha512hash=HASH)
5855
libname = get_lib_name(settings)
5956

tools/ports/sdl2_mixer.py

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ def get_lib_name(settings):
3636

3737

3838
def get(ports, settings, shared):
39-
sdl_build = os.path.join(ports.get_build_dir(), 'sdl2')
40-
assert os.path.exists(sdl_build), 'You must use SDL2 to use SDL2_mixer'
4139
ports.fetch_project('sdl2_mixer', f'https://github.com/libsdl-org/SDL_mixer/archive/{TAG}.zip', sha512hash=HASH)
4240
libname = get_lib_name(settings)
4341

tools/ports/sdl2_net.py

-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# University of Illinois/NCSA Open Source License. Both these licenses can be
44
# found in the LICENSE file.
55

6-
import os
7-
86
TAG = 'version_2'
97
HASH = '317b22ad9b6b2f7b40fac7b7c426da2fa2da1803bbe58d480631f1e5b190d730763f2768c77c72affa806c69a1e703f401b15a1be3ec611cd259950d5ebc3711'
108

@@ -16,8 +14,6 @@ def needed(settings):
1614

1715

1816
def get(ports, settings, shared):
19-
sdl_build = os.path.join(ports.get_build_dir(), 'sdl2')
20-
assert os.path.exists(sdl_build), 'You must use SDL2 to use SDL2_net'
2117
ports.fetch_project('sdl2_net', f'https://github.com/emscripten-ports/SDL2_net/archive/{TAG}.zip', sha512hash=HASH)
2218

2319
def create(final):

tools/system_libs.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ def get_base_cflags(build_dir, force_object_files=False, preprocess=True):
7979
return flags
8080

8181

82+
def get_build_dir():
83+
return cache.get_path('build')
84+
85+
8286
def clean_env():
8387
# building system libraries and ports should be hermetic in that it is not
8488
# affected by things like EMCC_CFLAGS which the user may have set.
@@ -150,7 +154,7 @@ def create_lib(libname, inputs):
150154

151155

152156
def get_top_level_ninja_file():
153-
return os.path.join(cache.get_path('build'), 'build.ninja')
157+
return os.path.join(get_build_dir(), 'build.ninja')
154158

155159

156160
def run_ninja(build_dir):
@@ -552,7 +556,7 @@ def customize_build_cmd(self, cmd, _filename):
552556
def do_build(self, out_filename, generate_only=False):
553557
"""Builds the library and returns the path to the file."""
554558
assert out_filename == self.get_path(absolute=True)
555-
build_dir = os.path.join(cache.get_path('build'), self.get_base_name())
559+
build_dir = os.path.join(get_build_dir(), self.get_base_name())
556560
if USE_NINJA:
557561
self.generate_ninja(build_dir, out_filename)
558562
if not generate_only:

0 commit comments

Comments
 (0)