Skip to content

Commit 8f6f43f

Browse files
committed
Allow building mips
1 parent 7d1d498 commit 8f6f43f

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

builders/build-linux-rust/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,12 @@ RUN curl -LO https://github.com/NordSecurity/rust_build_utils/releases/download/
9999
RUN echo "[target.mipsel-unknown-linux-musl]\n" >> ${CARGO_HOME}/config.toml
100100
RUN echo "linker = \"/opt/mipsel-linux-muslsf-cross/bin/mipsel-linux-muslsf-gcc\"" >> ${CARGO_HOME}/config.toml
101101

102+
RUN curl -LO https://musl.cc/mips-linux-muslsf-cross.tgz \
103+
&& tar -xzf mips-linux-muslsf-cross.tgz -C /opt \
104+
&& rm mips-linux-muslsf-cross.tgz
105+
106+
RUN echo "[target.mips-unknown-linux-musl]\n" >> ${CARGO_HOME}/config.toml
107+
RUN echo "linker = \"/opt/mips-linux-muslsf-cross/bin/mips-linux-muslsf-gcc\"" >> ${CARGO_HOME}/config.toml
108+
102109
# Skip llt-secrets check when building in builder images
103110
ENV BYPASS_LLT_SECRETS=1

rust_build_utils/linux_build_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _create_debug_symbols(bin_path: str):
2727
f"{bin_path}.debug",
2828
]
2929
rutils.run_command(create_debug_symbols_cmd)
30-
elif strip_bin.endswith("mipsel-linux-muslsf-strip"):
30+
elif strip_bin.endswith("mipsel-linux-muslsf-strip") or strip_bin.endswith("mips-linux-muslsf-strip"):
3131
create_debug_symbols_cmd = [
3232
f"{strip_bin}",
3333
"--only-keep-debug",

rust_build_utils/rust_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def parse_cli():
304304
def _build_packages(
305305
config, packages: List[str], extra_args: Optional[List[str]], subcommand: str
306306
) -> None:
307-
if "tvos" in config.target_os or config.rust_target == "mipsel-unknown-linux-musl":
307+
if "tvos" in config.target_os or config.rust_target == "mipsel-unknown-linux-musl" or config.rust_target == "mips-unknown-linux-musl":
308308
args = [
309309
"cargo",
310310
f"+nightly-{RUST_NIGHTLY_VERSION}",
@@ -398,7 +398,7 @@ def _cargo(
398398
shutil.rmtree(distribution_dir)
399399
os.makedirs(distribution_dir)
400400

401-
if "tvos" in config.target_os or config.rust_target == "mipsel-unknown-linux-musl":
401+
if "tvos" in config.target_os or config.rust_target == "mipsel-unknown-linux-musl" or config.rust_target == "mips-unknown-linux-musl":
402402
run_command(
403403
["rustup", "toolchain", "install", f"nightly-{RUST_NIGHTLY_VERSION}"]
404404
)

rust_build_utils/rust_utils_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class WindowsLinkingMethod(enum.Enum):
5454
"strip_path": "/opt/mipsel-linux-muslsf-cross/bin/mipsel-linux-muslsf-strip",
5555
"rust_target": "mipsel-unknown-linux-musl",
5656
},
57+
"mips": {
58+
"strip_path": "/opt/mips-linux-muslsf-cross/bin/mips-linux-muslsf-strip",
59+
"rust_target": "mips-unknown-linux-musl",
60+
},
5761
"aarch64": {
5862
"strip_path": "/usr/aarch64-linux-gnu/bin/objcopy",
5963
"rust_target": "aarch64-unknown-linux-musl",

0 commit comments

Comments
 (0)