kornelski / cavif-rs

AVIF image creator in pure Rust
https://lib.rs/cavif
BSD 3-Clause "New" or "Revised" License
570 stars 27 forks source link

Install NASM per build script #52

Closed johannesvollmer closed 2 years ago

johannesvollmer commented 2 years ago

Hi!

Performance is great, but manually installing the NASM dependency is a hassle. To increase the usability of this crate, it would be nice if a build script handled the installation, and maybe if it fails, deactivate the feature as a fallback. Is such a build script possible with NASM?

kornelski commented 2 years ago

No, Cargo build scripts are not allowed to change the operating system. They could download a private copy of nasm, but that's a weird hack.

Use pre-built binaries if you don't want to install dev dependencies.

johannesvollmer commented 2 years ago

What about building a local nasm from a copy of local nasm source code in the build script? Isn't this possible with nasm?

kornelski commented 2 years ago

It is possible, but I don't think that's a sensible path to pursue. To build nasm I'd need (in addition to a C compiler toolchain) autotools and Perl, which not every platform has, so this moves the problem by one step: should I build autotools and Perl too? And their dependencies?

Nasm has packages for every Linux distro, Mac Homebrew, and an installer for Windows, so it's not that difficult to get.

I'm providing pre-build binaries for cavif, so users don't need to install nasm. It's only required for building from source, and I think it's reasonable to ask developers to install a common developer tool.