Install Rust under /usr/local instead of PREFIX

Rust is a build tool, not a library, so it should not follow the
library install prefix.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GuofangandClaude Sonnet 5.5 committed 2026-11-06 13:13:50 +08:00
1 parent ac50e86249
commit 68abc5042c
3 files changed
+5 -3

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ Use environment variables to select the container engine or override image names
CONTAINER_ENGINE=podman IMAGE_NAME=my-build-env ./rocky9/build.sh
```
The Debian 13 and Rocky Linux 9 images install every library under `/usr/local` by default. Set `PREFIX` to install them elsewhere; the build environment variables (`PATH`, `PKG_CONFIG_PATH`, `CMAKE_PREFIX_PATH`, `CMAKE_INSTALL_PREFIX`, and so on) follow it. The Alpine image does not support `PREFIX`.
The Debian 13 and Rocky Linux 9 images install every library under `/usr/local` by default. Set `PREFIX` to install them elsewhere; the build environment variables (`PATH`, `PKG_CONFIG_PATH`, `CMAKE_PREFIX_PATH`, `CMAKE_INSTALL_PREFIX`, and so on) follow it. Rust is a build tool rather than a library, so it always lives under `/usr/local` and is not affected by `PREFIX`. The Alpine image does not support `PREFIX`.
```sh
PREFIX=/opt/stack ./debian13/build.sh
+2 -1
View File
@@ -38,10 +38,11 @@ ENV PATH=${PREFIX}/bin:${PATH} \
RUN test "$(cmake --version | sed -n '1s/[^0-9]*//p' | cut -d. -f2)" -ge 29
# Rust is a build tool, not a library, so it is installed under /usr/local regardless of ${PREFIX}.
RUN --mount=type=bind,from=sources,source=rust,target=/tmp/rust \
mkdir rust-src \
&& tar -xJf "/tmp/rust/rust-1.99.1-$(uname -m)-unknown-linux-gnu.tar.xz" -C rust-src --strip-components=1 \
&& rust-src/install.sh --prefix=${PREFIX} --without=rust-docs \
&& rust-src/install.sh --prefix=/usr/local --without=rust-docs \
&& rm -rf rust-src
RUN --mount=type=bind,from=sources,source=boost_1_83_0.tar.bz2,target=/tmp/boost.tar.bz2 \
+2 -1
View File
@@ -52,10 +52,11 @@ ENV PATH=${PREFIX}/bin:${PATH} \
RUN test "$(cmake --version | sed -n '1s/[^0-9]*//p' | cut -d. -f2)" -ge 29
# Rust is a build tool, not a library, so it is installed under /usr/local regardless of ${PREFIX}.
RUN --mount=type=bind,from=sources,source=rust,target=/tmp/rust \
mkdir rust-src \
&& tar -xJf "/tmp/rust/rust-1.99.1-$(uname -m)-unknown-linux-gnu.tar.xz" -C rust-src --strip-components=1 \
&& rust-src/install.sh --prefix=${PREFIX} --without=rust-docs \
&& rust-src/install.sh --prefix=/usr/local --without=rust-docs \
&& rm -rf rust-src
RUN --mount=type=bind,from=sources,source=boost_1_83_0.tar.bz2,target=/tmp/boost.tar.bz2 \