You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs-rs/add-dependencies.md
+34-12Lines changed: 34 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,39 @@
2
2
3
3
Rustwide internally uses `rustops/crates-build-env` as the build environment for the crate. If you want to add a system package for crates to link to, this is place you're looking for.
4
4
5
+
## Preconditions
6
+
7
+
Docker and docker-compose must be installed. For example, on Debian or Ubuntu:
8
+
9
+
```sh
10
+
sudo apt-get install docker.io docker-compose
11
+
```
12
+
5
13
## Getting started
6
14
7
-
First, clone the crates-build-env repo:
15
+
First, clone the crates-build-env and the docs.rs repos:
Set the path to the directory of your crate. This must be an absolute path, not a relative path! On platforms with coreutils, you can instead use `$(realpath ../relative/path)` (relative to the docs.rs directory).
Next, add the package to `packages.txt`. This should be the name of a package in the **Ubuntu 18.04** Repositories. See [the package home page](https://packages.ubuntu.com/) for a full list/search bar, or use `apt search` locally.
28
+
## Add package
29
+
30
+
Next, add the package to `crates-build-env/linux/packages.txt` in the correct alphabetical order. This should be the name of a package in the **Ubuntu 20.04** Repositories. See [the package home page](https://packages.ubuntu.com/) for a full list/search bar, or use `apt search` locally.
14
31
15
32
## Building the image
16
33
17
34
Now build the image. This will take a very long time, probably 10-20 minutes.
# NOTE: this must be an absolute path, not a relative path
31
-
# On platforms with coreutils, you can instead use `$(realpath ../relative/path)`
32
-
YOUR_CRATE=/path/to/your/crate
33
49
# avoid docker-compose creating the volume if it doesn't exist
34
50
if [ -e"$YOUR_CRATE" ];then
35
-
docker-compose run -e DOCS_RS_LOCAL_DOCKER_IMAGE=build-env \
51
+
docker-compose run -e DOCSRS_DOCKER_IMAGE=build-env \
36
52
-e RUST_BACKTRACE=1 \
37
53
-v "$YOUR_CRATE":/opt/rustwide/workdir \
38
54
web build crate --local /opt/rustwide/workdir
@@ -49,17 +65,23 @@ On line 7 of the Dockerfile, add this line: `RUN apt-get install -y your_second_
49
65
Rerun the build and start the container; it should take much less time now:
50
66
51
67
```sh
52
-
cd/path/to/crates-build-env
68
+
cd../crates-build-env/linux
53
69
docker build --tag build-env .
54
-
cd /path/to/docs.rs
55
-
docker-compose run -e DOCS_RS_LOCAL_DOCKER_IMAGE=build-env \
70
+
cd ../../docs.rs
71
+
docker-compose run -e DOCSRS_DOCKER_IMAGE=build-env \
72
+
-e RUST_BACKTRACE=1 \
56
73
-v "$YOUR_CRATE":/opt/rustwide/workdir \
57
74
web build crate --local /opt/rustwide/workdir
58
75
```
59
76
60
77
## Run the lint script
61
78
62
-
Before you make a PR, run the shell script `ci/lint.sh` and make sure it passes. It ensures `packages.txt` is in order and will tell you exactly what changes you need to make if not.
79
+
Before you make a PR, run the shell script `lint.sh` and make sure it passes. It ensures `packages.txt` is in order and will tell you exactly what changes you need to make if not.
0 commit comments