Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM64: build librsvg without the -Zbuild-std feature flag #123

Merged
merged 1 commit into from
Dec 21, 2021
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
17 changes: 0 additions & 17 deletions build/lin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,7 @@ if [ "$DARWIN" = true ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --no-modify-path --profile minimal ${DARWIN_ARM:+--default-toolchain nightly}
if [ "$DARWIN_ARM" = true ]; then
${CARGO_HOME}/bin/rustup component add rust-src
${CARGO_HOME}/bin/rustup target add aarch64-apple-darwin

# Rebuild the standard library of Rust to avoid collisions with system libraries.
# See: https://github.com/lovell/sharp-libvips/issues/109
printf "[unstable]\n\
build-std = [\"std\", \"panic_abort\"]\n\
build-std-features = [\"panic_immediate_abort\"]" > ${CARGO_HOME}/config.toml
fi
fi

Expand Down Expand Up @@ -446,16 +439,6 @@ ninja -C _build install
mkdir ${DEPS}/svg
$CURL https://download.gnome.org/sources/librsvg/$(without_patch $VERSION_SVG)/librsvg-${VERSION_SVG}.tar.xz | tar xJC ${DEPS}/svg --strip-components=1
cd ${DEPS}/svg
# Allow building vendored sources with `-Zbuild-std`, see:
# https://github.com/rust-lang/wg-cargo-std-aware/issues/23#issuecomment-720455524
if [[ $PLATFORM == *"-arm64v8" ]]; then
RUST_SRC=$(rustc +nightly --print sysroot)/lib/rustlib/src/rust
RUST_TEST=$RUST_SRC/library/test
# Copy the Cargo.lock for Rust to places `vendor` will see
cp $RUST_SRC/Cargo.lock $RUST_TEST
# Actually do the vendor
cargo +nightly vendor -s $RUST_TEST/Cargo.toml
fi
sed -i'.bak' "s/^\(Requires:.*\)/\1 cairo-gobject pangocairo/" librsvg.pc.in
# LTO optimization does not work for staticlib+rlib compilation
sed -i'.bak' "s/, \"rlib\"//" Cargo.toml
Expand Down
8 changes: 0 additions & 8 deletions linux-arm64v8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,11 @@ RUN \
--profile minimal \
--default-toolchain nightly \
&& \
rustup component add rust-src && \
rustup target add aarch64-unknown-linux-gnu && \
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
pip3 install --upgrade pip && \
pip3 install meson ninja

# Rebuild the standard library of Rust to avoid collisions with system libraries.
# See: https://github.com/lovell/sharp-libvips/issues/109
RUN \
printf "[unstable]\n\
build-std = [\"std\", \"panic_abort\"]\n\
build-std-features = [\"panic_immediate_abort\"]" > $CARGO_HOME/config.toml

# Compiler settings
ENV \
PLATFORM="linux-arm64v8" \
Expand Down
10 changes: 1 addition & 9 deletions linuxmusl-arm64v8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,9 @@ RUN \
--profile minimal \
--default-toolchain nightly \
&& \
rustup component add rust-src && \
rustup target add aarch64-unknown-linux-musl && \
pip3 install meson

# Rebuild the standard library of Rust to avoid collisions with system libraries.
# See: https://github.com/lovell/sharp-libvips/issues/109
RUN \
printf "[unstable]\n\
build-std = [\"std\", \"panic_abort\"]\n\
build-std-features = [\"panic_immediate_abort\"]" > $CARGO_HOME/config.toml

# Compiler settings
ENV \
PKG_CONFIG="/bin/aarch64-linux-musl-pkg-config" \
Expand All @@ -69,7 +61,7 @@ ENV \
# The toolchain will produce static libs by default.
# We also need to add the directory containing libc.a to the library search path.
ENV \
RUSTFLAGS="-C target-feature=-crt-static -Lnative=/aarch64-linux-musl/lib"
RUSTFLAGS="-Ctarget-feature=-crt-static -Lnative=/aarch64-linux-musl/lib"

COPY Toolchain.cmake /root/
COPY meson.ini /root/