Skip to content

Commit 8ecf73d

Browse files
committed
unix: encode host platform in generated Makefile
In case we ever support cross-compiling and the settings vary depending on the host.
1 parent 807ab8a commit 8ecf73d

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

cpython-unix/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ endif
4646

4747
# Always write out settings files.
4848
$(shell $(RUN_BUILD) placeholder_archive makefiles)
49-
include $(OUTDIR)/Makefile.$(TARGET_TRIPLE).$(PYBUILD_PYTHON_MAJOR_VERSION)
49+
include $(OUTDIR)/Makefile.$(HOST_PLATFORM).$(TARGET_TRIPLE).$(PYBUILD_PYTHON_MAJOR_VERSION)
5050
include $(OUTDIR)/versions/VERSION.*
5151

5252
BASE_TOOLCHAIN_DEPENDS := \

pythonbuild/utils.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,27 @@ def write_triples_makefiles(targets, dest_dir: pathlib.Path):
132132
dest_dir.mkdir(parents=True, exist_ok=True)
133133

134134
for triple, settings in targets.items():
135-
for python in settings["pythons_supported"]:
136-
makefile_path = dest_dir / ("Makefile.%s.%s" % (triple, python))
135+
for host_platform in settings["host_platforms"]:
136+
for python in settings["pythons_supported"]:
137+
makefile_path = dest_dir / (
138+
"Makefile.%s.%s.%s" % (host_platform, triple, python)
139+
)
137140

138-
lines = []
139-
for need in settings.get("needs", []):
140-
lines.append("NEED_%s := 1\n" % need.upper())
141+
lines = []
142+
for need in settings.get("needs", []):
143+
lines.append("NEED_%s := 1\n" % need.upper())
141144

142-
if "PYBUILD_LIBRESSL" in os.environ:
143-
lines.append("NEED_LIBRESSL := 1\n")
144-
else:
145-
lines.append("NEED_OPENSSL := 1\n")
145+
if "PYBUILD_LIBRESSL" in os.environ:
146+
lines.append("NEED_LIBRESSL := 1\n")
147+
else:
148+
lines.append("NEED_OPENSSL := 1\n")
146149

147-
image_suffix = settings.get("docker_image_suffix", "")
150+
image_suffix = settings.get("docker_image_suffix", "")
148151

149-
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
150-
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
152+
lines.append("DOCKER_IMAGE_BUILD := build%s\n" % image_suffix)
153+
lines.append("DOCKER_IMAGE_XCB := xcb%s\n" % image_suffix)
151154

152-
write_if_different(makefile_path, "".join(lines).encode("ascii"))
155+
write_if_different(makefile_path, "".join(lines).encode("ascii"))
153156

154157

155158
def write_package_versions(dest_path: pathlib.Path):

0 commit comments

Comments
 (0)