﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
22978	Make offline-build the standard method for rust-based packages	Rainer	pierre	"Contrary to what is said in the book, an internet connection is not 
mandatory for building rust-based packages like cargo-c, cbindgen or librsvg.
With ""cargo vendor"" a simple alternate method is available which makes an 
offline build possible. 

From a user perspective an offline build has several advantages:
- It increases transparency and better control as it allows the user
  to take a look at the downloaded packages _before_ the build starts.
- It thus may help users who have qualms about having to blindly download and 
  accept stuff when building software for their systems.
- By copying directory ""vendor"" (and perhaps other needed files), the
  user creates a backup which can be reused if the build fails.  After
  all, users are admonished to start each build with a freshly unpacked
  source which otherwise would mean to repeat the whole downloading-act.
- It also may make the user aware that the often tiny download-size of
  the target-package may be misleading and may just be the lesser part of
  the download-piper.

Thus I think that - where possible - ""cargo vendor"" plus ensuing offline-build should be the preferred method for rust-based packages in BLFS.

Edit: On request, I've added an example for librsvg-2.61.4, see below.  The formatting is not as intended but I don't know how to get this right here, sorry.

Rainer

--

Example for librsvg-2.61.4

# The build of librsvg-2.61.4 requires a lot of packages (""crates"") which must be downloaded.  With an internet connection active, issue

cargo vendor

# After that, the internet connection is no longer needed.  If you like, inspect the contents of directory ""vendor"" which was created by ""cargo vendor"" and contains the ""crates"".  For possible reuse, make a copy:

cp -r vendor ../vendor_librsvg-2.61.4

# Create directory "".cargo"":

mkdir -v .cargo

# Create file .cargo/config.toml:
{{{
cat > .cargo/config.toml << ""EOF""
[source.crates-io]
replace-with = ""vendored-sources""

[source.vendored-sources]
directory = ""vendor""
EOF
}}}

# Again, for possible later reuse:

cp -r .cargo ../.cargo-librsvg-2.61.4

# If you later want to repeat the offline-build with a freshly unpacked source:

# ln -sv ../vendor_librsvg-2.61.4 vendor

# ln -sv ../.cargo-librsvg-2.61.4 .cargo


# First, fix the installation path of the API documentation:

sed -e ""/OUTDIR/s|,| / 'librsvg-2.61.4', '--no-namespace-dir',|"" \
[...]"	enhancement	closed	normal	13.1	BOOK	git	medium	fixed	rust,offline build,cargo vendor,cargo-c,librsvg,cbindgen,glycin	Rainer
