On Sat, 2017-12-02 at 13:51 -0500, David Michael wrote:
> 
> In librsvg's COMPILING.md, there are two inconsistencies around
> cross-compiling.
> 
>   * The option --target=TRIPLE is passed to cargo, not --host.
>   * RUST_TARGET_PATH should be set for make, not configure.

Ah, thanks for noticing!  I've pushed this fix.

> An alternative to writing a target JSON file could be to override
> CARGO_TARGET_ARGS and RUST_TARGET_SUBDIR (if RUST_LIB used the
> variable) when a compatible builtin target is available.  For
> example:
> 
>     ./configure --host=x86_64-redhat-linux-gnu ...
>     make CARGO_TARGET_ARGS=--target=x86_64-unknown-linux-gnu ...

You mean, in Makefile.am instead of

RUST_LIB=@abs_top_builddir@/rust/target/@RUST_TARGET_SUBDIR@/librsvg_internals.a

Something like

RUST_TARGET_SUBDIR=@RUST_TARGET_SUBDIR@
RUST_LIB=@abs_top_builddir@/rust/target/$(RUST_TARGET_SUBDIR)/librsvg_internals.a

?

(I haven't even tested this; just trying to see if we are thinking of
the same thing.)

> Is that worth maybe adding a --with-rust-target option to configure
> that defaults to $host when cross-compiling?  (I didn't think of that
> for the cross-compiling patch since I was only building for a new
> target with no builtin support.)

Hmmmmm, I'm not sure.  Would these be the two cases then?

1. Rust supports the same --host=TRIPLE out of the box, in the form of 
"cargo --target=TRIPLE".

2. Rust doesn't know the --host=TRIPLE.  You'd like an easier way to
pass the json file, or a compatible triple, and that would be the 
--with-rust-target option?

I haven't played with cross compilation at all, so if you want to own
this bit and patch the build infrastructure, feel free to do it :)

> As a side note, here is one way to generate a JSON spec from a
> similar
> builtin target.  It may not be helpful including this in
> documentation
> since it uses unstable options, so I'm just throwing it out there.
> 
>     RUSTC_BOOTSTRAP=1 rustc -Z unstable-options \
>         --print=target-spec-json \
>         --target=x86_64-unknown-linux-gnu |
>     sed -e /is-builtin/d -e s/unknown/redhat/g \
>         > "${RUST_TARGET_PATH%%:*}/x86_64-redhat-linux-gnu.json"

Interesting.  For now I want to keep librsvg compiling on rust stable,
although I have implicitly updated what "stable" means in the past :) 
No nightly features, I guess.


_______________________________________________
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Reply via email to