Skip to content

Commit

Permalink
Support llvm-mingw ARM/ARM64 targets in Rust (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
kleisauke authored Sep 28, 2020
1 parent 380da94 commit f415e83
Show file tree
Hide file tree
Showing 13 changed files with 1,093 additions and 32 deletions.
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [ ] Try to test the binaries with the Python test suite on Wine.
- [ ] Incorporate the llvm-mingw toolchain plugin into MXE (see [mxe/mxe#2330](https://github.com/mxe/mxe/issues/2330)).
- [x] Test the `armv7-w64-mingw32` target on a Raspberry Pi 3B with Windows 10 IoT.
- [ ] Test the `aarch64-w64-mingw32` target on a Raspberry Pi 4B with Windows 10 ARM64.
- [ ] The VIPS test suite should be able to run successfully on ARM/ARM64.
- [x] Test the `aarch64-w64-mingw32` target on a Raspberry Pi 4B with Windows 10 ARM64.
- [x] The VIPS test suite should be able to run successfully on ARM/ARM64.
- [ ] Fix the llvm-mingw specific patches upstream or within LLVM.
- [ ] The Rust MinGW-w64 ARM/ARM64 targets are not yet supported, is there an alternative way to build librsvg for these architectures?
- [x] The Rust MinGW-w64 ARM/ARM64 targets are not yet supported, is there an alternative way to build librsvg for these architectures?
5 changes: 4 additions & 1 deletion build/overrides.mk
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,9 @@ define librsvg_BUILD
$(SED) -i 's/45d980167c6b1a2fd54f045f39e6322a7739be6c4723b8c373716f8252d3778c/f769fd23b7389e684b2f365a9f1038273788eb0f3d5907fe34f7ac5383b0daf0/' '$(SOURCE_DIR)/vendor/cairo-rs/.cargo-checksum.json'
$(SED) -i 's/d8c54bf5eeba9d035434da591646047329e0cad2c0be93c10409f7b36a0e55ec/b03f53a3c001dcd51fac158e8ca17f0c15299c77edba59444e91b73bc2b2226a/' '$(SOURCE_DIR)/vendor/cairo-sys-rs/.cargo-checksum.json'

# armv7 -> thumbv7a
$(eval ARCH_NAME := $(if $(findstring armv7,$(PROCESSOR)),thumbv7a,$(PROCESSOR)))

cd '$(BUILD_DIR)' && $(SOURCE_DIR)/configure \
$(MXE_CONFIGURE_OPTS) \
--disable-pixbuf-loader \
Expand All @@ -560,7 +563,7 @@ define librsvg_BUILD
--disable-nls \
--without-libiconv-prefix \
--without-libintl-prefix \
RUST_TARGET='$(PROCESSOR)-pc-windows-gnu' \
RUST_TARGET='$(ARCH_NAME)-pc-windows-gnu' \
CARGO='$(TARGET)-cargo' \
RUSTC='$(TARGET)-rustc'

Expand Down
26 changes: 26 additions & 0 deletions build/patches/vips-8-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <[email protected]>
Date: Fri, 25 Sep 2020 10:30:00 +0200
Subject: [PATCH 1/1] Fix test failure on ARM-based Windows

The optional parameters of vips_gaussnoise were incorrectly
passed within vips_fractsurf. This was discovered when running
the libvips testsuite on Windows 10 IoT (ARM32).

diff --git a/libvips/create/fractsurf.c b/libvips/create/fractsurf.c
index 1111111..2222222 100644
--- a/libvips/create/fractsurf.c
+++ b/libvips/create/fractsurf.c
@@ -74,8 +74,10 @@ vips_fractsurf_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_fractsurf_parent_class )->build( object ) )
return( -1 );

- if( vips_gaussnoise( &t[0],
- fractsurf->width, fractsurf->height, 0.0, 1.0, NULL ) ||
+ if( vips_gaussnoise( &t[0], fractsurf->width, fractsurf->height,
+ "mean", 0.0,
+ "sigma", 1.0,
+ NULL ) ||
vips_mask_fractal( &t[1], fractsurf->width, fractsurf->height,
fractsurf->fractal_dimension, NULL ) ||
vips_freqmult( t[0], t[1], &t[2], NULL ) ||
7 changes: 2 additions & 5 deletions build/plugins/llvm-mingw/llvm-mingw.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ $(PKG)_DEPS := mingw-w64
# https://github.com/mstorsjo/llvm-mingw/blob/master/build-mingw-w64.sh#L5-L6
# Install the headers in $(PREFIX)/$(TARGET)/mingw since
# we need to distribute the /include and /lib directories
# Note: Building with --with-default-msvcrt=ucrt breaks
# compatibility with the prebuilt Rust binaries that
# is built in msvcrt mode.
define $(PKG)_BUILD_mingw-w64
# install the usual wrappers
$($(PKG)_PRE_BUILD)
Expand All @@ -31,7 +28,7 @@ define $(PKG)_BUILD_mingw-w64
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)/mingw' \
--enable-idl \
--with-default-msvcrt=msvcrt \
--with-default-msvcrt=ucrt \
--with-default-win32-winnt=0x601 \
$(mingw-w64-headers_CONFIGURE_OPTS)
$(MAKE) -C '$(BUILD_DIR).headers' install
Expand All @@ -41,7 +38,7 @@ define $(PKG)_BUILD_mingw-w64
cd '$(BUILD_DIR).crt' && '$(BUILD_DIR)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)/mingw' \
--with-default-msvcrt=msvcrt \
--with-default-msvcrt=ucrt \
@mingw-crt-config-opts@
$(MAKE) -C '$(BUILD_DIR).crt' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR).crt' -j 1 $(INSTALL_STRIP_TOOLCHAIN)
Expand Down
8 changes: 1 addition & 7 deletions build/plugins/llvm-mingw/overrides.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ $(PLUGIN_HEADER)
IS_LLVM := $(true)

# Override sub-dependencies
cc_DEPS := llvm

# TODO: The armv7-pc-windows-gnu and aarch64-pc-windows-gnu Rust targets are not yet supported.
librsvg_BUILD_aarch64-w64-mingw32 =
librsvg_BUILD_armv7-w64-mingw32 =
rust_BUILD_aarch64-w64-mingw32 =
rust_BUILD_armv7-w64-mingw32 =
cc_DEPS := llvm

# GCC does not support Windows on ARM
gcc_BUILD_aarch64-w64-mingw32 =
Expand Down
Loading

0 comments on commit f415e83

Please sign in to comment.