You are not logged in.

#1 2016-12-30 22:49:10

Flat
Member
Registered: 2016-05-30
Posts: 17

[Solved] Advice on rust compiler targets as dependencies

Hello,

I maintain parallel-rust in the aur, and upstream has made changes that recommend targeting -unknown-linux-musl for greatly increased performance.

The only way I know of however to install the required targets for rust is with using rust's rustup script. This creates the toolchain and target in the user's home directory and PKGBUILD (and their generated packages) shouldn't touch any files there. Would it be appropriate to check if this target is already installed by adding rustup as a build dependency and then executing

rustup target list

to check if the target exists, and then proceed to target musl? If so I feel this would need a large amount of if statements and a custom bool variable of the package build to keep track of this.

Is there a cleaner/more appropriate way to do this in a package build?

Thanks!

Last edited by Flat (2017-01-01 06:02:07)


(´ω)

Offline

#2 2017-01-01 04:22:46

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] Advice on rust compiler targets as dependencies

I'm not really familiar with the issues involved in replacing your toolchain, but a quick pacman search tells me that we have a "musl" package in community which provides /usr/bin/musl-gcc
Can you not simply add this makedepends?

I would hope if the rust people have their act together, that you'd be able to specify how to use a system-provided alternative toolchain. wink
Which seems (again, to my inexperienced eye) to be what that is.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2017-01-01 04:33:10

Flat
Member
Registered: 2016-05-30
Posts: 17

Re: [Solved] Advice on rust compiler targets as dependencies

I wish it was that easy, unfortunately rust also provides their own compilers along with different sets of libraries for "cross compiling" for different targets. It doesn't replace the tool chain as much as it just installs them all alongside each other. Similar to compiling with mingw, but for rust alone.

Thank you for the suggestion none the less.


(´ω)

Offline

#4 2017-01-01 05:15:56

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] Advice on rust compiler targets as dependencies

So rust forces you to use their own compiler if you want to target musl? sad It seems rust requires Yet Another Toolchain on general principle -- oh well.

What I would like to say, is that you should use a cleanly packaged system version of the needed toolchain. Failing that, you can probably trick rustup into building the toolchain inside "$srcdir" by faking the $HOME variable.
As a user, I'd prefer that over gaining mysterious files (even dotfiles) cluttering up my $HOME -- unfortunately, not all PKGBUILDs respect that.

Last edited by eschwartz (2017-01-01 05:20:33)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2017-01-01 05:50:58

Flat
Member
Registered: 2016-05-30
Posts: 17

Re: [Solved] Advice on rust compiler targets as dependencies

Thanks for the ideas! I've actually come up with a way to install the tool chain inside $srcdir using rustup that I believe works well for targeting musl without messing with user's $HOME nor weird package dependencies. The downside of this being that even users that currently have rustup installed with the proper settings will have to re-download it for this package. In my opinion this is much better than mysterious files appearing in $HOME. (Even though I should say every user should read PKGBUILDS before running them, but I know that doesn't always happen).


(´ω)

Offline

Board footer

Powered by FluxBB