Skip to content

Commit eb77ef4

Browse files
larisdylanmckay
authored andcommitted
customize MacOS building and installation
1 parent 8405b30 commit eb77ef4

File tree

1 file changed

+35
-6
lines changed

1 file changed

+35
-6
lines changed

README.md

+35-6
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,44 @@ First make sure you've installed all dependencies for building, as specified in
2525
the main Rust repository [here](https://github.com/rust-lang/rust/#building-from-source).
2626
Then use the following commands:
2727

28+
### Unix/Linux/*nix
29+
30+
``` bash
31+
# Grab the avr-rust sources
32+
git clone https://github.com/avr-rust/rust.git --recursive
33+
34+
# Create a directory to place built files in
35+
mkdir build && cd build
36+
37+
# Generate Makefile using settings suitable for an experimental compiler
38+
../rust/configure \
39+
--enable-debug \
40+
--disable-docs \
41+
--enable-llvm-assertions \
42+
--enable-debug-assertions \
43+
--enable-optimize \
44+
--enable-llvm-release-debuginfo \
45+
--experimental-targets=AVR \
46+
--prefix=/opt/avr-rust
47+
48+
# Build the compiler, optionally install it to /opt/avr-rust
49+
make
50+
make install
51+
52+
# Register the toolchain with rustup
53+
rustup toolchain link avr-toolchain $(realpath $(find . -name 'stage2'))
54+
55+
# Optionally enable the avr toolchain globally
56+
rustup default avr-toolchain
57+
```
2858
### Notes for macOS
2959

3060
The conventional install directory for macOS is `/usr/local/avr-rust` rather than the Linux default `/opt/avr-rust`, so before the steps below, you must:
3161

32-
1. Edit `build/config.toml` to set `prefix = '/usr/local/avr-rust'`.
33-
2. Ensure `/usr/local/avr-rust` exists and has the correct permissions: `sudo mkdir /usr/local/avr-rust && sudo chown $USER:admin /usr/local/avr-rust`
62+
1. ~~Edit `build/config.toml` to set `prefix = '/usr/local/avr-rust'`.~~
63+
2. Ensure `/usr/local/avr-rust` exists and has the correct permissions: `sudo mkdir /usr/local/avr-rust && sudo chown ${USER}:admin /usr/local/avr-rust`
3464

3565
Finally, `realpath` isn't included by default on macOS but is included in GNU Coreutils, so you can either `brew install coreutils` so the `rustup toolchain...` step works properly, or just use the explicit path (`rustup toolchain link avr-toolchain /usr/local/avr-rust`).
36-
3766
``` bash
3867
# Grab the avr-rust sources
3968
git clone https://github.com/avr-rust/rust.git --recursive
@@ -50,14 +79,14 @@ mkdir build && cd build
5079
--enable-optimize \
5180
--enable-llvm-release-debuginfo \
5281
--experimental-targets=AVR \
53-
--prefix=/opt/avr-rust
82+
--prefix=/usr/local/avr-rust
5483

55-
# Build the compiler, optionally install it to /opt/avr-rust
84+
# Build the compiler, install it to /usr/local/avr-rust
5685
make
5786
make install
5887

5988
# Register the toolchain with rustup
60-
rustup toolchain link avr-toolchain $(realpath $(find . -name 'stage2'))
89+
rustup toolchain link avr-toolchain /usr/local/avr-rust
6190

6291
# Optionally enable the avr toolchain globally
6392
rustup default avr-toolchain

0 commit comments

Comments
 (0)